summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-01-03 22:30:09 +0100
committerVolker Lendecke <vl@samba.org>2012-01-05 13:09:35 +0100
commitf7439f81be83be5836feb8d5050d0e9e616950b3 (patch)
treecd6a37d6c02e16b75995db0a4781acd04242cbba /source3/smbd
parent69b51e9053bf808213f9d09cfb8ef50e927dee72 (diff)
downloadsamba-f7439f81be83be5836feb8d5050d0e9e616950b3.tar.gz
samba-f7439f81be83be5836feb8d5050d0e9e616950b3.tar.bz2
samba-f7439f81be83be5836feb8d5050d0e9e616950b3.zip
s3: Add a suicide mode to smbd
To test our cleanup code paths properly, we need a way to make smbd exit hard without cleaning up
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/process.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index f366600ab8..bf161bbdba 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1412,6 +1412,17 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in
if ((size < (smb_size - 4)) || !valid_smb_header(sconn, req->inbuf)) {
DEBUG(2,("Non-SMB packet of length %d. Terminating server\n",
smb_len(req->inbuf)));
+
+ /* special magic for immediate exit */
+ if ((size == smb_size) &&
+ (IVAL(req->inbuf, 4) == 0x74697865) &&
+ lp_parm_bool(-1, "smbd", "suicide mode", false)) {
+ uint8_t exitcode = CVAL(req->inbuf, 8);
+ DEBUG(1, ("Exiting immediately with code %d\n",
+ (int)exitcode));
+ exit(exitcode);
+ }
+
exit_server_cleanly("Non-SMB packet");
}