2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Tridgell 2003
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.
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, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 /****************************************************************************
24 fetch file ACL (async send)
25 ****************************************************************************/
26 struct cli_request *smb_raw_query_secdesc_send(struct cli_tree *tree,
27 struct smb_query_secdesc *query)
29 struct smb_nttrans nt;
34 nt.in.max_data = 0x10000;
35 nt.in.setup_count = 0;
36 nt.in.function = NT_TRANSACT_QUERY_SECURITY_DESC;
39 SSVAL(params, 0, query->in.fnum);
40 SSVAL(params, 2, 0); /* padding */
41 SIVAL(params, 4, query->in.secinfo_flags);
43 nt.in.params.data = params;
44 nt.in.params.length = 8;
46 nt.in.data = data_blob(NULL, 0);
48 return smb_raw_nttrans_send(tree, &nt);
52 /****************************************************************************
53 fetch file ACL (async recv)
54 ****************************************************************************/
55 NTSTATUS smb_raw_query_secdesc_recv(struct cli_request *req,
57 struct smb_query_secdesc *query)
60 struct smb_nttrans nt;
61 struct ndr_parse *rpc;
63 status = smb_raw_nttrans_recv(req, mem_ctx, &nt);
64 if (!NT_STATUS_IS_OK(status)) {
68 /* check that the basics are valid */
69 if (nt.out.params.length != 4 ||
70 IVAL(nt.out.params.data, 0) > nt.out.data.length) {
71 return NT_STATUS_INVALID_PARAMETER;
74 nt.out.data.length = IVAL(nt.out.params.data, 0);
76 rpc = ndr_parse_init_blob(&nt.out.data, mem_ctx);
78 return NT_STATUS_INVALID_PARAMETER;
81 status = ndr_parse_security_descriptor(rpc, &query->out.sd);
87 /****************************************************************************
88 fetch file ACL (sync interface)
89 ****************************************************************************/
90 NTSTATUS smb_raw_query_secdesc(struct cli_tree *tree,
92 struct smb_query_secdesc *query)
94 struct cli_request *req = smb_raw_query_secdesc_send(tree, query);
95 return smb_raw_query_secdesc_recv(req, mem_ctx, query);