summaryrefslogtreecommitdiff
path: root/source4/smb_server/smb2
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-05-21 17:23:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:52:44 -0500
commit10498e8a720d047ca3a013abbc9e406c630ab30a (patch)
tree8be0631fbc2e98b170bef4b59bbd0f80fa533529 /source4/smb_server/smb2
parentbaa81e29593bbf73711914aadc35306fbf79ba21 (diff)
downloadsamba-10498e8a720d047ca3a013abbc9e406c630ab30a.tar.gz
samba-10498e8a720d047ca3a013abbc9e406c630ab30a.tar.bz2
samba-10498e8a720d047ca3a013abbc9e406c630ab30a.zip
r23044: - use uint32_t for handle id's
- include the session vuid in the SMB2 128-Bit wire handles as SMB2 oplock breaks doesn't include a TID or VUID in the header we need to make sure the handle is unique for the whole TCP connection metze (This used to be commit 7c29b8a7e67c48478399788912b22c287fbd3b4e)
Diffstat (limited to 'source4/smb_server/smb2')
-rw-r--r--source4/smb_server/smb2/tcon.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/source4/smb_server/smb2/tcon.c b/source4/smb_server/smb2/tcon.c
index 023ca9b0a4..9dd2461a0e 100644
--- a/source4/smb_server/smb2/tcon.c
+++ b/source4/smb_server/smb2/tcon.c
@@ -41,9 +41,9 @@ struct ntvfs_handle *smb2srv_pull_handle(struct smb2srv_request *req, const uint
{
struct smbsrv_tcon *tcon;
struct smbsrv_handle *handle;
- uint64_t hid;
+ uint32_t hid;
uint32_t tid;
- uint32_t pad;
+ uint64_t uid;
/*
* if there're chained requests used the cached handle
@@ -56,16 +56,20 @@ struct ntvfs_handle *smb2srv_pull_handle(struct smb2srv_request *req, const uint
offset = 0;
}
- hid = BVAL(base, offset);
- tid = IVAL(base, offset + 8);
- pad = IVAL(base, offset + 12);
+ hid = IVAL(base, offset);
+ tid = IVAL(base, offset + 4);
+ uid = BVAL(base, offset + 8);
- if (pad != UINT32_MAX) {
+ /* if it's the wildcard handle, don't waste time to search it... */
+ if (hid == UINT32_MAX && tid == UINT32_MAX && uid == UINT64_MAX) {
return NULL;
}
- /* if it's the wildcard handle, don't waste time to search it... */
- if (hid == UINT64_MAX && tid == UINT32_MAX) {
+ /*
+ * if the (v)uid part doesn't match the given session the handle isn't
+ * valid
+ */
+ if (uid != req->session->vuid) {
return NULL;
}
@@ -74,7 +78,7 @@ struct ntvfs_handle *smb2srv_pull_handle(struct smb2srv_request *req, const uint
* 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
+ * because of this we put the 32 bit TID into the
* 128 bit handle, so that we can extract the tcon from the
* handle
*/
@@ -102,6 +106,8 @@ struct ntvfs_handle *smb2srv_pull_handle(struct smb2srv_request *req, const uint
* 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
+ *
+ * TODO: check if that's correct for chained requests as well!
*/
req->tcon = tcon;
return handle->ntvfs;
@@ -115,9 +121,9 @@ void smb2srv_push_handle(uint8_t *base, uint_t offset, struct ntvfs_handle *ntvf
/*
* the handle is 128 bit on the wire
*/
- SBVAL(base, offset, handle->hid);
- SIVAL(base, offset + 8, handle->tcon->tid);
- SIVAL(base, offset + 12,UINT32_MAX);
+ SIVAL(base, offset, handle->hid);
+ SIVAL(base, offset + 4, handle->tcon->tid);
+ SBVAL(base, offset + 8, handle->session->vuid);
}
static NTSTATUS smb2srv_handle_create_new(void *private_data, struct ntvfs_request *ntvfs, struct ntvfs_handle **_h)