f01dcb906dfd0e52616e617d75e6f8c761a912b6
[metze/samba/wip.git] / source3 / rpc_client / cli_lsarpc.h
1 /*
2  *  Unix SMB/CIFS implementation.
3  *
4  *  LSARPC client routines
5  *
6  *  Copyright (c) 2000-2001 Tim Potter
7  *  Copyright (c) 1992-2000 Andrew Tridgell
8  *  Copyright (c) 2002      Rafal Szczesniak
9  *  Copyright (c) 2005      Jeremy Allison
10  *  Copyright (c) 2007      Michael Adam
11  *  Copyright (c) 2008      Guenther Deschner
12  *
13  *  This program is free software; you can redistribute it and/or modify
14  *  it under the terms of the GNU General Public License as published by
15  *  the Free Software Foundation; either version 3 of the License, or
16  *  (at your option) any later version.
17  *
18  *  This program is distributed in the hope that it will be useful,
19  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  *  GNU General Public License for more details.
22  *
23  *  You should have received a copy of the GNU General Public License
24  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
25  */
26
27 #ifndef _CLI_LSARPC_H
28 #define _CLI_LSARPC_H
29
30 /* The following definitions come from rpc_client/cli_lsarpc.c  */
31
32 struct rpc_pipe_client;
33
34 /**
35  * @brief Open a LSA policy.
36  *
37  * @param[in]  h        The dcerpc binding hanlde to use.
38  *
39  * @param[in]  mem_ctx  The memory context to use.
40  *
41  * @param[in]  sec_qos  Enable security quality of services.
42  *
43  * @param[in]  des_access The disired access rights to be granted.
44  *
45  * @param[out]  pol     A pointer to a rpc policy handle.
46  *
47  * @param[out]  result  A pointer for the NDR NTSTATUS error code.
48  *
49  * @return              A corresponding NTSTATUS error code for the connection.
50  */
51 NTSTATUS dcerpc_lsa_open_policy(struct dcerpc_binding_handle *h,
52                                 TALLOC_CTX *mem_ctx,
53                                 bool sec_qos,
54                                 uint32_t des_access,
55                                 struct policy_handle *pol,
56                                 NTSTATUS *result);
57 NTSTATUS rpccli_lsa_open_policy(struct rpc_pipe_client *cli,
58                                 TALLOC_CTX *mem_ctx,
59                                 bool sec_qos, uint32_t des_access,
60                                 struct policy_handle *pol);
61
62 /**
63  * @brief Open a LSA policy.
64  *
65  * @param[in]  h        The dcerpc binding hanlde to use.
66  *
67  * @param[in]  mem_ctx  The memory context to use.
68  *
69  * @param[in]  sec_qos  Enable security quality of services.
70  *
71  * @param[in]  des_access The disired access rights to be granted.
72  *
73  * @param[out]  pol     A pointer to a rpc policy handle.
74  *
75  * @param[out]  result  A pointer for the NDR NTSTATUS error code.
76  *
77  * @return              A corresponding NTSTATUS error code for the connection.
78  */
79 NTSTATUS dcerpc_lsa_open_policy2(struct dcerpc_binding_handle *h,
80                                  TALLOC_CTX *mem_ctx,
81                                  const char *srv_name_slash,
82                                  bool sec_qos,
83                                  uint32_t des_access,
84                                  struct policy_handle *pol,
85                                  NTSTATUS *result);
86 NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
87                                  TALLOC_CTX *mem_ctx, bool sec_qos,
88                                  uint32_t des_access, struct policy_handle *pol);
89
90 /**
91  * @brief Look up the names that correspond to an array of sids.
92  *
93  * @param[in]  h        The initialized binding handle for a dcerpc connection.
94  *
95  * @param[in]  mem_ctx  The memory context to use.
96  *
97  * @param[in]  pol      The opened domain policy handle.
98  *
99  * @param[in]  num_sids The number of sids in the sids array to look up.
100  *
101  * @param[in]  sids     The array of sids to look up.
102  *
103  * @param[out]  pdomains A pointer to store the refercenced domains.
104  *
105  * @param[out]  pnames  A pointer to an array for the translated names.
106  *
107  * @param[out]  ptypes  A pointer to an array for the types of the names.
108  *
109  * @param[out]  result  A pointer for the conversion result.
110  *
111  * @return              A corresponding NTSTATUS error code.
112  */
113 NTSTATUS dcerpc_lsa_lookup_sids(struct dcerpc_binding_handle *h,
114                                 TALLOC_CTX *mem_ctx,
115                                 struct policy_handle *pol,
116                                 int num_sids,
117                                 const struct dom_sid *sids,
118                                 char ***pdomains,
119                                 char ***pnames,
120                                 enum lsa_SidType **ptypes,
121                                 NTSTATUS *result);
122 NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
123                                 TALLOC_CTX *mem_ctx,
124                                 struct policy_handle *pol,
125                                 int num_sids,
126                                 const struct dom_sid *sids,
127                                 char ***pdomains,
128                                 char ***pnames,
129                                 enum lsa_SidType **ptypes);
130 NTSTATUS dcerpc_lsa_lookup_sids_generic(struct dcerpc_binding_handle *h,
131                                         TALLOC_CTX *mem_ctx,
132                                         struct policy_handle *pol,
133                                         int num_sids,
134                                         const struct dom_sid *sids,
135                                         enum lsa_LookupNamesLevel level,
136                                         char ***pdomains,
137                                         char ***pnames,
138                                         enum lsa_SidType **ptypes,
139                                         bool use_lookupsids3,
140                                         NTSTATUS *presult);
141 /**
142  * @brief Look up the names that correspond to an array of sids.
143  *
144  * @param[in]  h        The initialized binding handle for a dcerpc connection.
145  *
146  * @param[in]  mem_ctx  The memory context to use.
147  *
148  * @param[in]  pol      The opened domain policy handle.
149  *
150  * @param[in]  num_sids The number of sids in the sids array to look up.
151  *
152  * @param[in]  sids     The array of sids to look up.
153  *
154  * @param[out]  pdomains A pointer to store the refercenced domains.
155  *
156  * @param[out]  pnames  A pointer to an array for the translated names.
157  *
158  * @param[out]  ptypes  A pointer to an array for the types of the names.
159  *
160  * @param[out]  result  A pointer for the conversion result.
161  *
162  * @return              A corresponding NTSTATUS error code.
163  */
164 NTSTATUS dcerpc_lsa_lookup_sids3(struct dcerpc_binding_handle *h,
165                                  TALLOC_CTX *mem_ctx,
166                                  struct policy_handle *pol,
167                                  int num_sids,
168                                  const struct dom_sid *sids,
169                                  char ***pdomains,
170                                  char ***pnames,
171                                  enum lsa_SidType **ptypes,
172                                  NTSTATUS *result);
173 NTSTATUS dcerpc_lsa_lookup_names(struct dcerpc_binding_handle *h,
174                                  TALLOC_CTX *mem_ctx,
175                                  struct policy_handle *pol,
176                                  uint32_t num_names,
177                                  const char **names,
178                                  const char ***dom_names,
179                                  enum lsa_LookupNamesLevel level,
180                                  struct dom_sid **sids,
181                                  enum lsa_SidType **types,
182                                  NTSTATUS *result);
183 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
184                                  TALLOC_CTX *mem_ctx,
185                                  struct policy_handle *pol, int num_names,
186                                  const char **names,
187                                  const char ***dom_names,
188                                  int level,
189                                  struct dom_sid **sids,
190                                  enum lsa_SidType **types);
191
192 NTSTATUS dcerpc_lsa_lookup_names4(struct dcerpc_binding_handle *h,
193                                   TALLOC_CTX *mem_ctx,
194                                   struct policy_handle *pol,
195                                   uint32_t num_names,
196                                   const char **names,
197                                   const char ***dom_names,
198                                   enum lsa_LookupNamesLevel level,
199                                   struct dom_sid **sids,
200                                   enum lsa_SidType **types,
201                                   NTSTATUS *result);
202 NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h,
203                                          TALLOC_CTX *mem_ctx,
204                                          struct policy_handle *pol,
205                                          uint32_t num_names,
206                                          const char **names,
207                                          const char ***dom_names,
208                                          enum lsa_LookupNamesLevel level,
209                                          struct dom_sid **sids,
210                                          enum lsa_SidType **types,
211                                          bool use_lookupnames4,
212                                          NTSTATUS *presult);
213
214 bool fetch_domain_sid( char *domain, char *remote_machine, struct dom_sid *psid);
215
216 #endif /* _CLI_LSARPC_H */