util:datablob: data_blob_pad checks its alignment assumption
[samba.git] / source3 / rpc_client / cli_lsarpc.h
blob0a0f399346e6282d8e7c392547935419ff48bcbb
1 /*
2 * Unix SMB/CIFS implementation.
4 * LSARPC client routines
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
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.
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.
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/>.
27 #ifndef _CLI_LSARPC_H
28 #define _CLI_LSARPC_H
30 /* The following definitions come from rpc_client/cli_lsarpc.c */
32 /**
33 * @brief Open a LSA policy.
35 * @param[in] h The dcerpc binding handle to use.
37 * @param[in] mem_ctx The memory context to use.
39 * @param[in] sec_qos Enable security quality of services.
41 * @param[in] des_access The desired access rights to be granted.
43 * @param[out] pol A pointer to a rpc policy handle.
45 * @param[out] result A pointer for the NDR NTSTATUS error code.
47 * @return A corresponding NTSTATUS error code for the connection.
49 NTSTATUS dcerpc_lsa_open_policy(struct dcerpc_binding_handle *h,
50 TALLOC_CTX *mem_ctx,
51 bool sec_qos,
52 uint32_t des_access,
53 struct policy_handle *pol,
54 NTSTATUS *result);
55 NTSTATUS rpccli_lsa_open_policy(struct rpc_pipe_client *cli,
56 TALLOC_CTX *mem_ctx,
57 bool sec_qos, uint32_t des_access,
58 struct policy_handle *pol);
60 /**
61 * @brief Open a LSA policy.
63 * @param[in] h The dcerpc binding handle to use.
65 * @param[in] mem_ctx The memory context to use.
67 * @param[in] sec_qos Enable security quality of services.
69 * @param[in] des_access The desired access rights to be granted.
71 * @param[out] pol A pointer to a rpc policy handle.
73 * @param[out] result A pointer for the NDR NTSTATUS error code.
75 * @return A corresponding NTSTATUS error code for the connection.
77 NTSTATUS dcerpc_lsa_open_policy2(struct dcerpc_binding_handle *h,
78 TALLOC_CTX *mem_ctx,
79 const char *srv_name_slash,
80 bool sec_qos,
81 uint32_t des_access,
82 struct policy_handle *pol,
83 NTSTATUS *result);
85 /**
86 * @brief Open a LSA policy.
88 * @param[in] h The dcerpc binding handle to use.
90 * @param[in] mem_ctx The memory context to use.
92 * @param[in] sec_qos Enable security quality of services.
94 * @param[in] des_access The desired access rights to be granted.
96 * @param[out] out_version A pointer to an uin32_t to store the version of the
97 * following data structure.
99 * @param[out] out_revision info A pointer to store the out_revision_info.
101 * @param[out] pol A pointer to a rpc policy handle.
103 * @param[out] result A pointer for the NDR NTSTATUS error code.
105 * @return A corresponding NTSTATUS error code for the connection.
107 NTSTATUS dcerpc_lsa_open_policy3(struct dcerpc_binding_handle *h,
108 TALLOC_CTX *mem_ctx,
109 const char *srv_name_slash,
110 bool sec_qos,
111 uint32_t des_access,
112 uint32_t *out_version,
113 union lsa_revision_info *out_revision_info,
114 struct policy_handle *pol,
115 NTSTATUS *result);
118 * @brief Open a LSA policy with fallback to previous version
120 * This first calls lsa_open_policy3 and falls back to lsa_open_policy2 in case
121 * it isn't implemented.
123 * @param[in] h The dcerpc binding handle to use.
125 * @param[in] mem_ctx The memory context to use.
127 * @param[in] sec_qos Enable security quality of services.
129 * @param[in] des_access The desired access rights to be granted.
131 * @param[out] out_version A pointer to an uin32_t to store the version of the
132 * following data structure.
134 * @param[out] out_revision info A pointer to store the out_revision_info.
136 * @param[out] pol A pointer to a rpc policy handle.
138 * @param[out] result A pointer for the NDR NTSTATUS error code.
140 * @return A corresponding NTSTATUS error code for the connection.
142 NTSTATUS dcerpc_lsa_open_policy_fallback(struct dcerpc_binding_handle *h,
143 TALLOC_CTX *mem_ctx,
144 const char *srv_name_slash,
145 bool sec_qos,
146 uint32_t desired_access,
147 uint32_t *out_version,
148 union lsa_revision_info *out_revision_info,
149 struct policy_handle *pol,
150 NTSTATUS *result);
153 * @brief Look up the names that correspond to an array of sids.
155 * @param[in] h The initialized binding handle for a dcerpc connection.
157 * @param[in] mem_ctx The memory context to use.
159 * @param[in] pol The opened domain policy handle.
161 * @param[in] num_sids The number of sids in the sids array to look up.
163 * @param[in] sids The array of sids to look up.
165 * @param[out] pdomains A pointer to store the refercenced domains.
167 * @param[out] pnames A pointer to an array for the translated names.
169 * @param[out] ptypes A pointer to an array for the types of the names.
171 * @param[out] result A pointer for the conversion result.
173 * @return A corresponding NTSTATUS error code.
175 NTSTATUS dcerpc_lsa_lookup_sids(struct dcerpc_binding_handle *h,
176 TALLOC_CTX *mem_ctx,
177 struct policy_handle *pol,
178 int num_sids,
179 const struct dom_sid *sids,
180 char ***pdomains,
181 char ***pnames,
182 enum lsa_SidType **ptypes,
183 NTSTATUS *result);
184 NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
185 TALLOC_CTX *mem_ctx,
186 struct policy_handle *pol,
187 int num_sids,
188 const struct dom_sid *sids,
189 char ***pdomains,
190 char ***pnames,
191 enum lsa_SidType **ptypes);
192 NTSTATUS dcerpc_lsa_lookup_sids_generic(struct dcerpc_binding_handle *h,
193 TALLOC_CTX *mem_ctx,
194 struct policy_handle *pol,
195 int num_sids,
196 const struct dom_sid *sids,
197 enum lsa_LookupNamesLevel level,
198 char ***pdomains,
199 char ***pnames,
200 enum lsa_SidType **ptypes,
201 bool use_lookupsids3,
202 NTSTATUS *presult);
204 * @brief Look up the names that correspond to an array of sids.
206 * @param[in] h The initialized binding handle for a dcerpc connection.
208 * @param[in] mem_ctx The memory context to use.
210 * @param[in] pol The opened domain policy handle.
212 * @param[in] num_sids The number of sids in the sids array to look up.
214 * @param[in] sids The array of sids to look up.
216 * @param[out] pdomains A pointer to store the refercenced domains.
218 * @param[out] pnames A pointer to an array for the translated names.
220 * @param[out] ptypes A pointer to an array for the types of the names.
222 * @param[out] result A pointer for the conversion result.
224 * @return A corresponding NTSTATUS error code.
226 NTSTATUS dcerpc_lsa_lookup_sids3(struct dcerpc_binding_handle *h,
227 TALLOC_CTX *mem_ctx,
228 struct policy_handle *pol,
229 int num_sids,
230 const struct dom_sid *sids,
231 char ***pdomains,
232 char ***pnames,
233 enum lsa_SidType **ptypes,
234 NTSTATUS *result);
235 NTSTATUS dcerpc_lsa_lookup_names(struct dcerpc_binding_handle *h,
236 TALLOC_CTX *mem_ctx,
237 struct policy_handle *pol,
238 uint32_t num_names,
239 const char **names,
240 const char ***dom_names,
241 enum lsa_LookupNamesLevel level,
242 struct dom_sid **sids,
243 enum lsa_SidType **types,
244 NTSTATUS *result);
245 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
246 TALLOC_CTX *mem_ctx,
247 struct policy_handle *pol, int num_names,
248 const char **names,
249 const char ***dom_names,
250 int level,
251 struct dom_sid **sids,
252 enum lsa_SidType **types);
254 NTSTATUS dcerpc_lsa_lookup_names4(struct dcerpc_binding_handle *h,
255 TALLOC_CTX *mem_ctx,
256 struct policy_handle *pol,
257 uint32_t num_names,
258 const char **names,
259 const char ***dom_names,
260 enum lsa_LookupNamesLevel level,
261 struct dom_sid **sids,
262 enum lsa_SidType **types,
263 NTSTATUS *result);
264 NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h,
265 TALLOC_CTX *mem_ctx,
266 struct policy_handle *pol,
267 uint32_t num_names,
268 const char **names,
269 const char ***dom_names,
270 enum lsa_LookupNamesLevel level,
271 struct dom_sid **sids,
272 enum lsa_SidType **types,
273 bool use_lookupnames4,
274 NTSTATUS *presult);
276 bool fetch_domain_sid( char *domain, char *remote_machine, struct dom_sid *psid);
278 #endif /* _CLI_LSARPC_H */