smbd: let switch_message() only call chdir_current_service() for SMBtdis/SMBexit
authorStefan Metzmacher <metze@samba.org>
Thu, 14 Jun 2018 09:18:13 +0000 (11:18 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Jun 2018 06:59:17 +0000 (08:59 +0200)
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 <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/process.c

index 7babf4d5699f29ff12da0859a6c20db2fdd55d55..88362711632b9f365d539d10c22ce35cf6cef1df 100644 (file)
@@ -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++;
        }