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 */
51 WBC_ERR_NOT_MAPPED
/**< Translation function failed on some element **/
54 typedef enum _wbcErrType wbcErr
;
56 #define WBC_ERROR_IS_OK(x) ((x) == WBC_ERR_SUCCESS)
58 const char *wbcErrorString(wbcErr error
);
61 * @brief Some useful details about the wbclient library
63 * 0.1: Initial version
64 * 0.2: Added wbcRemoveUidMapping()
65 * Added wbcRemoveGidMapping()
66 * 0.3: Added wbcGetpwsid()
67 * Added wbcGetSidAliases()
68 * 0.4: Added wbcSidTypeString()
69 * 0.5: Added wbcChangeTrustCredentials()
70 * 0.6: Made struct wbcInterfaceDetails char* members non-const
71 * 0.7: Added wbcSidToStringBuf()
72 * 0.8: Added wbcSidsToUnixIds() and wbcLookupSids()
73 * 0.9: Added support for WBC_ID_TYPE_BOTH
74 * 0.10: Added wbcPingDc2()
75 * 0.11: Extended wbcAuthenticateUserEx to provide PAC parsing
76 * 0.12: Added wbcCtxCreate and friends
77 * 0.13: Added wbcCtxUnixIdsToSids and wbcUnixIdsToSids
78 * 0.14: Added "authoritative" to wbcAuthErrorInfo
79 * Added WBC_SID_NAME_LABEL
80 * 0.15: Added wbcSetClientProcessName()
81 * 0.16: Added wbcChangeTrustCredentialsAt()
83 #define WBCLIENT_MAJOR_VERSION 0
84 #define WBCLIENT_MINOR_VERSION 16
85 #define WBCLIENT_VENDOR_VERSION "Samba libwbclient"
86 struct wbcLibraryDetails
{
87 uint16_t major_version
;
88 uint16_t minor_version
;
89 const char *vendor_version
;
93 * @brief Some useful details about the running winbindd
96 struct wbcInterfaceDetails
{
97 uint32_t interface_version
;
98 char *winbind_version
;
99 char winbind_separator
;
101 char *netbios_domain
;
106 * @brief Library context data
113 * Data types used by the Winbind Client API
116 #ifndef WBC_MAXSUBAUTHS
117 #define WBC_MAXSUBAUTHS 15 /* max sub authorities in a SID */
121 * @brief Windows Security Identifier
125 struct wbcDomainSid
{
129 uint32_t sub_auths
[WBC_MAXSUBAUTHS
];
133 * @brief Security Identifier type
137 WBC_SID_NAME_USE_NONE
=0,
139 WBC_SID_NAME_DOM_GRP
=2,
140 WBC_SID_NAME_DOMAIN
=3,
141 WBC_SID_NAME_ALIAS
=4,
142 WBC_SID_NAME_WKN_GRP
=5,
143 WBC_SID_NAME_DELETED
=6,
144 WBC_SID_NAME_INVALID
=7,
145 WBC_SID_NAME_UNKNOWN
=8,
146 WBC_SID_NAME_COMPUTER
=9,
147 WBC_SID_NAME_LABEL
=10
151 * @brief Security Identifier with attributes
154 struct wbcSidWithAttr
{
155 struct wbcDomainSid sid
;
159 /* wbcSidWithAttr->attributes */
161 #define WBC_SID_ATTR_GROUP_MANDATORY 0x00000001
162 #define WBC_SID_ATTR_GROUP_ENABLED_BY_DEFAULT 0x00000002
163 #define WBC_SID_ATTR_GROUP_ENABLED 0x00000004
164 #define WBC_SID_ATTR_GROUP_OWNER 0x00000008
165 #define WBC_SID_ATTR_GROUP_USEFOR_DENY_ONLY 0x00000010
166 #define WBC_SID_ATTR_GROUP_RESOURCE 0x20000000
167 #define WBC_SID_ATTR_GROUP_LOGON_ID 0xC0000000
170 * @brief Windows GUID
177 uint16_t time_hi_and_version
;
178 uint8_t clock_seq
[2];
183 * @brief Domain Information
186 struct wbcDomainInfo
{
189 struct wbcDomainSid sid
;
190 uint32_t domain_flags
;
191 uint32_t trust_flags
;
196 /* wbcDomainInfo->domain_flags */
198 #define WBC_DOMINFO_DOMAIN_UNKNOWN 0x00000000
199 #define WBC_DOMINFO_DOMAIN_NATIVE 0x00000001
200 #define WBC_DOMINFO_DOMAIN_AD 0x00000002
201 #define WBC_DOMINFO_DOMAIN_PRIMARY 0x00000004
202 #define WBC_DOMINFO_DOMAIN_OFFLINE 0x00000008
204 /* wbcDomainInfo->trust_flags */
206 #define WBC_DOMINFO_TRUST_TRANSITIVE 0x00000001
207 #define WBC_DOMINFO_TRUST_INCOMING 0x00000002
208 #define WBC_DOMINFO_TRUST_OUTGOING 0x00000004
210 /* wbcDomainInfo->trust_type */
212 #define WBC_DOMINFO_TRUSTTYPE_NONE 0x00000000
213 #define WBC_DOMINFO_TRUSTTYPE_FOREST 0x00000001
214 #define WBC_DOMINFO_TRUSTTYPE_IN_FOREST 0x00000002
215 #define WBC_DOMINFO_TRUSTTYPE_EXTERNAL 0x00000003
216 #define WBC_DOMINFO_TRUSTTYPE_LOCAL 0x00000004
217 #define WBC_DOMINFO_TRUSTTYPE_WKSTA 0x00000005
218 #define WBC_DOMINFO_TRUSTTYPE_RWDC 0x00000006
219 #define WBC_DOMINFO_TRUSTTYPE_RODC 0x00000007
220 #define WBC_DOMINFO_TRUSTTYPE_PDC 0x00000008
224 * @brief Generic Blob
236 struct wbcNamedBlob
{
243 * @brief Auth User Parameters
246 struct wbcAuthUserParams
{
247 const char *account_name
;
248 const char *domain_name
;
249 const char *workstation_name
;
253 uint32_t parameter_control
;
255 enum wbcAuthUserLevel
{
256 WBC_AUTH_USER_LEVEL_PLAIN
= 1,
257 WBC_AUTH_USER_LEVEL_HASH
= 2,
258 WBC_AUTH_USER_LEVEL_RESPONSE
= 3,
259 WBC_AUTH_USER_LEVEL_PAC
= 4
262 const char *plaintext
;
268 uint8_t challenge
[8];
279 * @brief Logon User Parameters
282 struct wbcLogonUserParams
{
283 const char *username
;
284 const char *password
;
286 struct wbcNamedBlob
*blobs
;
290 * @brief ChangePassword Parameters
293 struct wbcChangePasswordParams
{
294 const char *account_name
;
295 const char *domain_name
;
299 enum wbcChangePasswordLevel
{
300 WBC_CHANGE_PASSWORD_LEVEL_PLAIN
= 1,
301 WBC_CHANGE_PASSWORD_LEVEL_RESPONSE
= 2
305 const char *plaintext
;
307 uint32_t old_nt_hash_enc_length
;
308 uint8_t *old_nt_hash_enc_data
;
309 uint32_t old_lm_hash_enc_length
;
310 uint8_t *old_lm_hash_enc_data
;
314 const char *plaintext
;
324 /* wbcAuthUserParams->parameter_control */
326 #define WBC_MSV1_0_CLEARTEXT_PASSWORD_ALLOWED 0x00000002
327 #define WBC_MSV1_0_UPDATE_LOGON_STATISTICS 0x00000004
328 #define WBC_MSV1_0_RETURN_USER_PARAMETERS 0x00000008
329 #define WBC_MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT 0x00000020
330 #define WBC_MSV1_0_RETURN_PROFILE_PATH 0x00000200
331 #define WBC_MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT 0x00000800
332 #define WBC_MSV1_0_ALLOW_MSVCHAPV2 0x00010000
334 /* wbcAuthUserParams->flags */
336 #define WBC_AUTH_PARAM_FLAGS_INTERACTIVE_LOGON 0x00000001
339 * @brief Auth User Information
341 * Some of the strings are maybe NULL
344 struct wbcAuthUserInfo
{
348 char *user_principal
;
351 char *dns_domain_name
;
354 uint8_t user_session_key
[16];
355 uint8_t lm_session_key
[8];
357 uint16_t logon_count
;
358 uint16_t bad_password_count
;
361 uint64_t logoff_time
;
362 uint64_t kickoff_time
;
363 uint64_t pass_last_set_time
;
364 uint64_t pass_can_change_time
;
365 uint64_t pass_must_change_time
;
370 char *home_directory
;
374 * the 1st one is the account sid
375 * the 2nd one is the primary_group sid
376 * followed by the rest of the groups
379 struct wbcSidWithAttr
*sids
;
383 * @brief Logon User Information
385 * Some of the strings are maybe NULL
388 struct wbcLogonUserInfo
{
389 struct wbcAuthUserInfo
*info
;
391 struct wbcNamedBlob
*blobs
;
394 /* wbcAuthUserInfo->user_flags */
396 #define WBC_AUTH_USER_INFO_GUEST 0x00000001
397 #define WBC_AUTH_USER_INFO_NOENCRYPTION 0x00000002
398 #define WBC_AUTH_USER_INFO_CACHED_ACCOUNT 0x00000004
399 #define WBC_AUTH_USER_INFO_USED_LM_PASSWORD 0x00000008
400 #define WBC_AUTH_USER_INFO_EXTRA_SIDS 0x00000020
401 #define WBC_AUTH_USER_INFO_SUBAUTH_SESSION_KEY 0x00000040
402 #define WBC_AUTH_USER_INFO_SERVER_TRUST_ACCOUNT 0x00000080
403 #define WBC_AUTH_USER_INFO_NTLMV2_ENABLED 0x00000100
404 #define WBC_AUTH_USER_INFO_RESOURCE_GROUPS 0x00000200
405 #define WBC_AUTH_USER_INFO_PROFILE_PATH_RETURNED 0x00000400
406 #define WBC_AUTH_USER_INFO_GRACE_LOGON 0x01000000
408 /* wbcAuthUserInfo->acct_flags */
410 #define WBC_ACB_DISABLED 0x00000001 /* 1 User account disabled */
411 #define WBC_ACB_HOMDIRREQ 0x00000002 /* 1 Home directory required */
412 #define WBC_ACB_PWNOTREQ 0x00000004 /* 1 User password not required */
413 #define WBC_ACB_TEMPDUP 0x00000008 /* 1 Temporary duplicate account */
414 #define WBC_ACB_NORMAL 0x00000010 /* 1 Normal user account */
415 #define WBC_ACB_MNS 0x00000020 /* 1 MNS logon user account */
416 #define WBC_ACB_DOMTRUST 0x00000040 /* 1 Interdomain trust account */
417 #define WBC_ACB_WSTRUST 0x00000080 /* 1 Workstation trust account */
418 #define WBC_ACB_SVRTRUST 0x00000100 /* 1 Server trust account */
419 #define WBC_ACB_PWNOEXP 0x00000200 /* 1 User password does not expire */
420 #define WBC_ACB_AUTOLOCK 0x00000400 /* 1 Account auto locked */
421 #define WBC_ACB_ENC_TXT_PWD_ALLOWED 0x00000800 /* 1 Encrypted text password is allowed */
422 #define WBC_ACB_SMARTCARD_REQUIRED 0x00001000 /* 1 Smart Card required */
423 #define WBC_ACB_TRUSTED_FOR_DELEGATION 0x00002000 /* 1 Trusted for Delegation */
424 #define WBC_ACB_NOT_DELEGATED 0x00004000 /* 1 Not delegated */
425 #define WBC_ACB_USE_DES_KEY_ONLY 0x00008000 /* 1 Use DES key only */
426 #define WBC_ACB_DONT_REQUIRE_PREAUTH 0x00010000 /* 1 Preauth not required */
427 #define WBC_ACB_PW_EXPIRED 0x00020000 /* 1 Password Expired */
428 #define WBC_ACB_NO_AUTH_DATA_REQD 0x00080000 /* 1 = No authorization data required */
430 struct wbcAuthErrorInfo
{
434 char *display_string
;
435 uint8_t authoritative
;
439 * @brief User Password Policy Information
442 /* wbcUserPasswordPolicyInfo->password_properties */
444 #define WBC_DOMAIN_PASSWORD_COMPLEX 0x00000001
445 #define WBC_DOMAIN_PASSWORD_NO_ANON_CHANGE 0x00000002
446 #define WBC_DOMAIN_PASSWORD_NO_CLEAR_CHANGE 0x00000004
447 #define WBC_DOMAIN_PASSWORD_LOCKOUT_ADMINS 0x00000008
448 #define WBC_DOMAIN_PASSWORD_STORE_CLEARTEXT 0x00000010
449 #define WBC_DOMAIN_REFUSE_PASSWORD_CHANGE 0x00000020
451 struct wbcUserPasswordPolicyInfo
{
452 uint32_t min_length_password
;
453 uint32_t password_history
;
454 uint32_t password_properties
;
456 uint64_t min_passwordage
;
460 * @brief Change Password Reject Reason
463 enum wbcPasswordChangeRejectReason
{
464 WBC_PWD_CHANGE_NO_ERROR
=0,
465 WBC_PWD_CHANGE_PASSWORD_TOO_SHORT
=1,
466 WBC_PWD_CHANGE_PWD_IN_HISTORY
=2,
467 WBC_PWD_CHANGE_USERNAME_IN_PASSWORD
=3,
468 WBC_PWD_CHANGE_FULLNAME_IN_PASSWORD
=4,
469 WBC_PWD_CHANGE_NOT_COMPLEX
=5,
470 WBC_PWD_CHANGE_MACHINE_NOT_DEFAULT
=6,
471 WBC_PWD_CHANGE_FAILED_BY_FILTER
=7,
472 WBC_PWD_CHANGE_PASSWORD_TOO_LONG
=8
475 /* Note: this defines exist for compatibility reasons with existing code */
476 #define WBC_PWD_CHANGE_REJECT_OTHER WBC_PWD_CHANGE_NO_ERROR
477 #define WBC_PWD_CHANGE_REJECT_TOO_SHORT WBC_PWD_CHANGE_PASSWORD_TOO_SHORT
478 #define WBC_PWD_CHANGE_REJECT_IN_HISTORY WBC_PWD_CHANGE_PWD_IN_HISTORY
479 #define WBC_PWD_CHANGE_REJECT_COMPLEXITY WBC_PWD_CHANGE_NOT_COMPLEX
482 * @brief Logoff User Parameters
485 struct wbcLogoffUserParams
{
486 const char *username
;
488 struct wbcNamedBlob
*blobs
;
491 /** @brief Credential cache log-on parameters
495 struct wbcCredentialCacheParams
{
496 const char *account_name
;
497 const char *domain_name
;
498 enum wbcCredentialCacheLevel
{
499 WBC_CREDENTIAL_CACHE_LEVEL_NTLMSSP
= 1
502 struct wbcNamedBlob
*blobs
;
506 /** @brief Info returned by credential cache auth
510 struct wbcCredentialCacheInfo
{
512 struct wbcNamedBlob
*blobs
;
516 * DomainControllerInfo struct
518 struct wbcDomainControllerInfo
{
523 * DomainControllerInfoEx struct
525 struct wbcDomainControllerInfoEx
{
527 const char *dc_address
;
528 uint16_t dc_address_type
;
529 struct wbcGuid
*domain_guid
;
530 const char *domain_name
;
531 const char *forest_name
;
533 const char *dc_site_name
;
534 const char *client_site_name
;
537 /**********************************************************
539 **********************************************************/
542 * @brief Free library allocated memory
544 * @param * Pointer to free
548 void wbcFreeMemory(void*);
551 /**********************************************************
553 **********************************************************/
556 * @brief Create a new wbcContext context
560 struct wbcContext
*wbcCtxCreate(void);
563 * @brief Free a library context
565 * @param ctx wbcContext to free
569 void wbcCtxFree(struct wbcContext
*ctx
);
574 * Utility functions for dealing with SIDs
578 * @brief Get a string representation of the SID type
580 * @param type type of the SID
582 * @return string representation of the SID type
584 const char* wbcSidTypeString(enum wbcSidType type
);
586 #define WBC_SID_STRING_BUFLEN (15*11+25)
589 * @brief Print a sid into a buffer
591 * @param sid Binary Security Identifier
592 * @param buf Target buffer
593 * @param buflen Target buffer length
595 * @return Resulting string length.
597 int wbcSidToStringBuf(const struct wbcDomainSid
*sid
, char *buf
, int buflen
);
600 * @brief Convert a binary SID to a character string
602 * @param sid Binary Security Identifier
603 * @param **sid_string Resulting character string
607 wbcErr
wbcSidToString(const struct wbcDomainSid
*sid
,
611 * @brief Convert a character string to a binary SID
613 * @param *sid_string Character string in the form of S-...
614 * @param sid Resulting binary SID
618 wbcErr
wbcStringToSid(const char *sid_string
,
619 struct wbcDomainSid
*sid
);
622 * Utility functions for dealing with GUIDs
626 * @brief Convert a binary GUID to a character string
628 * @param guid Binary Guid
629 * @param **guid_string Resulting character string
633 wbcErr
wbcGuidToString(const struct wbcGuid
*guid
,
637 * @brief Convert a character string to a binary GUID
639 * @param *guid_string Character string
640 * @param guid Resulting binary GUID
644 wbcErr
wbcStringToGuid(const char *guid_string
,
645 struct wbcGuid
*guid
);
648 * @brief Ping winbindd to see if the daemon is running
650 * @param *ctx wbclient Context
654 wbcErr
wbcCtxPing(struct wbcContext
*ctx
);
657 * @brief Ping winbindd to see if the daemon is running
661 wbcErr
wbcPing(void);
663 wbcErr
wbcLibraryDetails(struct wbcLibraryDetails
**details
);
665 wbcErr
wbcCtxInterfaceDetails(struct wbcContext
*ctx
,
666 struct wbcInterfaceDetails
**details
);
667 wbcErr
wbcInterfaceDetails(struct wbcInterfaceDetails
**details
);
669 /**********************************************************
670 * Name/SID conversion
671 **********************************************************/
674 * @brief Convert a domain and name to SID
676 * @param *ctx wbclient Context
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
wbcCtxLookupName(struct wbcContext
*ctx
,
685 const char *dom_name
,
687 struct wbcDomainSid
*sid
,
688 enum wbcSidType
*name_type
);
691 * @brief Convert a domain and name to SID
693 * @param dom_name Domain name (possibly "")
694 * @param name User or group name
695 * @param *sid Pointer to the resolved domain SID
696 * @param *name_type Pointer to the SID type
700 wbcErr
wbcLookupName(const char *dom_name
,
702 struct wbcDomainSid
*sid
,
703 enum wbcSidType
*name_type
);
706 * @brief Convert a SID to a domain and name
708 * @param *ctx wbclient Context
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
wbcCtxLookupSid(struct wbcContext
*ctx
,
717 const struct wbcDomainSid
*sid
,
720 enum wbcSidType
*name_type
);
723 * @brief Convert a SID to a domain and name
725 * @param *sid Pointer to the domain SID to be resolved
726 * @param domain Resolved Domain name (possibly "")
727 * @param name Resolved User or group name
728 * @param *name_type Pointer to the resolved SID type
732 wbcErr
wbcLookupSid(const struct wbcDomainSid
*sid
,
735 enum wbcSidType
*name_type
);
737 struct wbcTranslatedName
{
738 enum wbcSidType type
;
743 wbcErr
wbcCtxLookupSids(struct wbcContext
*ctx
,
744 const struct wbcDomainSid
*sids
, int num_sids
,
745 struct wbcDomainInfo
**domains
, int *num_domains
,
746 struct wbcTranslatedName
**names
);
748 wbcErr
wbcLookupSids(const struct wbcDomainSid
*sids
, int num_sids
,
749 struct wbcDomainInfo
**domains
, int *num_domains
,
750 struct wbcTranslatedName
**names
);
753 * @brief Translate a collection of RIDs within a domain to names
755 wbcErr
wbcCtxLookupRids(struct wbcContext
*ctx
,
756 struct wbcDomainSid
*dom_sid
,
759 const char **domain_name
,
761 enum wbcSidType
**types
);
764 * @brief Translate a collection of RIDs within a domain to names
766 wbcErr
wbcLookupRids(struct wbcDomainSid
*dom_sid
,
769 const char **domain_name
,
771 enum wbcSidType
**types
);
774 * @brief Get the groups a user belongs to
776 wbcErr
wbcCtxLookupUserSids(struct wbcContext
*ctx
,
777 const struct wbcDomainSid
*user_sid
,
778 bool domain_groups_only
,
780 struct wbcDomainSid
**sids
);
783 * @brief Get the groups a user belongs to
785 wbcErr
wbcLookupUserSids(const struct wbcDomainSid
*user_sid
,
786 bool domain_groups_only
,
788 struct wbcDomainSid
**sids
);
791 * @brief Get alias membership for sids
793 wbcErr
wbcCtxGetSidAliases(struct wbcContext
*ctx
,
794 const struct wbcDomainSid
*dom_sid
,
795 struct wbcDomainSid
*sids
,
797 uint32_t **alias_rids
,
798 uint32_t *num_alias_rids
);
801 * @brief Get alias membership for sids
803 wbcErr
wbcGetSidAliases(const struct wbcDomainSid
*dom_sid
,
804 struct wbcDomainSid
*sids
,
806 uint32_t **alias_rids
,
807 uint32_t *num_alias_rids
);
812 wbcErr
wbcCtxListUsers(struct wbcContext
*ctx
,
813 const char *domain_name
,
815 const char ***users
);
820 wbcErr
wbcListUsers(const char *domain_name
,
822 const char ***users
);
825 * @brief Lists Groups
827 wbcErr
wbcCtxListGroups(struct wbcContext
*ctx
,
828 const char *domain_name
,
829 uint32_t *num_groups
,
830 const char ***groups
);
833 * @brief Lists Groups
835 wbcErr
wbcListGroups(const char *domain_name
,
836 uint32_t *num_groups
,
837 const char ***groups
);
839 wbcErr
wbcCtxGetDisplayName(struct wbcContext
*ctx
,
840 const struct wbcDomainSid
*sid
,
843 enum wbcSidType
*pname_type
);
845 wbcErr
wbcGetDisplayName(const struct wbcDomainSid
*sid
,
848 enum wbcSidType
*pname_type
);
850 /**********************************************************
851 * SID/uid/gid Mappings
852 **********************************************************/
855 * @brief Convert a Windows SID to a Unix uid, allocating an uid if needed
857 * @param *ctx wbclient Context
858 * @param *sid Pointer to the domain SID to be resolved
859 * @param *puid Pointer to the resolved uid_t value
864 wbcErr
wbcCtxSidToUid(struct wbcContext
*ctx
,
865 const struct wbcDomainSid
*sid
,
869 * @brief Convert a Windows SID to a Unix uid, allocating an uid if needed
871 * @param *sid Pointer to the domain SID to be resolved
872 * @param *puid Pointer to the resolved uid_t value
877 wbcErr
wbcSidToUid(const struct wbcDomainSid
*sid
,
881 * @brief Convert a Windows SID to a Unix uid if there already is a mapping
883 * @param *sid Pointer to the domain SID to be resolved
884 * @param *puid Pointer to the resolved uid_t value
889 wbcErr
wbcQuerySidToUid(const struct wbcDomainSid
*sid
,
893 * @brief Convert a Unix uid to a Windows SID, allocating a SID if needed
895 * @param *ctx wbclient Context
896 * @param uid Unix uid to be resolved
897 * @param *sid Pointer to the resolved domain SID
902 wbcErr
wbcCtxUidToSid(struct wbcContext
*ctx
, uid_t uid
,
903 struct wbcDomainSid
*sid
);
906 * @brief Convert a Unix uid to a Windows SID, allocating a SID if needed
908 * @param uid Unix uid to be resolved
909 * @param *sid Pointer to the resolved domain SID
914 wbcErr
wbcUidToSid(uid_t uid
,
915 struct wbcDomainSid
*sid
);
918 * @brief Convert a Unix uid to a Windows SID if there already is a mapping
920 * @param uid Unix uid to be resolved
921 * @param *sid Pointer to the resolved domain SID
926 wbcErr
wbcQueryUidToSid(uid_t uid
,
927 struct wbcDomainSid
*sid
);
930 * @brief Convert a Windows SID to a Unix gid, allocating a gid if needed
932 * @param *ctx wbclient Context
933 * @param *sid Pointer to the domain SID to be resolved
934 * @param *pgid Pointer to the resolved gid_t value
939 wbcErr
wbcCtxSidToGid(struct wbcContext
*ctx
,
940 const struct wbcDomainSid
*sid
,
944 * @brief Convert a Windows SID to a Unix gid, allocating a gid if needed
946 * @param *sid Pointer to the domain SID to be resolved
947 * @param *pgid Pointer to the resolved gid_t value
952 wbcErr
wbcSidToGid(const struct wbcDomainSid
*sid
,
956 * @brief Convert a Windows SID to a Unix gid if there already is a mapping
958 * @param *sid Pointer to the domain SID to be resolved
959 * @param *pgid Pointer to the resolved gid_t value
964 wbcErr
wbcQuerySidToGid(const struct wbcDomainSid
*sid
,
968 * @brief Convert a Unix gid to a Windows SID, allocating a SID if needed
970 * @param *ctx wbclient Context
971 * @param gid Unix gid to be resolved
972 * @param *sid Pointer to the resolved domain SID
977 wbcErr
wbcCtxGidToSid(struct wbcContext
*ctx
, gid_t gid
,
978 struct wbcDomainSid
*sid
);
981 * @brief Convert a Unix gid to a Windows SID, allocating a SID if needed
983 * @param gid Unix gid to be resolved
984 * @param *sid Pointer to the resolved domain SID
989 wbcErr
wbcGidToSid(gid_t gid
,
990 struct wbcDomainSid
*sid
);
993 * @brief Convert a Unix gid to a Windows SID if there already is a mapping
995 * @param gid Unix gid to be resolved
996 * @param *sid Pointer to the resolved domain SID
1001 wbcErr
wbcQueryGidToSid(gid_t gid
,
1002 struct wbcDomainSid
*sid
);
1005 WBC_ID_TYPE_NOT_SPECIFIED
,
1011 union wbcUnixIdContainer
{
1017 enum wbcIdType type
;
1018 union wbcUnixIdContainer id
;
1022 * @brief Convert a list of sids to unix ids
1024 * @param *ctx wbclient Context
1025 * @param sids Pointer to an array of SIDs to convert
1026 * @param num_sids Number of SIDs
1027 * @param ids Preallocated output array for translated IDs
1032 wbcErr
wbcCtxSidsToUnixIds(struct wbcContext
*ctx
,
1033 const struct wbcDomainSid
*sids
, uint32_t num_sids
,
1034 struct wbcUnixId
*ids
);
1037 * @brief Convert a list of sids to unix ids
1039 * @param sids Pointer to an array of SIDs to convert
1040 * @param num_sids Number of SIDs
1041 * @param ids Preallocated output array for translated IDs
1046 wbcErr
wbcSidsToUnixIds(const struct wbcDomainSid
*sids
, uint32_t num_sids
,
1047 struct wbcUnixId
*ids
);
1049 wbcErr
wbcCtxUnixIdsToSids(struct wbcContext
*ctx
,
1050 const struct wbcUnixId
*ids
, uint32_t num_ids
,
1051 struct wbcDomainSid
*sids
);
1052 wbcErr
wbcUnixIdsToSids(const struct wbcUnixId
*ids
, uint32_t num_ids
,
1053 struct wbcDomainSid
*sids
);
1056 * @brief Obtain a new uid from Winbind
1058 * @param *ctx wbclient Context
1059 * @param *puid Pointer to the allocated uid
1063 wbcErr
wbcCtxAllocateUid(struct wbcContext
*ctx
, uid_t
*puid
);
1066 * @brief Obtain a new uid from Winbind
1068 * @param *puid Pointer to the allocated uid
1072 wbcErr
wbcAllocateUid(uid_t
*puid
);
1075 * @brief Obtain a new gid from Winbind
1077 * @param *ctx wbclient Context
1078 * @param *pgid Pointer to the allocated gid
1082 wbcErr
wbcCtxAllocateGid(struct wbcContext
*ctx
, gid_t
*pgid
);
1085 * @brief Obtain a new gid from Winbind
1087 * @param *pgid Pointer to the allocated gid
1091 wbcErr
wbcAllocateGid(gid_t
*pgid
);
1094 * @brief Set an user id mapping
1096 * @param uid Uid of the desired mapping.
1097 * @param *sid Pointer to the sid of the desired mapping.
1101 * @deprecated This method is not implemented any more and should
1102 * be removed in the next major version change.
1104 wbcErr
wbcSetUidMapping(uid_t uid
, const struct wbcDomainSid
*sid
);
1107 * @brief Set a group id mapping
1109 * @param gid Gid of the desired mapping.
1110 * @param *sid Pointer to the sid of the desired mapping.
1114 * @deprecated This method is not implemented any more and should
1115 * be removed in the next major version change.
1117 wbcErr
wbcSetGidMapping(gid_t gid
, const struct wbcDomainSid
*sid
);
1120 * @brief Remove a user id mapping
1122 * @param uid Uid of the mapping to remove.
1123 * @param *sid Pointer to the sid of the mapping to remove.
1127 * @deprecated This method is not implemented any more and should
1128 * be removed in the next major version change.
1130 wbcErr
wbcRemoveUidMapping(uid_t uid
, const struct wbcDomainSid
*sid
);
1133 * @brief Remove a group id mapping
1135 * @param gid Gid of the mapping to remove.
1136 * @param *sid Pointer to the sid of the mapping to remove.
1140 * @deprecated This method is not implemented any more and should
1141 * be removed in the next major version change.
1143 wbcErr
wbcRemoveGidMapping(gid_t gid
, const struct wbcDomainSid
*sid
);
1146 * @brief Set the highwater mark for allocated uids.
1148 * @param uid_hwm The new uid highwater mark value
1152 * @deprecated This method is not implemented any more and should
1153 * be removed in the next major version change.
1155 wbcErr
wbcSetUidHwm(uid_t uid_hwm
);
1158 * @brief Set the highwater mark for allocated gids.
1160 * @param gid_hwm The new gid highwater mark value
1164 * @deprecated This method is not implemented any more and should
1165 * be removed in the next major version change.
1167 wbcErr
wbcSetGidHwm(gid_t gid_hwm
);
1169 /**********************************************************
1170 * NSS Lookup User/Group details
1171 **********************************************************/
1174 * @brief Fill in a struct passwd* for a domain user based
1177 * @param *ctx wbclient Context
1178 * @param *name Username to lookup
1179 * @param **pwd Pointer to resulting struct passwd* from the query.
1183 wbcErr
wbcCtxGetpwnam(struct wbcContext
*ctx
,
1184 const char *name
, struct passwd
**pwd
);
1187 * @brief Fill in a struct passwd* for a domain user based
1190 * @param *name Username to lookup
1191 * @param **pwd Pointer to resulting struct passwd* from the query.
1195 wbcErr
wbcGetpwnam(const char *name
, struct passwd
**pwd
);
1198 * @brief Fill in a struct passwd* for a domain user based
1201 * @param *ctx wbclient Context
1202 * @param uid Uid to lookup
1203 * @param **pwd Pointer to resulting struct passwd* from the query.
1207 wbcErr
wbcCtxGetpwuid(struct wbcContext
*ctx
,
1208 uid_t uid
, struct passwd
**pwd
);
1211 * @brief Fill in a struct passwd* for a domain user based
1214 * @param uid Uid to lookup
1215 * @param **pwd Pointer to resulting struct passwd* from the query.
1219 wbcErr
wbcGetpwuid(uid_t uid
, struct passwd
**pwd
);
1222 * @brief Fill in a struct passwd* for a domain user based
1225 * @param *ctx wbclient Context
1226 * @param sid Sid to lookup
1227 * @param **pwd Pointer to resulting struct passwd* from the query.
1231 wbcErr
wbcCtxGetpwsid(struct wbcContext
*ctx
,
1232 struct wbcDomainSid
* sid
, struct passwd
**pwd
);
1235 * @brief Fill in a struct passwd* for a domain user based
1238 * @param sid Sid to lookup
1239 * @param **pwd Pointer to resulting struct passwd* from the query.
1243 wbcErr
wbcGetpwsid(struct wbcDomainSid
* sid
, struct passwd
**pwd
);
1246 * @brief Fill in a struct passwd* for a domain user based
1249 * @param *ctx wbclient Context
1250 * @param *name Username to lookup
1251 * @param **grp Pointer to resulting struct group* from the query.
1255 wbcErr
wbcCtxGetgrnam(struct wbcContext
*ctx
,
1256 const char *name
, struct group
**grp
);
1259 * @brief Fill in a struct passwd* for a domain user based
1262 * @param *name Username to lookup
1263 * @param **grp Pointer to resulting struct group* from the query.
1267 wbcErr
wbcGetgrnam(const char *name
, struct group
**grp
);
1270 * @brief Fill in a struct passwd* for a domain user based
1273 * @param *ctx wbclient Context
1274 * @param gid Uid to lookup
1275 * @param **grp Pointer to resulting struct group* from the query.
1279 wbcErr
wbcCtxGetgrgid(struct wbcContext
*ctx
,
1280 gid_t gid
, struct group
**grp
);
1283 * @brief Fill in a struct passwd* for a domain user based
1286 * @param gid Uid to lookup
1287 * @param **grp Pointer to resulting struct group* from the query.
1291 wbcErr
wbcGetgrgid(gid_t gid
, struct group
**grp
);
1294 * @brief Reset the passwd iterator
1296 * @param *ctx wbclient Context
1300 wbcErr
wbcCtxSetpwent(struct wbcContext
*ctx
);
1303 * @brief Reset the passwd iterator
1307 wbcErr
wbcSetpwent(void);
1310 * @brief Close the passwd iterator
1312 * @param *ctx wbclient Context
1316 wbcErr
wbcCtxEndpwent(struct wbcContext
*ctx
);
1319 * @brief Close the passwd iterator
1323 wbcErr
wbcEndpwent(void);
1326 * @brief Return the next struct passwd* entry from the pwent iterator
1328 * @param *ctx wbclient Context
1329 * @param **pwd Pointer to resulting struct passwd* from the query.
1333 wbcErr
wbcCtxGetpwent(struct wbcContext
*ctx
, struct passwd
**pwd
);
1336 * @brief Return the next struct passwd* entry from the pwent iterator
1338 * @param **pwd Pointer to resulting struct passwd* from the query.
1342 wbcErr
wbcGetpwent(struct passwd
**pwd
);
1345 * @brief Reset the group iterator
1347 * @param *ctx wbclient Context
1351 wbcErr
wbcCtxSetgrent(struct wbcContext
*ctx
);
1354 * @brief Reset the group iterator
1358 wbcErr
wbcSetgrent(void);
1361 * @brief Close the group iterator
1363 * @param *ctx wbclient Context
1367 wbcErr
wbcCtxEndgrent(struct wbcContext
*ctx
);
1370 * @brief Close the group iterator
1374 wbcErr
wbcEndgrent(void);
1377 * @brief Return the next struct group* entry from the pwent iterator
1379 * @param *ctx wbclient Context
1380 * @param **grp Pointer to resulting struct group* from the query.
1384 wbcErr
wbcCtxGetgrent(struct wbcContext
*ctx
, struct group
**grp
);
1387 * @brief Return the next struct group* entry from the pwent iterator
1389 * @param **grp Pointer to resulting struct group* from the query.
1393 wbcErr
wbcGetgrent(struct group
**grp
);
1396 * @brief Return the next struct group* entry from the pwent iterator
1398 * This is similar to #wbcGetgrent, just that the member list is empty
1400 * @param *ctx wbclient Context
1401 * @param **grp Pointer to resulting struct group* from the query.
1405 wbcErr
wbcCtxGetgrlist(struct wbcContext
*ctx
, struct group
**grp
);
1408 * @brief Return the next struct group* entry from the pwent iterator
1410 * This is similar to #wbcGetgrent, just that the member list is empty
1412 * @param **grp Pointer to resulting struct group* from the query.
1416 wbcErr
wbcGetgrlist(struct group
**grp
);
1419 * @brief Return the unix group array belonging to the given user
1421 * @param *ctx wbclient Context
1422 * @param *account The given user name
1423 * @param *num_groups Number of elements returned in the groups array
1424 * @param **_groups Pointer to resulting gid_t array.
1428 wbcErr
wbcCtxGetGroups(struct wbcContext
*ctx
,
1429 const char *account
,
1430 uint32_t *num_groups
,
1434 * @brief Return the unix group array belonging to the given user
1436 * @param *account The given user name
1437 * @param *num_groups Number of elements returned in the groups array
1438 * @param **_groups Pointer to resulting gid_t array.
1442 wbcErr
wbcGetGroups(const char *account
,
1443 uint32_t *num_groups
,
1447 /**********************************************************
1448 * Lookup Domain information
1449 **********************************************************/
1452 * @brief Lookup the current status of a trusted domain
1454 * @param *ctx wbclient Context
1455 * @param domain The domain to query
1457 * @param dinfo A pointer to store the returned domain_info struct.
1461 wbcErr
wbcCtxDomainInfo(struct wbcContext
*ctx
,
1463 struct wbcDomainInfo
**dinfo
);
1466 * @brief Lookup the current status of a trusted domain
1468 * @param domain The domain to query
1470 * @param dinfo A pointer to store the returned domain_info struct.
1474 wbcErr
wbcDomainInfo(const char *domain
,
1475 struct wbcDomainInfo
**dinfo
);
1478 * @brief Lookup the currently contacted DCs
1480 * @param *ctx wbclient Context
1481 * @param domain The domain to query
1483 * @param num_dcs Number of DCs currently known
1484 * @param dc_names Names of the currently known DCs
1485 * @param dc_ips IP addresses of the currently known DCs
1489 wbcErr
wbcCtxDcInfo(struct wbcContext
*ctx
,
1490 const char *domain
, size_t *num_dcs
,
1491 const char ***dc_names
, const char ***dc_ips
);
1494 * @brief Lookup the currently contacted DCs
1496 * @param domain The domain to query
1498 * @param num_dcs Number of DCs currently known
1499 * @param dc_names Names of the currently known DCs
1500 * @param dc_ips IP addresses of the currently known DCs
1504 wbcErr
wbcDcInfo(const char *domain
, size_t *num_dcs
,
1505 const char ***dc_names
, const char ***dc_ips
);
1508 * @brief Enumerate the domain trusts known by Winbind
1510 * @param *ctx wbclient Context
1511 * @param **domains Pointer to the allocated domain list array
1512 * @param *num_domains Pointer to number of domains returned
1516 wbcErr
wbcCtxListTrusts(struct wbcContext
*ctx
,
1517 struct wbcDomainInfo
**domains
,
1518 size_t *num_domains
);
1521 * @brief Enumerate the domain trusts known by Winbind
1523 * @param **domains Pointer to the allocated domain list array
1524 * @param *num_domains Pointer to number of domains returned
1528 wbcErr
wbcListTrusts(struct wbcDomainInfo
**domains
,
1529 size_t *num_domains
);
1531 /* Flags for wbcLookupDomainController */
1533 #define WBC_LOOKUP_DC_FORCE_REDISCOVERY 0x00000001
1534 #define WBC_LOOKUP_DC_DS_REQUIRED 0x00000010
1535 #define WBC_LOOKUP_DC_DS_PREFERRED 0x00000020
1536 #define WBC_LOOKUP_DC_GC_SERVER_REQUIRED 0x00000040
1537 #define WBC_LOOKUP_DC_PDC_REQUIRED 0x00000080
1538 #define WBC_LOOKUP_DC_BACKGROUND_ONLY 0x00000100
1539 #define WBC_LOOKUP_DC_IP_REQUIRED 0x00000200
1540 #define WBC_LOOKUP_DC_KDC_REQUIRED 0x00000400
1541 #define WBC_LOOKUP_DC_TIMESERV_REQUIRED 0x00000800
1542 #define WBC_LOOKUP_DC_WRITABLE_REQUIRED 0x00001000
1543 #define WBC_LOOKUP_DC_GOOD_TIMESERV_PREFERRED 0x00002000
1544 #define WBC_LOOKUP_DC_AVOID_SELF 0x00004000
1545 #define WBC_LOOKUP_DC_ONLY_LDAP_NEEDED 0x00008000
1546 #define WBC_LOOKUP_DC_IS_FLAT_NAME 0x00010000
1547 #define WBC_LOOKUP_DC_IS_DNS_NAME 0x00020000
1548 #define WBC_LOOKUP_DC_TRY_NEXTCLOSEST_SITE 0x00040000
1549 #define WBC_LOOKUP_DC_DS_6_REQUIRED 0x00080000
1550 #define WBC_LOOKUP_DC_RETURN_DNS_NAME 0x40000000
1551 #define WBC_LOOKUP_DC_RETURN_FLAT_NAME 0x80000000
1554 * @brief Enumerate the domain trusts known by Winbind
1556 * @param *ctx wbclient Context
1557 * @param domain Name of the domain to query for a DC
1558 * @param flags Bit flags used to control the domain location query
1559 * @param *dc_info Pointer to the returned domain controller information
1563 wbcErr
wbcCtxLookupDomainController(struct wbcContext
*ctx
,
1566 struct wbcDomainControllerInfo
**dc_info
);
1569 * @brief Enumerate the domain trusts known by Winbind
1571 * @param domain Name of the domain to query for a DC
1572 * @param flags Bit flags used to control the domain location query
1573 * @param *dc_info Pointer to the returned domain controller information
1577 wbcErr
wbcLookupDomainController(const char *domain
,
1579 struct wbcDomainControllerInfo
**dc_info
);
1582 * @brief Get extended domain controller information
1584 * @param *ctx wbclient Context
1585 * @param domain Name of the domain to query for a DC
1586 * @param guid Guid of the domain to query for a DC
1587 * @param site Site of the domain to query for a DC
1588 * @param flags Bit flags used to control the domain location query
1589 * @param *dc_info Pointer to the returned extended domain controller information
1593 wbcErr
wbcCtxLookupDomainControllerEx(struct wbcContext
*ctx
,
1595 struct wbcGuid
*guid
,
1598 struct wbcDomainControllerInfoEx
**dc_info
);
1601 * @brief Get extended domain controller information
1603 * @param domain Name of the domain to query for a DC
1604 * @param guid Guid of the domain to query for a DC
1605 * @param site Site of the domain to query for a DC
1606 * @param flags Bit flags used to control the domain location query
1607 * @param *dc_info Pointer to the returned extended domain controller information
1611 wbcErr
wbcLookupDomainControllerEx(const char *domain
,
1612 struct wbcGuid
*guid
,
1615 struct wbcDomainControllerInfoEx
**dc_info
);
1617 /**********************************************************
1618 * Athenticate functions
1619 **********************************************************/
1622 * @brief Authenticate a username/password pair
1624 * @param *ctx wbclient Context
1625 * @param username Name of user to authenticate
1626 * @param password Clear text password os user
1630 wbcErr
wbcCtxAuthenticateUser(struct wbcContext
*ctx
,
1631 const char *username
,
1632 const char *password
);
1635 * @brief Authenticate a username/password pair
1637 * @param username Name of user to authenticate
1638 * @param password Clear text password os user
1642 wbcErr
wbcAuthenticateUser(const char *username
,
1643 const char *password
);
1646 * @brief Authenticate with more detailed information
1648 * @param *ctx wbclient Context
1649 * @param params Input parameters, WBC_AUTH_USER_LEVEL_HASH
1650 * is not supported yet
1651 * @param info Output details on WBC_ERR_SUCCESS
1652 * @param error Output details on WBC_ERR_AUTH_ERROR
1656 wbcErr
wbcCtxAuthenticateUserEx(struct wbcContext
*ctx
,
1657 const struct wbcAuthUserParams
*params
,
1658 struct wbcAuthUserInfo
**info
,
1659 struct wbcAuthErrorInfo
**error
);
1662 * @brief Authenticate with more detailed information
1664 * @param params Input parameters, WBC_AUTH_USER_LEVEL_HASH
1665 * is not supported yet
1666 * @param info Output details on WBC_ERR_SUCCESS
1667 * @param error Output details on WBC_ERR_AUTH_ERROR
1671 wbcErr
wbcAuthenticateUserEx(const struct wbcAuthUserParams
*params
,
1672 struct wbcAuthUserInfo
**info
,
1673 struct wbcAuthErrorInfo
**error
);
1676 * @brief Logon a User
1678 * @param[in] *ctx wbclient Context
1679 * @param[in] params Pointer to a wbcLogonUserParams structure
1680 * @param[out] info Pointer to a pointer to a wbcLogonUserInfo structure
1681 * @param[out] error Pointer to a pointer to a wbcAuthErrorInfo structure
1682 * @param[out] policy Pointer to a pointer to a wbcUserPasswordPolicyInfo structure
1686 wbcErr
wbcCtxLogonUser(struct wbcContext
*ctx
,
1687 const struct wbcLogonUserParams
*params
,
1688 struct wbcLogonUserInfo
**info
,
1689 struct wbcAuthErrorInfo
**error
,
1690 struct wbcUserPasswordPolicyInfo
**policy
);
1693 * @brief Logon a User
1695 * @param[in] params Pointer to a wbcLogonUserParams structure
1696 * @param[out] info Pointer to a pointer to a wbcLogonUserInfo structure
1697 * @param[out] error Pointer to a pointer to a wbcAuthErrorInfo structure
1698 * @param[out] policy Pointer to a pointer to a wbcUserPasswordPolicyInfo structure
1702 wbcErr
wbcLogonUser(const struct wbcLogonUserParams
*params
,
1703 struct wbcLogonUserInfo
**info
,
1704 struct wbcAuthErrorInfo
**error
,
1705 struct wbcUserPasswordPolicyInfo
**policy
);
1708 * @brief Trigger a logoff notification to Winbind for a specific user
1710 * @param *ctx wbclient Context
1711 * @param username Name of user to remove from Winbind's list of
1713 * @param uid Uid assigned to the username
1714 * @param ccfilename Absolute path to the Krb5 credentials cache to
1719 wbcErr
wbcCtxLogoffUser(struct wbcContext
*ctx
,
1720 const char *username
, uid_t uid
,
1721 const char *ccfilename
);
1724 * @brief Trigger a logoff notification to Winbind for a specific user
1726 * @param username Name of user to remove from Winbind's list of
1728 * @param uid Uid assigned to the username
1729 * @param ccfilename Absolute path to the Krb5 credentials cache to
1734 wbcErr
wbcLogoffUser(const char *username
,
1736 const char *ccfilename
);
1739 * @brief Trigger an extended logoff notification to Winbind for a specific user
1741 * @param *ctx wbclient Context
1742 * @param params A wbcLogoffUserParams structure
1743 * @param error User output details on error
1747 wbcErr
wbcCtxLogoffUserEx(struct wbcContext
*ctx
,
1748 const struct wbcLogoffUserParams
*params
,
1749 struct wbcAuthErrorInfo
**error
);
1752 * @brief Trigger an extended logoff notification to Winbind for a specific user
1754 * @param params A wbcLogoffUserParams structure
1755 * @param error User output details on error
1759 wbcErr
wbcLogoffUserEx(const struct wbcLogoffUserParams
*params
,
1760 struct wbcAuthErrorInfo
**error
);
1763 * @brief Change a password for a user
1765 * @param *ctx wbclient Context
1766 * @param username Name of user to authenticate
1767 * @param old_password Old clear text password of user
1768 * @param new_password New clear text password of user
1772 wbcErr
wbcCtxChangeUserPassword(struct wbcContext
*ctx
,
1773 const char *username
,
1774 const char *old_password
,
1775 const char *new_password
);
1778 * @brief Change a password for a user
1780 * @param username Name of user to authenticate
1781 * @param old_password Old clear text password of user
1782 * @param new_password New clear text password of user
1786 wbcErr
wbcChangeUserPassword(const char *username
,
1787 const char *old_password
,
1788 const char *new_password
);
1791 * @brief Change a password for a user with more detailed information upon
1794 * @param *ctx wbclient Context
1795 * @param params Input parameters
1796 * @param error User output details on WBC_ERR_PWD_CHANGE_FAILED
1797 * @param reject_reason New password reject reason on WBC_ERR_PWD_CHANGE_FAILED
1798 * @param policy Password policy output details on WBC_ERR_PWD_CHANGE_FAILED
1802 wbcErr
wbcCtxChangeUserPasswordEx(struct wbcContext
*ctx
,
1803 const struct wbcChangePasswordParams
*params
,
1804 struct wbcAuthErrorInfo
**error
,
1805 enum wbcPasswordChangeRejectReason
*reject_reason
,
1806 struct wbcUserPasswordPolicyInfo
**policy
);
1809 * @brief Change a password for a user with more detailed information upon
1812 * @param params Input parameters
1813 * @param error User output details on WBC_ERR_PWD_CHANGE_FAILED
1814 * @param reject_reason New password reject reason on WBC_ERR_PWD_CHANGE_FAILED
1815 * @param policy Password policy output details on WBC_ERR_PWD_CHANGE_FAILED
1819 wbcErr
wbcChangeUserPasswordEx(const struct wbcChangePasswordParams
*params
,
1820 struct wbcAuthErrorInfo
**error
,
1821 enum wbcPasswordChangeRejectReason
*reject_reason
,
1822 struct wbcUserPasswordPolicyInfo
**policy
);
1825 * @brief Authenticate a user with cached credentials
1827 * @param *ctx wbclient Context
1828 * @param *params Pointer to a wbcCredentialCacheParams structure
1829 * @param **info Pointer to a pointer to a wbcCredentialCacheInfo structure
1830 * @param **error Pointer to a pointer to a wbcAuthErrorInfo structure
1834 wbcErr
wbcCtxCredentialCache(struct wbcContext
*ctx
,
1835 struct wbcCredentialCacheParams
*params
,
1836 struct wbcCredentialCacheInfo
**info
,
1837 struct wbcAuthErrorInfo
**error
);
1840 * @brief Authenticate a user with cached credentials
1842 * @param *params Pointer to a wbcCredentialCacheParams structure
1843 * @param **info Pointer to a pointer to a wbcCredentialCacheInfo structure
1844 * @param **error Pointer to a pointer to a wbcAuthErrorInfo structure
1848 wbcErr
wbcCredentialCache(struct wbcCredentialCacheParams
*params
,
1849 struct wbcCredentialCacheInfo
**info
,
1850 struct wbcAuthErrorInfo
**error
);
1853 * @brief Save a password with winbind for doing wbcCredentialCache() later
1855 * @param *ctx wbclient Context
1856 * @param *user Username
1857 * @param *password Password
1861 wbcErr
wbcCtxCredentialSave(struct wbcContext
*ctx
,
1862 const char *user
, const char *password
);
1865 * @brief Save a password with winbind for doing wbcCredentialCache() later
1867 * @param *user Username
1868 * @param *password Password
1872 wbcErr
wbcCredentialSave(const char *user
, const char *password
);
1874 /**********************************************************
1876 **********************************************************/
1879 * @brief Resolve a NetbiosName via WINS
1881 * @param *ctx wbclient Context
1882 * @param name Name to resolve
1883 * @param *ip Pointer to the ip address string
1887 wbcErr
wbcCtxResolveWinsByName(struct wbcContext
*ctx
,
1888 const char *name
, char **ip
);
1891 * @brief Resolve a NetbiosName via WINS
1893 * @param name Name to resolve
1894 * @param *ip Pointer to the ip address string
1898 wbcErr
wbcResolveWinsByName(const char *name
, char **ip
);
1901 * @brief Resolve an IP address via WINS into a NetbiosName
1903 * @param *ctx wbclient Context
1904 * @param ip The ip address string
1905 * @param *name Pointer to the name
1910 wbcErr
wbcCtxResolveWinsByIP(struct wbcContext
*ctx
,
1911 const char *ip
, char **name
);
1914 * @brief Resolve an IP address via WINS into a NetbiosName
1916 * @param ip The ip address string
1917 * @param *name Pointer to the name
1922 wbcErr
wbcResolveWinsByIP(const char *ip
, char **name
);
1924 /**********************************************************
1925 * Trusted domain functions
1926 **********************************************************/
1929 * @brief Trigger a verification of the trust credentials of a specific domain
1931 * @param *ctx wbclient Context
1932 * @param *domain The name of the domain.
1933 * @param error Output details on WBC_ERR_AUTH_ERROR
1937 wbcErr
wbcCtxCheckTrustCredentials(struct wbcContext
*ctx
, const char *domain
,
1938 struct wbcAuthErrorInfo
**error
);
1941 * @brief Trigger a verification of the trust credentials of a specific domain
1943 * @param *domain The name of the domain.
1944 * @param error Output details on WBC_ERR_AUTH_ERROR
1948 wbcErr
wbcCheckTrustCredentials(const char *domain
,
1949 struct wbcAuthErrorInfo
**error
);
1952 * @brief Trigger a change of the trust credentials for a specific domain
1954 * @param *ctx wbclient Context
1955 * @param *domain The name of the domain.
1956 * @param error Output details on WBC_ERR_AUTH_ERROR
1960 wbcErr
wbcCtxChangeTrustCredentials(struct wbcContext
*ctx
, const char *domain
,
1961 struct wbcAuthErrorInfo
**error
);
1964 * @brief Trigger a change of the trust credentials for a specific domain
1966 * @param *domain The name of the domain.
1967 * @param error Output details on WBC_ERR_AUTH_ERROR
1971 wbcErr
wbcChangeTrustCredentials(const char *domain
,
1972 struct wbcAuthErrorInfo
**error
);
1975 * @brief Trigger a change of the trust credentials for a specific domain
1976 * on the optionally given domain controller
1978 * @param *ctx wbclient Context
1979 * @param *domain The name of the domain.
1980 * @param *dcname The host name of the domain controller.
1981 * @param error Output details on WBC_ERR_AUTH_ERROR
1985 * @see wbcCtxChangeTrustCredentials()
1987 wbcErr
wbcCtxChangeTrustCredentialsAt(struct wbcContext
*ctx
,
1990 struct wbcAuthErrorInfo
**error
);
1993 * @brief Trigger a change of the trust credentials for a specific domain
1994 * on the optionally given domain controller
1996 * @param *domain The name of the domain.
1997 * @param *dcname The host name of the domain controller.
1998 * @param error Output details on WBC_ERR_AUTH_ERROR
2002 * @see wbcChangeTrustCredentials()
2004 wbcErr
wbcChangeTrustCredentialsAt(const char *domain
,
2006 struct wbcAuthErrorInfo
**error
);
2009 * @brief Trigger a no-op call through the NETLOGON pipe. Low-cost
2010 * version of wbcCheckTrustCredentials
2012 * @param *ctx wbclient Context
2013 * @param *domain The name of the domain, only NULL for the default domain is
2014 * supported yet. Other values than NULL will result in
2015 * WBC_ERR_NOT_IMPLEMENTED.
2016 * @param error Output details on WBC_ERR_AUTH_ERROR
2020 wbcErr
wbcCtxPingDc(struct wbcContext
*ctx
, const char *domain
,
2021 struct wbcAuthErrorInfo
**error
);
2024 * @brief Trigger a no-op call through the NETLOGON pipe. Low-cost
2025 * version of wbcCheckTrustCredentials
2027 * @param *domain The name of the domain, only NULL for the default domain is
2028 * supported yet. Other values than NULL will result in
2029 * WBC_ERR_NOT_IMPLEMENTED.
2030 * @param error Output details on WBC_ERR_AUTH_ERROR
2034 wbcErr
wbcPingDc(const char *domain
, struct wbcAuthErrorInfo
**error
);
2037 * @brief Trigger a no-op call through the NETLOGON pipe. Low-cost
2038 * version of wbcCheckTrustCredentials
2040 * @param *ctx wbclient Context
2041 * @param *domain The name of the domain, only NULL for the default domain is
2042 * supported yet. Other values than NULL will result in
2043 * WBC_ERR_NOT_IMPLEMENTED.
2044 * @param error Output details on WBC_ERR_AUTH_ERROR
2045 * @param dcname DC that was attempted to ping
2049 wbcErr
wbcCtxPingDc2(struct wbcContext
*ctx
, const char *domain
,
2050 struct wbcAuthErrorInfo
**error
,
2054 * @brief Trigger a no-op call through the NETLOGON pipe. Low-cost
2055 * version of wbcCheckTrustCredentials
2057 * @param *domain The name of the domain, only NULL for the default domain is
2058 * supported yet. Other values than NULL will result in
2059 * WBC_ERR_NOT_IMPLEMENTED.
2060 * @param error Output details on WBC_ERR_AUTH_ERROR
2061 * @param dcname DC that was attempted to ping
2065 wbcErr
wbcPingDc2(const char *domain
, struct wbcAuthErrorInfo
**error
,
2068 /**********************************************************
2070 **********************************************************/
2073 * @brief Initialize a named blob and add to list of blobs
2075 * @param[in,out] num_blobs Pointer to the number of blobs
2076 * @param[in,out] blobs Pointer to an array of blobs
2077 * @param[in] name Name of the new named blob
2078 * @param[in] flags Flags of the new named blob
2079 * @param[in] data Blob data of new blob
2080 * @param[in] length Blob data length of new blob
2084 wbcErr
wbcAddNamedBlob(size_t *num_blobs
,
2085 struct wbcNamedBlob
**blobs
,
2092 * @brief Set the name of the process which call wbclient.
2094 * By default wbclient will figure out the process name. This should just be
2095 * used in special cases like pam modules or similar. Only alpha numeric
2096 * chars in ASCII are allowed.
2098 * This function should only be called once!
2100 * @param[in] name The process name to set.
2102 void wbcSetClientProcessName(const char *name
);
2104 #endif /* _WBCLIENT_H */