r16407: add parsing code the SMB2 GetInfo in the server
[kai/samba-autobuild/.git] / source4 / smb_server / smb2 / fileinfo.c
1 /* 
2    Unix SMB2 implementation.
3    
4    Copyright (C) Stefan Metzmacher      2006
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 2 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, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #include "includes.h"
22 #include "libcli/smb2/smb2.h"
23 #include "libcli/smb2/smb2_calls.h"
24 #include "smb_server/smb_server.h"
25 #include "smb_server/service_smb_proto.h"
26 #include "smb_server/smb2/smb2_server.h"
27 #include "ntvfs/ntvfs.h"
28
29 static void smb2srv_getinfo_send(struct ntvfs_request *ntvfs)
30 {
31         struct smb2srv_request *req;
32         struct smb2_getinfo *info;
33
34         SMB2SRV_CHECK_ASYNC_STATUS(info, struct smb2_getinfo);
35         SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, True, 0));
36
37         /* TODO: this is maybe a o16s32_blob */
38         SMB2SRV_CHECK(smb2_push_o16s16_blob(&req->out, 0x02, info->out.blob));
39         SSVAL(req->out.body,    0x06,   0);
40
41         smb2srv_send_reply(req);
42 }
43
44 static NTSTATUS smb2srv_getinfo_backend(struct ntvfs_request *ntvfs, struct smb2_getinfo *info)
45 {
46         return NT_STATUS_NOT_IMPLEMENTED;
47 }
48
49 void smb2srv_getinfo_recv(struct smb2srv_request *req)
50 {
51         struct smb2_getinfo *info;
52
53         SMB2SRV_CHECK_BODY_SIZE(req, 0x30, True);
54         SMB2SRV_TALLOC_IO_PTR(info, struct smb2_getinfo);
55         SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_getinfo_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
56
57         info->in.level                  = SVAL(req->in.body, 0x02);
58         info->in.max_response_size      = IVAL(req->in.body, 0x04);
59         info->in.unknown1               = IVAL(req->in.body, 0x08);
60         info->in.unknown2               = IVAL(req->in.body, 0x0C);
61         info->in.flags                  = IVAL(req->in.body, 0x10);
62         info->in.flags2                 = IVAL(req->in.body, 0x14);
63         info->in.file.ntvfs             = smb2srv_pull_handle(req, req->in.body, 0x18);
64
65         SMB2SRV_CHECK_FILE_HANDLE(info->in.file.ntvfs);
66         SMB2SRV_CALL_NTVFS_BACKEND(smb2srv_getinfo_backend(req->ntvfs, info));
67 }
68
69 void smb2srv_setinfo_recv(struct smb2srv_request *req)
70 {
71         smb2srv_send_error(req, NT_STATUS_NOT_IMPLEMENTED);
72 }
73
74 void smb2srv_break_recv(struct smb2srv_request *req)
75 {
76         smb2srv_send_error(req, NT_STATUS_NOT_IMPLEMENTED);
77 }