1 | /*
|
---|
2 | Unix SMB/CIFS implementation.
|
---|
3 |
|
---|
4 | Winbind client API
|
---|
5 |
|
---|
6 | Copyright (C) Gerald (Jerry) Carter 2007
|
---|
7 |
|
---|
8 | This library is free software; you can redistribute it and/or
|
---|
9 | modify it under the terms of the GNU Lesser General Public
|
---|
10 | License as published by the Free Software Foundation; either
|
---|
11 | version 3 of the License, or (at your option) any later version.
|
---|
12 |
|
---|
13 | This library is distributed in the hope that it will be useful,
|
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
16 | Library General Public License for more details.
|
---|
17 |
|
---|
18 | You should have received a copy of the GNU Lesser General Public License
|
---|
19 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef _WBCLIENT_H
|
---|
23 | #define _WBCLIENT_H
|
---|
24 |
|
---|
25 | #include <pwd.h>
|
---|
26 | #include <grp.h>
|
---|
27 |
|
---|
28 | /* Define error types */
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * @brief Status codes returned from wbc functions
|
---|
32 | **/
|
---|
33 |
|
---|
34 | enum _wbcErrType {
|
---|
35 | WBC_ERR_SUCCESS = 0, /**< Successful completion **/
|
---|
36 | WBC_ERR_NOT_IMPLEMENTED,/**< Function not implemented **/
|
---|
37 | WBC_ERR_UNKNOWN_FAILURE,/**< General failure **/
|
---|
38 | WBC_ERR_NO_MEMORY, /**< Memory allocation error **/
|
---|
39 | WBC_ERR_INVALID_SID, /**< Invalid SID format **/
|
---|
40 | WBC_ERR_INVALID_PARAM, /**< An Invalid parameter was supplied **/
|
---|
41 | WBC_ERR_WINBIND_NOT_AVAILABLE, /**< Winbind daemon is not available **/
|
---|
42 | WBC_ERR_DOMAIN_NOT_FOUND, /**< Domain is not trusted or cannot be found **/
|
---|
43 | WBC_ERR_INVALID_RESPONSE, /**< Winbind returned an invalid response **/
|
---|
44 | WBC_ERR_NSS_ERROR, /**< NSS_STATUS error **/
|
---|
45 | WBC_ERR_AUTH_ERROR, /**< Authentication failed **/
|
---|
46 | WBC_ERR_UNKNOWN_USER, /**< User account cannot be found */
|
---|
47 | WBC_ERR_UNKNOWN_GROUP, /**< Group account cannot be found */
|
---|
48 | WBC_ERR_PWD_CHANGE_FAILED /**< Password Change has failed */
|
---|
49 | };
|
---|
50 |
|
---|
51 | typedef enum _wbcErrType wbcErr;
|
---|
52 |
|
---|
53 | #define WBC_ERROR_IS_OK(x) ((x) == WBC_ERR_SUCCESS)
|
---|
54 |
|
---|
55 | const char *wbcErrorString(wbcErr error);
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * @brief Some useful details about the wbclient library
|
---|
59 | *
|
---|
60 | * 0.1: Initial version
|
---|
61 | * 0.2: Added wbcRemoveUidMapping()
|
---|
62 | * Added wbcRemoveGidMapping()
|
---|
63 | **/
|
---|
64 | #define WBCLIENT_MAJOR_VERSION 0
|
---|
65 | #define WBCLIENT_MINOR_VERSION 2
|
---|
66 | #define WBCLIENT_VENDOR_VERSION "Samba libwbclient"
|
---|
67 | struct wbcLibraryDetails {
|
---|
68 | uint16_t major_version;
|
---|
69 | uint16_t minor_version;
|
---|
70 | const char *vendor_version;
|
---|
71 | };
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * @brief Some useful details about the running winbindd
|
---|
75 | *
|
---|
76 | **/
|
---|
77 | struct wbcInterfaceDetails {
|
---|
78 | uint32_t interface_version;
|
---|
79 | const char *winbind_version;
|
---|
80 | char winbind_separator;
|
---|
81 | const char *netbios_name;
|
---|
82 | const char *netbios_domain;
|
---|
83 | const char *dns_domain;
|
---|
84 | };
|
---|
85 |
|
---|
86 | /*
|
---|
87 | * Data types used by the Winbind Client API
|
---|
88 | */
|
---|
89 |
|
---|
90 | #ifndef WBC_MAXSUBAUTHS
|
---|
91 | #define WBC_MAXSUBAUTHS 15 /* max sub authorities in a SID */
|
---|
92 | #endif
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * @brief Windows Security Identifier
|
---|
96 | *
|
---|
97 | **/
|
---|
98 |
|
---|
99 | struct wbcDomainSid {
|
---|
100 | uint8_t sid_rev_num;
|
---|
101 | uint8_t num_auths;
|
---|
102 | uint8_t id_auth[6];
|
---|
103 | uint32_t sub_auths[WBC_MAXSUBAUTHS];
|
---|
104 | };
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * @brief Security Identifier type
|
---|
108 | **/
|
---|
109 |
|
---|
110 | enum wbcSidType {
|
---|
111 | WBC_SID_NAME_USE_NONE=0,
|
---|
112 | WBC_SID_NAME_USER=1,
|
---|
113 | WBC_SID_NAME_DOM_GRP=2,
|
---|
114 | WBC_SID_NAME_DOMAIN=3,
|
---|
115 | WBC_SID_NAME_ALIAS=4,
|
---|
116 | WBC_SID_NAME_WKN_GRP=5,
|
---|
117 | WBC_SID_NAME_DELETED=6,
|
---|
118 | WBC_SID_NAME_INVALID=7,
|
---|
119 | WBC_SID_NAME_UNKNOWN=8,
|
---|
120 | WBC_SID_NAME_COMPUTER=9
|
---|
121 | };
|
---|
122 |
|
---|
123 | /**
|
---|
124 | * @brief Security Identifier with attributes
|
---|
125 | **/
|
---|
126 |
|
---|
127 | struct wbcSidWithAttr {
|
---|
128 | struct wbcDomainSid sid;
|
---|
129 | uint32_t attributes;
|
---|
130 | };
|
---|
131 |
|
---|
132 | /* wbcSidWithAttr->attributes */
|
---|
133 |
|
---|
134 | #define WBC_SID_ATTR_GROUP_MANDATORY 0x00000001
|
---|
135 | #define WBC_SID_ATTR_GROUP_ENABLED_BY_DEFAULT 0x00000002
|
---|
136 | #define WBC_SID_ATTR_GROUP_ENABLED 0x00000004
|
---|
137 | #define WBC_SID_ATTR_GROUP_OWNER 0x00000008
|
---|
138 | #define WBC_SID_ATTR_GROUP_USEFOR_DENY_ONLY 0x00000010
|
---|
139 | #define WBC_SID_ATTR_GROUP_RESOURCE 0x20000000
|
---|
140 | #define WBC_SID_ATTR_GROUP_LOGON_ID 0xC0000000
|
---|
141 |
|
---|
142 | /**
|
---|
143 | * @brief Windows GUID
|
---|
144 | *
|
---|
145 | **/
|
---|
146 |
|
---|
147 | struct wbcGuid {
|
---|
148 | uint32_t time_low;
|
---|
149 | uint16_t time_mid;
|
---|
150 | uint16_t time_hi_and_version;
|
---|
151 | uint8_t clock_seq[2];
|
---|
152 | uint8_t node[6];
|
---|
153 | };
|
---|
154 |
|
---|
155 | /**
|
---|
156 | * @brief Domain Information
|
---|
157 | **/
|
---|
158 |
|
---|
159 | struct wbcDomainInfo {
|
---|
160 | char *short_name;
|
---|
161 | char *dns_name;
|
---|
162 | struct wbcDomainSid sid;
|
---|
163 | uint32_t domain_flags;
|
---|
164 | uint32_t trust_flags;
|
---|
165 | uint32_t trust_type;
|
---|
166 | };
|
---|
167 |
|
---|
168 | /* wbcDomainInfo->domain_flags */
|
---|
169 |
|
---|
170 | #define WBC_DOMINFO_DOMAIN_UNKNOWN 0x00000000
|
---|
171 | #define WBC_DOMINFO_DOMAIN_NATIVE 0x00000001
|
---|
172 | #define WBC_DOMINFO_DOMAIN_AD 0x00000002
|
---|
173 | #define WBC_DOMINFO_DOMAIN_PRIMARY 0x00000004
|
---|
174 | #define WBC_DOMINFO_DOMAIN_OFFLINE 0x00000008
|
---|
175 |
|
---|
176 | /* wbcDomainInfo->trust_flags */
|
---|
177 |
|
---|
178 | #define WBC_DOMINFO_TRUST_TRANSITIVE 0x00000001
|
---|
179 | #define WBC_DOMINFO_TRUST_INCOMING 0x00000002
|
---|
180 | #define WBC_DOMINFO_TRUST_OUTGOING 0x00000004
|
---|
181 |
|
---|
182 | /* wbcDomainInfo->trust_type */
|
---|
183 |
|
---|
184 | #define WBC_DOMINFO_TRUSTTYPE_NONE 0x00000000
|
---|
185 | #define WBC_DOMINFO_TRUSTTYPE_FOREST 0x00000001
|
---|
186 | #define WBC_DOMINFO_TRUSTTYPE_IN_FOREST 0x00000002
|
---|
187 | #define WBC_DOMINFO_TRUSTTYPE_EXTERNAL 0x00000003
|
---|
188 |
|
---|
189 |
|
---|
190 | /**
|
---|
191 | * @brief Auth User Parameters
|
---|
192 | **/
|
---|
193 |
|
---|
194 | struct wbcAuthUserParams {
|
---|
195 | const char *account_name;
|
---|
196 | const char *domain_name;
|
---|
197 | const char *workstation_name;
|
---|
198 |
|
---|
199 | uint32_t flags;
|
---|
200 |
|
---|
201 | uint32_t parameter_control;
|
---|
202 |
|
---|
203 | enum wbcAuthUserLevel {
|
---|
204 | WBC_AUTH_USER_LEVEL_PLAIN = 1,
|
---|
205 | WBC_AUTH_USER_LEVEL_HASH = 2,
|
---|
206 | WBC_AUTH_USER_LEVEL_RESPONSE = 3
|
---|
207 | } level;
|
---|
208 | union {
|
---|
209 | const char *plaintext;
|
---|
210 | struct {
|
---|
211 | uint8_t nt_hash[16];
|
---|
212 | uint8_t lm_hash[16];
|
---|
213 | } hash;
|
---|
214 | struct {
|
---|
215 | uint8_t challenge[8];
|
---|
216 | uint32_t nt_length;
|
---|
217 | uint8_t *nt_data;
|
---|
218 | uint32_t lm_length;
|
---|
219 | uint8_t *lm_data;
|
---|
220 | } response;
|
---|
221 | } password;
|
---|
222 | };
|
---|
223 |
|
---|
224 | /**
|
---|
225 | * @brief Generic Blob
|
---|
226 | **/
|
---|
227 |
|
---|
228 | struct wbcBlob {
|
---|
229 | uint8_t *data;
|
---|
230 | size_t length;
|
---|
231 | };
|
---|
232 |
|
---|
233 | /**
|
---|
234 | * @brief Named Blob
|
---|
235 | **/
|
---|
236 |
|
---|
237 | struct wbcNamedBlob {
|
---|
238 | const char *name;
|
---|
239 | uint32_t flags;
|
---|
240 | struct wbcBlob blob;
|
---|
241 | };
|
---|
242 |
|
---|
243 | /**
|
---|
244 | * @brief Logon User Parameters
|
---|
245 | **/
|
---|
246 |
|
---|
247 | struct wbcLogonUserParams {
|
---|
248 | const char *username;
|
---|
249 | const char *password;
|
---|
250 | size_t num_blobs;
|
---|
251 | struct wbcNamedBlob *blobs;
|
---|
252 | };
|
---|
253 |
|
---|
254 | /**
|
---|
255 | * @brief ChangePassword Parameters
|
---|
256 | **/
|
---|
257 |
|
---|
258 | struct wbcChangePasswordParams {
|
---|
259 | const char *account_name;
|
---|
260 | const char *domain_name;
|
---|
261 |
|
---|
262 | uint32_t flags;
|
---|
263 |
|
---|
264 | enum wbcChangePasswordLevel {
|
---|
265 | WBC_CHANGE_PASSWORD_LEVEL_PLAIN = 1,
|
---|
266 | WBC_CHANGE_PASSWORD_LEVEL_RESPONSE = 2
|
---|
267 | } level;
|
---|
268 |
|
---|
269 | union {
|
---|
270 | const char *plaintext;
|
---|
271 | struct {
|
---|
272 | uint32_t old_nt_hash_enc_length;
|
---|
273 | uint8_t *old_nt_hash_enc_data;
|
---|
274 | uint32_t old_lm_hash_enc_length;
|
---|
275 | uint8_t *old_lm_hash_enc_data;
|
---|
276 | } response;
|
---|
277 | } old_password;
|
---|
278 | union {
|
---|
279 | const char *plaintext;
|
---|
280 | struct {
|
---|
281 | uint32_t nt_length;
|
---|
282 | uint8_t *nt_data;
|
---|
283 | uint32_t lm_length;
|
---|
284 | uint8_t *lm_data;
|
---|
285 | } response;
|
---|
286 | } new_password;
|
---|
287 | };
|
---|
288 |
|
---|
289 | /* wbcAuthUserParams->parameter_control */
|
---|
290 |
|
---|
291 | #define WBC_MSV1_0_CLEARTEXT_PASSWORD_ALLOWED 0x00000002
|
---|
292 | #define WBC_MSV1_0_UPDATE_LOGON_STATISTICS 0x00000004
|
---|
293 | #define WBC_MSV1_0_RETURN_USER_PARAMETERS 0x00000008
|
---|
294 | #define WBC_MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT 0x00000020
|
---|
295 | #define WBC_MSV1_0_RETURN_PROFILE_PATH 0x00000200
|
---|
296 | #define WBC_MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT 0x00000800
|
---|
297 |
|
---|
298 | /* wbcAuthUserParams->flags */
|
---|
299 |
|
---|
300 | #define WBC_AUTH_PARAM_FLAGS_INTERACTIVE_LOGON 0x00000001
|
---|
301 |
|
---|
302 | /**
|
---|
303 | * @brief Auth User Information
|
---|
304 | *
|
---|
305 | * Some of the strings are maybe NULL
|
---|
306 | **/
|
---|
307 |
|
---|
308 | struct wbcAuthUserInfo {
|
---|
309 | uint32_t user_flags;
|
---|
310 |
|
---|
311 | char *account_name;
|
---|
312 | char *user_principal;
|
---|
313 | char *full_name;
|
---|
314 | char *domain_name;
|
---|
315 | char *dns_domain_name;
|
---|
316 |
|
---|
317 | uint32_t acct_flags;
|
---|
318 | uint8_t user_session_key[16];
|
---|
319 | uint8_t lm_session_key[8];
|
---|
320 |
|
---|
321 | uint16_t logon_count;
|
---|
322 | uint16_t bad_password_count;
|
---|
323 |
|
---|
324 | uint64_t logon_time;
|
---|
325 | uint64_t logoff_time;
|
---|
326 | uint64_t kickoff_time;
|
---|
327 | uint64_t pass_last_set_time;
|
---|
328 | uint64_t pass_can_change_time;
|
---|
329 | uint64_t pass_must_change_time;
|
---|
330 |
|
---|
331 | char *logon_server;
|
---|
332 | char *logon_script;
|
---|
333 | char *profile_path;
|
---|
334 | char *home_directory;
|
---|
335 | char *home_drive;
|
---|
336 |
|
---|
337 | /*
|
---|
338 | * the 1st one is the account sid
|
---|
339 | * the 2nd one is the primary_group sid
|
---|
340 | * followed by the rest of the groups
|
---|
341 | */
|
---|
342 | uint32_t num_sids;
|
---|
343 | struct wbcSidWithAttr *sids;
|
---|
344 | };
|
---|
345 |
|
---|
346 | /**
|
---|
347 | * @brief Logon User Information
|
---|
348 | *
|
---|
349 | * Some of the strings are maybe NULL
|
---|
350 | **/
|
---|
351 |
|
---|
352 | struct wbcLogonUserInfo {
|
---|
353 | struct wbcAuthUserInfo *info;
|
---|
354 | size_t num_blobs;
|
---|
355 | struct wbcNamedBlob *blobs;
|
---|
356 | };
|
---|
357 |
|
---|
358 | /* wbcAuthUserInfo->user_flags */
|
---|
359 |
|
---|
360 | #define WBC_AUTH_USER_INFO_GUEST 0x00000001
|
---|
361 | #define WBC_AUTH_USER_INFO_NOENCRYPTION 0x00000002
|
---|
362 | #define WBC_AUTH_USER_INFO_CACHED_ACCOUNT 0x00000004
|
---|
363 | #define WBC_AUTH_USER_INFO_USED_LM_PASSWORD 0x00000008
|
---|
364 | #define WBC_AUTH_USER_INFO_EXTRA_SIDS 0x00000020
|
---|
365 | #define WBC_AUTH_USER_INFO_SUBAUTH_SESSION_KEY 0x00000040
|
---|
366 | #define WBC_AUTH_USER_INFO_SERVER_TRUST_ACCOUNT 0x00000080
|
---|
367 | #define WBC_AUTH_USER_INFO_NTLMV2_ENABLED 0x00000100
|
---|
368 | #define WBC_AUTH_USER_INFO_RESOURCE_GROUPS 0x00000200
|
---|
369 | #define WBC_AUTH_USER_INFO_PROFILE_PATH_RETURNED 0x00000400
|
---|
370 | #define WBC_AUTH_USER_INFO_GRACE_LOGON 0x01000000
|
---|
371 |
|
---|
372 | /* wbcAuthUserInfo->acct_flags */
|
---|
373 |
|
---|
374 | #define WBC_ACB_DISABLED 0x00000001 /* 1 User account disabled */
|
---|
375 | #define WBC_ACB_HOMDIRREQ 0x00000002 /* 1 Home directory required */
|
---|
376 | #define WBC_ACB_PWNOTREQ 0x00000004 /* 1 User password not required */
|
---|
377 | #define WBC_ACB_TEMPDUP 0x00000008 /* 1 Temporary duplicate account */
|
---|
378 | #define WBC_ACB_NORMAL 0x00000010 /* 1 Normal user account */
|
---|
379 | #define WBC_ACB_MNS 0x00000020 /* 1 MNS logon user account */
|
---|
380 | #define WBC_ACB_DOMTRUST 0x00000040 /* 1 Interdomain trust account */
|
---|
381 | #define WBC_ACB_WSTRUST 0x00000080 /* 1 Workstation trust account */
|
---|
382 | #define WBC_ACB_SVRTRUST 0x00000100 /* 1 Server trust account */
|
---|
383 | #define WBC_ACB_PWNOEXP 0x00000200 /* 1 User password does not expire */
|
---|
384 | #define WBC_ACB_AUTOLOCK 0x00000400 /* 1 Account auto locked */
|
---|
385 | #define WBC_ACB_ENC_TXT_PWD_ALLOWED 0x00000800 /* 1 Encryped text password is allowed */
|
---|
386 | #define WBC_ACB_SMARTCARD_REQUIRED 0x00001000 /* 1 Smart Card required */
|
---|
387 | #define WBC_ACB_TRUSTED_FOR_DELEGATION 0x00002000 /* 1 Trusted for Delegation */
|
---|
388 | #define WBC_ACB_NOT_DELEGATED 0x00004000 /* 1 Not delegated */
|
---|
389 | #define WBC_ACB_USE_DES_KEY_ONLY 0x00008000 /* 1 Use DES key only */
|
---|
390 | #define WBC_ACB_DONT_REQUIRE_PREAUTH 0x00010000 /* 1 Preauth not required */
|
---|
391 | #define WBC_ACB_PW_EXPIRED 0x00020000 /* 1 Password Expired */
|
---|
392 | #define WBC_ACB_NO_AUTH_DATA_REQD 0x00080000 /* 1 = No authorization data required */
|
---|
393 |
|
---|
394 | struct wbcAuthErrorInfo {
|
---|
395 | uint32_t nt_status;
|
---|
396 | char *nt_string;
|
---|
397 | int32_t pam_error;
|
---|
398 | char *display_string;
|
---|
399 | };
|
---|
400 |
|
---|
401 | /**
|
---|
402 | * @brief User Password Policy Information
|
---|
403 | **/
|
---|
404 |
|
---|
405 | /* wbcUserPasswordPolicyInfo->password_properties */
|
---|
406 |
|
---|
407 | #define WBC_DOMAIN_PASSWORD_COMPLEX 0x00000001
|
---|
408 | #define WBC_DOMAIN_PASSWORD_NO_ANON_CHANGE 0x00000002
|
---|
409 | #define WBC_DOMAIN_PASSWORD_NO_CLEAR_CHANGE 0x00000004
|
---|
410 | #define WBC_DOMAIN_PASSWORD_LOCKOUT_ADMINS 0x00000008
|
---|
411 | #define WBC_DOMAIN_PASSWORD_STORE_CLEARTEXT 0x00000010
|
---|
412 | #define WBC_DOMAIN_REFUSE_PASSWORD_CHANGE 0x00000020
|
---|
413 |
|
---|
414 | struct wbcUserPasswordPolicyInfo {
|
---|
415 | uint32_t min_length_password;
|
---|
416 | uint32_t password_history;
|
---|
417 | uint32_t password_properties;
|
---|
418 | uint64_t expire;
|
---|
419 | uint64_t min_passwordage;
|
---|
420 | };
|
---|
421 |
|
---|
422 | /**
|
---|
423 | * @brief Change Password Reject Reason
|
---|
424 | **/
|
---|
425 |
|
---|
426 | enum wbcPasswordChangeRejectReason {
|
---|
427 | WBC_PWD_CHANGE_REJECT_OTHER=0,
|
---|
428 | WBC_PWD_CHANGE_REJECT_TOO_SHORT=1,
|
---|
429 | WBC_PWD_CHANGE_REJECT_IN_HISTORY=2,
|
---|
430 | WBC_PWD_CHANGE_REJECT_COMPLEXITY=5
|
---|
431 | };
|
---|
432 |
|
---|
433 | /**
|
---|
434 | * @brief Logoff User Parameters
|
---|
435 | **/
|
---|
436 |
|
---|
437 | struct wbcLogoffUserParams {
|
---|
438 | const char *username;
|
---|
439 | size_t num_blobs;
|
---|
440 | struct wbcNamedBlob *blobs;
|
---|
441 | };
|
---|
442 |
|
---|
443 | /** @brief Credential cache log-on parameters
|
---|
444 | *
|
---|
445 | */
|
---|
446 |
|
---|
447 | struct wbcCredentialCacheParams {
|
---|
448 | const char *account_name;
|
---|
449 | const char *domain_name;
|
---|
450 | enum wbcCredentialCacheLevel {
|
---|
451 | WBC_CREDENTIAL_CACHE_LEVEL_NTLMSSP = 1
|
---|
452 | } level;
|
---|
453 | size_t num_blobs;
|
---|
454 | struct wbcNamedBlob *blobs;
|
---|
455 | };
|
---|
456 |
|
---|
457 |
|
---|
458 | /** @brief Info returned by credential cache auth
|
---|
459 | *
|
---|
460 | */
|
---|
461 |
|
---|
462 | struct wbcCredentialCacheInfo {
|
---|
463 | size_t num_blobs;
|
---|
464 | struct wbcNamedBlob *blobs;
|
---|
465 | };
|
---|
466 |
|
---|
467 | /*
|
---|
468 | * DomainControllerInfo struct
|
---|
469 | */
|
---|
470 | struct wbcDomainControllerInfo {
|
---|
471 | char *dc_name;
|
---|
472 | };
|
---|
473 |
|
---|
474 | /*
|
---|
475 | * DomainControllerInfoEx struct
|
---|
476 | */
|
---|
477 | struct wbcDomainControllerInfoEx {
|
---|
478 | const char *dc_unc;
|
---|
479 | const char *dc_address;
|
---|
480 | uint16_t dc_address_type;
|
---|
481 | struct wbcGuid *domain_guid;
|
---|
482 | const char *domain_name;
|
---|
483 | const char *forest_name;
|
---|
484 | uint32_t dc_flags;
|
---|
485 | const char *dc_site_name;
|
---|
486 | const char *client_site_name;
|
---|
487 | };
|
---|
488 |
|
---|
489 | /*
|
---|
490 | * Memory Management
|
---|
491 | */
|
---|
492 |
|
---|
493 | void wbcFreeMemory(void*);
|
---|
494 |
|
---|
495 |
|
---|
496 | /*
|
---|
497 | * Utility functions for dealing with SIDs
|
---|
498 | */
|
---|
499 |
|
---|
500 | wbcErr wbcSidToString(const struct wbcDomainSid *sid,
|
---|
501 | char **sid_string);
|
---|
502 |
|
---|
503 | wbcErr wbcStringToSid(const char *sid_string,
|
---|
504 | struct wbcDomainSid *sid);
|
---|
505 |
|
---|
506 | /*
|
---|
507 | * Utility functions for dealing with GUIDs
|
---|
508 | */
|
---|
509 |
|
---|
510 | wbcErr wbcGuidToString(const struct wbcGuid *guid,
|
---|
511 | char **guid_string);
|
---|
512 |
|
---|
513 | wbcErr wbcStringToGuid(const char *guid_string,
|
---|
514 | struct wbcGuid *guid);
|
---|
515 |
|
---|
516 | wbcErr wbcPing(void);
|
---|
517 |
|
---|
518 | wbcErr wbcLibraryDetails(struct wbcLibraryDetails **details);
|
---|
519 |
|
---|
520 | wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **details);
|
---|
521 |
|
---|
522 | /*
|
---|
523 | * Name/SID conversion
|
---|
524 | */
|
---|
525 |
|
---|
526 | wbcErr wbcLookupName(const char *dom_name,
|
---|
527 | const char *name,
|
---|
528 | struct wbcDomainSid *sid,
|
---|
529 | enum wbcSidType *name_type);
|
---|
530 |
|
---|
531 | wbcErr wbcLookupSid(const struct wbcDomainSid *sid,
|
---|
532 | char **domain,
|
---|
533 | char **name,
|
---|
534 | enum wbcSidType *name_type);
|
---|
535 |
|
---|
536 | wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
|
---|
537 | int num_rids,
|
---|
538 | uint32_t *rids,
|
---|
539 | const char **domain_name,
|
---|
540 | const char ***names,
|
---|
541 | enum wbcSidType **types);
|
---|
542 |
|
---|
543 | wbcErr wbcLookupUserSids(const struct wbcDomainSid *user_sid,
|
---|
544 | bool domain_groups_only,
|
---|
545 | uint32_t *num_sids,
|
---|
546 | struct wbcDomainSid **sids);
|
---|
547 |
|
---|
548 | wbcErr wbcListUsers(const char *domain_name,
|
---|
549 | uint32_t *num_users,
|
---|
550 | const char ***users);
|
---|
551 |
|
---|
552 | wbcErr wbcListGroups(const char *domain_name,
|
---|
553 | uint32_t *num_groups,
|
---|
554 | const char ***groups);
|
---|
555 |
|
---|
556 | wbcErr wbcGetDisplayName(const struct wbcDomainSid *sid,
|
---|
557 | char **pdomain,
|
---|
558 | char **pfullname,
|
---|
559 | enum wbcSidType *pname_type);
|
---|
560 |
|
---|
561 | /*
|
---|
562 | * SID/uid/gid Mappings
|
---|
563 | */
|
---|
564 |
|
---|
565 | wbcErr wbcSidToUid(const struct wbcDomainSid *sid,
|
---|
566 | uid_t *puid);
|
---|
567 |
|
---|
568 | wbcErr wbcQuerySidToUid(const struct wbcDomainSid *sid,
|
---|
569 | uid_t *puid);
|
---|
570 |
|
---|
571 | wbcErr wbcUidToSid(uid_t uid,
|
---|
572 | struct wbcDomainSid *sid);
|
---|
573 |
|
---|
574 | wbcErr wbcQueryUidToSid(uid_t uid,
|
---|
575 | struct wbcDomainSid *sid);
|
---|
576 |
|
---|
577 | wbcErr wbcSidToGid(const struct wbcDomainSid *sid,
|
---|
578 | gid_t *pgid);
|
---|
579 |
|
---|
580 | wbcErr wbcQuerySidToGid(const struct wbcDomainSid *sid,
|
---|
581 | gid_t *pgid);
|
---|
582 |
|
---|
583 | wbcErr wbcGidToSid(gid_t gid,
|
---|
584 | struct wbcDomainSid *sid);
|
---|
585 |
|
---|
586 | wbcErr wbcQueryGidToSid(gid_t gid,
|
---|
587 | struct wbcDomainSid *sid);
|
---|
588 |
|
---|
589 | wbcErr wbcAllocateUid(uid_t *puid);
|
---|
590 |
|
---|
591 | wbcErr wbcAllocateGid(gid_t *pgid);
|
---|
592 |
|
---|
593 | wbcErr wbcSetUidMapping(uid_t uid, const struct wbcDomainSid *sid);
|
---|
594 |
|
---|
595 | wbcErr wbcSetGidMapping(gid_t gid, const struct wbcDomainSid *sid);
|
---|
596 |
|
---|
597 | wbcErr wbcRemoveUidMapping(uid_t uid, const struct wbcDomainSid *sid);
|
---|
598 |
|
---|
599 | wbcErr wbcRemoveGidMapping(gid_t gid, const struct wbcDomainSid *sid);
|
---|
600 |
|
---|
601 | wbcErr wbcSetUidHwm(uid_t uid_hwm);
|
---|
602 |
|
---|
603 | wbcErr wbcSetGidHwm(gid_t gid_hwm);
|
---|
604 |
|
---|
605 | /*
|
---|
606 | * NSS Lookup User/Group details
|
---|
607 | */
|
---|
608 |
|
---|
609 | wbcErr wbcGetpwnam(const char *name, struct passwd **pwd);
|
---|
610 |
|
---|
611 | wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd);
|
---|
612 |
|
---|
613 | wbcErr wbcGetgrnam(const char *name, struct group **grp);
|
---|
614 |
|
---|
615 | wbcErr wbcGetgrgid(gid_t gid, struct group **grp);
|
---|
616 |
|
---|
617 | wbcErr wbcSetpwent(void);
|
---|
618 |
|
---|
619 | wbcErr wbcEndpwent(void);
|
---|
620 |
|
---|
621 | wbcErr wbcGetpwent(struct passwd **pwd);
|
---|
622 |
|
---|
623 | wbcErr wbcSetgrent(void);
|
---|
624 |
|
---|
625 | wbcErr wbcEndgrent(void);
|
---|
626 |
|
---|
627 | wbcErr wbcGetgrent(struct group **grp);
|
---|
628 |
|
---|
629 | wbcErr wbcGetgrlist(struct group **grp);
|
---|
630 |
|
---|
631 | wbcErr wbcGetGroups(const char *account,
|
---|
632 | uint32_t *num_groups,
|
---|
633 | gid_t **_groups);
|
---|
634 |
|
---|
635 |
|
---|
636 | /*
|
---|
637 | * Lookup Domain information
|
---|
638 | */
|
---|
639 |
|
---|
640 | wbcErr wbcDomainInfo(const char *domain,
|
---|
641 | struct wbcDomainInfo **info);
|
---|
642 |
|
---|
643 | wbcErr wbcListTrusts(struct wbcDomainInfo **domains,
|
---|
644 | size_t *num_domains);
|
---|
645 |
|
---|
646 | /* Flags for wbcLookupDomainController */
|
---|
647 |
|
---|
648 | #define WBC_LOOKUP_DC_FORCE_REDISCOVERY 0x00000001
|
---|
649 | #define WBC_LOOKUP_DC_DS_REQUIRED 0x00000010
|
---|
650 | #define WBC_LOOKUP_DC_DS_PREFERRED 0x00000020
|
---|
651 | #define WBC_LOOKUP_DC_GC_SERVER_REQUIRED 0x00000040
|
---|
652 | #define WBC_LOOKUP_DC_PDC_REQUIRED 0x00000080
|
---|
653 | #define WBC_LOOKUP_DC_BACKGROUND_ONLY 0x00000100
|
---|
654 | #define WBC_LOOKUP_DC_IP_REQUIRED 0x00000200
|
---|
655 | #define WBC_LOOKUP_DC_KDC_REQUIRED 0x00000400
|
---|
656 | #define WBC_LOOKUP_DC_TIMESERV_REQUIRED 0x00000800
|
---|
657 | #define WBC_LOOKUP_DC_WRITABLE_REQUIRED 0x00001000
|
---|
658 | #define WBC_LOOKUP_DC_GOOD_TIMESERV_PREFERRED 0x00002000
|
---|
659 | #define WBC_LOOKUP_DC_AVOID_SELF 0x00004000
|
---|
660 | #define WBC_LOOKUP_DC_ONLY_LDAP_NEEDED 0x00008000
|
---|
661 | #define WBC_LOOKUP_DC_IS_FLAT_NAME 0x00010000
|
---|
662 | #define WBC_LOOKUP_DC_IS_DNS_NAME 0x00020000
|
---|
663 | #define WBC_LOOKUP_DC_TRY_NEXTCLOSEST_SITE 0x00040000
|
---|
664 | #define WBC_LOOKUP_DC_DS_6_REQUIRED 0x00080000
|
---|
665 | #define WBC_LOOKUP_DC_RETURN_DNS_NAME 0x40000000
|
---|
666 | #define WBC_LOOKUP_DC_RETURN_FLAT_NAME 0x80000000
|
---|
667 |
|
---|
668 | wbcErr wbcLookupDomainController(const char *domain,
|
---|
669 | uint32_t flags,
|
---|
670 | struct wbcDomainControllerInfo **dc_info);
|
---|
671 |
|
---|
672 | wbcErr wbcLookupDomainControllerEx(const char *domain,
|
---|
673 | struct wbcGuid *guid,
|
---|
674 | const char *site,
|
---|
675 | uint32_t flags,
|
---|
676 | struct wbcDomainControllerInfoEx **dc_info);
|
---|
677 |
|
---|
678 | /*
|
---|
679 | * Athenticate functions
|
---|
680 | */
|
---|
681 |
|
---|
682 | wbcErr wbcAuthenticateUser(const char *username,
|
---|
683 | const char *password);
|
---|
684 |
|
---|
685 | wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params,
|
---|
686 | struct wbcAuthUserInfo **info,
|
---|
687 | struct wbcAuthErrorInfo **error);
|
---|
688 |
|
---|
689 | wbcErr wbcLogonUser(const struct wbcLogonUserParams *params,
|
---|
690 | struct wbcLogonUserInfo **info,
|
---|
691 | struct wbcAuthErrorInfo **error,
|
---|
692 | struct wbcUserPasswordPolicyInfo **policy);
|
---|
693 |
|
---|
694 | wbcErr wbcLogoffUser(const char *username,
|
---|
695 | uid_t uid,
|
---|
696 | const char *ccfilename);
|
---|
697 |
|
---|
698 | wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params,
|
---|
699 | struct wbcAuthErrorInfo **error);
|
---|
700 |
|
---|
701 | wbcErr wbcChangeUserPassword(const char *username,
|
---|
702 | const char *old_password,
|
---|
703 | const char *new_password);
|
---|
704 |
|
---|
705 | wbcErr wbcChangeUserPasswordEx(const struct wbcChangePasswordParams *params,
|
---|
706 | struct wbcAuthErrorInfo **error,
|
---|
707 | enum wbcPasswordChangeRejectReason *reject_reason,
|
---|
708 | struct wbcUserPasswordPolicyInfo **policy);
|
---|
709 |
|
---|
710 | wbcErr wbcCredentialCache(struct wbcCredentialCacheParams *params,
|
---|
711 | struct wbcCredentialCacheInfo **info,
|
---|
712 | struct wbcAuthErrorInfo **error);
|
---|
713 |
|
---|
714 | /*
|
---|
715 | * Resolve functions
|
---|
716 | */
|
---|
717 | wbcErr wbcResolveWinsByName(const char *name, char **ip);
|
---|
718 | wbcErr wbcResolveWinsByIP(const char *ip, char **name);
|
---|
719 |
|
---|
720 | /*
|
---|
721 | * Trusted domain functions
|
---|
722 | */
|
---|
723 | wbcErr wbcCheckTrustCredentials(const char *domain,
|
---|
724 | struct wbcAuthErrorInfo **error);
|
---|
725 | /*
|
---|
726 | * Helper functions
|
---|
727 | */
|
---|
728 | wbcErr wbcAddNamedBlob(size_t *num_blobs,
|
---|
729 | struct wbcNamedBlob **blobs,
|
---|
730 | const char *name,
|
---|
731 | uint32_t flags,
|
---|
732 | uint8_t *data,
|
---|
733 | size_t length);
|
---|
734 |
|
---|
735 | #endif /* _WBCLIENT_H */
|
---|