summaryrefslogtreecommitdiffstats
path: root/source3/smbd/smb2_glue.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-04-08 22:15:55 -0700
committerJeremy Allison <jra@samba.org>2010-04-08 22:15:55 -0700
commit08b24e923dff99d3d3c0618903a7ed2959640470 (patch)
treeacfc07cc9c3aec2d1d78287b4fc58dbe143de627 /source3/smbd/smb2_glue.c
parent3491f6d119d1f4c7e0a259a9993ce96783b77e23 (diff)
downloadsamba-08b24e923dff99d3d3c0618903a7ed2959640470.tar.gz
samba-08b24e923dff99d3d3c0618903a7ed2959640470.tar.xz
samba-08b24e923dff99d3d3c0618903a7ed2959640470.zip
Stop smb2 from calling into smb1 blocking lock request code.
Allocate a uint16_t internal SMB1 mid for an SMB2 request. Add a back pointer from the faked up smb_request struct to the smb2 request. Getting ready to add restart code for blocking locks, share mode violations and oplocks in SMB2. Jeremy.
Diffstat (limited to 'source3/smbd/smb2_glue.c')
-rw-r--r--source3/smbd/smb2_glue.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source3/smbd/smb2_glue.c b/source3/smbd/smb2_glue.c
index d5a6217aa3..3ecc790bba 100644
--- a/source3/smbd/smb2_glue.c
+++ b/source3/smbd/smb2_glue.c
@@ -22,6 +22,18 @@
#include "smbd/globals.h"
#include "../libcli/smb/smb_common.h"
+static uint16_t allocate_next_mid(void)
+{
+ struct smbd_server_connection *sconn = smbd_server_conn;
+
+ sconn->smb2.next_compat_mid++;
+ /* Avoid mid == 0 and mid == 0xffff. */
+ if (sconn->smb2.next_compat_mid == 0xFFFF) {
+ sconn->smb2.next_compat_mid += 2;
+ }
+ return sconn->smb2.next_compat_mid;
+}
+
struct smb_request *smbd_smb2_fake_smb_request(struct smbd_smb2_request *req)
{
struct smb_request *smbreq;
@@ -46,7 +58,9 @@ struct smb_request *smbd_smb2_fake_smb_request(struct smbd_smb2_request *req)
if (IVAL(inhdr, SMB2_HDR_FLAGS) & SMB2_HDR_FLAG_DFS) {
smbreq->flags2 |= FLAGS2_DFS_PATHNAMES;
}
+ req->compat_mid = smbreq->mid = allocate_next_mid();
smbreq->chain_fsp = req->compat_chain_fsp;
+ smbreq->smb2req = req;
return smbreq;
}