From: Stefan Metzmacher Date: Thu, 14 Jun 2018 09:18:13 +0000 (+0200) Subject: smbd: let switch_message() only call chdir_current_service() for SMBtdis/SMBexit X-Git-Tag: tevent-0.9.37~302 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4a97448cc9433a4a8e03f8efbe00a404d72c3616;p=thirdparty%2Fsamba.git smbd: let switch_message() only call chdir_current_service() for SMBtdis/SMBexit These are the two opcodes with DO_CHDIR, we don't want the set_current_case_sensitive() logic for them, so we don't need the full set_current_service() anymore. The AS_USER case is already handled before, set_current_case_sensitive() is called directly before change_to_user(), which already calls chdir_current_service(). Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 7babf4d5699..88362711632 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1654,11 +1654,14 @@ static connection_struct *switch_message(uint8_t type, struct smb_request *req) } } - if (!set_current_service(conn,SVAL(req->inbuf,smb_flg), - (flags & (AS_USER|DO_CHDIR) - ?True:False))) { - reply_nterror(req, NT_STATUS_ACCESS_DENIED); - return conn; + if (flags & DO_CHDIR) { + bool ok; + + ok = chdir_current_service(conn); + if (!ok) { + reply_nterror(req, NT_STATUS_ACCESS_DENIED); + return conn; + } } conn->num_smb_operations++; }