summaryrefslogtreecommitdiffstats
path: root/source3/smbd/smb2_glue.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-06-02 11:54:00 +0200
committerStefan Metzmacher <metze@samba.org>2009-06-03 17:54:39 +0200
commitcfc8d4a1f49a304ab8ff3e1dde7217a031cccf10 (patch)
tree5639865b4328cdcea21a106bbe10f0d946a775fd /source3/smbd/smb2_glue.c
parent4b14ebb91d59da2adab85bcba171931395990797 (diff)
downloadsamba-cfc8d4a1f49a304ab8ff3e1dde7217a031cccf10.tar.gz
samba-cfc8d4a1f49a304ab8ff3e1dde7217a031cccf10.tar.xz
samba-cfc8d4a1f49a304ab8ff3e1dde7217a031cccf10.zip
s3:smbd: add smbd_smb2_fake_smb_request()
metze
Diffstat (limited to 'source3/smbd/smb2_glue.c')
-rw-r--r--source3/smbd/smb2_glue.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/source3/smbd/smb2_glue.c b/source3/smbd/smb2_glue.c
new file mode 100644
index 00000000000..c3c38542a0d
--- /dev/null
+++ b/source3/smbd/smb2_glue.c
@@ -0,0 +1,51 @@
+/*
+ Unix SMB/CIFS implementation.
+ Core SMB2 server
+
+ Copyright (C) Stefan Metzmacher 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "smbd/globals.h"
+#include "../source4/libcli/smb2/smb2_constants.h"
+
+struct smb_request *smbd_smb2_fake_smb_request(struct smbd_smb2_request *req)
+{
+ struct smb_request *smbreq;
+ const uint8_t *inhdr;
+ int i = req->current_idx;
+
+ inhdr = (const uint8_t *)req->in.vector[i+0].iov_base;
+
+ smbreq = talloc_zero(req, struct smb_request);
+ if (smbreq == NULL) {
+ return NULL;
+ }
+
+ smbreq->vuid = req->session->compat_vuser->vuid;
+ smbreq->tid = req->tcon->compat_conn->cnum;
+ smbreq->conn = req->tcon->compat_conn;
+ smbreq->smbpid = (uint16_t)IVAL(inhdr, SMB2_HDR_PID);
+ smbreq->flags2 = FLAGS2_UNICODE_STRINGS |
+ FLAGS2_32_BIT_ERROR_CODES |
+ FLAGS2_LONG_PATH_COMPONENTS |
+ FLAGS2_IS_LONG_NAME;
+ if (IVAL(inhdr, SMB2_HDR_FLAGS) & SMB2_HDR_FLAG_DFS) {
+ smbreq->flags2 |= FLAGS2_DFS_PATHNAMES;
+ }
+
+ return smbreq;
+}