From: Volker Lendecke Date: Tue, 21 May 2019 12:52:22 +0000 (+0200) Subject: smbd: Enable "smbd:suicide mode" for smb2 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=ebf95e62bd03a7344b3a141c3e7102aac721f25a;p=metze%2Fsamba%2Fwip.git smbd: Enable "smbd:suicide mode" for smb2 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 Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 5057cf68d7b2..7b6e82ba2f01 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -30,6 +30,7 @@ #include "../librpc/gen_ndr/krb5pac.h" #include "lib/util/iov_buf.h" #include "auth.h" +#include "libcli/smb/smbXcli_base.h" #include #include @@ -447,6 +448,17 @@ static NTSTATUS smbd_smb2_inbuf_parse_compound(struct smbXsrv_connection *xconn, */ if (len < SMB2_HDR_BODY + 2) { + + if ((len == 5) && + (IVAL(hdr, 0) == SMB_SUICIDE_PACKET) && + 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;