/****************************************************************************
init the handle structures
****************************************************************************/
-NTSTATUS smbsrv_init_handles(struct smbsrv_tcon *tcon, uint64_t limit)
+NTSTATUS smbsrv_init_handles(struct smbsrv_tcon *tcon, uint32_t limit)
{
/*
* the idr_* functions take 'int' as limit,
find a handle given a handle id
****************************************************************************/
static struct smbsrv_handle *smbsrv_handle_find(struct smbsrv_handles_context *handles_ctx,
- uint64_t hid, struct timeval request_time)
+ uint32_t hid, struct timeval request_time)
{
void *p;
struct smbsrv_handle *handle;
}
struct smbsrv_handle *smbsrv_smb2_handle_find(struct smbsrv_tcon *smb_tcon,
- uint64_t hid, struct timeval request_time)
+ uint32_t hid, struct timeval request_time)
{
return smbsrv_handle_find(&smb_tcon->handles, hid, request_time);
}
{
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
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;
}
* 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
*/
* 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;
/*
* 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)