summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2012-05-22 13:18:06 +0200
committerStefan Metzmacher <metze@samba.org>2012-06-25 20:55:06 +0200
commitd693ff54dbb3fa7ab44034775de1609f419ac879 (patch)
treed59856bc9ba675afae68daf96735ca2e54f0f77a /source3
parenta129e271b5385853fb39a8e54b56b508b00a3e41 (diff)
downloadsamba-d693ff54dbb3fa7ab44034775de1609f419ac879.tar.gz
samba-d693ff54dbb3fa7ab44034775de1609f419ac879.tar.bz2
samba-d693ff54dbb3fa7ab44034775de1609f419ac879.zip
s3:smbd: use smbXsrv_session_logoff_all() and smb1srv_tcon_disconnect_all() in exit_server_common()
This removes the use of conn_close_all() and invalidate_all_vuids() Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/server_exit.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c
index 593bdacd41..07b8432bff 100644
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -79,10 +79,10 @@ static struct files_struct *log_writeable_file_fn(
enum server_exit_reason { SERVER_EXIT_NORMAL, SERVER_EXIT_ABNORMAL };
static void exit_server_common(enum server_exit_reason how,
- const char *const reason) _NORETURN_;
+ const char *reason) _NORETURN_;
static void exit_server_common(enum server_exit_reason how,
- const char *const reason)
+ const char *reason)
{
struct smbXsrv_connection *conn = global_smbXsrv_connection;
struct smbd_server_connection *sconn = NULL;
@@ -103,12 +103,40 @@ static void exit_server_common(enum server_exit_reason how,
}
if (sconn) {
+ NTSTATUS status;
+
if (lp_log_writeable_files_on_exit()) {
bool found = false;
files_forall(sconn, log_writeable_file_fn, &found);
}
- conn_close_all(sconn);
- invalidate_all_vuids(sconn);
+
+ /*
+ * Note: this is a no-op for smb2 as
+ * conn->tcon_table is empty
+ */
+ status = smb1srv_tcon_disconnect_all(conn);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("Server exit (%s)\n",
+ (reason ? reason : "normal exit")));
+ DEBUG(0, ("exit_server_common: "
+ "smb1srv_tcon_disconnect_all() failed (%s) - "
+ "triggering cleanup\n", nt_errstr(status)));
+ how = SERVER_EXIT_ABNORMAL;
+ reason = "smb1srv_tcon_disconnect_all failed";
+ }
+
+ status = smbXsrv_session_logoff_all(conn);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("Server exit (%s)\n",
+ (reason ? reason : "normal exit")));
+ DEBUG(0, ("exit_server_common: "
+ "smbXsrv_session_logoff_all() failed (%s) - "
+ "triggering cleanup\n", nt_errstr(status)));
+ how = SERVER_EXIT_ABNORMAL;
+ reason = "smbXsrv_session_logoff_all failed";
+ }
+
+ change_to_root_user();
}
/* 3 second timeout. */