2 Unix SMB/Netbios implementation.
4 client security descriptor functions
5 Copyright (C) Andrew Tridgell 2000
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 /****************************************************************************
29 query the security descriptor for a open file
30 ****************************************************************************/
31 SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd)
34 char *rparam=NULL, *rdata=NULL;
35 int rparam_count=0, rdata_count=0;
44 if (!cli_send_nt_trans(cli,
45 NT_TRANSACT_QUERY_SECURITY_DESC,
50 DEBUG(1,("Failed to send NT_TRANSACT_QUERY_SECURITY_DESC\n"));
55 if (!cli_receive_nt_trans(cli,
56 &rparam, &rparam_count,
57 &rdata, &rdata_count)) {
58 DEBUG(1,("Failed to recv NT_TRANSACT_QUERY_SECURITY_DESC\n"));
62 if ((mem_ctx = talloc_init()) == NULL) {
63 DEBUG(0,("talloc_init failed.\n"));
67 prs_init(&pd, rdata_count, 4, mem_ctx, UNMARSHALL);
68 prs_append_data(&pd, rdata, rdata_count);
71 if (!sec_io_desc("sd data", &psd, &pd, 1)) {
72 DEBUG(1,("Failed to parse secdesc\n"));
76 ret = dup_sec_desc(psd);
77 talloc_destroy(mem_ctx);