source: branches/samba-3.5.x/source4/smb_server/smb2/keepalive.c

Last change on this file was 414, checked in by Herwig Bauernfeind, 15 years ago

Samba 3.5.0: Initial import

File size: 1.9 KB
Line 
1/*
2 Unix SMB2 implementation.
3
4 Copyright (C) Stefan Metzmacher 2005
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#include "includes.h"
21#include "libcli/smb2/smb2.h"
22#include "smb_server/smb_server.h"
23#include "smb_server/smb2/smb2_server.h"
24
25static NTSTATUS smb2srv_keepalive_backend(struct smb2srv_request *req)
26{
27 /* TODO: maybe update some flags on the connection struct */
28 return NT_STATUS_OK;
29}
30
31static void smb2srv_keepalive_send(struct smb2srv_request *req)
32{
33 NTSTATUS status;
34
35 if (NT_STATUS_IS_ERR(req->status)) {
36 smb2srv_send_error(req, req->status);
37 return;
38 }
39
40 status = smb2srv_setup_reply(req, 0x04, false, 0);
41 if (!NT_STATUS_IS_OK(status)) {
42 smbsrv_terminate_connection(req->smb_conn, nt_errstr(status));
43 talloc_free(req);
44 return;
45 }
46
47 SSVAL(req->out.body, 0x02, 0);
48
49 smb2srv_send_reply(req);
50}
51
52void smb2srv_keepalive_recv(struct smb2srv_request *req)
53{
54 uint16_t _pad;
55
56 if (req->in.body_size != 0x04) {
57 smb2srv_send_error(req, NT_STATUS_INVALID_PARAMETER);
58 return;
59 }
60
61 if (SVAL(req->in.body, 0x00) != 0x04) {
62 smb2srv_send_error(req, NT_STATUS_INVALID_PARAMETER);
63 return;
64 }
65
66 _pad = SVAL(req->in.body, 0x02);
67
68 req->status = smb2srv_keepalive_backend(req);
69
70 if (req->control_flags & SMB2SRV_REQ_CTRL_FLAG_NOT_REPLY) {
71 talloc_free(req);
72 return;
73 }
74 smb2srv_keepalive_send(req);
75}
Note: See TracBrowser for help on using the repository browser.