482853c0abd3697ffa982ad4575b5937212399cb
[kamenim/samba.git] / source4 / librpc / rpc / dcerpc_lsa.c
1 /* 
2    Unix SMB/CIFS implementation.
3    raw dcerpc operations
4
5    Copyright (C) Tim Potter 2004
6    
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.
11    
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.
16    
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.
20 */
21
22 #include "includes.h"
23
24 NTSTATUS lsa_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
25                         struct policy_handle *handle)
26 {
27         struct lsa_ObjectAttribute attr;
28         struct lsa_QosInfo qos;
29         struct lsa_OpenPolicy r;
30         NTSTATUS status;
31         uint16 system_name = '\\';
32
33         qos.len = 0;
34         qos.impersonation_level = 2;
35         qos.context_mode = 1;
36         qos.effective_only = 0;
37
38         attr.len = 0;
39         attr.root_dir = NULL;
40         attr.object_name = NULL;
41         attr.attributes = 0;
42         attr.sec_desc = NULL;
43         attr.sec_qos = &qos;
44
45         r.in.system_name = &system_name;
46         r.in.attr = &attr;
47         r.in.desired_access = SEC_RIGHTS_MAXIMUM_ALLOWED;
48         r.out.handle = handle;  
49
50         return dcerpc_lsa_OpenPolicy(p, mem_ctx, &r);
51 }
52
53 NTSTATUS lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
54                          struct policy_handle *handle)
55 {
56         struct lsa_ObjectAttribute attr;
57         struct lsa_QosInfo qos;
58         struct lsa_OpenPolicy2 r;
59
60         qos.len = 0;
61         qos.impersonation_level = 2;
62         qos.context_mode = 1;
63         qos.effective_only = 0;
64
65         attr.len = 0;
66         attr.root_dir = NULL;
67         attr.object_name = NULL;
68         attr.attributes = 0;
69         attr.sec_desc = NULL;
70         attr.sec_qos = &qos;
71
72         r.in.system_name = "\\";
73         r.in.attr = &attr;
74         r.in.desired_access = SEC_RIGHTS_MAXIMUM_ALLOWED;
75         r.out.handle = handle;
76
77         return dcerpc_lsa_OpenPolicy2(p, mem_ctx, &r);
78 }
79