source: vendor/3.6.0/source3/smbd/smb2_glue.c

Last change on this file was 740, checked in by Silvan Scherrer, 13 years ago

Samba Server: update vendor to 3.6.0

File size: 2.4 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 Core SMB2 server
4
5 Copyright (C) Stefan Metzmacher 2009
6
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.
11
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.
16
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/>.
19*/
20
21#include "includes.h"
22#include "smbd/smbd.h"
23#include "smbd/globals.h"
24#include "../libcli/smb/smb_common.h"
25
26struct smb_request *smbd_smb2_fake_smb_request(struct smbd_smb2_request *req)
27{
28 struct smb_request *smbreq;
29 const uint8_t *inhdr;
30 int i = req->current_idx;
31
32 inhdr = (const uint8_t *)req->in.vector[i+0].iov_base;
33
34 smbreq = talloc_zero(req, struct smb_request);
35 if (smbreq == NULL) {
36 return NULL;
37 }
38
39 smbreq->vuid = req->session->compat_vuser->vuid;
40 smbreq->tid = req->tcon->compat_conn->cnum;
41 smbreq->conn = req->tcon->compat_conn;
42 smbreq->sconn = req->sconn;
43 smbreq->smbpid = (uint16_t)IVAL(inhdr, SMB2_HDR_PID);
44 smbreq->flags2 = FLAGS2_UNICODE_STRINGS |
45 FLAGS2_32_BIT_ERROR_CODES |
46 FLAGS2_LONG_PATH_COMPONENTS |
47 FLAGS2_IS_LONG_NAME;
48 if (IVAL(inhdr, SMB2_HDR_FLAGS) & SMB2_HDR_FLAG_DFS) {
49 smbreq->flags2 |= FLAGS2_DFS_PATHNAMES;
50 }
51 smbreq->mid = BVAL(inhdr, SMB2_HDR_MESSAGE_ID);
52 smbreq->chain_fsp = req->compat_chain_fsp;
53 smbreq->smb2req = req;
54 req->smb1req = smbreq;
55
56 return smbreq;
57}
58
59/*********************************************************
60 Called from file_free() to remove any chained fsp pointers.
61*********************************************************/
62
63void remove_smb2_chained_fsp(files_struct *fsp)
64{
65 struct smbd_server_connection *sconn = fsp->conn->sconn;
66 struct smbd_smb2_request *smb2req;
67
68 for (smb2req = sconn->smb2.requests; smb2req; smb2req = smb2req->next) {
69 if (smb2req->compat_chain_fsp == fsp) {
70 smb2req->compat_chain_fsp = NULL;
71 }
72 if (smb2req->smb1req && smb2req->smb1req->chain_fsp == fsp) {
73 smb2req->smb1req->chain_fsp = NULL;
74 }
75 }
76}
Note: See TracBrowser for help on using the repository browser.