diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-08-06 12:32:50 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-08-07 11:16:37 +0200 |
commit | 59b9dfa0cbb5e9f165f9fc0bcbd90fedddd7ec32 (patch) | |
tree | 5b2bcc2f63410476b33b55134f446ca75975afd8 /source3 | |
parent | aba6df9f5502fcb3fb8b86ae14890554065155f8 (diff) | |
download | samba-59b9dfa0cbb5e9f165f9fc0bcbd90fedddd7ec32.tar.gz samba-59b9dfa0cbb5e9f165f9fc0bcbd90fedddd7ec32.tar.bz2 samba-59b9dfa0cbb5e9f165f9fc0bcbd90fedddd7ec32.zip |
s3:smb2_server: do one central session check if the operation requires it
metze
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/smb2_server.c | 72 |
1 files changed, 6 insertions, 66 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 4ee0e2f0b5..700f6127ee 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -1778,6 +1778,12 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) req->sconn->smb2.compound_related_in_progress = true; } + if (call->need_session) { + if (!NT_STATUS_IS_OK(session_status)) { + return smbd_smb2_request_error(req, session_status); + } + } + switch (opcode) { case SMB2_OP_NEGPROT: /* This call needs to be run as root */ @@ -1802,11 +1808,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_LOGOFF: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } - /* This call needs to be run as root */ change_to_root_user(); @@ -1818,11 +1819,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_TCON: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } - /* * This call needs to be run as root. * @@ -1840,10 +1836,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_TDIS: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * @@ -1867,10 +1859,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_CREATE: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * @@ -1891,10 +1879,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_CLOSE: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * @@ -1915,10 +1899,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_FLUSH: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * @@ -1939,10 +1919,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_READ: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * @@ -1963,10 +1939,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_WRITE: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * @@ -1987,14 +1959,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_LOCK: - if (!NT_STATUS_IS_OK(session_status)) { - /* Too ugly to live ? JRA. */ - if (NT_STATUS_EQUAL(session_status,NT_STATUS_USER_SESSION_DELETED)) { - session_status = NT_STATUS_FILE_CLOSED; - } - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * @@ -2019,10 +1983,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_IOCTL: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * @@ -2069,10 +2029,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_FIND: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * @@ -2093,10 +2049,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_NOTIFY: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * @@ -2117,10 +2069,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_GETINFO: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * @@ -2141,10 +2089,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_SETINFO: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * @@ -2165,10 +2109,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) break; case SMB2_OP_BREAK: - if (!NT_STATUS_IS_OK(session_status)) { - return_value = smbd_smb2_request_error(req, session_status); - break; - } /* * This call needs to be run as user. * |