summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-03-21 13:59:20 -0700
committerKarolin Seeger <kseeger@samba.org>2013-04-26 09:25:03 +0200
commit55df8b1633595bd4d7a3e11250da29cc542976fe (patch)
tree591ddf2fa34e8d1cdef1566c2a43e060c5b375bb
parenta0346c10974fd23a152b98783ba8975604dd3ea5 (diff)
downloadsamba-55df8b1633595bd4d7a3e11250da29cc542976fe.tar.gz
Fix bug #9733 - smbcontrol close-share is not working.
As part of forcibly disconnecting a client from a share, smbd must atomically call reload_services() to ensure that the entry in the ServicePtrs[] array corresponding to that share is removed if the share was removed from the smb.conf or registry entries. Otherwise the ServicePtrs[] array entry for the share remains active and the client races to auto-reconnect to the share before a second message to reload the smb.conf file can be sent. This has to be done as part of the close-share message processing, as removing the share from the smb.conf file first, then telling the smbd to reload followed by the forcible disconnect message doesn't work as in this sequence of events when the reload message is received the client is still connected to the share, so the ServicePtrs[] entry is still left active. The forcible-disconnect + service reload has to be done together as an atomic operation in order for this to work. Signed-off-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 1df61789ca466923a7a252244888bd1b7cfbc79e)
-rw-r--r--source3/smbd/conn.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index 8a96e880538..05e692fa508 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -481,7 +481,7 @@ void msg_force_tdis(struct messaging_context *msg,
if (strcmp(sharename, "*") == 0) {
DEBUG(1,("Forcing close of all shares\n"));
conn_close_all(sconn);
- return;
+ goto done;
}
if (sconn->using_smb2) {
@@ -512,4 +512,9 @@ void msg_force_tdis(struct messaging_context *msg,
}
}
}
+
+ done:
+
+ change_to_root_user();
+ reload_services(msg, -1, true);
}