Merge branch 'master' of /home/tridge/samba/git/combined
[Samba/aatanasov.git] / source3 / smbd / smb2_glue.c
blobd5a6217aa31e5be5e83134e51beda0a06c55ca11
1 /*
2 Unix SMB/CIFS implementation.
3 Core SMB2 server
5 Copyright (C) Stefan Metzmacher 2009
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "includes.h"
22 #include "smbd/globals.h"
23 #include "../libcli/smb/smb_common.h"
25 struct smb_request *smbd_smb2_fake_smb_request(struct smbd_smb2_request *req)
27 struct smb_request *smbreq;
28 const uint8_t *inhdr;
29 int i = req->current_idx;
31 inhdr = (const uint8_t *)req->in.vector[i+0].iov_base;
33 smbreq = talloc_zero(req, struct smb_request);
34 if (smbreq == NULL) {
35 return NULL;
38 smbreq->vuid = req->session->compat_vuser->vuid;
39 smbreq->tid = req->tcon->compat_conn->cnum;
40 smbreq->conn = req->tcon->compat_conn;
41 smbreq->smbpid = (uint16_t)IVAL(inhdr, SMB2_HDR_PID);
42 smbreq->flags2 = FLAGS2_UNICODE_STRINGS |
43 FLAGS2_32_BIT_ERROR_CODES |
44 FLAGS2_LONG_PATH_COMPONENTS |
45 FLAGS2_IS_LONG_NAME;
46 if (IVAL(inhdr, SMB2_HDR_FLAGS) & SMB2_HDR_FLAG_DFS) {
47 smbreq->flags2 |= FLAGS2_DFS_PATHNAMES;
49 smbreq->chain_fsp = req->compat_chain_fsp;
51 return smbreq;