]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Enable "smbd:suicide mode" for smb2
authorVolker Lendecke <vl@samba.org>
Tue, 21 May 2019 12:52:22 +0000 (14:52 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 13 Jun 2019 08:52:28 +0000 (08:52 +0000)
The next commit needs an smbd to just exit and leave data behind in the
locking.tdb file. Don't make it harder to eventually phase out SMB1: Do
the test in SMB2.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13957
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/smb2_server.c

index 0d7dc7e20b96d06e4861dfcf3e40b243bfe5fdb4..cec1d9ad2a98e734af88aec356208c6aa275496e 100644 (file)
@@ -31,6 +31,7 @@
 #include "lib/util/iov_buf.h"
 #include "auth.h"
 #include "lib/crypto/sha512.h"
+#include "libcli/smb/smbXcli_base.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_SMB2
@@ -445,6 +446,17 @@ static NTSTATUS smbd_smb2_inbuf_parse_compound(struct smbXsrv_connection *xconn,
                 */
 
                if (len < SMB2_HDR_BODY + 2) {
+
+                       if ((len == 5) &&
+                           (IVAL(hdr, 0) == 0x74697865) &&
+                           lp_parm_bool(-1, "smbd", "suicide mode", false)) {
+                               uint8_t exitcode = CVAL(hdr, 4);
+                               DBG_WARNING("SUICIDE: Exiting immediately "
+                                           "with code %"PRIu8"\n",
+                                           exitcode);
+                               exit(exitcode);
+                       }
+
                        DEBUG(10, ("%d bytes left, expected at least %d\n",
                                   (int)len, SMB2_HDR_BODY));
                        goto inval;