From ff011609044c2ac7b21d40f7464ec90d40459158 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Fri, 15 May 2015 11:58:05 +0200 Subject: [PATCH] libwbclient-sssd: update interface to version 0.12 --- Makefile.am | 18 +- src/conf_macros.m4 | 6 + src/sss_client/libwbclient/wbc_ctx_sssd.c | 396 ++++++++++++ src/sss_client/libwbclient/wbclient.exports | 62 +- src/sss_client/libwbclient/wbclient_sssd.h | 853 ++++++++++++++++++++++--- src/sss_client/libwbclient/wbclient_sssd.pc.in | 2 +- 6 files changed, 1233 insertions(+), 104 deletions(-) create mode 100644 src/sss_client/libwbclient/wbc_ctx_sssd.c diff --git a/Makefile.am b/Makefile.am index 8a318c2ffcaabc7c21117cef20b9621d75516382..248185aac2d3d3cafc306296a4add8429fcbbeb5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -891,7 +891,9 @@ libwbclient_LTLIBRARIES = libwbclient.la pkgconfig_DATA += src/sss_client/libwbclient/wbclient_sssd.pc EXTRA_libwbclient_la_DEPENDENCIES = \ - src/sss_client/libwbclient/wbclient.exports + src/sss_client/libwbclient/wbclient.exports \ + $(NULL) + libwbclient_la_SOURCES = \ src/sss_client/libwbclient/wbc_guid.c \ src/sss_client/libwbclient/wbc_idmap_common.c \ @@ -904,15 +906,21 @@ libwbclient_la_SOURCES = \ src/sss_client/libwbclient/wbc_sid_sssd.c \ src/sss_client/libwbclient/wbc_sssd_internal.h \ src/sss_client/libwbclient/wbc_util_common.c \ - src/sss_client/libwbclient/wbc_util_sssd.c + src/sss_client/libwbclient/wbc_util_sssd.c \ + src/sss_client/libwbclient/wbc_ctx_sssd.c \ + $(NULL) libwbclient_la_LIBADD = \ libsss_nss_idmap.la \ - $(CLIENT_LIBS) + $(CLIENT_LIBS) \ + $(NULL) + libwbclient_la_LDFLAGS = \ -Wl,--version-script,$(srcdir)/src/sss_client/libwbclient/wbclient.exports \ - -version-info 11:0:11 + -version-info @libwbclient_version_info@ \ + $(NULL) -dist_noinst_DATA += src/sss_client/libwbclient/wbclient.exports +dist_noinst_DATA += src/sss_client/libwbclient/wbclient.exports \ + $(NULL) include_HEADERS += src/sss_client/libwbclient/wbclient_sssd.h endif #BUILD_LIBWBCLIENT diff --git a/src/conf_macros.m4 b/src/conf_macros.m4 index 9ed0a4c44c209e88fc896d0cd3040cb572b358c9..86876fab8115c49f38ebef4e3037a8ba36a5b92e 100644 --- a/src/conf_macros.m4 +++ b/src/conf_macros.m4 @@ -698,6 +698,12 @@ AC_DEFUN([WITH_LIBWBCLIENT], if test x"$with_libwbclient" = xyes; then AC_DEFINE(BUILD_LIBWBCLIENT, 1, [whether to build SSSD implementation of libwbclient]) + + libwbclient_version="0.12" + AC_SUBST(libwbclient_version) + + libwbclient_version_info="12:0:12" + AC_SUBST(libwbclient_version_info) fi AM_CONDITIONAL([BUILD_LIBWBCLIENT], [test x"$with_libwbclient" = xyes]) ]) diff --git a/src/sss_client/libwbclient/wbc_ctx_sssd.c b/src/sss_client/libwbclient/wbc_ctx_sssd.c new file mode 100644 index 0000000000000000000000000000000000000000..1f259ee00e48d68d8da3f6b0abc12175a70c1f20 --- /dev/null +++ b/src/sss_client/libwbclient/wbc_ctx_sssd.c @@ -0,0 +1,396 @@ +/* + Unix SMB/CIFS implementation. + + Winbind client API - SSSD version + + Copyright (C) Sumit Bose 2015 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#include "config.h" + +#include "libwbclient.h" +#include "wbc_sssd_internal.h" + +struct wbcContext *wbcCtxCreate(void) +{ + WBC_SSSD_DEV_LOG; + return NULL; +} + +void wbcCtxFree(struct wbcContext *ctx) +{ + WBC_SSSD_DEV_LOG; + return; +} + +wbcErr wbcCtxPing(struct wbcContext *ctx) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +struct wbcContext *wbcGetGlobalCtx(void) +{ + WBC_SSSD_DEV_LOG; + return NULL; +} + +wbcErr wbcCtxInterfaceDetails(struct wbcContext *ctx, + struct wbcInterfaceDetails **details) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxLookupName(struct wbcContext *ctx, + const char *dom_name, + const char *name, + struct wbcDomainSid *sid, + enum wbcSidType *name_type) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxLookupSid(struct wbcContext *ctx, + const struct wbcDomainSid *sid, + char **domain, + char **name, + enum wbcSidType *name_type) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxLookupSids(struct wbcContext *ctx, + const struct wbcDomainSid *sids, int num_sids, + struct wbcDomainInfo **domains, int *num_domains, + struct wbcTranslatedName **names) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxLookupRids(struct wbcContext *ctx, + struct wbcDomainSid *dom_sid, + int num_rids, + uint32_t *rids, + const char **domain_name, + const char ***names, + enum wbcSidType **types) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxLookupUserSids(struct wbcContext *ctx, + const struct wbcDomainSid *user_sid, + bool domain_groups_only, + uint32_t *num_sids, + struct wbcDomainSid **sids) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxGetSidAliases(struct wbcContext *ctx, + const struct wbcDomainSid *dom_sid, + struct wbcDomainSid *sids, + uint32_t num_sids, + uint32_t **alias_rids, + uint32_t *num_alias_rids) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxListUsers(struct wbcContext *ctx, + const char *domain_name, + uint32_t *num_users, + const char ***users) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxListGroups(struct wbcContext *ctx, + const char *domain_name, + uint32_t *num_groups, + const char ***groups) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxGetDisplayName(struct wbcContext *ctx, + const struct wbcDomainSid *sid, + char **pdomain, + char **pfullname, + enum wbcSidType *pname_type) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxSidToUid(struct wbcContext *ctx, + const struct wbcDomainSid *sid, + uid_t *puid) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxUidToSid(struct wbcContext *ctx, uid_t uid, + struct wbcDomainSid *sid) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxSidToGid(struct wbcContext *ctx, + const struct wbcDomainSid *sid, + gid_t *pgid) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxGidToSid(struct wbcContext *ctx, gid_t gid, + struct wbcDomainSid *sid) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxSidsToUnixIds(struct wbcContext *ctx, + const struct wbcDomainSid *sids, uint32_t num_sids, + struct wbcUnixId *ids) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxAllocateUid(struct wbcContext *ctx, uid_t *puid) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxAllocateGid(struct wbcContext *ctx, gid_t *pgid) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxGetpwnam(struct wbcContext *ctx, + const char *name, struct passwd **pwd) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxGetpwuid(struct wbcContext *ctx, + uid_t uid, struct passwd **pwd) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxGetpwsid(struct wbcContext *ctx, + struct wbcDomainSid * sid, struct passwd **pwd) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxGetgrnam(struct wbcContext *ctx, + const char *name, struct group **grp) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxGetgrgid(struct wbcContext *ctx, + gid_t gid, struct group **grp) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxSetpwent(struct wbcContext *ctx) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxEndpwent(struct wbcContext *ctx) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxGetpwent(struct wbcContext *ctx, struct passwd **pwd) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxSetgrent(struct wbcContext *ctx) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxEndgrent(struct wbcContext *ctx) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxGetgrent(struct wbcContext *ctx, struct group **grp) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxGetgrlist(struct wbcContext *ctx, struct group **grp) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxGetGroups(struct wbcContext *ctx, + const char *account, + uint32_t *num_groups, + gid_t **_groups) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxDomainInfo(struct wbcContext *ctx, + const char *domain, + struct wbcDomainInfo **dinfo) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxDcInfo(struct wbcContext *ctx, + const char *domain, size_t *num_dcs, + const char ***dc_names, const char ***dc_ips) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxListTrusts(struct wbcContext *ctx, + struct wbcDomainInfo **domains, + size_t *num_domains) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxLookupDomainController(struct wbcContext *ctx, + const char *domain, + uint32_t flags, + struct wbcDomainControllerInfo **dc_info) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxLookupDomainControllerEx(struct wbcContext *ctx, + const char *domain, + struct wbcGuid *guid, + const char *site, + uint32_t flags, + struct wbcDomainControllerInfoEx **dc_info) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxAuthenticateUser(struct wbcContext *ctx, + const char *username, + const char *password) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxAuthenticateUserEx(struct wbcContext *ctx, + const struct wbcAuthUserParams *params, + struct wbcAuthUserInfo **info, + struct wbcAuthErrorInfo **error) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxLogonUser(struct wbcContext *ctx, + const struct wbcLogonUserParams *params, + struct wbcLogonUserInfo **info, + struct wbcAuthErrorInfo **error, + struct wbcUserPasswordPolicyInfo **policy) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxLogoffUser(struct wbcContext *ctx, + const char *username, uid_t uid, + const char *ccfilename) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxLogoffUserEx(struct wbcContext *ctx, + const struct wbcLogoffUserParams *params, + struct wbcAuthErrorInfo **error) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxChangeUserPassword(struct wbcContext *ctx, + const char *username, + const char *old_password, + const char *new_password) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxChangeUserPasswordEx(struct wbcContext *ctx, + const struct wbcChangePasswordParams *params, + struct wbcAuthErrorInfo **error, + enum wbcPasswordChangeRejectReason *reject_reason, + struct wbcUserPasswordPolicyInfo **policy) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxCredentialCache(struct wbcContext *ctx, + struct wbcCredentialCacheParams *params, + struct wbcCredentialCacheInfo **info, + struct wbcAuthErrorInfo **error) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxCredentialSave(struct wbcContext *ctx, + const char *user, const char *password) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxResolveWinsByName(struct wbcContext *ctx, + const char *name, char **ip) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxResolveWinsByIP(struct wbcContext *ctx, + const char *ip, char **name) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxCheckTrustCredentials(struct wbcContext *ctx, const char *domain, + struct wbcAuthErrorInfo **error) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxChangeTrustCredentials(struct wbcContext *ctx, const char *domain, + struct wbcAuthErrorInfo **error) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxPingDc(struct wbcContext *ctx, const char *domain, + struct wbcAuthErrorInfo **error) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} + +wbcErr wbcCtxPingDc2(struct wbcContext *ctx, const char *domain, + struct wbcAuthErrorInfo **error, + char **dcname) +{ + WBC_SSSD_NOT_IMPLEMENTED; +} diff --git a/src/sss_client/libwbclient/wbclient.exports b/src/sss_client/libwbclient/wbclient.exports index a3cd1165b9a18ae9b2bb9f782c32d8a7f8b189af..574c1d1fe232fad0a4c104de086977515a05ab84 100644 --- a/src/sss_client/libwbclient/wbclient.exports +++ b/src/sss_client/libwbclient/wbclient.exports @@ -83,8 +83,64 @@ WBCLIENT_0.10 { } WBCLIENT_0.9; WBCLIENT_0.11 { - global: - wbc*; local: *; -}; +} WBCLIENT_0.10; + +WBCLIENT_0.12 { + global: + wbcCtxCreate; + wbcCtxFree; + wbcGetGlobalCtx; + wbcCtxPing; + wbcCtxInterfaceDetails; + wbcCtxLookupName; + wbcCtxLookupSid; + wbcCtxLookupSids; + wbcCtxLookupRids; + wbcCtxLookupUserSids; + wbcCtxGetSidAliases; + wbcCtxListUsers; + wbcCtxListGroups; + wbcCtxGetDisplayName; + wbcCtxSidToUid; + wbcCtxUidToSid; + wbcCtxSidToGid; + wbcCtxGidToSid; + wbcCtxSidsToUnixIds; + wbcCtxAllocateUid; + wbcCtxAllocateGid; + wbcCtxGetpwnam; + wbcCtxGetpwuid; + wbcCtxGetpwsid; + wbcCtxGetgrnam; + wbcCtxGetgrgid; + wbcCtxSetpwent; + wbcCtxEndpwent; + wbcCtxGetpwent; + wbcCtxSetgrent; + wbcCtxEndgrent; + wbcCtxGetgrent; + wbcCtxGetgrlist; + wbcCtxGetGroups; + wbcCtxDomainInfo; + wbcCtxDcInfo; + wbcCtxListTrusts; + wbcCtxLookupDomainController; + wbcCtxLookupDomainControllerEx; + wbcCtxAuthenticateUser; + wbcCtxAuthenticateUserEx; + wbcCtxLogonUser; + wbcCtxLogoffUser; + wbcCtxLogoffUserEx; + wbcCtxChangeUserPassword; + wbcCtxChangeUserPasswordEx; + wbcCtxCredentialCache; + wbcCtxCredentialSave; + wbcCtxResolveWinsByName; + wbcCtxResolveWinsByIP; + wbcCtxCheckTrustCredentials; + wbcCtxChangeTrustCredentials; + wbcCtxPingDc; + wbcCtxPingDc2; +} WBCLIENT_0.11; diff --git a/src/sss_client/libwbclient/wbclient_sssd.h b/src/sss_client/libwbclient/wbclient_sssd.h index 4f0e957a7e29cb1fde9e5349ae49f5b9f252bc2d..ec6d032814445bff0819b4de0df07ccf4008aefc 100644 --- a/src/sss_client/libwbclient/wbclient_sssd.h +++ b/src/sss_client/libwbclient/wbclient_sssd.h @@ -5,6 +5,7 @@ Copyright (C) Gerald (Jerry) Carter 2007 Copyright (C) Volker Lendecke 2009 + Copyright (C) Matthew Newton 2015 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -71,9 +72,10 @@ const char *wbcErrorString(wbcErr error); * 0.9: Added support for WBC_ID_TYPE_BOTH * 0.10: Added wbcPingDc2() * 0.11: Extended wbcAuthenticateUserEx to provide PAC parsing + * 0.12: Added wbcCtxCreate and friends **/ #define WBCLIENT_MAJOR_VERSION 0 -#define WBCLIENT_MINOR_VERSION 11 +#define WBCLIENT_MINOR_VERSION 12 #define WBCLIENT_VENDOR_VERSION "Samba libwbclient" struct wbcLibraryDetails { uint16_t major_version; @@ -94,6 +96,13 @@ struct wbcInterfaceDetails { char *dns_domain; }; +/** + * @brief Library context data + * + **/ + +struct wbcContext; + /* * Data types used by the Winbind Client API */ @@ -523,6 +532,28 @@ struct wbcDomainControllerInfoEx { void wbcFreeMemory(void*); +/********************************************************** + * Context Management + **********************************************************/ + +/** + * @brief Create a new wbcContext context + * + * @return wbcContext + **/ +struct wbcContext *wbcCtxCreate(void); + +/** + * @brief Free a library context + * + * @param ctx wbcContext to free + * + * @return void + **/ +void wbcCtxFree(struct wbcContext *ctx); + + + /* * Utility functions for dealing with SIDs */ @@ -558,7 +589,7 @@ int wbcSidToStringBuf(const struct wbcDomainSid *sid, char *buf, int buflen); * @return #wbcErr **/ wbcErr wbcSidToString(const struct wbcDomainSid *sid, - char **sid_string); + char **sid_string); /** * @brief Convert a character string to a binary SID @@ -569,7 +600,7 @@ wbcErr wbcSidToString(const struct wbcDomainSid *sid, * @return #wbcErr **/ wbcErr wbcStringToSid(const char *sid_string, - struct wbcDomainSid *sid); + struct wbcDomainSid *sid); /* * Utility functions for dealing with GUIDs @@ -584,7 +615,7 @@ wbcErr wbcStringToSid(const char *sid_string, * @return #wbcErr **/ wbcErr wbcGuidToString(const struct wbcGuid *guid, - char **guid_string); + char **guid_string); /** * @brief Convert a character string to a binary GUID @@ -595,7 +626,16 @@ wbcErr wbcGuidToString(const struct wbcGuid *guid, * @return #wbcErr **/ wbcErr wbcStringToGuid(const char *guid_string, - struct wbcGuid *guid); + struct wbcGuid *guid); + +/** + * @brief Ping winbindd to see if the daemon is running + * + * @param *ctx wbclient Context + * + * @return #wbcErr + **/ +wbcErr wbcCtxPing(struct wbcContext *ctx); /** * @brief Ping winbindd to see if the daemon is running @@ -606,6 +646,8 @@ wbcErr wbcPing(void); wbcErr wbcLibraryDetails(struct wbcLibraryDetails **details); +wbcErr wbcCtxInterfaceDetails(struct wbcContext *ctx, + struct wbcInterfaceDetails **details); wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **details); /********************************************************** @@ -615,6 +657,23 @@ wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **details); /** * @brief Convert a domain and name to SID * + * @param *ctx wbclient Context + * @param dom_name Domain name (possibly "") + * @param name User or group name + * @param *sid Pointer to the resolved domain SID + * @param *name_type Pointer to the SID type + * + * @return #wbcErr + **/ +wbcErr wbcCtxLookupName(struct wbcContext *ctx, + const char *dom_name, + const char *name, + struct wbcDomainSid *sid, + enum wbcSidType *name_type); + +/** + * @brief Convert a domain and name to SID + * * @param dom_name Domain name (possibly "") * @param name User or group name * @param *sid Pointer to the resolved domain SID @@ -623,14 +682,31 @@ wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **details); * @return #wbcErr **/ wbcErr wbcLookupName(const char *dom_name, - const char *name, - struct wbcDomainSid *sid, - enum wbcSidType *name_type); + const char *name, + struct wbcDomainSid *sid, + enum wbcSidType *name_type); /** * @brief Convert a SID to a domain and name * - * @param *sid Pointer to the domain SID to be resolved + * @param *ctx wbclient Context + * @param *sid Pointer to the domain SID to be resolved + * @param domain Resolved Domain name (possibly "") + * @param name Resolved User or group name + * @param *name_type Pointer to the resolved SID type + * + * @return #wbcErr + **/ +wbcErr wbcCtxLookupSid(struct wbcContext *ctx, + const struct wbcDomainSid *sid, + char **domain, + char **name, + enum wbcSidType *name_type); + +/** + * @brief Convert a SID to a domain and name + * + * @param *sid Pointer to the domain SID to be resolved * @param domain Resolved Domain name (possibly "") * @param name Resolved User or group name * @param *name_type Pointer to the resolved SID type @@ -638,65 +714,122 @@ wbcErr wbcLookupName(const char *dom_name, * @return #wbcErr **/ wbcErr wbcLookupSid(const struct wbcDomainSid *sid, - char **domain, - char **name, - enum wbcSidType *name_type); + char **domain, + char **name, + enum wbcSidType *name_type); struct wbcTranslatedName { - enum wbcSidType type; - char *name; - int domain_index; + enum wbcSidType type; + char *name; + int domain_index; }; +wbcErr wbcCtxLookupSids(struct wbcContext *ctx, + const struct wbcDomainSid *sids, int num_sids, + struct wbcDomainInfo **domains, int *num_domains, + struct wbcTranslatedName **names); + wbcErr wbcLookupSids(const struct wbcDomainSid *sids, int num_sids, - struct wbcDomainInfo **domains, int *num_domains, - struct wbcTranslatedName **names); + struct wbcDomainInfo **domains, int *num_domains, + struct wbcTranslatedName **names); + +/** + * @brief Translate a collection of RIDs within a domain to names + */ +wbcErr wbcCtxLookupRids(struct wbcContext *ctx, + struct wbcDomainSid *dom_sid, + int num_rids, + uint32_t *rids, + const char **domain_name, + const char ***names, + enum wbcSidType **types); /** * @brief Translate a collection of RIDs within a domain to names */ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, - int num_rids, - uint32_t *rids, - const char **domain_name, - const char ***names, - enum wbcSidType **types); + int num_rids, + uint32_t *rids, + const char **domain_name, + const char ***names, + enum wbcSidType **types); + +/* + * @brief Get the groups a user belongs to + **/ +wbcErr wbcCtxLookupUserSids(struct wbcContext *ctx, + const struct wbcDomainSid *user_sid, + bool domain_groups_only, + uint32_t *num_sids, + struct wbcDomainSid **sids); /* * @brief Get the groups a user belongs to **/ wbcErr wbcLookupUserSids(const struct wbcDomainSid *user_sid, - bool domain_groups_only, - uint32_t *num_sids, - struct wbcDomainSid **sids); + bool domain_groups_only, + uint32_t *num_sids, + struct wbcDomainSid **sids); + +/* + * @brief Get alias membership for sids + **/ +wbcErr wbcCtxGetSidAliases(struct wbcContext *ctx, + const struct wbcDomainSid *dom_sid, + struct wbcDomainSid *sids, + uint32_t num_sids, + uint32_t **alias_rids, + uint32_t *num_alias_rids); /* * @brief Get alias membership for sids **/ wbcErr wbcGetSidAliases(const struct wbcDomainSid *dom_sid, - struct wbcDomainSid *sids, - uint32_t num_sids, - uint32_t **alias_rids, - uint32_t *num_alias_rids); + struct wbcDomainSid *sids, + uint32_t num_sids, + uint32_t **alias_rids, + uint32_t *num_alias_rids); + +/** + * @brief Lists Users + **/ +wbcErr wbcCtxListUsers(struct wbcContext *ctx, + const char *domain_name, + uint32_t *num_users, + const char ***users); /** * @brief Lists Users **/ wbcErr wbcListUsers(const char *domain_name, - uint32_t *num_users, - const char ***users); + uint32_t *num_users, + const char ***users); + +/** + * @brief Lists Groups + **/ +wbcErr wbcCtxListGroups(struct wbcContext *ctx, + const char *domain_name, + uint32_t *num_groups, + const char ***groups); /** * @brief Lists Groups **/ wbcErr wbcListGroups(const char *domain_name, - uint32_t *num_groups, - const char ***groups); + uint32_t *num_groups, + const char ***groups); + +wbcErr wbcCtxGetDisplayName(struct wbcContext *ctx, + const struct wbcDomainSid *sid, + char **pdomain, + char **pfullname, + enum wbcSidType *pname_type); wbcErr wbcGetDisplayName(const struct wbcDomainSid *sid, - char **pdomain, - char **pfullname, - enum wbcSidType *pname_type); + char **pdomain, + char **pfullname, + enum wbcSidType *pname_type); /********************************************************** * SID/uid/gid Mappings @@ -705,6 +838,20 @@ wbcErr wbcGetDisplayName(const struct wbcDomainSid *sid, /** * @brief Convert a Windows SID to a Unix uid, allocating an uid if needed * + * @param *ctx wbclient Context + * @param *sid Pointer to the domain SID to be resolved + * @param *puid Pointer to the resolved uid_t value + * + * @return #wbcErr + * + **/ +wbcErr wbcCtxSidToUid(struct wbcContext *ctx, + const struct wbcDomainSid *sid, + uid_t *puid); + +/** + * @brief Convert a Windows SID to a Unix uid, allocating an uid if needed + * * @param *sid Pointer to the domain SID to be resolved * @param *puid Pointer to the resolved uid_t value * @@ -712,7 +859,7 @@ wbcErr wbcGetDisplayName(const struct wbcDomainSid *sid, * **/ wbcErr wbcSidToUid(const struct wbcDomainSid *sid, - uid_t *puid); + uid_t *puid); /** * @brief Convert a Windows SID to a Unix uid if there already is a mapping @@ -724,7 +871,20 @@ wbcErr wbcSidToUid(const struct wbcDomainSid *sid, * **/ wbcErr wbcQuerySidToUid(const struct wbcDomainSid *sid, - uid_t *puid); + uid_t *puid); + +/** + * @brief Convert a Unix uid to a Windows SID, allocating a SID if needed + * + * @param *ctx wbclient Context + * @param uid Unix uid to be resolved + * @param *sid Pointer to the resolved domain SID + * + * @return #wbcErr + * + **/ +wbcErr wbcCtxUidToSid(struct wbcContext *ctx, uid_t uid, + struct wbcDomainSid *sid); /** * @brief Convert a Unix uid to a Windows SID, allocating a SID if needed @@ -736,7 +896,7 @@ wbcErr wbcQuerySidToUid(const struct wbcDomainSid *sid, * **/ wbcErr wbcUidToSid(uid_t uid, - struct wbcDomainSid *sid); + struct wbcDomainSid *sid); /** * @brief Convert a Unix uid to a Windows SID if there already is a mapping @@ -748,7 +908,21 @@ wbcErr wbcUidToSid(uid_t uid, * **/ wbcErr wbcQueryUidToSid(uid_t uid, - struct wbcDomainSid *sid); + struct wbcDomainSid *sid); + +/** + * @brief Convert a Windows SID to a Unix gid, allocating a gid if needed + * + * @param *ctx wbclient Context + * @param *sid Pointer to the domain SID to be resolved + * @param *pgid Pointer to the resolved gid_t value + * + * @return #wbcErr + * + **/ +wbcErr wbcCtxSidToGid(struct wbcContext *ctx, + const struct wbcDomainSid *sid, + gid_t *pgid); /** * @brief Convert a Windows SID to a Unix gid, allocating a gid if needed @@ -760,7 +934,7 @@ wbcErr wbcQueryUidToSid(uid_t uid, * **/ wbcErr wbcSidToGid(const struct wbcDomainSid *sid, - gid_t *pgid); + gid_t *pgid); /** * @brief Convert a Windows SID to a Unix gid if there already is a mapping @@ -772,7 +946,20 @@ wbcErr wbcSidToGid(const struct wbcDomainSid *sid, * **/ wbcErr wbcQuerySidToGid(const struct wbcDomainSid *sid, - gid_t *pgid); + gid_t *pgid); + +/** + * @brief Convert a Unix gid to a Windows SID, allocating a SID if needed + * + * @param *ctx wbclient Context + * @param gid Unix gid to be resolved + * @param *sid Pointer to the resolved domain SID + * + * @return #wbcErr + * + **/ +wbcErr wbcCtxGidToSid(struct wbcContext *ctx, gid_t gid, + struct wbcDomainSid *sid); /** * @brief Convert a Unix gid to a Windows SID, allocating a SID if needed @@ -784,7 +971,7 @@ wbcErr wbcQuerySidToGid(const struct wbcDomainSid *sid, * **/ wbcErr wbcGidToSid(gid_t gid, - struct wbcDomainSid *sid); + struct wbcDomainSid *sid); /** * @brief Convert a Unix gid to a Windows SID if there already is a mapping @@ -796,28 +983,43 @@ wbcErr wbcGidToSid(gid_t gid, * **/ wbcErr wbcQueryGidToSid(gid_t gid, - struct wbcDomainSid *sid); + struct wbcDomainSid *sid); enum wbcIdType { - WBC_ID_TYPE_NOT_SPECIFIED, - WBC_ID_TYPE_UID, - WBC_ID_TYPE_GID, - WBC_ID_TYPE_BOTH + WBC_ID_TYPE_NOT_SPECIFIED, + WBC_ID_TYPE_UID, + WBC_ID_TYPE_GID, + WBC_ID_TYPE_BOTH }; union wbcUnixIdContainer { - uid_t uid; - gid_t gid; + uid_t uid; + gid_t gid; }; struct wbcUnixId { - enum wbcIdType type; - union wbcUnixIdContainer id; + enum wbcIdType type; + union wbcUnixIdContainer id; }; /** * @brief Convert a list of sids to unix ids * + * @param *ctx wbclient Context + * @param sids Pointer to an array of SIDs to convert + * @param num_sids Number of SIDs + * @param ids Preallocated output array for translated IDs + * + * @return #wbcErr + * + **/ +wbcErr wbcCtxSidsToUnixIds(struct wbcContext *ctx, + const struct wbcDomainSid *sids, uint32_t num_sids, + struct wbcUnixId *ids); + +/** + * @brief Convert a list of sids to unix ids + * * @param sids Pointer to an array of SIDs to convert * @param num_sids Number of SIDs * @param ids Preallocated output array for translated IDs @@ -826,12 +1028,22 @@ struct wbcUnixId { * **/ wbcErr wbcSidsToUnixIds(const struct wbcDomainSid *sids, uint32_t num_sids, - struct wbcUnixId *ids); + struct wbcUnixId *ids); /** * @brief Obtain a new uid from Winbind * - * @param *puid *pointer to the allocated uid + * @param *ctx wbclient Context + * @param *puid Pointer to the allocated uid + * + * @return #wbcErr + **/ +wbcErr wbcCtxAllocateUid(struct wbcContext *ctx, uid_t *puid); + +/** + * @brief Obtain a new uid from Winbind + * + * @param *puid Pointer to the allocated uid * * @return #wbcErr **/ @@ -840,7 +1052,17 @@ wbcErr wbcAllocateUid(uid_t *puid); /** * @brief Obtain a new gid from Winbind * - * @param *pgid Pointer to the allocated gid + * @param *ctx wbclient Context + * @param *pgid Pointer to the allocated gid + * + * @return #wbcErr + **/ +wbcErr wbcCtxAllocateGid(struct wbcContext *ctx, gid_t *pgid); + +/** + * @brief Obtain a new gid from Winbind + * + * @param *pgid Pointer to the allocated gid * * @return #wbcErr **/ @@ -930,6 +1152,19 @@ wbcErr wbcSetGidHwm(gid_t gid_hwm); * @brief Fill in a struct passwd* for a domain user based * on username * + * @param *ctx wbclient Context + * @param *name Username to lookup + * @param **pwd Pointer to resulting struct passwd* from the query. + * + * @return #wbcErr + **/ +wbcErr wbcCtxGetpwnam(struct wbcContext *ctx, + const char *name, struct passwd **pwd); + +/** + * @brief Fill in a struct passwd* for a domain user based + * on username + * * @param *name Username to lookup * @param **pwd Pointer to resulting struct passwd* from the query. * @@ -941,6 +1176,19 @@ wbcErr wbcGetpwnam(const char *name, struct passwd **pwd); * @brief Fill in a struct passwd* for a domain user based * on uid * + * @param *ctx wbclient Context + * @param uid Uid to lookup + * @param **pwd Pointer to resulting struct passwd* from the query. + * + * @return #wbcErr + **/ +wbcErr wbcCtxGetpwuid(struct wbcContext *ctx, + uid_t uid, struct passwd **pwd); + +/** + * @brief Fill in a struct passwd* for a domain user based + * on uid + * * @param uid Uid to lookup * @param **pwd Pointer to resulting struct passwd* from the query. * @@ -952,6 +1200,19 @@ wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd); * @brief Fill in a struct passwd* for a domain user based * on sid * + * @param *ctx wbclient Context + * @param sid Sid to lookup + * @param **pwd Pointer to resulting struct passwd* from the query. + * + * @return #wbcErr + **/ +wbcErr wbcCtxGetpwsid(struct wbcContext *ctx, + struct wbcDomainSid * sid, struct passwd **pwd); + +/** + * @brief Fill in a struct passwd* for a domain user based + * on sid + * * @param sid Sid to lookup * @param **pwd Pointer to resulting struct passwd* from the query. * @@ -963,6 +1224,19 @@ wbcErr wbcGetpwsid(struct wbcDomainSid * sid, struct passwd **pwd); * @brief Fill in a struct passwd* for a domain user based * on username * + * @param *ctx wbclient Context + * @param *name Username to lookup + * @param **grp Pointer to resulting struct group* from the query. + * + * @return #wbcErr + **/ +wbcErr wbcCtxGetgrnam(struct wbcContext *ctx, + const char *name, struct group **grp); + +/** + * @brief Fill in a struct passwd* for a domain user based + * on username + * * @param *name Username to lookup * @param **grp Pointer to resulting struct group* from the query. * @@ -974,6 +1248,19 @@ wbcErr wbcGetgrnam(const char *name, struct group **grp); * @brief Fill in a struct passwd* for a domain user based * on uid * + * @param *ctx wbclient Context + * @param gid Uid to lookup + * @param **grp Pointer to resulting struct group* from the query. + * + * @return #wbcErr + **/ +wbcErr wbcCtxGetgrgid(struct wbcContext *ctx, + gid_t gid, struct group **grp); + +/** + * @brief Fill in a struct passwd* for a domain user based + * on uid + * * @param gid Uid to lookup * @param **grp Pointer to resulting struct group* from the query. * @@ -984,6 +1271,15 @@ wbcErr wbcGetgrgid(gid_t gid, struct group **grp); /** * @brief Reset the passwd iterator * + * @param *ctx wbclient Context + * + * @return #wbcErr + **/ +wbcErr wbcCtxSetpwent(struct wbcContext *ctx); + +/** + * @brief Reset the passwd iterator + * * @return #wbcErr **/ wbcErr wbcSetpwent(void); @@ -991,6 +1287,15 @@ wbcErr wbcSetpwent(void); /** * @brief Close the passwd iterator * + * @param *ctx wbclient Context + * + * @return #wbcErr + **/ +wbcErr wbcCtxEndpwent(struct wbcContext *ctx); + +/** + * @brief Close the passwd iterator + * * @return #wbcErr **/ wbcErr wbcEndpwent(void); @@ -998,7 +1303,17 @@ wbcErr wbcEndpwent(void); /** * @brief Return the next struct passwd* entry from the pwent iterator * - * @param **pwd Pointer to resulting struct passwd* from the query. + * @param *ctx wbclient Context + * @param **pwd Pointer to resulting struct passwd* from the query. + * + * @return #wbcErr + **/ +wbcErr wbcCtxGetpwent(struct wbcContext *ctx, struct passwd **pwd); + +/** + * @brief Return the next struct passwd* entry from the pwent iterator + * + * @param **pwd Pointer to resulting struct passwd* from the query. * * @return #wbcErr **/ @@ -1007,6 +1322,15 @@ wbcErr wbcGetpwent(struct passwd **pwd); /** * @brief Reset the group iterator * + * @param *ctx wbclient Context + * + * @return #wbcErr + **/ +wbcErr wbcCtxSetgrent(struct wbcContext *ctx); + +/** + * @brief Reset the group iterator + * * @return #wbcErr **/ wbcErr wbcSetgrent(void); @@ -1014,6 +1338,15 @@ wbcErr wbcSetgrent(void); /** * @brief Close the group iterator * + * @param *ctx wbclient Context + * + * @return #wbcErr + **/ +wbcErr wbcCtxEndgrent(struct wbcContext *ctx); + +/** + * @brief Close the group iterator + * * @return #wbcErr **/ wbcErr wbcEndgrent(void); @@ -1021,7 +1354,17 @@ wbcErr wbcEndgrent(void); /** * @brief Return the next struct group* entry from the pwent iterator * - * @param **grp Pointer to resulting struct group* from the query. + * @param *ctx wbclient Context + * @param **grp Pointer to resulting struct group* from the query. + * + * @return #wbcErr + **/ +wbcErr wbcCtxGetgrent(struct wbcContext *ctx, struct group **grp); + +/** + * @brief Return the next struct group* entry from the pwent iterator + * + * @param **grp Pointer to resulting struct group* from the query. * * @return #wbcErr **/ @@ -1032,7 +1375,19 @@ wbcErr wbcGetgrent(struct group **grp); * * This is similar to #wbcGetgrent, just that the member list is empty * - * @param **grp Pointer to resulting struct group* from the query. + * @param *ctx wbclient Context + * @param **grp Pointer to resulting struct group* from the query. + * + * @return #wbcErr + **/ +wbcErr wbcCtxGetgrlist(struct wbcContext *ctx, struct group **grp); + +/** + * @brief Return the next struct group* entry from the pwent iterator + * + * This is similar to #wbcGetgrent, just that the member list is empty + * + * @param **grp Pointer to resulting struct group* from the query. * * @return #wbcErr **/ @@ -1041,6 +1396,21 @@ wbcErr wbcGetgrlist(struct group **grp); /** * @brief Return the unix group array belonging to the given user * + * @param *ctx wbclient Context + * @param *account The given user name + * @param *num_groups Number of elements returned in the groups array + * @param **_groups Pointer to resulting gid_t array. + * + * @return #wbcErr + **/ +wbcErr wbcCtxGetGroups(struct wbcContext *ctx, + const char *account, + uint32_t *num_groups, + gid_t **_groups); + +/** + * @brief Return the unix group array belonging to the given user + * * @param *account The given user name * @param *num_groups Number of elements returned in the groups array * @param **_groups Pointer to resulting gid_t array. @@ -1048,8 +1418,8 @@ wbcErr wbcGetgrlist(struct group **grp); * @return #wbcErr **/ wbcErr wbcGetGroups(const char *account, - uint32_t *num_groups, - gid_t **_groups); + uint32_t *num_groups, + gid_t **_groups); /********************************************************** @@ -1059,14 +1429,44 @@ wbcErr wbcGetGroups(const char *account, /** * @brief Lookup the current status of a trusted domain * - * @param domain The domain to query + * @param *ctx wbclient Context + * @param domain The domain to query + * + * @param dinfo A pointer to store the returned domain_info struct. + * + * @return #wbcErr + **/ +wbcErr wbcCtxDomainInfo(struct wbcContext *ctx, + const char *domain, + struct wbcDomainInfo **dinfo); + +/** + * @brief Lookup the current status of a trusted domain + * + * @param domain The domain to query * * @param dinfo A pointer to store the returned domain_info struct. * * @return #wbcErr **/ wbcErr wbcDomainInfo(const char *domain, - struct wbcDomainInfo **dinfo); + struct wbcDomainInfo **dinfo); + +/** + * @brief Lookup the currently contacted DCs + * + * @param *ctx wbclient Context + * @param domain The domain to query + * + * @param num_dcs Number of DCs currently known + * @param dc_names Names of the currently known DCs + * @param dc_ips IP addresses of the currently known DCs + * + * @return #wbcErr + **/ +wbcErr wbcCtxDcInfo(struct wbcContext *ctx, + const char *domain, size_t *num_dcs, + const char ***dc_names, const char ***dc_ips); /** * @brief Lookup the currently contacted DCs @@ -1080,7 +1480,20 @@ wbcErr wbcDomainInfo(const char *domain, * @return #wbcErr **/ wbcErr wbcDcInfo(const char *domain, size_t *num_dcs, - const char ***dc_names, const char ***dc_ips); + const char ***dc_names, const char ***dc_ips); + +/** + * @brief Enumerate the domain trusts known by Winbind + * + * @param *ctx wbclient Context + * @param **domains Pointer to the allocated domain list array + * @param *num_domains Pointer to number of domains returned + * + * @return #wbcErr + **/ +wbcErr wbcCtxListTrusts(struct wbcContext *ctx, + struct wbcDomainInfo **domains, + size_t *num_domains); /** * @brief Enumerate the domain trusts known by Winbind @@ -1091,7 +1504,7 @@ wbcErr wbcDcInfo(const char *domain, size_t *num_dcs, * @return #wbcErr **/ wbcErr wbcListTrusts(struct wbcDomainInfo **domains, - size_t *num_domains); + size_t *num_domains); /* Flags for wbcLookupDomainController */ @@ -1118,6 +1531,21 @@ wbcErr wbcListTrusts(struct wbcDomainInfo **domains, /** * @brief Enumerate the domain trusts known by Winbind * + * @param *ctx wbclient Context + * @param domain Name of the domain to query for a DC + * @param flags Bit flags used to control the domain location query + * @param *dc_info Pointer to the returned domain controller information + * + * @return #wbcErr + **/ +wbcErr wbcCtxLookupDomainController(struct wbcContext *ctx, + const char *domain, + uint32_t flags, + struct wbcDomainControllerInfo **dc_info); + +/** + * @brief Enumerate the domain trusts known by Winbind + * * @param domain Name of the domain to query for a DC * @param flags Bit flags used to control the domain location query * @param *dc_info Pointer to the returned domain controller information @@ -1125,8 +1553,27 @@ wbcErr wbcListTrusts(struct wbcDomainInfo **domains, * @return #wbcErr **/ wbcErr wbcLookupDomainController(const char *domain, - uint32_t flags, - struct wbcDomainControllerInfo **dc_info); + uint32_t flags, + struct wbcDomainControllerInfo **dc_info); + +/** + * @brief Get extended domain controller information + * + * @param *ctx wbclient Context + * @param domain Name of the domain to query for a DC + * @param guid Guid of the domain to query for a DC + * @param site Site of the domain to query for a DC + * @param flags Bit flags used to control the domain location query + * @param *dc_info Pointer to the returned extended domain controller information + * + * @return #wbcErr + **/ +wbcErr wbcCtxLookupDomainControllerEx(struct wbcContext *ctx, + const char *domain, + struct wbcGuid *guid, + const char *site, + uint32_t flags, + struct wbcDomainControllerInfoEx **dc_info); /** * @brief Get extended domain controller information @@ -1140,10 +1587,10 @@ wbcErr wbcLookupDomainController(const char *domain, * @return #wbcErr **/ wbcErr wbcLookupDomainControllerEx(const char *domain, - struct wbcGuid *guid, - const char *site, - uint32_t flags, - struct wbcDomainControllerInfoEx **dc_info); + struct wbcGuid *guid, + const char *site, + uint32_t flags, + struct wbcDomainControllerInfoEx **dc_info); /********************************************************** * Athenticate functions @@ -1152,13 +1599,42 @@ wbcErr wbcLookupDomainControllerEx(const char *domain, /** * @brief Authenticate a username/password pair * + * @param *ctx wbclient Context + * @param username Name of user to authenticate + * @param password Clear text password os user + * + * @return #wbcErr + **/ +wbcErr wbcCtxAuthenticateUser(struct wbcContext *ctx, + const char *username, + const char *password); + +/** + * @brief Authenticate a username/password pair + * * @param username Name of user to authenticate * @param password Clear text password os user * * @return #wbcErr **/ wbcErr wbcAuthenticateUser(const char *username, - const char *password); + const char *password); + +/** + * @brief Authenticate with more detailed information + * + * @param *ctx wbclient Context + * @param params Input parameters, WBC_AUTH_USER_LEVEL_HASH + * is not supported yet + * @param info Output details on WBC_ERR_SUCCESS + * @param error Output details on WBC_ERR_AUTH_ERROR + * + * @return #wbcErr + **/ +wbcErr wbcCtxAuthenticateUserEx(struct wbcContext *ctx, + const struct wbcAuthUserParams *params, + struct wbcAuthUserInfo **info, + struct wbcAuthErrorInfo **error); /** * @brief Authenticate with more detailed information @@ -1171,8 +1647,25 @@ wbcErr wbcAuthenticateUser(const char *username, * @return #wbcErr **/ wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params, - struct wbcAuthUserInfo **info, - struct wbcAuthErrorInfo **error); + struct wbcAuthUserInfo **info, + struct wbcAuthErrorInfo **error); + +/** + * @brief Logon a User + * + * @param[in] *ctx wbclient Context + * @param[in] params Pointer to a wbcLogonUserParams structure + * @param[out] info Pointer to a pointer to a wbcLogonUserInfo structure + * @param[out] error Pointer to a pointer to a wbcAuthErrorInfo structure + * @param[out] policy Pointer to a pointer to a wbcUserPasswordPolicyInfo structure + * + * @return #wbcErr + **/ +wbcErr wbcCtxLogonUser(struct wbcContext *ctx, + const struct wbcLogonUserParams *params, + struct wbcLogonUserInfo **info, + struct wbcAuthErrorInfo **error, + struct wbcUserPasswordPolicyInfo **policy); /** * @brief Logon a User @@ -1185,9 +1678,25 @@ wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params, * @return #wbcErr **/ wbcErr wbcLogonUser(const struct wbcLogonUserParams *params, - struct wbcLogonUserInfo **info, - struct wbcAuthErrorInfo **error, - struct wbcUserPasswordPolicyInfo **policy); + struct wbcLogonUserInfo **info, + struct wbcAuthErrorInfo **error, + struct wbcUserPasswordPolicyInfo **policy); + +/** + * @brief Trigger a logoff notification to Winbind for a specific user + * + * @param *ctx wbclient Context + * @param username Name of user to remove from Winbind's list of + * logged on users. + * @param uid Uid assigned to the username + * @param ccfilename Absolute path to the Krb5 credentials cache to + * be removed + * + * @return #wbcErr + **/ +wbcErr wbcCtxLogoffUser(struct wbcContext *ctx, + const char *username, uid_t uid, + const char *ccfilename); /** * @brief Trigger a logoff notification to Winbind for a specific user @@ -1201,8 +1710,21 @@ wbcErr wbcLogonUser(const struct wbcLogonUserParams *params, * @return #wbcErr **/ wbcErr wbcLogoffUser(const char *username, - uid_t uid, - const char *ccfilename); + uid_t uid, + const char *ccfilename); + +/** + * @brief Trigger an extended logoff notification to Winbind for a specific user + * + * @param *ctx wbclient Context + * @param params A wbcLogoffUserParams structure + * @param error User output details on error + * + * @return #wbcErr + **/ +wbcErr wbcCtxLogoffUserEx(struct wbcContext *ctx, + const struct wbcLogoffUserParams *params, + struct wbcAuthErrorInfo **error); /** * @brief Trigger an extended logoff notification to Winbind for a specific user @@ -1213,7 +1735,22 @@ wbcErr wbcLogoffUser(const char *username, * @return #wbcErr **/ wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params, - struct wbcAuthErrorInfo **error); + struct wbcAuthErrorInfo **error); + +/** + * @brief Change a password for a user + * + * @param *ctx wbclient Context + * @param username Name of user to authenticate + * @param old_password Old clear text password of user + * @param new_password New clear text password of user + * + * @return #wbcErr + **/ +wbcErr wbcCtxChangeUserPassword(struct wbcContext *ctx, + const char *username, + const char *old_password, + const char *new_password); /** * @brief Change a password for a user @@ -1225,8 +1762,26 @@ wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params, * @return #wbcErr **/ wbcErr wbcChangeUserPassword(const char *username, - const char *old_password, - const char *new_password); + const char *old_password, + const char *new_password); + +/** + * @brief Change a password for a user with more detailed information upon + * failure + * + * @param *ctx wbclient Context + * @param params Input parameters + * @param error User output details on WBC_ERR_PWD_CHANGE_FAILED + * @param reject_reason New password reject reason on WBC_ERR_PWD_CHANGE_FAILED + * @param policy Password policy output details on WBC_ERR_PWD_CHANGE_FAILED + * + * @return #wbcErr + **/ +wbcErr wbcCtxChangeUserPasswordEx(struct wbcContext *ctx, + const struct wbcChangePasswordParams *params, + struct wbcAuthErrorInfo **error, + enum wbcPasswordChangeRejectReason *reject_reason, + struct wbcUserPasswordPolicyInfo **policy); /** * @brief Change a password for a user with more detailed information upon @@ -1240,9 +1795,24 @@ wbcErr wbcChangeUserPassword(const char *username, * @return #wbcErr **/ wbcErr wbcChangeUserPasswordEx(const struct wbcChangePasswordParams *params, - struct wbcAuthErrorInfo **error, - enum wbcPasswordChangeRejectReason *reject_reason, - struct wbcUserPasswordPolicyInfo **policy); + struct wbcAuthErrorInfo **error, + enum wbcPasswordChangeRejectReason *reject_reason, + struct wbcUserPasswordPolicyInfo **policy); + +/** + * @brief Authenticate a user with cached credentials + * + * @param *ctx wbclient Context + * @param *params Pointer to a wbcCredentialCacheParams structure + * @param **info Pointer to a pointer to a wbcCredentialCacheInfo structure + * @param **error Pointer to a pointer to a wbcAuthErrorInfo structure + * + * @return #wbcErr + **/ +wbcErr wbcCtxCredentialCache(struct wbcContext *ctx, + struct wbcCredentialCacheParams *params, + struct wbcCredentialCacheInfo **info, + struct wbcAuthErrorInfo **error); /** * @brief Authenticate a user with cached credentials @@ -1260,7 +1830,19 @@ wbcErr wbcCredentialCache(struct wbcCredentialCacheParams *params, /** * @brief Save a password with winbind for doing wbcCredentialCache() later * - * @param *user Username + * @param *ctx wbclient Context + * @param *user Username + * @param *password Password + * + * @return #wbcErr + **/ +wbcErr wbcCtxCredentialSave(struct wbcContext *ctx, + const char *user, const char *password); + +/** + * @brief Save a password with winbind for doing wbcCredentialCache() later + * + * @param *user Username * @param *password Password * * @return #wbcErr @@ -1274,6 +1856,18 @@ wbcErr wbcCredentialSave(const char *user, const char *password); /** * @brief Resolve a NetbiosName via WINS * + * @param *ctx wbclient Context + * @param name Name to resolve + * @param *ip Pointer to the ip address string + * + * @return #wbcErr + **/ +wbcErr wbcCtxResolveWinsByName(struct wbcContext *ctx, + const char *name, char **ip); + +/** + * @brief Resolve a NetbiosName via WINS + * * @param name Name to resolve * @param *ip Pointer to the ip address string * @@ -1284,8 +1878,21 @@ wbcErr wbcResolveWinsByName(const char *name, char **ip); /** * @brief Resolve an IP address via WINS into a NetbiosName * - * @param ip The ip address string - * @param *name Pointer to the name + * @param *ctx wbclient Context + * @param ip The ip address string + * @param *name Pointer to the name + * + * @return #wbcErr + * + **/ +wbcErr wbcCtxResolveWinsByIP(struct wbcContext *ctx, + const char *ip, char **name); + +/** + * @brief Resolve an IP address via WINS into a NetbiosName + * + * @param ip The ip address string + * @param *name Pointer to the name * * @return #wbcErr * @@ -1299,13 +1906,37 @@ wbcErr wbcResolveWinsByIP(const char *ip, char **name); /** * @brief Trigger a verification of the trust credentials of a specific domain * + * @param *ctx wbclient Context + * @param *domain The name of the domain. + * @param error Output details on WBC_ERR_AUTH_ERROR + * + * @return #wbcErr + **/ +wbcErr wbcCtxCheckTrustCredentials(struct wbcContext *ctx, const char *domain, + struct wbcAuthErrorInfo **error); + +/** + * @brief Trigger a verification of the trust credentials of a specific domain + * * @param *domain The name of the domain. * @param error Output details on WBC_ERR_AUTH_ERROR * * @return #wbcErr **/ wbcErr wbcCheckTrustCredentials(const char *domain, - struct wbcAuthErrorInfo **error); + struct wbcAuthErrorInfo **error); + +/** + * @brief Trigger a change of the trust credentials for a specific domain + * + * @param *ctx wbclient Context + * @param *domain The name of the domain. + * @param error Output details on WBC_ERR_AUTH_ERROR + * + * @return #wbcErr + **/ +wbcErr wbcCtxChangeTrustCredentials(struct wbcContext *ctx, const char *domain, + struct wbcAuthErrorInfo **error); /** * @brief Trigger a change of the trust credentials for a specific domain @@ -1316,7 +1947,22 @@ wbcErr wbcCheckTrustCredentials(const char *domain, * @return #wbcErr **/ wbcErr wbcChangeTrustCredentials(const char *domain, - struct wbcAuthErrorInfo **error); + struct wbcAuthErrorInfo **error); + +/** + * @brief Trigger a no-op call through the NETLOGON pipe. Low-cost + * version of wbcCheckTrustCredentials + * + * @param *ctx wbclient Context + * @param *domain The name of the domain, only NULL for the default domain is + * supported yet. Other values than NULL will result in + * WBC_ERR_NOT_IMPLEMENTED. + * @param error Output details on WBC_ERR_AUTH_ERROR + * + * @return #wbcErr + **/ +wbcErr wbcCtxPingDc(struct wbcContext *ctx, const char *domain, + struct wbcAuthErrorInfo **error); /** * @brief Trigger a no-op call through the NETLOGON pipe. Low-cost @@ -1335,6 +1981,23 @@ wbcErr wbcPingDc(const char *domain, struct wbcAuthErrorInfo **error); * @brief Trigger a no-op call through the NETLOGON pipe. Low-cost * version of wbcCheckTrustCredentials * + * @param *ctx wbclient Context + * @param *domain The name of the domain, only NULL for the default domain is + * supported yet. Other values than NULL will result in + * WBC_ERR_NOT_IMPLEMENTED. + * @param error Output details on WBC_ERR_AUTH_ERROR + * @param dcname DC that was attempted to ping + * + * @return #wbcErr + **/ +wbcErr wbcCtxPingDc2(struct wbcContext *ctx, const char *domain, + struct wbcAuthErrorInfo **error, + char **dcname); + +/** + * @brief Trigger a no-op call through the NETLOGON pipe. Low-cost + * version of wbcCheckTrustCredentials + * * @param *domain The name of the domain, only NULL for the default domain is * supported yet. Other values than NULL will result in * WBC_ERR_NOT_IMPLEMENTED. @@ -1344,7 +2007,7 @@ wbcErr wbcPingDc(const char *domain, struct wbcAuthErrorInfo **error); * @return #wbcErr **/ wbcErr wbcPingDc2(const char *domain, struct wbcAuthErrorInfo **error, - char **dcname); + char **dcname); /********************************************************** * Helper functions @@ -1363,10 +2026,10 @@ wbcErr wbcPingDc2(const char *domain, struct wbcAuthErrorInfo **error, * @return #wbcErr **/ wbcErr wbcAddNamedBlob(size_t *num_blobs, - struct wbcNamedBlob **blobs, - const char *name, - uint32_t flags, - uint8_t *data, - size_t length); + struct wbcNamedBlob **blobs, + const char *name, + uint32_t flags, + uint8_t *data, + size_t length); #endif /* _WBCLIENT_H */ diff --git a/src/sss_client/libwbclient/wbclient_sssd.pc.in b/src/sss_client/libwbclient/wbclient_sssd.pc.in index 124c3ad6b9d35ce5d101f08480616a0d6b5fdc8c..9ffa5169dc2cea8a0c805ef2892291751b473ca5 100644 --- a/src/sss_client/libwbclient/wbclient_sssd.pc.in +++ b/src/sss_client/libwbclient/wbclient_sssd.pc.in @@ -5,7 +5,7 @@ includedir=@includedir@ Name: wbclient Description: SSSD implementation of Samba wbclient API -Version: 0.11 +Version: @libwbclient_version@ Libs: -L${libdir} -lwbclient Cflags: URL: http://fedorahosted.org/sssd/, http://www.samba.org -- 2.1.0