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/>.
30 /* The following definitions come from rpc_client/cli_lsarpc.c */
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
,
53 struct policy_handle
*pol
,
55 NTSTATUS
rpccli_lsa_open_policy(struct rpc_pipe_client
*cli
,
57 bool sec_qos
, uint32_t des_access
,
58 struct policy_handle
*pol
);
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
,
79 const char *srv_name_slash
,
82 struct policy_handle
*pol
,
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
,
109 const char *srv_name_slash
,
112 uint32_t *out_version
,
113 union lsa_revision_info
*out_revision_info
,
114 struct policy_handle
*pol
,
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
,
144 const char *srv_name_slash
,
146 uint32_t desired_access
,
147 uint32_t *out_version
,
148 union lsa_revision_info
*out_revision_info
,
149 struct policy_handle
*pol
,
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
,
177 struct policy_handle
*pol
,
179 const struct dom_sid
*sids
,
182 enum lsa_SidType
**ptypes
,
184 NTSTATUS
rpccli_lsa_lookup_sids(struct rpc_pipe_client
*cli
,
186 struct policy_handle
*pol
,
188 const struct dom_sid
*sids
,
191 enum lsa_SidType
**ptypes
);
192 NTSTATUS
dcerpc_lsa_lookup_sids_generic(struct dcerpc_binding_handle
*h
,
194 struct policy_handle
*pol
,
196 const struct dom_sid
*sids
,
197 enum lsa_LookupNamesLevel level
,
200 enum lsa_SidType
**ptypes
,
201 bool use_lookupsids3
,
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
,
228 struct policy_handle
*pol
,
230 const struct dom_sid
*sids
,
233 enum lsa_SidType
**ptypes
,
235 NTSTATUS
dcerpc_lsa_lookup_names(struct dcerpc_binding_handle
*h
,
237 struct policy_handle
*pol
,
240 const char ***dom_names
,
241 enum lsa_LookupNamesLevel level
,
242 struct dom_sid
**sids
,
243 enum lsa_SidType
**types
,
245 NTSTATUS
rpccli_lsa_lookup_names(struct rpc_pipe_client
*cli
,
247 struct policy_handle
*pol
, int num_names
,
249 const char ***dom_names
,
251 struct dom_sid
**sids
,
252 enum lsa_SidType
**types
);
254 NTSTATUS
dcerpc_lsa_lookup_names4(struct dcerpc_binding_handle
*h
,
256 struct policy_handle
*pol
,
259 const char ***dom_names
,
260 enum lsa_LookupNamesLevel level
,
261 struct dom_sid
**sids
,
262 enum lsa_SidType
**types
,
264 NTSTATUS
dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle
*h
,
266 struct policy_handle
*pol
,
269 const char ***dom_names
,
270 enum lsa_LookupNamesLevel level
,
271 struct dom_sid
**sids
,
272 enum lsa_SidType
**types
,
273 bool use_lookupnames4
,
276 bool fetch_domain_sid( char *domain
, char *remote_machine
, struct dom_sid
*psid
);
278 #endif /* _CLI_LSARPC_H */