summaryrefslogtreecommitdiff
path: root/source3/smbd/smb2_glue.c
blob: 26107df389fd7d88348bf723ae4fb4823f6e88ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
   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 "../libcli/smb/smb_common.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;
	}
	smbreq->mid = BVAL(inhdr, SMB2_HDR_MESSAGE_ID);
	smbreq->chain_fsp = req->compat_chain_fsp;
	smbreq->smb2req = req;

	return smbreq;
}

/* Dummy functions for the SMB1 -> SMB2 deferred open message
 * hooks. */

void remove_deferred_open_message_smb2(uint64_t mid)
{
}

void schedule_deferred_open_message_smb2(uint64_t mid)
{
}

bool open_was_deferred_smb2(uint64_t mid)
{
	return false;
}

bool get_deferred_open_message_state_smb2(uint64_t mid,
			struct timeval *p_request_time,
			void **pp_state)
{
	return false;
}

bool push_deferred_open_message_smb2(struct smb_request *req,
				struct timeval request_time,
				struct timeval timeout,
				char *private_data,
				size_t priv_len)
{
	return false;
}