summaryrefslogtreecommitdiff
path: root/source4/smb_server/smb2/tcon.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-08-01 10:37:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:19 -0500
commitc5148cd9cd7cbc6463308b9c65bbc68c2be3b16a (patch)
tree294036f1378a88cb33a7121f19072f0d75a6418d /source4/smb_server/smb2/tcon.c
parent7b52d77eb5b43787bb95298575bcd0f5f1ed7602 (diff)
downloadsamba-c5148cd9cd7cbc6463308b9c65bbc68c2be3b16a.tar.gz
samba-c5148cd9cd7cbc6463308b9c65bbc68c2be3b16a.tar.bz2
samba-c5148cd9cd7cbc6463308b9c65bbc68c2be3b16a.zip
r17360: add some comments
metze (This used to be commit 3d849f9d2565ebcba16653df3ce2060d3b606c50)
Diffstat (limited to 'source4/smb_server/smb2/tcon.c')
-rw-r--r--source4/smb_server/smb2/tcon.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/source4/smb_server/smb2/tcon.c b/source4/smb_server/smb2/tcon.c
index d01b63d446..a98110ab85 100644
--- a/source4/smb_server/smb2/tcon.c
+++ b/source4/smb_server/smb2/tcon.c
@@ -49,7 +49,7 @@ struct ntvfs_handle *smb2srv_pull_handle(struct smb2srv_request *req, const uint
tid = IVAL(base, offset + 8);
pad = IVAL(base, offset + 12);
- if (pad != 0xFFFFFFFF) {
+ if (pad != UINT32_MAX) {
return NULL;
}
@@ -58,7 +58,15 @@ struct ntvfs_handle *smb2srv_pull_handle(struct smb2srv_request *req, const uint
return NULL;
}
-/* TODO: add comments */
+ /*
+ * the handle can belong to a different tcon
+ * as that TID in the SMB2 header says, but
+ * the request should succeed nevertheless!
+ *
+ * because if this we put the 32 bit TID into the
+ * 128 bit handle, so that we can extract the tcon from the
+ * handle
+ */
tcon = req->tcon;
if (tid != req->tcon->tid) {
tcon = smbsrv_smb2_tcon_find(req->session, tid, req->request_time);
@@ -72,6 +80,18 @@ struct ntvfs_handle *smb2srv_pull_handle(struct smb2srv_request *req, const uint
return NULL;
}
+ /*
+ * as the smb2srv_tcon is a child object of the smb2srv_session
+ * the handle belongs to the correct session!
+ *
+ * Note: no check is needed here for SMB2
+ */
+
+ /*
+ * as the handle may have overwritten the tcon
+ * we need to set it on the request so that the
+ * correct ntvfs context will be used for the ntvfs_*() request
+ */
req->tcon = tcon;
return handle->ntvfs;
}
@@ -86,7 +106,7 @@ void smb2srv_push_handle(uint8_t *base, uint_t offset, struct ntvfs_handle *ntvf
*/
SBVAL(base, offset, handle->hid);
SIVAL(base, offset + 8, handle->tcon->tid);
- SIVAL(base, offset + 12,0xFFFFFFFF);
+ SIVAL(base, offset + 12,UINT32_MAX);
}
static NTSTATUS smb2srv_handle_create_new(void *private_data, struct ntvfs_request *ntvfs, struct ntvfs_handle **_h)