diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-11-19 05:21:05 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2013-11-27 16:31:44 +0100 |
commit | 3cc0651d9feda00b6a04f84b76744b2acc3a0446 (patch) | |
tree | f3975ba5e24ec0ceb9601db06a5fce21a0720e01 /source3 | |
parent | 36efaac2597d2d36826c02f23be15e7323b09784 (diff) | |
download | samba-3cc0651d9feda00b6a04f84b76744b2acc3a0446.tar.gz samba-3cc0651d9feda00b6a04f84b76744b2acc3a0446.tar.xz samba-3cc0651d9feda00b6a04f84b76744b2acc3a0446.zip |
s3:smb2_server: avoid calling set_current_user_info() for each request
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Nov 27 16:31:44 CET 2013 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/globals.h | 2 | ||||
-rw-r--r-- | source3/smbd/process.c | 5 | ||||
-rw-r--r-- | source3/smbd/smb2_server.c | 9 |
3 files changed, 9 insertions, 7 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index e2c763bafd..94111b60ad 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -367,6 +367,7 @@ struct smbXsrv_connection { * this session_table is used for SMB1 and SMB2, */ struct smbXsrv_session_table *session_table; + uint64_t last_session_id; /* * this tcon_table is only used for SMB1. */ @@ -731,7 +732,6 @@ struct smbd_server_connection { * Set by us for CORE protocol. */ int max_send; - uint64_t last_session_tag; } sessions; struct smb_signing_state *signing_state; diff --git a/source3/smbd/process.c b/source3/smbd/process.c index b8e01ba8aa..09fe910219 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1436,10 +1436,10 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req) } } - if (session_tag != sconn->smb1.sessions.last_session_tag) { + if (session_tag != sconn->conn->last_session_id) { struct user_struct *vuser = NULL; - sconn->smb1.sessions.last_session_tag = session_tag; + sconn->conn->last_session_id = session_tag; if (session) { vuser = session->compat; } @@ -3596,7 +3596,6 @@ void smbd_process(struct tevent_context *ev_ctx, sconn->smb1.sessions.done_sesssetup = false; sconn->smb1.sessions.max_send = BUFFER_SIZE; - sconn->smb1.sessions.last_session_tag = UID_FIELD_INVALID; if (!init_dptrs(sconn)) { exit_server("init_dptrs() failed"); diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index a3ed09bbb2..768a9c8c05 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -1749,9 +1749,12 @@ static NTSTATUS smbd_smb2_request_check_session(struct smbd_smb2_request *req) return NT_STATUS_INVALID_HANDLE; } - set_current_user_info(session_info->unix_info->sanitized_username, - session_info->unix_info->unix_name, - session_info->info->domain_name); + if (in_session_id != req->sconn->conn->last_session_id) { + req->sconn->conn->last_session_id = in_session_id; + set_current_user_info(session_info->unix_info->sanitized_username, + session_info->unix_info->unix_name, + session_info->info->domain_name); + } return NT_STATUS_OK; } |