[PATCH/RFC] s3:smbd: reload services upon tree connect

Brian Campbell lambda at editshare.com
Fri Oct 19 18:33:56 MDT 2012


Reload services upon tree connect, so that if we have multiple
sessions on the same connection with different usernames, we will
expand includes properly for tree connects initiated by the different
sessions.
---
This is due to a problem that we've encountered based on how we
configure shares for different users. In our smb.conf, we have have
the following line:

  include = smb.%U.conf

In each of the smb.user.conf files, we set up the options for various
shares. Different users will have the same share configured to user
different paths. For example:

smb.alice.conf:
[share1]
  path = /path/to/share1/alice

[share2]
  path = /path/to/share2/alice

smb.bob.conf:
[share1]
  path = /path/to/share1/bob

[share2]
  path = /path/to/share2/bob

We have another server that needs to mount these shares as different
users, including multiple users at once. So it may call:

mount -t cifs //server/share1 -o user=alice
mount -t cifs //server/share2 -o user=bob
mount -t cifs //server/share2 -o user=alice

When that happens, cifs shares a single network connection to a single
instance of Samba. The first line opens a session for alice, reading
the smb.alice.conf file. The second opens a session for bob, reading
the smb.bob.conf file. The third re-uses alice's existing session, so
it never reloads services, leaving the configuration from smb.bob.conf
active, and so alice sees bob's view of the world.

This can be fixed by adding a call to reload_services() in
make_connection(). I believe this is the right place to put this call,
but I wanted to check with people who know the code better. Is there
any reason why this shouldn't work, or is there a better place to put
this call?
---
 source3/smbd/service.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s3-smbd-reload-services-upon-tree-connect.patch
Type: text/x-patch
Size: 540 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20121019/a93446a6/attachment.bin>


More information about the samba-technical mailing list