idl: rebuild drsuapi.idl
[Samba/aatanasov.git] / source4 / smb_server / smb2 / keepalive.c
blobff47d594f025a4bd00a7614ed2baa64042479a67
1 /*
2 Unix SMB2 implementation.
4 Copyright (C) Stefan Metzmacher 2005
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.
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.
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/>.
20 #include "includes.h"
21 #include "libcli/smb2/smb2.h"
22 #include "smb_server/smb_server.h"
23 #include "smb_server/service_smb_proto.h"
24 #include "smb_server/smb2/smb2_server.h"
26 static NTSTATUS smb2srv_keepalive_backend(struct smb2srv_request *req)
28 /* TODO: maybe update some flags on the connection struct */
29 return NT_STATUS_OK;
32 static void smb2srv_keepalive_send(struct smb2srv_request *req)
34 NTSTATUS status;
36 if (NT_STATUS_IS_ERR(req->status)) {
37 smb2srv_send_error(req, req->status);
38 return;
41 status = smb2srv_setup_reply(req, 0x04, false, 0);
42 if (!NT_STATUS_IS_OK(status)) {
43 smbsrv_terminate_connection(req->smb_conn, nt_errstr(status));
44 talloc_free(req);
45 return;
48 SSVAL(req->out.body, 0x02, 0);
50 smb2srv_send_reply(req);
53 void smb2srv_keepalive_recv(struct smb2srv_request *req)
55 uint16_t _pad;
57 if (req->in.body_size != 0x04) {
58 smb2srv_send_error(req, NT_STATUS_INVALID_PARAMETER);
59 return;
62 if (SVAL(req->in.body, 0x00) != 0x04) {
63 smb2srv_send_error(req, NT_STATUS_INVALID_PARAMETER);
64 return;
67 _pad = SVAL(req->in.body, 0x02);
69 req->status = smb2srv_keepalive_backend(req);
71 if (req->control_flags & SMB2SRV_REQ_CTRL_FLAG_NOT_REPLY) {
72 talloc_free(req);
73 return;
75 smb2srv_keepalive_send(req);