2 Unix SMB/CIFS implementation.
6 Copyright (C) Gerald (Jerry) Carter 2007
7 Copyright (C) Volker Lendecke 2009
8 Copyright (C) Matthew Newton 2015
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 3 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
30 /* Define error types */
33 * @brief Status codes returned from wbc functions
37 WBC_ERR_SUCCESS
= 0, /**< Successful completion **/
38 WBC_ERR_NOT_IMPLEMENTED
,/**< Function not implemented **/
39 WBC_ERR_UNKNOWN_FAILURE
,/**< General failure **/
40 WBC_ERR_NO_MEMORY
, /**< Memory allocation error **/
41 WBC_ERR_INVALID_SID
, /**< Invalid SID format **/
42 WBC_ERR_INVALID_PARAM
, /**< An Invalid parameter was supplied **/
43 WBC_ERR_WINBIND_NOT_AVAILABLE
, /**< Winbind daemon is not available **/
44 WBC_ERR_DOMAIN_NOT_FOUND
, /**< Domain is not trusted or cannot be found **/
45 WBC_ERR_INVALID_RESPONSE
, /**< Winbind returned an invalid response **/
46 WBC_ERR_NSS_ERROR
, /**< NSS_STATUS error **/
47 WBC_ERR_AUTH_ERROR
, /**< Authentication failed **/
48 WBC_ERR_UNKNOWN_USER
, /**< User account cannot be found */
49 WBC_ERR_UNKNOWN_GROUP
, /**< Group account cannot be found */
50 WBC_ERR_PWD_CHANGE_FAILED
/**< Password Change has failed */
53 typedef enum _wbcErrType wbcErr
;
55 #define WBC_ERROR_IS_OK(x) ((x) == WBC_ERR_SUCCESS)
57 const char *wbcErrorString(wbcErr error
);
60 * @brief Some useful details about the wbclient library
62 * 0.1: Initial version
63 * 0.2: Added wbcRemoveUidMapping()
64 * Added wbcRemoveGidMapping()
65 * 0.3: Added wbcGetpwsid()
66 * Added wbcGetSidAliases()
67 * 0.4: Added wbcSidTypeString()
68 * 0.5: Added wbcChangeTrustCredentials()
69 * 0.6: Made struct wbcInterfaceDetails char* members non-const
70 * 0.7: Added wbcSidToStringBuf()
71 * 0.8: Added wbcSidsToUnixIds() and wbcLookupSids()
72 * 0.9: Added support for WBC_ID_TYPE_BOTH
73 * 0.10: Added wbcPingDc2()
74 * 0.11: Extended wbcAuthenticateUserEx to provide PAC parsing
75 * 0.12: Added wbcCtxCreate and friends
77 #define WBCLIENT_MAJOR_VERSION 0
78 #define WBCLIENT_MINOR_VERSION 12
79 #define WBCLIENT_VENDOR_VERSION "Samba libwbclient"
80 struct wbcLibraryDetails
{
81 uint16_t major_version
;
82 uint16_t minor_version
;
83 const char *vendor_version
;
87 * @brief Some useful details about the running winbindd
90 struct wbcInterfaceDetails
{
91 uint32_t interface_version
;
92 char *winbind_version
;
93 char winbind_separator
;
100 * @brief Library context data
107 * Data types used by the Winbind Client API
110 #ifndef WBC_MAXSUBAUTHS
111 #define WBC_MAXSUBAUTHS 15 /* max sub authorities in a SID */
115 * @brief Windows Security Identifier
119 struct wbcDomainSid
{
123 uint32_t sub_auths
[WBC_MAXSUBAUTHS
];
127 * @brief Security Identifier type
131 WBC_SID_NAME_USE_NONE
=0,
133 WBC_SID_NAME_DOM_GRP
=2,
134 WBC_SID_NAME_DOMAIN
=3,
135 WBC_SID_NAME_ALIAS
=4,
136 WBC_SID_NAME_WKN_GRP
=5,
137 WBC_SID_NAME_DELETED
=6,
138 WBC_SID_NAME_INVALID
=7,
139 WBC_SID_NAME_UNKNOWN
=8,
140 WBC_SID_NAME_COMPUTER
=9
144 * @brief Security Identifier with attributes
147 struct wbcSidWithAttr
{
148 struct wbcDomainSid sid
;
152 /* wbcSidWithAttr->attributes */
154 #define WBC_SID_ATTR_GROUP_MANDATORY 0x00000001
155 #define WBC_SID_ATTR_GROUP_ENABLED_BY_DEFAULT 0x00000002
156 #define WBC_SID_ATTR_GROUP_ENABLED 0x00000004
157 #define WBC_SID_ATTR_GROUP_OWNER 0x00000008
158 #define WBC_SID_ATTR_GROUP_USEFOR_DENY_ONLY 0x00000010
159 #define WBC_SID_ATTR_GROUP_RESOURCE 0x20000000
160 #define WBC_SID_ATTR_GROUP_LOGON_ID 0xC0000000
163 * @brief Windows GUID
170 uint16_t time_hi_and_version
;
171 uint8_t clock_seq
[2];
176 * @brief Domain Information
179 struct wbcDomainInfo
{
182 struct wbcDomainSid sid
;
183 uint32_t domain_flags
;
184 uint32_t trust_flags
;
188 /* wbcDomainInfo->domain_flags */
190 #define WBC_DOMINFO_DOMAIN_UNKNOWN 0x00000000
191 #define WBC_DOMINFO_DOMAIN_NATIVE 0x00000001
192 #define WBC_DOMINFO_DOMAIN_AD 0x00000002
193 #define WBC_DOMINFO_DOMAIN_PRIMARY 0x00000004
194 #define WBC_DOMINFO_DOMAIN_OFFLINE 0x00000008
196 /* wbcDomainInfo->trust_flags */
198 #define WBC_DOMINFO_TRUST_TRANSITIVE 0x00000001
199 #define WBC_DOMINFO_TRUST_INCOMING 0x00000002
200 #define WBC_DOMINFO_TRUST_OUTGOING 0x00000004
202 /* wbcDomainInfo->trust_type */
204 #define WBC_DOMINFO_TRUSTTYPE_NONE 0x00000000
205 #define WBC_DOMINFO_TRUSTTYPE_FOREST 0x00000001
206 #define WBC_DOMINFO_TRUSTTYPE_IN_FOREST 0x00000002
207 #define WBC_DOMINFO_TRUSTTYPE_EXTERNAL 0x00000003
210 * @brief Generic Blob
222 struct wbcNamedBlob
{
229 * @brief Auth User Parameters
232 struct wbcAuthUserParams
{
233 const char *account_name
;
234 const char *domain_name
;
235 const char *workstation_name
;
239 uint32_t parameter_control
;
241 enum wbcAuthUserLevel
{
242 WBC_AUTH_USER_LEVEL_PLAIN
= 1,
243 WBC_AUTH_USER_LEVEL_HASH
= 2,
244 WBC_AUTH_USER_LEVEL_RESPONSE
= 3,
245 WBC_AUTH_USER_LEVEL_PAC
= 4
248 const char *plaintext
;
254 uint8_t challenge
[8];
265 * @brief Logon User Parameters
268 struct wbcLogonUserParams
{
269 const char *username
;
270 const char *password
;
272 struct wbcNamedBlob
*blobs
;
276 * @brief ChangePassword Parameters
279 struct wbcChangePasswordParams
{
280 const char *account_name
;
281 const char *domain_name
;
285 enum wbcChangePasswordLevel
{
286 WBC_CHANGE_PASSWORD_LEVEL_PLAIN
= 1,
287 WBC_CHANGE_PASSWORD_LEVEL_RESPONSE
= 2
291 const char *plaintext
;
293 uint32_t old_nt_hash_enc_length
;
294 uint8_t *old_nt_hash_enc_data
;
295 uint32_t old_lm_hash_enc_length
;
296 uint8_t *old_lm_hash_enc_data
;
300 const char *plaintext
;
310 /* wbcAuthUserParams->parameter_control */
312 #define WBC_MSV1_0_CLEARTEXT_PASSWORD_ALLOWED 0x00000002
313 #define WBC_MSV1_0_UPDATE_LOGON_STATISTICS 0x00000004
314 #define WBC_MSV1_0_RETURN_USER_PARAMETERS 0x00000008
315 #define WBC_MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT 0x00000020
316 #define WBC_MSV1_0_RETURN_PROFILE_PATH 0x00000200
317 #define WBC_MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT 0x00000800
319 /* wbcAuthUserParams->flags */
321 #define WBC_AUTH_PARAM_FLAGS_INTERACTIVE_LOGON 0x00000001
324 * @brief Auth User Information
326 * Some of the strings are maybe NULL
329 struct wbcAuthUserInfo
{
333 char *user_principal
;
336 char *dns_domain_name
;
339 uint8_t user_session_key
[16];
340 uint8_t lm_session_key
[8];
342 uint16_t logon_count
;
343 uint16_t bad_password_count
;
346 uint64_t logoff_time
;
347 uint64_t kickoff_time
;
348 uint64_t pass_last_set_time
;
349 uint64_t pass_can_change_time
;
350 uint64_t pass_must_change_time
;
355 char *home_directory
;
359 * the 1st one is the account sid
360 * the 2nd one is the primary_group sid
361 * followed by the rest of the groups
364 struct wbcSidWithAttr
*sids
;
368 * @brief Logon User Information
370 * Some of the strings are maybe NULL
373 struct wbcLogonUserInfo
{
374 struct wbcAuthUserInfo
*info
;
376 struct wbcNamedBlob
*blobs
;
379 /* wbcAuthUserInfo->user_flags */
381 #define WBC_AUTH_USER_INFO_GUEST 0x00000001
382 #define WBC_AUTH_USER_INFO_NOENCRYPTION 0x00000002
383 #define WBC_AUTH_USER_INFO_CACHED_ACCOUNT 0x00000004
384 #define WBC_AUTH_USER_INFO_USED_LM_PASSWORD 0x00000008
385 #define WBC_AUTH_USER_INFO_EXTRA_SIDS 0x00000020
386 #define WBC_AUTH_USER_INFO_SUBAUTH_SESSION_KEY 0x00000040
387 #define WBC_AUTH_USER_INFO_SERVER_TRUST_ACCOUNT 0x00000080
388 #define WBC_AUTH_USER_INFO_NTLMV2_ENABLED 0x00000100
389 #define WBC_AUTH_USER_INFO_RESOURCE_GROUPS 0x00000200
390 #define WBC_AUTH_USER_INFO_PROFILE_PATH_RETURNED 0x00000400
391 #define WBC_AUTH_USER_INFO_GRACE_LOGON 0x01000000
393 /* wbcAuthUserInfo->acct_flags */
395 #define WBC_ACB_DISABLED 0x00000001 /* 1 User account disabled */
396 #define WBC_ACB_HOMDIRREQ 0x00000002 /* 1 Home directory required */
397 #define WBC_ACB_PWNOTREQ 0x00000004 /* 1 User password not required */
398 #define WBC_ACB_TEMPDUP 0x00000008 /* 1 Temporary duplicate account */
399 #define WBC_ACB_NORMAL 0x00000010 /* 1 Normal user account */
400 #define WBC_ACB_MNS 0x00000020 /* 1 MNS logon user account */
401 #define WBC_ACB_DOMTRUST 0x00000040 /* 1 Interdomain trust account */
402 #define WBC_ACB_WSTRUST 0x00000080 /* 1 Workstation trust account */
403 #define WBC_ACB_SVRTRUST 0x00000100 /* 1 Server trust account */
404 #define WBC_ACB_PWNOEXP 0x00000200 /* 1 User password does not expire */
405 #define WBC_ACB_AUTOLOCK 0x00000400 /* 1 Account auto locked */
406 #define WBC_ACB_ENC_TXT_PWD_ALLOWED 0x00000800 /* 1 Encryped text password is allowed */
407 #define WBC_ACB_SMARTCARD_REQUIRED 0x00001000 /* 1 Smart Card required */
408 #define WBC_ACB_TRUSTED_FOR_DELEGATION 0x00002000 /* 1 Trusted for Delegation */
409 #define WBC_ACB_NOT_DELEGATED 0x00004000 /* 1 Not delegated */
410 #define WBC_ACB_USE_DES_KEY_ONLY 0x00008000 /* 1 Use DES key only */
411 #define WBC_ACB_DONT_REQUIRE_PREAUTH 0x00010000 /* 1 Preauth not required */
412 #define WBC_ACB_PW_EXPIRED 0x00020000 /* 1 Password Expired */
413 #define WBC_ACB_NO_AUTH_DATA_REQD 0x00080000 /* 1 = No authorization data required */
415 struct wbcAuthErrorInfo
{
419 char *display_string
;
423 * @brief User Password Policy Information
426 /* wbcUserPasswordPolicyInfo->password_properties */
428 #define WBC_DOMAIN_PASSWORD_COMPLEX 0x00000001
429 #define WBC_DOMAIN_PASSWORD_NO_ANON_CHANGE 0x00000002
430 #define WBC_DOMAIN_PASSWORD_NO_CLEAR_CHANGE 0x00000004
431 #define WBC_DOMAIN_PASSWORD_LOCKOUT_ADMINS 0x00000008
432 #define WBC_DOMAIN_PASSWORD_STORE_CLEARTEXT 0x00000010
433 #define WBC_DOMAIN_REFUSE_PASSWORD_CHANGE 0x00000020
435 struct wbcUserPasswordPolicyInfo
{
436 uint32_t min_length_password
;
437 uint32_t password_history
;
438 uint32_t password_properties
;
440 uint64_t min_passwordage
;
444 * @brief Change Password Reject Reason
447 enum wbcPasswordChangeRejectReason
{
448 WBC_PWD_CHANGE_NO_ERROR
=0,
449 WBC_PWD_CHANGE_PASSWORD_TOO_SHORT
=1,
450 WBC_PWD_CHANGE_PWD_IN_HISTORY
=2,
451 WBC_PWD_CHANGE_USERNAME_IN_PASSWORD
=3,
452 WBC_PWD_CHANGE_FULLNAME_IN_PASSWORD
=4,
453 WBC_PWD_CHANGE_NOT_COMPLEX
=5,
454 WBC_PWD_CHANGE_MACHINE_NOT_DEFAULT
=6,
455 WBC_PWD_CHANGE_FAILED_BY_FILTER
=7,
456 WBC_PWD_CHANGE_PASSWORD_TOO_LONG
=8
459 /* Note: this defines exist for compatibility reasons with existing code */
460 #define WBC_PWD_CHANGE_REJECT_OTHER WBC_PWD_CHANGE_NO_ERROR
461 #define WBC_PWD_CHANGE_REJECT_TOO_SHORT WBC_PWD_CHANGE_PASSWORD_TOO_SHORT
462 #define WBC_PWD_CHANGE_REJECT_IN_HISTORY WBC_PWD_CHANGE_PWD_IN_HISTORY
463 #define WBC_PWD_CHANGE_REJECT_COMPLEXITY WBC_PWD_CHANGE_NOT_COMPLEX
466 * @brief Logoff User Parameters
469 struct wbcLogoffUserParams
{
470 const char *username
;
472 struct wbcNamedBlob
*blobs
;
475 /** @brief Credential cache log-on parameters
479 struct wbcCredentialCacheParams
{
480 const char *account_name
;
481 const char *domain_name
;
482 enum wbcCredentialCacheLevel
{
483 WBC_CREDENTIAL_CACHE_LEVEL_NTLMSSP
= 1
486 struct wbcNamedBlob
*blobs
;
490 /** @brief Info returned by credential cache auth
494 struct wbcCredentialCacheInfo
{
496 struct wbcNamedBlob
*blobs
;
500 * DomainControllerInfo struct
502 struct wbcDomainControllerInfo
{
507 * DomainControllerInfoEx struct
509 struct wbcDomainControllerInfoEx
{
511 const char *dc_address
;
512 uint16_t dc_address_type
;
513 struct wbcGuid
*domain_guid
;
514 const char *domain_name
;
515 const char *forest_name
;
517 const char *dc_site_name
;
518 const char *client_site_name
;
521 /**********************************************************
523 **********************************************************/
526 * @brief Free library allocated memory
528 * @param * Pointer to free
532 void wbcFreeMemory(void*);
535 /**********************************************************
537 **********************************************************/
540 * @brief Create a new wbcContext context
544 struct wbcContext
*wbcCtxCreate(void);
547 * @brief Free a library context
549 * @param ctx wbcContext to free
553 void wbcCtxFree(struct wbcContext
*ctx
);
558 * Utility functions for dealing with SIDs
562 * @brief Get a string representation of the SID type
564 * @param type type of the SID
566 * @return string representation of the SID type
568 const char* wbcSidTypeString(enum wbcSidType type
);
570 #define WBC_SID_STRING_BUFLEN (15*11+25)
573 * @brief Print a sid into a buffer
575 * @param sid Binary Security Identifier
576 * @param buf Target buffer
577 * @param buflen Target buffer length
579 * @return Resulting string length.
581 int wbcSidToStringBuf(const struct wbcDomainSid
*sid
, char *buf
, int buflen
);
584 * @brief Convert a binary SID to a character string
586 * @param sid Binary Security Identifier
587 * @param **sid_string Resulting character string
591 wbcErr
wbcSidToString(const struct wbcDomainSid
*sid
,
595 * @brief Convert a character string to a binary SID
597 * @param *sid_string Character string in the form of S-...
598 * @param sid Resulting binary SID
602 wbcErr
wbcStringToSid(const char *sid_string
,
603 struct wbcDomainSid
*sid
);
606 * Utility functions for dealing with GUIDs
610 * @brief Convert a binary GUID to a character string
612 * @param guid Binary Guid
613 * @param **guid_string Resulting character string
617 wbcErr
wbcGuidToString(const struct wbcGuid
*guid
,
621 * @brief Convert a character string to a binary GUID
623 * @param *guid_string Character string
624 * @param guid Resulting binary GUID
628 wbcErr
wbcStringToGuid(const char *guid_string
,
629 struct wbcGuid
*guid
);
632 * @brief Ping winbindd to see if the daemon is running
634 * @param *ctx wbclient Context
638 wbcErr
wbcCtxPing(struct wbcContext
*ctx
);
641 * @brief Ping winbindd to see if the daemon is running
645 wbcErr
wbcPing(void);
647 wbcErr
wbcLibraryDetails(struct wbcLibraryDetails
**details
);
649 wbcErr
wbcCtxInterfaceDetails(struct wbcContext
*ctx
,
650 struct wbcInterfaceDetails
**details
);
651 wbcErr
wbcInterfaceDetails(struct wbcInterfaceDetails
**details
);
653 /**********************************************************
654 * Name/SID conversion
655 **********************************************************/
658 * @brief Convert a domain and name to SID
660 * @param *ctx wbclient Context
661 * @param dom_name Domain name (possibly "")
662 * @param name User or group name
663 * @param *sid Pointer to the resolved domain SID
664 * @param *name_type Pointer to the SID type
668 wbcErr
wbcCtxLookupName(struct wbcContext
*ctx
,
669 const char *dom_name
,
671 struct wbcDomainSid
*sid
,
672 enum wbcSidType
*name_type
);
675 * @brief Convert a domain and name to SID
677 * @param dom_name Domain name (possibly "")
678 * @param name User or group name
679 * @param *sid Pointer to the resolved domain SID
680 * @param *name_type Pointer to the SID type
684 wbcErr
wbcLookupName(const char *dom_name
,
686 struct wbcDomainSid
*sid
,
687 enum wbcSidType
*name_type
);
690 * @brief Convert a SID to a domain and name
692 * @param *ctx wbclient Context
693 * @param *sid Pointer to the domain SID to be resolved
694 * @param domain Resolved Domain name (possibly "")
695 * @param name Resolved User or group name
696 * @param *name_type Pointer to the resolved SID type
700 wbcErr
wbcCtxLookupSid(struct wbcContext
*ctx
,
701 const struct wbcDomainSid
*sid
,
704 enum wbcSidType
*name_type
);
707 * @brief Convert a SID to a domain and name
709 * @param *sid Pointer to the domain SID to be resolved
710 * @param domain Resolved Domain name (possibly "")
711 * @param name Resolved User or group name
712 * @param *name_type Pointer to the resolved SID type
716 wbcErr
wbcLookupSid(const struct wbcDomainSid
*sid
,
719 enum wbcSidType
*name_type
);
721 struct wbcTranslatedName
{
722 enum wbcSidType type
;
727 wbcErr
wbcCtxLookupSids(struct wbcContext
*ctx
,
728 const struct wbcDomainSid
*sids
, int num_sids
,
729 struct wbcDomainInfo
**domains
, int *num_domains
,
730 struct wbcTranslatedName
**names
);
732 wbcErr
wbcLookupSids(const struct wbcDomainSid
*sids
, int num_sids
,
733 struct wbcDomainInfo
**domains
, int *num_domains
,
734 struct wbcTranslatedName
**names
);
737 * @brief Translate a collection of RIDs within a domain to names
739 wbcErr
wbcCtxLookupRids(struct wbcContext
*ctx
,
740 struct wbcDomainSid
*dom_sid
,
743 const char **domain_name
,
745 enum wbcSidType
**types
);
748 * @brief Translate a collection of RIDs within a domain to names
750 wbcErr
wbcLookupRids(struct wbcDomainSid
*dom_sid
,
753 const char **domain_name
,
755 enum wbcSidType
**types
);
758 * @brief Get the groups a user belongs to
760 wbcErr
wbcCtxLookupUserSids(struct wbcContext
*ctx
,
761 const struct wbcDomainSid
*user_sid
,
762 bool domain_groups_only
,
764 struct wbcDomainSid
**sids
);
767 * @brief Get the groups a user belongs to
769 wbcErr
wbcLookupUserSids(const struct wbcDomainSid
*user_sid
,
770 bool domain_groups_only
,
772 struct wbcDomainSid
**sids
);
775 * @brief Get alias membership for sids
777 wbcErr
wbcCtxGetSidAliases(struct wbcContext
*ctx
,
778 const struct wbcDomainSid
*dom_sid
,
779 struct wbcDomainSid
*sids
,
781 uint32_t **alias_rids
,
782 uint32_t *num_alias_rids
);
785 * @brief Get alias membership for sids
787 wbcErr
wbcGetSidAliases(const struct wbcDomainSid
*dom_sid
,
788 struct wbcDomainSid
*sids
,
790 uint32_t **alias_rids
,
791 uint32_t *num_alias_rids
);
796 wbcErr
wbcCtxListUsers(struct wbcContext
*ctx
,
797 const char *domain_name
,
799 const char ***users
);
804 wbcErr
wbcListUsers(const char *domain_name
,
806 const char ***users
);
809 * @brief Lists Groups
811 wbcErr
wbcCtxListGroups(struct wbcContext
*ctx
,
812 const char *domain_name
,
813 uint32_t *num_groups
,
814 const char ***groups
);
817 * @brief Lists Groups
819 wbcErr
wbcListGroups(const char *domain_name
,
820 uint32_t *num_groups
,
821 const char ***groups
);
823 wbcErr
wbcCtxGetDisplayName(struct wbcContext
*ctx
,
824 const struct wbcDomainSid
*sid
,
827 enum wbcSidType
*pname_type
);
829 wbcErr
wbcGetDisplayName(const struct wbcDomainSid
*sid
,
832 enum wbcSidType
*pname_type
);
834 /**********************************************************
835 * SID/uid/gid Mappings
836 **********************************************************/
839 * @brief Convert a Windows SID to a Unix uid, allocating an uid if needed
841 * @param *ctx wbclient Context
842 * @param *sid Pointer to the domain SID to be resolved
843 * @param *puid Pointer to the resolved uid_t value
848 wbcErr
wbcCtxSidToUid(struct wbcContext
*ctx
,
849 const struct wbcDomainSid
*sid
,
853 * @brief Convert a Windows SID to a Unix uid, allocating an uid if needed
855 * @param *sid Pointer to the domain SID to be resolved
856 * @param *puid Pointer to the resolved uid_t value
861 wbcErr
wbcSidToUid(const struct wbcDomainSid
*sid
,
865 * @brief Convert a Windows SID to a Unix uid if there already is a mapping
867 * @param *sid Pointer to the domain SID to be resolved
868 * @param *puid Pointer to the resolved uid_t value
873 wbcErr
wbcQuerySidToUid(const struct wbcDomainSid
*sid
,
877 * @brief Convert a Unix uid to a Windows SID, allocating a SID if needed
879 * @param *ctx wbclient Context
880 * @param uid Unix uid to be resolved
881 * @param *sid Pointer to the resolved domain SID
886 wbcErr
wbcCtxUidToSid(struct wbcContext
*ctx
, uid_t uid
,
887 struct wbcDomainSid
*sid
);
890 * @brief Convert a Unix uid to a Windows SID, allocating a SID if needed
892 * @param uid Unix uid to be resolved
893 * @param *sid Pointer to the resolved domain SID
898 wbcErr
wbcUidToSid(uid_t uid
,
899 struct wbcDomainSid
*sid
);
902 * @brief Convert a Unix uid to a Windows SID if there already is a mapping
904 * @param uid Unix uid to be resolved
905 * @param *sid Pointer to the resolved domain SID
910 wbcErr
wbcQueryUidToSid(uid_t uid
,
911 struct wbcDomainSid
*sid
);
914 * @brief Convert a Windows SID to a Unix gid, allocating a gid if needed
916 * @param *ctx wbclient Context
917 * @param *sid Pointer to the domain SID to be resolved
918 * @param *pgid Pointer to the resolved gid_t value
923 wbcErr
wbcCtxSidToGid(struct wbcContext
*ctx
,
924 const struct wbcDomainSid
*sid
,
928 * @brief Convert a Windows SID to a Unix gid, allocating a gid if needed
930 * @param *sid Pointer to the domain SID to be resolved
931 * @param *pgid Pointer to the resolved gid_t value
936 wbcErr
wbcSidToGid(const struct wbcDomainSid
*sid
,
940 * @brief Convert a Windows SID to a Unix gid if there already is a mapping
942 * @param *sid Pointer to the domain SID to be resolved
943 * @param *pgid Pointer to the resolved gid_t value
948 wbcErr
wbcQuerySidToGid(const struct wbcDomainSid
*sid
,
952 * @brief Convert a Unix gid to a Windows SID, allocating a SID if needed
954 * @param *ctx wbclient Context
955 * @param gid Unix gid to be resolved
956 * @param *sid Pointer to the resolved domain SID
961 wbcErr
wbcCtxGidToSid(struct wbcContext
*ctx
, gid_t gid
,
962 struct wbcDomainSid
*sid
);
965 * @brief Convert a Unix gid to a Windows SID, allocating a SID if needed
967 * @param gid Unix gid to be resolved
968 * @param *sid Pointer to the resolved domain SID
973 wbcErr
wbcGidToSid(gid_t gid
,
974 struct wbcDomainSid
*sid
);
977 * @brief Convert a Unix gid to a Windows SID if there already is a mapping
979 * @param gid Unix gid to be resolved
980 * @param *sid Pointer to the resolved domain SID
985 wbcErr
wbcQueryGidToSid(gid_t gid
,
986 struct wbcDomainSid
*sid
);
989 WBC_ID_TYPE_NOT_SPECIFIED
,
995 union wbcUnixIdContainer
{
1001 enum wbcIdType type
;
1002 union wbcUnixIdContainer id
;
1006 * @brief Convert a list of sids to unix ids
1008 * @param *ctx wbclient Context
1009 * @param sids Pointer to an array of SIDs to convert
1010 * @param num_sids Number of SIDs
1011 * @param ids Preallocated output array for translated IDs
1016 wbcErr
wbcCtxSidsToUnixIds(struct wbcContext
*ctx
,
1017 const struct wbcDomainSid
*sids
, uint32_t num_sids
,
1018 struct wbcUnixId
*ids
);
1021 * @brief Convert a list of sids to unix ids
1023 * @param sids Pointer to an array of SIDs to convert
1024 * @param num_sids Number of SIDs
1025 * @param ids Preallocated output array for translated IDs
1030 wbcErr
wbcSidsToUnixIds(const struct wbcDomainSid
*sids
, uint32_t num_sids
,
1031 struct wbcUnixId
*ids
);
1034 * @brief Obtain a new uid from Winbind
1036 * @param *ctx wbclient Context
1037 * @param *puid Pointer to the allocated uid
1041 wbcErr
wbcCtxAllocateUid(struct wbcContext
*ctx
, uid_t
*puid
);
1044 * @brief Obtain a new uid from Winbind
1046 * @param *puid Pointer to the allocated uid
1050 wbcErr
wbcAllocateUid(uid_t
*puid
);
1053 * @brief Obtain a new gid from Winbind
1055 * @param *ctx wbclient Context
1056 * @param *pgid Pointer to the allocated gid
1060 wbcErr
wbcCtxAllocateGid(struct wbcContext
*ctx
, gid_t
*pgid
);
1063 * @brief Obtain a new gid from Winbind
1065 * @param *pgid Pointer to the allocated gid
1069 wbcErr
wbcAllocateGid(gid_t
*pgid
);
1072 * @brief Set an user id mapping
1074 * @param uid Uid of the desired mapping.
1075 * @param *sid Pointer to the sid of the desired mapping.
1079 * @deprecated This method is not impemented any more and should
1080 * be removed in the next major version change.
1082 wbcErr
wbcSetUidMapping(uid_t uid
, const struct wbcDomainSid
*sid
);
1085 * @brief Set a group id mapping
1087 * @param gid Gid of the desired mapping.
1088 * @param *sid Pointer to the sid of the desired mapping.
1092 * @deprecated This method is not impemented any more and should
1093 * be removed in the next major version change.
1095 wbcErr
wbcSetGidMapping(gid_t gid
, const struct wbcDomainSid
*sid
);
1098 * @brief Remove a user id mapping
1100 * @param uid Uid of the mapping to remove.
1101 * @param *sid Pointer to the sid of the mapping to remove.
1105 * @deprecated This method is not impemented any more and should
1106 * be removed in the next major version change.
1108 wbcErr
wbcRemoveUidMapping(uid_t uid
, const struct wbcDomainSid
*sid
);
1111 * @brief Remove a group id mapping
1113 * @param gid Gid of the mapping to remove.
1114 * @param *sid Pointer to the sid of the mapping to remove.
1118 * @deprecated This method is not impemented any more and should
1119 * be removed in the next major version change.
1121 wbcErr
wbcRemoveGidMapping(gid_t gid
, const struct wbcDomainSid
*sid
);
1124 * @brief Set the highwater mark for allocated uids.
1126 * @param uid_hwm The new uid highwater mark value
1130 * @deprecated This method is not impemented any more and should
1131 * be removed in the next major version change.
1133 wbcErr
wbcSetUidHwm(uid_t uid_hwm
);
1136 * @brief Set the highwater mark for allocated gids.
1138 * @param gid_hwm The new gid highwater mark value
1142 * @deprecated This method is not impemented any more and should
1143 * be removed in the next major version change.
1145 wbcErr
wbcSetGidHwm(gid_t gid_hwm
);
1147 /**********************************************************
1148 * NSS Lookup User/Group details
1149 **********************************************************/
1152 * @brief Fill in a struct passwd* for a domain user based
1155 * @param *ctx wbclient Context
1156 * @param *name Username to lookup
1157 * @param **pwd Pointer to resulting struct passwd* from the query.
1161 wbcErr
wbcCtxGetpwnam(struct wbcContext
*ctx
,
1162 const char *name
, struct passwd
**pwd
);
1165 * @brief Fill in a struct passwd* for a domain user based
1168 * @param *name Username to lookup
1169 * @param **pwd Pointer to resulting struct passwd* from the query.
1173 wbcErr
wbcGetpwnam(const char *name
, struct passwd
**pwd
);
1176 * @brief Fill in a struct passwd* for a domain user based
1179 * @param *ctx wbclient Context
1180 * @param uid Uid to lookup
1181 * @param **pwd Pointer to resulting struct passwd* from the query.
1185 wbcErr
wbcCtxGetpwuid(struct wbcContext
*ctx
,
1186 uid_t uid
, struct passwd
**pwd
);
1189 * @brief Fill in a struct passwd* for a domain user based
1192 * @param uid Uid to lookup
1193 * @param **pwd Pointer to resulting struct passwd* from the query.
1197 wbcErr
wbcGetpwuid(uid_t uid
, struct passwd
**pwd
);
1200 * @brief Fill in a struct passwd* for a domain user based
1203 * @param *ctx wbclient Context
1204 * @param sid Sid to lookup
1205 * @param **pwd Pointer to resulting struct passwd* from the query.
1209 wbcErr
wbcCtxGetpwsid(struct wbcContext
*ctx
,
1210 struct wbcDomainSid
* sid
, struct passwd
**pwd
);
1213 * @brief Fill in a struct passwd* for a domain user based
1216 * @param sid Sid to lookup
1217 * @param **pwd Pointer to resulting struct passwd* from the query.
1221 wbcErr
wbcGetpwsid(struct wbcDomainSid
* sid
, struct passwd
**pwd
);
1224 * @brief Fill in a struct passwd* for a domain user based
1227 * @param *ctx wbclient Context
1228 * @param *name Username to lookup
1229 * @param **grp Pointer to resulting struct group* from the query.
1233 wbcErr
wbcCtxGetgrnam(struct wbcContext
*ctx
,
1234 const char *name
, struct group
**grp
);
1237 * @brief Fill in a struct passwd* for a domain user based
1240 * @param *name Username to lookup
1241 * @param **grp Pointer to resulting struct group* from the query.
1245 wbcErr
wbcGetgrnam(const char *name
, struct group
**grp
);
1248 * @brief Fill in a struct passwd* for a domain user based
1251 * @param *ctx wbclient Context
1252 * @param gid Uid to lookup
1253 * @param **grp Pointer to resulting struct group* from the query.
1257 wbcErr
wbcCtxGetgrgid(struct wbcContext
*ctx
,
1258 gid_t gid
, struct group
**grp
);
1261 * @brief Fill in a struct passwd* for a domain user based
1264 * @param gid Uid to lookup
1265 * @param **grp Pointer to resulting struct group* from the query.
1269 wbcErr
wbcGetgrgid(gid_t gid
, struct group
**grp
);
1272 * @brief Reset the passwd iterator
1274 * @param *ctx wbclient Context
1278 wbcErr
wbcCtxSetpwent(struct wbcContext
*ctx
);
1281 * @brief Reset the passwd iterator
1285 wbcErr
wbcSetpwent(void);
1288 * @brief Close the passwd iterator
1290 * @param *ctx wbclient Context
1294 wbcErr
wbcCtxEndpwent(struct wbcContext
*ctx
);
1297 * @brief Close the passwd iterator
1301 wbcErr
wbcEndpwent(void);
1304 * @brief Return the next struct passwd* entry from the pwent iterator
1306 * @param *ctx wbclient Context
1307 * @param **pwd Pointer to resulting struct passwd* from the query.
1311 wbcErr
wbcCtxGetpwent(struct wbcContext
*ctx
, struct passwd
**pwd
);
1314 * @brief Return the next struct passwd* entry from the pwent iterator
1316 * @param **pwd Pointer to resulting struct passwd* from the query.
1320 wbcErr
wbcGetpwent(struct passwd
**pwd
);
1323 * @brief Reset the group iterator
1325 * @param *ctx wbclient Context
1329 wbcErr
wbcCtxSetgrent(struct wbcContext
*ctx
);
1332 * @brief Reset the group iterator
1336 wbcErr
wbcSetgrent(void);
1339 * @brief Close the group iterator
1341 * @param *ctx wbclient Context
1345 wbcErr
wbcCtxEndgrent(struct wbcContext
*ctx
);
1348 * @brief Close the group iterator
1352 wbcErr
wbcEndgrent(void);
1355 * @brief Return the next struct group* entry from the pwent iterator
1357 * @param *ctx wbclient Context
1358 * @param **grp Pointer to resulting struct group* from the query.
1362 wbcErr
wbcCtxGetgrent(struct wbcContext
*ctx
, struct group
**grp
);
1365 * @brief Return the next struct group* entry from the pwent iterator
1367 * @param **grp Pointer to resulting struct group* from the query.
1371 wbcErr
wbcGetgrent(struct group
**grp
);
1374 * @brief Return the next struct group* entry from the pwent iterator
1376 * This is similar to #wbcGetgrent, just that the member list is empty
1378 * @param *ctx wbclient Context
1379 * @param **grp Pointer to resulting struct group* from the query.
1383 wbcErr
wbcCtxGetgrlist(struct wbcContext
*ctx
, struct group
**grp
);
1386 * @brief Return the next struct group* entry from the pwent iterator
1388 * This is similar to #wbcGetgrent, just that the member list is empty
1390 * @param **grp Pointer to resulting struct group* from the query.
1394 wbcErr
wbcGetgrlist(struct group
**grp
);
1397 * @brief Return the unix group array belonging to the given user
1399 * @param *ctx wbclient Context
1400 * @param *account The given user name
1401 * @param *num_groups Number of elements returned in the groups array
1402 * @param **_groups Pointer to resulting gid_t array.
1406 wbcErr
wbcCtxGetGroups(struct wbcContext
*ctx
,
1407 const char *account
,
1408 uint32_t *num_groups
,
1412 * @brief Return the unix group array belonging to the given user
1414 * @param *account The given user name
1415 * @param *num_groups Number of elements returned in the groups array
1416 * @param **_groups Pointer to resulting gid_t array.
1420 wbcErr
wbcGetGroups(const char *account
,
1421 uint32_t *num_groups
,
1425 /**********************************************************
1426 * Lookup Domain information
1427 **********************************************************/
1430 * @brief Lookup the current status of a trusted domain
1432 * @param *ctx wbclient Context
1433 * @param domain The domain to query
1435 * @param dinfo A pointer to store the returned domain_info struct.
1439 wbcErr
wbcCtxDomainInfo(struct wbcContext
*ctx
,
1441 struct wbcDomainInfo
**dinfo
);
1444 * @brief Lookup the current status of a trusted domain
1446 * @param domain The domain to query
1448 * @param dinfo A pointer to store the returned domain_info struct.
1452 wbcErr
wbcDomainInfo(const char *domain
,
1453 struct wbcDomainInfo
**dinfo
);
1456 * @brief Lookup the currently contacted DCs
1458 * @param *ctx wbclient Context
1459 * @param domain The domain to query
1461 * @param num_dcs Number of DCs currently known
1462 * @param dc_names Names of the currently known DCs
1463 * @param dc_ips IP addresses of the currently known DCs
1467 wbcErr
wbcCtxDcInfo(struct wbcContext
*ctx
,
1468 const char *domain
, size_t *num_dcs
,
1469 const char ***dc_names
, const char ***dc_ips
);
1472 * @brief Lookup the currently contacted DCs
1474 * @param domain The domain to query
1476 * @param num_dcs Number of DCs currently known
1477 * @param dc_names Names of the currently known DCs
1478 * @param dc_ips IP addresses of the currently known DCs
1482 wbcErr
wbcDcInfo(const char *domain
, size_t *num_dcs
,
1483 const char ***dc_names
, const char ***dc_ips
);
1486 * @brief Enumerate the domain trusts known by Winbind
1488 * @param *ctx wbclient Context
1489 * @param **domains Pointer to the allocated domain list array
1490 * @param *num_domains Pointer to number of domains returned
1494 wbcErr
wbcCtxListTrusts(struct wbcContext
*ctx
,
1495 struct wbcDomainInfo
**domains
,
1496 size_t *num_domains
);
1499 * @brief Enumerate the domain trusts known by Winbind
1501 * @param **domains Pointer to the allocated domain list array
1502 * @param *num_domains Pointer to number of domains returned
1506 wbcErr
wbcListTrusts(struct wbcDomainInfo
**domains
,
1507 size_t *num_domains
);
1509 /* Flags for wbcLookupDomainController */
1511 #define WBC_LOOKUP_DC_FORCE_REDISCOVERY 0x00000001
1512 #define WBC_LOOKUP_DC_DS_REQUIRED 0x00000010
1513 #define WBC_LOOKUP_DC_DS_PREFERRED 0x00000020
1514 #define WBC_LOOKUP_DC_GC_SERVER_REQUIRED 0x00000040
1515 #define WBC_LOOKUP_DC_PDC_REQUIRED 0x00000080
1516 #define WBC_LOOKUP_DC_BACKGROUND_ONLY 0x00000100
1517 #define WBC_LOOKUP_DC_IP_REQUIRED 0x00000200
1518 #define WBC_LOOKUP_DC_KDC_REQUIRED 0x00000400
1519 #define WBC_LOOKUP_DC_TIMESERV_REQUIRED 0x00000800
1520 #define WBC_LOOKUP_DC_WRITABLE_REQUIRED 0x00001000
1521 #define WBC_LOOKUP_DC_GOOD_TIMESERV_PREFERRED 0x00002000
1522 #define WBC_LOOKUP_DC_AVOID_SELF 0x00004000
1523 #define WBC_LOOKUP_DC_ONLY_LDAP_NEEDED 0x00008000
1524 #define WBC_LOOKUP_DC_IS_FLAT_NAME 0x00010000
1525 #define WBC_LOOKUP_DC_IS_DNS_NAME 0x00020000
1526 #define WBC_LOOKUP_DC_TRY_NEXTCLOSEST_SITE 0x00040000
1527 #define WBC_LOOKUP_DC_DS_6_REQUIRED 0x00080000
1528 #define WBC_LOOKUP_DC_RETURN_DNS_NAME 0x40000000
1529 #define WBC_LOOKUP_DC_RETURN_FLAT_NAME 0x80000000
1532 * @brief Enumerate the domain trusts known by Winbind
1534 * @param *ctx wbclient Context
1535 * @param domain Name of the domain to query for a DC
1536 * @param flags Bit flags used to control the domain location query
1537 * @param *dc_info Pointer to the returned domain controller information
1541 wbcErr
wbcCtxLookupDomainController(struct wbcContext
*ctx
,
1544 struct wbcDomainControllerInfo
**dc_info
);
1547 * @brief Enumerate the domain trusts known by Winbind
1549 * @param domain Name of the domain to query for a DC
1550 * @param flags Bit flags used to control the domain location query
1551 * @param *dc_info Pointer to the returned domain controller information
1555 wbcErr
wbcLookupDomainController(const char *domain
,
1557 struct wbcDomainControllerInfo
**dc_info
);
1560 * @brief Get extended domain controller information
1562 * @param *ctx wbclient Context
1563 * @param domain Name of the domain to query for a DC
1564 * @param guid Guid of the domain to query for a DC
1565 * @param site Site of the domain to query for a DC
1566 * @param flags Bit flags used to control the domain location query
1567 * @param *dc_info Pointer to the returned extended domain controller information
1571 wbcErr
wbcCtxLookupDomainControllerEx(struct wbcContext
*ctx
,
1573 struct wbcGuid
*guid
,
1576 struct wbcDomainControllerInfoEx
**dc_info
);
1579 * @brief Get extended domain controller information
1581 * @param domain Name of the domain to query for a DC
1582 * @param guid Guid of the domain to query for a DC
1583 * @param site Site of the domain to query for a DC
1584 * @param flags Bit flags used to control the domain location query
1585 * @param *dc_info Pointer to the returned extended domain controller information
1589 wbcErr
wbcLookupDomainControllerEx(const char *domain
,
1590 struct wbcGuid
*guid
,
1593 struct wbcDomainControllerInfoEx
**dc_info
);
1595 /**********************************************************
1596 * Athenticate functions
1597 **********************************************************/
1600 * @brief Authenticate a username/password pair
1602 * @param *ctx wbclient Context
1603 * @param username Name of user to authenticate
1604 * @param password Clear text password os user
1608 wbcErr
wbcCtxAuthenticateUser(struct wbcContext
*ctx
,
1609 const char *username
,
1610 const char *password
);
1613 * @brief Authenticate a username/password pair
1615 * @param username Name of user to authenticate
1616 * @param password Clear text password os user
1620 wbcErr
wbcAuthenticateUser(const char *username
,
1621 const char *password
);
1624 * @brief Authenticate with more detailed information
1626 * @param *ctx wbclient Context
1627 * @param params Input parameters, WBC_AUTH_USER_LEVEL_HASH
1628 * is not supported yet
1629 * @param info Output details on WBC_ERR_SUCCESS
1630 * @param error Output details on WBC_ERR_AUTH_ERROR
1634 wbcErr
wbcCtxAuthenticateUserEx(struct wbcContext
*ctx
,
1635 const struct wbcAuthUserParams
*params
,
1636 struct wbcAuthUserInfo
**info
,
1637 struct wbcAuthErrorInfo
**error
);
1640 * @brief Authenticate with more detailed information
1642 * @param params Input parameters, WBC_AUTH_USER_LEVEL_HASH
1643 * is not supported yet
1644 * @param info Output details on WBC_ERR_SUCCESS
1645 * @param error Output details on WBC_ERR_AUTH_ERROR
1649 wbcErr
wbcAuthenticateUserEx(const struct wbcAuthUserParams
*params
,
1650 struct wbcAuthUserInfo
**info
,
1651 struct wbcAuthErrorInfo
**error
);
1654 * @brief Logon a User
1656 * @param[in] *ctx wbclient Context
1657 * @param[in] params Pointer to a wbcLogonUserParams structure
1658 * @param[out] info Pointer to a pointer to a wbcLogonUserInfo structure
1659 * @param[out] error Pointer to a pointer to a wbcAuthErrorInfo structure
1660 * @param[out] policy Pointer to a pointer to a wbcUserPasswordPolicyInfo structure
1664 wbcErr
wbcCtxLogonUser(struct wbcContext
*ctx
,
1665 const struct wbcLogonUserParams
*params
,
1666 struct wbcLogonUserInfo
**info
,
1667 struct wbcAuthErrorInfo
**error
,
1668 struct wbcUserPasswordPolicyInfo
**policy
);
1671 * @brief Logon a User
1673 * @param[in] params Pointer to a wbcLogonUserParams structure
1674 * @param[out] info Pointer to a pointer to a wbcLogonUserInfo structure
1675 * @param[out] error Pointer to a pointer to a wbcAuthErrorInfo structure
1676 * @param[out] policy Pointer to a pointer to a wbcUserPasswordPolicyInfo structure
1680 wbcErr
wbcLogonUser(const struct wbcLogonUserParams
*params
,
1681 struct wbcLogonUserInfo
**info
,
1682 struct wbcAuthErrorInfo
**error
,
1683 struct wbcUserPasswordPolicyInfo
**policy
);
1686 * @brief Trigger a logoff notification to Winbind for a specific user
1688 * @param *ctx wbclient Context
1689 * @param username Name of user to remove from Winbind's list of
1691 * @param uid Uid assigned to the username
1692 * @param ccfilename Absolute path to the Krb5 credentials cache to
1697 wbcErr
wbcCtxLogoffUser(struct wbcContext
*ctx
,
1698 const char *username
, uid_t uid
,
1699 const char *ccfilename
);
1702 * @brief Trigger a logoff notification to Winbind for a specific user
1704 * @param username Name of user to remove from Winbind's list of
1706 * @param uid Uid assigned to the username
1707 * @param ccfilename Absolute path to the Krb5 credentials cache to
1712 wbcErr
wbcLogoffUser(const char *username
,
1714 const char *ccfilename
);
1717 * @brief Trigger an extended logoff notification to Winbind for a specific user
1719 * @param *ctx wbclient Context
1720 * @param params A wbcLogoffUserParams structure
1721 * @param error User output details on error
1725 wbcErr
wbcCtxLogoffUserEx(struct wbcContext
*ctx
,
1726 const struct wbcLogoffUserParams
*params
,
1727 struct wbcAuthErrorInfo
**error
);
1730 * @brief Trigger an extended logoff notification to Winbind for a specific user
1732 * @param params A wbcLogoffUserParams structure
1733 * @param error User output details on error
1737 wbcErr
wbcLogoffUserEx(const struct wbcLogoffUserParams
*params
,
1738 struct wbcAuthErrorInfo
**error
);
1741 * @brief Change a password for a user
1743 * @param *ctx wbclient Context
1744 * @param username Name of user to authenticate
1745 * @param old_password Old clear text password of user
1746 * @param new_password New clear text password of user
1750 wbcErr
wbcCtxChangeUserPassword(struct wbcContext
*ctx
,
1751 const char *username
,
1752 const char *old_password
,
1753 const char *new_password
);
1756 * @brief Change a password for a user
1758 * @param username Name of user to authenticate
1759 * @param old_password Old clear text password of user
1760 * @param new_password New clear text password of user
1764 wbcErr
wbcChangeUserPassword(const char *username
,
1765 const char *old_password
,
1766 const char *new_password
);
1769 * @brief Change a password for a user with more detailed information upon
1772 * @param *ctx wbclient Context
1773 * @param params Input parameters
1774 * @param error User output details on WBC_ERR_PWD_CHANGE_FAILED
1775 * @param reject_reason New password reject reason on WBC_ERR_PWD_CHANGE_FAILED
1776 * @param policy Password policy output details on WBC_ERR_PWD_CHANGE_FAILED
1780 wbcErr
wbcCtxChangeUserPasswordEx(struct wbcContext
*ctx
,
1781 const struct wbcChangePasswordParams
*params
,
1782 struct wbcAuthErrorInfo
**error
,
1783 enum wbcPasswordChangeRejectReason
*reject_reason
,
1784 struct wbcUserPasswordPolicyInfo
**policy
);
1787 * @brief Change a password for a user with more detailed information upon
1790 * @param params Input parameters
1791 * @param error User output details on WBC_ERR_PWD_CHANGE_FAILED
1792 * @param reject_reason New password reject reason on WBC_ERR_PWD_CHANGE_FAILED
1793 * @param policy Password policy output details on WBC_ERR_PWD_CHANGE_FAILED
1797 wbcErr
wbcChangeUserPasswordEx(const struct wbcChangePasswordParams
*params
,
1798 struct wbcAuthErrorInfo
**error
,
1799 enum wbcPasswordChangeRejectReason
*reject_reason
,
1800 struct wbcUserPasswordPolicyInfo
**policy
);
1803 * @brief Authenticate a user with cached credentials
1805 * @param *ctx wbclient Context
1806 * @param *params Pointer to a wbcCredentialCacheParams structure
1807 * @param **info Pointer to a pointer to a wbcCredentialCacheInfo structure
1808 * @param **error Pointer to a pointer to a wbcAuthErrorInfo structure
1812 wbcErr
wbcCtxCredentialCache(struct wbcContext
*ctx
,
1813 struct wbcCredentialCacheParams
*params
,
1814 struct wbcCredentialCacheInfo
**info
,
1815 struct wbcAuthErrorInfo
**error
);
1818 * @brief Authenticate a user with cached credentials
1820 * @param *params Pointer to a wbcCredentialCacheParams structure
1821 * @param **info Pointer to a pointer to a wbcCredentialCacheInfo structure
1822 * @param **error Pointer to a pointer to a wbcAuthErrorInfo structure
1826 wbcErr
wbcCredentialCache(struct wbcCredentialCacheParams
*params
,
1827 struct wbcCredentialCacheInfo
**info
,
1828 struct wbcAuthErrorInfo
**error
);
1831 * @brief Save a password with winbind for doing wbcCredentialCache() later
1833 * @param *ctx wbclient Context
1834 * @param *user Username
1835 * @param *password Password
1839 wbcErr
wbcCtxCredentialSave(struct wbcContext
*ctx
,
1840 const char *user
, const char *password
);
1843 * @brief Save a password with winbind for doing wbcCredentialCache() later
1845 * @param *user Username
1846 * @param *password Password
1850 wbcErr
wbcCredentialSave(const char *user
, const char *password
);
1852 /**********************************************************
1854 **********************************************************/
1857 * @brief Resolve a NetbiosName via WINS
1859 * @param *ctx wbclient Context
1860 * @param name Name to resolve
1861 * @param *ip Pointer to the ip address string
1865 wbcErr
wbcCtxResolveWinsByName(struct wbcContext
*ctx
,
1866 const char *name
, char **ip
);
1869 * @brief Resolve a NetbiosName via WINS
1871 * @param name Name to resolve
1872 * @param *ip Pointer to the ip address string
1876 wbcErr
wbcResolveWinsByName(const char *name
, char **ip
);
1879 * @brief Resolve an IP address via WINS into a NetbiosName
1881 * @param *ctx wbclient Context
1882 * @param ip The ip address string
1883 * @param *name Pointer to the name
1888 wbcErr
wbcCtxResolveWinsByIP(struct wbcContext
*ctx
,
1889 const char *ip
, char **name
);
1892 * @brief Resolve an IP address via WINS into a NetbiosName
1894 * @param ip The ip address string
1895 * @param *name Pointer to the name
1900 wbcErr
wbcResolveWinsByIP(const char *ip
, char **name
);
1902 /**********************************************************
1903 * Trusted domain functions
1904 **********************************************************/
1907 * @brief Trigger a verification of the trust credentials of a specific domain
1909 * @param *ctx wbclient Context
1910 * @param *domain The name of the domain.
1911 * @param error Output details on WBC_ERR_AUTH_ERROR
1915 wbcErr
wbcCtxCheckTrustCredentials(struct wbcContext
*ctx
, const char *domain
,
1916 struct wbcAuthErrorInfo
**error
);
1919 * @brief Trigger a verification of the trust credentials of a specific domain
1921 * @param *domain The name of the domain.
1922 * @param error Output details on WBC_ERR_AUTH_ERROR
1926 wbcErr
wbcCheckTrustCredentials(const char *domain
,
1927 struct wbcAuthErrorInfo
**error
);
1930 * @brief Trigger a change of the trust credentials for a specific domain
1932 * @param *ctx wbclient Context
1933 * @param *domain The name of the domain.
1934 * @param error Output details on WBC_ERR_AUTH_ERROR
1938 wbcErr
wbcCtxChangeTrustCredentials(struct wbcContext
*ctx
, const char *domain
,
1939 struct wbcAuthErrorInfo
**error
);
1942 * @brief Trigger a change of the trust credentials for a specific domain
1944 * @param *domain The name of the domain.
1945 * @param error Output details on WBC_ERR_AUTH_ERROR
1949 wbcErr
wbcChangeTrustCredentials(const char *domain
,
1950 struct wbcAuthErrorInfo
**error
);
1953 * @brief Trigger a no-op call through the NETLOGON pipe. Low-cost
1954 * version of wbcCheckTrustCredentials
1956 * @param *ctx wbclient Context
1957 * @param *domain The name of the domain, only NULL for the default domain is
1958 * supported yet. Other values than NULL will result in
1959 * WBC_ERR_NOT_IMPLEMENTED.
1960 * @param error Output details on WBC_ERR_AUTH_ERROR
1964 wbcErr
wbcCtxPingDc(struct wbcContext
*ctx
, const char *domain
,
1965 struct wbcAuthErrorInfo
**error
);
1968 * @brief Trigger a no-op call through the NETLOGON pipe. Low-cost
1969 * version of wbcCheckTrustCredentials
1971 * @param *domain The name of the domain, only NULL for the default domain is
1972 * supported yet. Other values than NULL will result in
1973 * WBC_ERR_NOT_IMPLEMENTED.
1974 * @param error Output details on WBC_ERR_AUTH_ERROR
1978 wbcErr
wbcPingDc(const char *domain
, struct wbcAuthErrorInfo
**error
);
1981 * @brief Trigger a no-op call through the NETLOGON pipe. Low-cost
1982 * version of wbcCheckTrustCredentials
1984 * @param *ctx wbclient Context
1985 * @param *domain The name of the domain, only NULL for the default domain is
1986 * supported yet. Other values than NULL will result in
1987 * WBC_ERR_NOT_IMPLEMENTED.
1988 * @param error Output details on WBC_ERR_AUTH_ERROR
1989 * @param dcname DC that was attempted to ping
1993 wbcErr
wbcCtxPingDc2(struct wbcContext
*ctx
, const char *domain
,
1994 struct wbcAuthErrorInfo
**error
,
1998 * @brief Trigger a no-op call through the NETLOGON pipe. Low-cost
1999 * version of wbcCheckTrustCredentials
2001 * @param *domain The name of the domain, only NULL for the default domain is
2002 * supported yet. Other values than NULL will result in
2003 * WBC_ERR_NOT_IMPLEMENTED.
2004 * @param error Output details on WBC_ERR_AUTH_ERROR
2005 * @param dcname DC that was attempted to ping
2009 wbcErr
wbcPingDc2(const char *domain
, struct wbcAuthErrorInfo
**error
,
2012 /**********************************************************
2014 **********************************************************/
2017 * @brief Initialize a named blob and add to list of blobs
2019 * @param[in,out] num_blobs Pointer to the number of blobs
2020 * @param[in,out] blobs Pointer to an array of blobs
2021 * @param[in] name Name of the new named blob
2022 * @param[in] flags Flags of the new named blob
2023 * @param[in] data Blob data of new blob
2024 * @param[in] length Blob data length of new blob
2028 wbcErr
wbcAddNamedBlob(size_t *num_blobs
,
2029 struct wbcNamedBlob
**blobs
,
2035 #endif /* _WBCLIENT_H */