smbd: Fix coredump on failing chdir during logoff
authorChristof Schmitt <cs@samba.org>
Wed, 13 Dec 2017 18:34:23 +0000 (11:34 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 2 Jan 2018 13:19:44 +0000 (14:19 +0100)
server_exit does an internal tree disconnect which requires a chdir to
the share directory. In case the file system encountered a problem and
the chdir call returns an error, this triggers a SERVER_EXIT_ABNORMAL
which in turn results in a panic and a coredump. As the log already
indicates the problem (chdir returned an error), avoid the
SERVER_EXIT_ABNORMAL in this case and not trigger a coredump.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13189

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Dec 16 01:56:06 CET 2017 on sn-devel-144

(cherry picked from commit 7fa91fc4791d076c609eaf119753e38dd3c50a1c)

Autobuild-User(v4-7-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-7-test): Tue Jan  2 14:19:44 CET 2018 on sn-devel-144

selftest/knownfail
source3/smbd/server_exit.c

index d5e4a188e27ad5549822bb40559bc386f8a5a202..dd23c7d204f591ec6421f658ae850f5a7c7a622e 100644 (file)
 ^samba.tests.ntlmauth.python\(ktest\).ntlmauth.NtlmAuthTests.test_ntlm_connection\(ktest\)
 # Disabling NTLM means you can't use samr to change the password
 ^samba.tests.ntlmauth.python\(ktest\).ntlmauth.NtlmAuthTests.test_samr_change_password\(ktest\)
-^samba3.blackbox.smbd_error.check_panic_2
index 74ddd70bd3a1b3701bac887fff08ec2f03ed69a5..ab96ebfe94d1cc20d306d500df5f5e88f1a0d2ca 100644 (file)
@@ -150,8 +150,6 @@ static void exit_server_common(enum server_exit_reason how,
                        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(xconn);
@@ -161,8 +159,6 @@ static void exit_server_common(enum server_exit_reason how,
                        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";
                }
        }