diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-08-06 12:32:50 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-08-07 13:14:38 +0200 |
commit | e7bf8e7e23855c9f03983200d52a93cdd49c4948 (patch) | |
tree | dcc367f89fe8843c895532b93a9b92bc2f7c1570 | |
parent | eec941e411676b72ac40107efcc0e19710db725e (diff) | |
download | samba-e7bf8e7e23855c9f03983200d52a93cdd49c4948.tar.gz samba-e7bf8e7e23855c9f03983200d52a93cdd49c4948.tar.bz2 samba-e7bf8e7e23855c9f03983200d52a93cdd49c4948.zip |
s3:smb2_server: do one central as_root check if the operation requires it
metze
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Aug 7 13:14:38 CEST 2012 on sn-devel-104
-rw-r--r-- | source3/smbd/smb2_server.c | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 1a53ee09fa..4e3259af94 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -1799,11 +1799,15 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) } } - switch (opcode) { - case SMB2_OP_NEGPROT: + if (call->as_root) { /* This call needs to be run as root */ change_to_root_user(); + } else { + SMB_ASSERT(call->need_tcon); + } + switch (opcode) { + case SMB2_OP_NEGPROT: { START_PROFILE(smb2_negprot); return_value = smbd_smb2_request_process_negprot(req); @@ -1812,9 +1816,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_SESSSETUP: - /* This call needs to be run as root */ - change_to_root_user(); - { START_PROFILE(smb2_sesssetup); return_value = smbd_smb2_request_process_sesssetup(req); @@ -1823,9 +1824,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_LOGOFF: - /* This call needs to be run as root */ - change_to_root_user(); - { START_PROFILE(smb2_logoff); return_value = smbd_smb2_request_process_logoff(req); @@ -1834,15 +1832,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_TCON: - /* - * This call needs to be run as root. - * - * smbd_smb2_request_process_tcon() - * calls make_connection_snum(), which will call - * change_to_user(), when needed. - */ - change_to_root_user(); - { START_PROFILE(smb2_tcon); return_value = smbd_smb2_request_process_tcon(req); @@ -1851,9 +1840,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_TDIS: - /* This call needs to be run as root */ - change_to_root_user(); - { START_PROFILE(smb2_tdis); return_value = smbd_smb2_request_process_tdis(req); @@ -1918,13 +1904,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_CANCEL: - /* - * This call needs to be run as root - * - * That is what we also do in the SMB1 case. - */ - change_to_root_user(); - { START_PROFILE(smb2_cancel); return_value = smbd_smb2_request_process_cancel(req); @@ -1933,9 +1912,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_KEEPALIVE: - /* This call needs to be run as root */ - change_to_root_user(); - { START_PROFILE(smb2_keepalive); return_value = smbd_smb2_request_process_keepalive(req); |