From: Stefan Metzmacher Date: Thu, 20 Sep 2012 03:10:28 +0000 (+0200) Subject: s3:smb2_server: reset req->last_session_id and req->last_tid after using it X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=68ef8cf99a7421daa1d57895189cfc2dc508adfd;p=metze%2Fsamba%2Fwip.git s3:smb2_server: reset req->last_session_id and req->last_tid after using it If we can find a valid session or tcon we'll set it after the lookup, but it need to make sure to reset it if we don't find the session. This fixes a problem where a compound unrelated request between related requests doesn't reset the session. If we have 3 requests in a compound chain, request 3 should never use the id's cached from request 1. It should only every inherit handles from request 2. metze (similar to commit 2552b6632372b35cbd7b788c4e00091dfe520a41) Signed-off-by: Stefan Metzmacher --- diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c index c90368ffc58a..1f48e332e85b 100644 --- a/source3/smbd/smb2_sesssetup.c +++ b/source3/smbd/smb2_sesssetup.c @@ -835,6 +835,8 @@ NTSTATUS smbd_smb2_request_check_session(struct smbd_smb2_request *req) in_session_id = req->last_session_id; } + req->last_session_id = UINT64_MAX; + /* lookup an existing session */ p = idr_find(req->sconn->smb2.sessions.idtree, in_session_id); if (p == NULL) { diff --git a/source3/smbd/smb2_tcon.c b/source3/smbd/smb2_tcon.c index 5ca303ec75b1..5f0e3a937a31 100644 --- a/source3/smbd/smb2_tcon.c +++ b/source3/smbd/smb2_tcon.c @@ -298,6 +298,8 @@ NTSTATUS smbd_smb2_request_check_tcon(struct smbd_smb2_request *req) in_tid = req->last_tid; } + req->last_tid = UINT32_MAX; + /* lookup an existing session */ p = idr_find(req->session->tcons.idtree, in_tid); if (p == NULL) {