summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Newton <matthew-git@newtoncomputing.co.uk>2015-02-21 22:30:11 +0000
committerJeremy Allison <jra@samba.org>2015-03-10 00:50:10 +0100
commit063c56dba590eec69439eb791a420b40505d4cc0 (patch)
treeab61976f8653a8a5c9058d86d32989e7be4d5279
parent348f93ff6e25c43e0233432bd2134bb9eacb0b87 (diff)
downloadsamba-063c56dba590eec69439eb791a420b40505d4cc0.tar.gz
samba-063c56dba590eec69439eb791a420b40505d4cc0.tar.xz
samba-063c56dba590eec69439eb791a420b40505d4cc0.zip
Add context versions of wbclient functions
To make the libwbclient library thread-safe, all functions that call through to wb_common winbindd_request_response need to have context that they can use. This commit adds all the necessary functions. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--nsswitch/libwbclient/wbc_idmap.c70
-rw-r--r--nsswitch/libwbclient/wbc_pam.c198
-rw-r--r--nsswitch/libwbclient/wbc_pwd.c127
-rw-r--r--nsswitch/libwbclient/wbc_sid.c169
-rw-r--r--nsswitch/libwbclient/wbc_util.c123
-rw-r--r--nsswitch/libwbclient/wbclient.h650
6 files changed, 1161 insertions, 176 deletions
diff --git a/nsswitch/libwbclient/wbc_idmap.c b/nsswitch/libwbclient/wbc_idmap.c
index 04e7d02995..3e8366a8f1 100644
--- a/nsswitch/libwbclient/wbc_idmap.c
+++ b/nsswitch/libwbclient/wbc_idmap.c
@@ -26,7 +26,8 @@
#include "../winbind_client.h"
/* Convert a Windows SID to a Unix uid, allocating an uid if needed */
-wbcErr wbcSidToUid(const struct wbcDomainSid *sid, uid_t *puid)
+wbcErr wbcCtxSidToUid(struct wbcContext *ctx, const struct wbcDomainSid *sid,
+ uid_t *puid)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -46,7 +47,7 @@ wbcErr wbcSidToUid(const struct wbcDomainSid *sid, uid_t *puid)
/* Make request */
- wbc_status = wbcRequestResponse(WINBINDD_SID_TO_UID,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_SID_TO_UID,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -59,6 +60,11 @@ wbcErr wbcSidToUid(const struct wbcDomainSid *sid, uid_t *puid)
return wbc_status;
}
+wbcErr wbcSidToUid(const struct wbcDomainSid *sid, uid_t *puid)
+{
+ return wbcCtxSidToUid(NULL, sid, puid);
+}
+
/* Convert a Windows SID to a Unix uid if there already is a mapping */
wbcErr wbcQuerySidToUid(const struct wbcDomainSid *sid,
uid_t *puid)
@@ -67,7 +73,8 @@ wbcErr wbcQuerySidToUid(const struct wbcDomainSid *sid,
}
/* Convert a Unix uid to a Windows SID, allocating a SID if needed */
-wbcErr wbcUidToSid(uid_t uid, struct wbcDomainSid *sid)
+wbcErr wbcCtxUidToSid(struct wbcContext *ctx, uid_t uid,
+ struct wbcDomainSid *sid)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -87,7 +94,7 @@ wbcErr wbcUidToSid(uid_t uid, struct wbcDomainSid *sid)
/* Make request */
- wbc_status = wbcRequestResponse(WINBINDD_UID_TO_SID,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_UID_TO_SID,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -99,6 +106,11 @@ done:
return wbc_status;
}
+wbcErr wbcUidToSid(uid_t uid, struct wbcDomainSid *sid)
+{
+ return wbcCtxUidToSid(NULL, uid, sid);
+}
+
/* Convert a Unix uid to a Windows SID if there already is a mapping */
wbcErr wbcQueryUidToSid(uid_t uid,
struct wbcDomainSid *sid)
@@ -115,7 +127,8 @@ wbcErr wbcQueryUidToSid(uid_t uid,
*
**/
-wbcErr wbcSidToGid(const struct wbcDomainSid *sid, gid_t *pgid)
+wbcErr wbcCtxSidToGid(struct wbcContext *ctx, const struct wbcDomainSid *sid,
+ gid_t *pgid)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -135,7 +148,7 @@ wbcErr wbcSidToGid(const struct wbcDomainSid *sid, gid_t *pgid)
/* Make request */
- wbc_status = wbcRequestResponse(WINBINDD_SID_TO_GID,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_SID_TO_GID,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -148,6 +161,10 @@ wbcErr wbcSidToGid(const struct wbcDomainSid *sid, gid_t *pgid)
return wbc_status;
}
+wbcErr wbcSidToGid(const struct wbcDomainSid *sid, gid_t *pgid)
+{
+ return wbcCtxSidToGid(NULL, sid, pgid);
+}
/* Convert a Windows SID to a Unix gid if there already is a mapping */
@@ -159,7 +176,8 @@ wbcErr wbcQuerySidToGid(const struct wbcDomainSid *sid,
/* Convert a Unix gid to a Windows SID, allocating a SID if needed */
-wbcErr wbcGidToSid(gid_t gid, struct wbcDomainSid *sid)
+wbcErr wbcCtxGidToSid(struct wbcContext *ctx, gid_t gid,
+ struct wbcDomainSid *sid)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -179,7 +197,7 @@ wbcErr wbcGidToSid(gid_t gid, struct wbcDomainSid *sid)
/* Make request */
- wbc_status = wbcRequestResponse(WINBINDD_GID_TO_SID,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GID_TO_SID,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -191,6 +209,11 @@ done:
return wbc_status;
}
+wbcErr wbcGidToSid(gid_t gid, struct wbcDomainSid *sid)
+{
+ return wbcCtxGidToSid(NULL, gid, sid);
+}
+
/* Convert a Unix gid to a Windows SID if there already is a mapping */
wbcErr wbcQueryGidToSid(gid_t gid,
struct wbcDomainSid *sid)
@@ -199,7 +222,7 @@ wbcErr wbcQueryGidToSid(gid_t gid,
}
/* Obtain a new uid from Winbind */
-wbcErr wbcAllocateUid(uid_t *puid)
+wbcErr wbcCtxAllocateUid(struct wbcContext *ctx, uid_t *puid)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -215,7 +238,7 @@ wbcErr wbcAllocateUid(uid_t *puid)
/* Make request */
- wbc_status = wbcRequestResponsePriv(WINBINDD_ALLOCATE_UID,
+ wbc_status = wbcRequestResponsePriv(ctx, WINBINDD_ALLOCATE_UID,
&request, &response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -228,8 +251,13 @@ wbcErr wbcAllocateUid(uid_t *puid)
return wbc_status;
}
+wbcErr wbcAllocateUid(uid_t *puid)
+{
+ return wbcCtxAllocateUid(NULL, puid);
+}
+
/* Obtain a new gid from Winbind */
-wbcErr wbcAllocateGid(gid_t *pgid)
+wbcErr wbcCtxAllocateGid(struct wbcContext *ctx, gid_t *pgid)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -245,7 +273,7 @@ wbcErr wbcAllocateGid(gid_t *pgid)
/* Make request */
- wbc_status = wbcRequestResponsePriv(WINBINDD_ALLOCATE_GID,
+ wbc_status = wbcRequestResponsePriv(ctx, WINBINDD_ALLOCATE_GID,
&request, &response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -258,6 +286,11 @@ wbcErr wbcAllocateGid(gid_t *pgid)
return wbc_status;
}
+wbcErr wbcAllocateGid(gid_t *pgid)
+{
+ return wbcCtxAllocateGid(NULL, pgid);
+}
+
/* we can't include smb.h here... */
#define _ID_TYPE_UID 1
#define _ID_TYPE_GID 2
@@ -299,8 +332,9 @@ wbcErr wbcSetGidHwm(gid_t gid_hwm)
}
/* Convert a list of SIDs */
-wbcErr wbcSidsToUnixIds(const struct wbcDomainSid *sids, uint32_t num_sids,
- struct wbcUnixId *ids)
+wbcErr wbcCtxSidsToUnixIds(struct wbcContext *ctx,
+ const struct wbcDomainSid *sids,
+ uint32_t num_sids, struct wbcUnixId *ids)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -341,7 +375,7 @@ wbcErr wbcSidsToUnixIds(const struct wbcDomainSid *sids, uint32_t num_sids,
request.extra_data.data = sidlist;
request.extra_len = p - sidlist;
- wbc_status = wbcRequestResponse(WINBINDD_SIDS_TO_XIDS,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_SIDS_TO_XIDS,
&request, &response);
free(sidlist);
if (!WBC_ERROR_IS_OK(wbc_status)) {
@@ -393,3 +427,9 @@ done:
winbindd_free_response(&response);
return wbc_status;
}
+
+wbcErr wbcSidsToUnixIds(const struct wbcDomainSid *sids, uint32_t num_sids,
+ struct wbcUnixId *ids)
+{
+ return wbcCtxSidsToUnixIds(NULL, sids, num_sids, ids);
+}
diff --git a/nsswitch/libwbclient/wbc_pam.c b/nsswitch/libwbclient/wbc_pam.c
index e243538b81..672cf37334 100644
--- a/nsswitch/libwbclient/wbc_pam.c
+++ b/nsswitch/libwbclient/wbc_pam.c
@@ -28,8 +28,8 @@
#include "../winbind_client.h"
/* Authenticate a username/password pair */
-wbcErr wbcAuthenticateUser(const char *username,
- const char *password)
+wbcErr wbcCtxAuthenticateUser(struct wbcContext *ctx,
+ const char *username, const char *password)
{
wbcErr wbc_status = WBC_ERR_SUCCESS;
struct wbcAuthUserParams params;
@@ -40,13 +40,18 @@ wbcErr wbcAuthenticateUser(const char *username,
params.level = WBC_AUTH_USER_LEVEL_PLAIN;
params.password.plaintext = password;
- wbc_status = wbcAuthenticateUserEx(&params, NULL, NULL);
+ wbc_status = wbcCtxAuthenticateUserEx(ctx, &params, NULL, NULL);
BAIL_ON_WBC_ERROR(wbc_status);
done:
return wbc_status;
}
+wbcErr wbcAuthenticateUser(const char *username, const char *password)
+{
+ return wbcCtxAuthenticateUser(NULL, username, password);
+}
+
static bool sid_attr_compose(struct wbcSidWithAttr *s,
const struct wbcDomainSid *d,
uint32_t rid, uint32_t attr)
@@ -342,9 +347,10 @@ done:
/* Authenticate with more detailed information */
-wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params,
- struct wbcAuthUserInfo **info,
- struct wbcAuthErrorInfo **error)
+wbcErr wbcCtxAuthenticateUserEx(struct wbcContext *ctx,
+ const struct wbcAuthUserParams *params,
+ struct wbcAuthUserInfo **info,
+ struct wbcAuthErrorInfo **error)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
int cmd = 0;
@@ -388,7 +394,7 @@ wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params,
ZERO_STRUCT(sep_response);
- wbc_status = wbcRequestResponse(WINBINDD_INFO,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_INFO,
NULL, &sep_response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -518,9 +524,11 @@ wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params,
}
if (cmd == WINBINDD_PAM_AUTH_CRAP) {
- wbc_status = wbcRequestResponsePriv(cmd, &request, &response);
+ wbc_status = wbcRequestResponsePriv(ctx, cmd,
+ &request, &response);
} else {
- wbc_status = wbcRequestResponse(cmd, &request, &response);
+ wbc_status = wbcRequestResponse(ctx, cmd,
+ &request, &response);
}
if (response.data.auth.nt_status != 0) {
if (error) {
@@ -547,9 +555,16 @@ done:
return wbc_status;
}
+wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params,
+ struct wbcAuthUserInfo **info,
+ struct wbcAuthErrorInfo **error)
+{
+ return wbcCtxAuthenticateUserEx(NULL, params, info, error);
+}
+
/* Trigger a verification of the trust credentials of a specific domain */
-wbcErr wbcCheckTrustCredentials(const char *domain,
- struct wbcAuthErrorInfo **error)
+wbcErr wbcCtxCheckTrustCredentials(struct wbcContext *ctx, const char *domain,
+ struct wbcAuthErrorInfo **error)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -565,7 +580,7 @@ wbcErr wbcCheckTrustCredentials(const char *domain,
/* Send request */
- wbc_status = wbcRequestResponsePriv(WINBINDD_CHECK_MACHACC,
+ wbc_status = wbcRequestResponsePriv(ctx, WINBINDD_CHECK_MACHACC,
&request, &response);
if (response.data.auth.nt_status != 0) {
if (error) {
@@ -583,9 +598,15 @@ wbcErr wbcCheckTrustCredentials(const char *domain,
return wbc_status;
}
+wbcErr wbcCheckTrustCredentials(const char *domain,
+ struct wbcAuthErrorInfo **error)
+{
+ return wbcCtxCheckTrustCredentials(NULL, domain, error);
+}
+
/* Trigger a change of the trust credentials for a specific domain */
-wbcErr wbcChangeTrustCredentials(const char *domain,
- struct wbcAuthErrorInfo **error)
+wbcErr wbcCtxChangeTrustCredentials(struct wbcContext *ctx, const char *domain,
+ struct wbcAuthErrorInfo **error)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -601,8 +622,8 @@ wbcErr wbcChangeTrustCredentials(const char *domain,
/* Send request */
- wbc_status = wbcRequestResponsePriv(WINBINDD_CHANGE_MACHACC,
- &request, &response);
+ wbc_status = wbcRequestResponsePriv(ctx, WINBINDD_CHANGE_MACHACC,
+ &request, &response);
if (response.data.auth.nt_status != 0) {
if (error) {
wbc_status = wbc_create_error_info(&response,
@@ -619,10 +640,22 @@ wbcErr wbcChangeTrustCredentials(const char *domain,
return wbc_status;
}
+wbcErr wbcChangeTrustCredentials(const char *domain,
+ struct wbcAuthErrorInfo **error)
+{
+ return wbcCtxChangeTrustCredentials(NULL, domain, error);
+}
+
/*
* Trigger a no-op NETLOGON call. Lightweight version of
* wbcCheckTrustCredentials
*/
+wbcErr wbcCtxPingDc(struct wbcContext *ctx, const char *domain,
+ struct wbcAuthErrorInfo **error)
+{
+ return wbcCtxPingDc2(ctx, domain, error, NULL);
+}
+
wbcErr wbcPingDc(const char *domain, struct wbcAuthErrorInfo **error)
{
return wbcPingDc2(domain, error, NULL);
@@ -632,8 +665,8 @@ wbcErr wbcPingDc(const char *domain, struct wbcAuthErrorInfo **error)
* Trigger a no-op NETLOGON call. Lightweight version of
* wbcCheckTrustCredentials, optionally return attempted DC
*/
-wbcErr wbcPingDc2(const char *domain, struct wbcAuthErrorInfo **error,
- char **dcname)
+wbcErr wbcCtxPingDc2(struct wbcContext *ctx, const char *domain,
+ struct wbcAuthErrorInfo **error, char **dcname)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -649,7 +682,7 @@ wbcErr wbcPingDc2(const char *domain, struct wbcAuthErrorInfo **error,
/* Send request */
- wbc_status = wbcRequestResponse(WINBINDD_PING_DC,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_PING_DC,
&request,
&response);
@@ -679,9 +712,16 @@ wbcErr wbcPingDc2(const char *domain, struct wbcAuthErrorInfo **error,
return wbc_status;
}
+wbcErr wbcPingDc2(const char *domain, struct wbcAuthErrorInfo **error,
+ char **dcname)
+{
+ return wbcCtxPingDc2(NULL, domain, error, dcname);
+}
+
/* Trigger an extended logoff notification to Winbind for a specific user */
-wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params,
- struct wbcAuthErrorInfo **error)
+wbcErr wbcCtxLogoffUserEx(struct wbcContext *ctx,
+ const struct wbcLogoffUserParams *params,
+ struct wbcAuthErrorInfo **error)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -744,7 +784,7 @@ wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params,
/* Send request */
- wbc_status = wbcRequestResponse(WINBINDD_PAM_LOGOFF,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_PAM_LOGOFF,
&request,
&response);
@@ -765,10 +805,16 @@ wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params,
return wbc_status;
}
+wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params,
+ struct wbcAuthErrorInfo **error)
+{
+ return wbcCtxLogoffUserEx(NULL, params, error);
+}
+
/* Trigger a logoff notification to Winbind for a specific user */
-wbcErr wbcLogoffUser(const char *username,
- uid_t uid,
- const char *ccfilename)
+wbcErr wbcCtxLogoffUser(struct wbcContext *ctx,
+ const char *username, uid_t uid,
+ const char *ccfilename)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -795,7 +841,7 @@ wbcErr wbcLogoffUser(const char *username,
/* Send request */
- wbc_status = wbcRequestResponse(WINBINDD_PAM_LOGOFF,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_PAM_LOGOFF,
&request,
&response);
@@ -805,11 +851,19 @@ wbcErr wbcLogoffUser(const char *username,
return wbc_status;
}
+wbcErr wbcLogoffUser(const char *username,
+ uid_t uid,
+ const char *ccfilename)
+{
+ return wbcCtxLogoffUser(NULL, username, uid, ccfilename);
+}
+
/* Change a password for a user with more detailed information upon failure */
-wbcErr wbcChangeUserPasswordEx(const struct wbcChangePasswordParams *params,
- struct wbcAuthErrorInfo **error,
- enum wbcPasswordChangeRejectReason *reject_reason,
- struct wbcUserPasswordPolicyInfo **policy)
+wbcErr wbcCtxChangeUserPasswordEx(struct wbcContext *ctx,
+ const struct wbcChangePasswordParams *params,
+ struct wbcAuthErrorInfo **error,
+ enum wbcPasswordChangeRejectReason *reject_reason,
+ struct wbcUserPasswordPolicyInfo **policy)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -968,7 +1022,7 @@ wbcErr wbcChangeUserPasswordEx(const struct wbcChangePasswordParams *params,
/* Send request */
- wbc_status = wbcRequestResponse(cmd,
+ wbc_status = wbcRequestResponse(ctx, cmd,
&request,
&response);
if (WBC_ERROR_IS_OK(wbc_status)) {
@@ -1003,10 +1057,20 @@ wbcErr wbcChangeUserPasswordEx(const struct wbcChangePasswordParams *params,
return wbc_status;
}
+wbcErr wbcChangeUserPasswordEx(const struct wbcChangePasswordParams *params,
+ struct wbcAuthErrorInfo **error,
+ enum wbcPasswordChangeRejectReason *reject_reason,
+ struct wbcUserPasswordPolicyInfo **policy)
+{
+ return wbcCtxChangeUserPasswordEx(NULL, params, error,
+ reject_reason, policy);
+}
+
/* Change a password for a user */
-wbcErr wbcChangeUserPassword(const char *username,
- const char *old_password,
- const char *new_password)
+wbcErr wbcCtxChangeUserPassword(struct wbcContext *ctx,
+ const char *username,
+ const char *old_password,
+ const char *new_password)
{
wbcErr wbc_status = WBC_ERR_SUCCESS;
struct wbcChangePasswordParams params;
@@ -1018,21 +1082,30 @@ wbcErr wbcChangeUserPassword(const char *username,
params.old_password.plaintext = old_password;
params.new_password.plaintext = new_password;
- wbc_status = wbcChangeUserPasswordEx(&params,
- NULL,
- NULL,
- NULL);
+ wbc_status = wbcCtxChangeUserPasswordEx(ctx, &params,
+ NULL,
+ NULL,
+ NULL);
BAIL_ON_WBC_ERROR(wbc_status);
done:
return wbc_status;
}
+wbcErr wbcChangeUserPassword(const char *username,
+ const char *old_password,
+ const char *new_password)
+{
+ return wbcCtxChangeUserPassword(NULL, username,
+ old_password, new_password);
+}
+
/* Logon a User */
-wbcErr wbcLogonUser(const struct wbcLogonUserParams *params,
- struct wbcLogonUserInfo **info,
- struct wbcAuthErrorInfo **error,
- struct wbcUserPasswordPolicyInfo **policy)
+wbcErr wbcCtxLogonUser(struct wbcContext *ctx,
+ const struct wbcLogonUserParams *params,
+ struct wbcLogonUserInfo **info,
+ struct wbcAuthErrorInfo **error,
+ struct wbcUserPasswordPolicyInfo **policy)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -1134,7 +1207,7 @@ wbcErr wbcLogonUser(const struct wbcLogonUserParams *params,
}
}
- wbc_status = wbcRequestResponse(WINBINDD_PAM_AUTH,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_PAM_AUTH,
&request,
&response);
@@ -1168,6 +1241,14 @@ done:
return wbc_status;
}
+wbcErr wbcLogonUser(const struct wbcLogonUserParams *params,
+ struct wbcLogonUserInfo **info,
+ struct wbcAuthErrorInfo **error,
+ struct wbcUserPasswordPolicyInfo **policy)
+{
+ return wbcCtxLogonUser(NULL, params, info, error, policy);
+}
+
static void wbcCredentialCacheInfoDestructor(void *ptr)
{
struct wbcCredentialCacheInfo *i =
@@ -1176,9 +1257,10 @@ static void wbcCredentialCacheInfoDestructor(void *ptr)
}
/* Authenticate a user with cached credentials */
-wbcErr wbcCredentialCache(struct wbcCredentialCacheParams *params,
- struct wbcCredentialCacheInfo **info,
- struct wbcAuthErrorInfo **error)
+wbcErr wbcCtxCredentialCache(struct wbcContext *ctx,
+ struct wbcCredentialCacheParams *params,
+ struct wbcCredentialCacheInfo **info,
+ struct wbcAuthErrorInfo **error)
{
wbcErr status = WBC_ERR_UNKNOWN_FAILURE;
struct wbcCredentialCacheInfo *result = NULL;
@@ -1223,7 +1305,8 @@ wbcErr wbcCredentialCache(struct wbcCredentialCacheParams *params,
}
if (params->domain_name != NULL) {
- status = wbcRequestResponse(WINBINDD_INFO, NULL, &response);
+ status = wbcRequestResponse(ctx, WINBINDD_INFO,
+ NULL, &response);
if (!WBC_ERROR_IS_OK(status)) {
goto fail;
}
@@ -1272,8 +1355,8 @@ wbcErr wbcCredentialCache(struct wbcCredentialCacheParams *params,
challenge_blob->blob.length);
}
- status = wbcRequestResponse(WINBINDD_CCACHE_NTLMAUTH, &request,
- &response);
+ status = wbcRequestResponse(ctx, WINBINDD_CCACHE_NTLMAUTH,
+ &request, &response);
if (!WBC_ERROR_IS_OK(status)) {
goto fail;
}
@@ -1312,8 +1395,16 @@ fail:
return status;
}
+wbcErr wbcCredentialCache(struct wbcCredentialCacheParams *params,
+ struct wbcCredentialCacheInfo **info,
+ struct wbcAuthErrorInfo **error)
+{
+ return wbcCtxCredentialCache(NULL, params, info, error);
+}
+
/* Authenticate a user with cached credentials */
-wbcErr wbcCredentialSave(const char *user, const char *password)
+wbcErr wbcCtxCredentialSave(struct wbcContext *ctx,
+ const char *user, const char *password)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -1327,5 +1418,10 @@ wbcErr wbcCredentialSave(const char *user, const char *password)
sizeof(request.data.ccache_save.pass)-1);
request.data.ccache_save.uid = getuid();
- return wbcRequestResponse(WINBINDD_CCACHE_SAVE, &request, &response);
+ return wbcRequestResponse(ctx, WINBINDD_CCACHE_SAVE, &request, &response);
+}
+
+wbcErr wbcCredentialSave(const char *user, const char *password)
+{
+ return wbcCtxCredentialSave(NULL, user, password);
}
diff --git a/nsswitch/libwbclient/wbc_pwd.c b/nsswitch/libwbclient/wbc_pwd.c
index 6df694dcac..0b05133a43 100644
--- a/nsswitch/libwbclient/wbc_pwd.c
+++ b/nsswitch/libwbclient/wbc_pwd.c
@@ -167,7 +167,8 @@ fail:
}
/* Fill in a struct passwd* for a domain user based on username */
-wbcErr wbcGetpwnam(const char *name, struct passwd **pwd)
+wbcErr wbcCtxGetpwnam(struct wbcContext *ctx,
+ const char *name, struct passwd **pwd)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -187,7 +188,7 @@ wbcErr wbcGetpwnam(const char *name, struct passwd **pwd)
strncpy(request.data.username, name, sizeof(request.data.username)-1);
- wbc_status = wbcRequestResponse(WINBINDD_GETPWNAM,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GETPWNAM,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -199,8 +200,13 @@ wbcErr wbcGetpwnam(const char *name, struct passwd **pwd)
return wbc_status;
}
+wbcErr wbcGetpwnam(const char *name, struct passwd **pwd)
+{
+ return wbcCtxGetpwnam(NULL, name, pwd);
+}
+
/* Fill in a struct passwd* for a domain user based on uid */
-wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd)
+wbcErr wbcCtxGetpwuid(struct wbcContext *ctx, uid_t uid, struct passwd **pwd)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -218,7 +224,7 @@ wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd)
request.data.uid = uid;
- wbc_status = wbcRequestResponse(WINBINDD_GETPWUID,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GETPWUID,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -230,8 +236,14 @@ wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd)
return wbc_status;
}
+wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd)
+{
+ return wbcCtxGetpwuid(NULL, uid, pwd);
+}
+
/* Fill in a struct passwd* for a domain user based on sid */
-wbcErr wbcGetpwsid(struct wbcDomainSid *sid, struct passwd **pwd)
+wbcErr wbcCtxGetpwsid(struct wbcContext *ctx,
+ struct wbcDomainSid *sid, struct passwd **pwd)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -249,7 +261,7 @@ wbcErr wbcGetpwsid(struct wbcDomainSid *sid, struct passwd **pwd)
wbcSidToStringBuf(sid, request.data.sid, sizeof(request.data.sid));
- wbc_status = wbcRequestResponse(WINBINDD_GETPWSID,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GETPWSID,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -261,8 +273,14 @@ wbcErr wbcGetpwsid(struct wbcDomainSid *sid, struct passwd **pwd)
return wbc_status;
}
+wbcErr wbcGetpwsid(struct wbcDomainSid *sid, struct passwd **pwd)
+{
+ return wbcCtxGetpwsid(NULL, sid, pwd);
+}
+
/* Fill in a struct passwd* for a domain user based on username */
-wbcErr wbcGetgrnam(const char *name, struct group **grp)
+wbcErr wbcCtxGetgrnam(struct wbcContext *ctx,
+ const char *name, struct group **grp)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -282,7 +300,7 @@ wbcErr wbcGetgrnam(const char *name, struct group **grp)
strncpy(request.data.groupname, name, sizeof(request.data.groupname)-1);
- wbc_status = wbcRequestResponse(WINBINDD_GETGRNAM,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GETGRNAM,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -297,8 +315,13 @@ wbcErr wbcGetgrnam(const char *name, struct group **grp)
return wbc_status;
}
+wbcErr wbcGetgrnam(const char *name, struct group **grp)
+{
+ return wbcCtxGetgrnam(NULL, name, grp);
+}
+
/* Fill in a struct passwd* for a domain user based on uid */
-wbcErr wbcGetgrgid(gid_t gid, struct group **grp)
+wbcErr wbcCtxGetgrgid(struct wbcContext *ctx, gid_t gid, struct group **grp)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -316,7 +339,7 @@ wbcErr wbcGetgrgid(gid_t gid, struct group **grp)
request.data.gid = gid;
- wbc_status = wbcRequestResponse(WINBINDD_GETGRGID,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GETGRGID,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -331,6 +354,11 @@ wbcErr wbcGetgrgid(gid_t gid, struct group **grp)
return wbc_status;
}
+wbcErr wbcGetgrgid(gid_t gid, struct group **grp)
+{
+ return wbcCtxGetgrgid(NULL, gid, grp);
+}
+
/** @brief Number of cached passwd structs
*
*/
@@ -347,7 +375,7 @@ static uint32_t pw_cache_idx;
static struct winbindd_response pw_response;
/* Reset the passwd iterator */
-wbcErr wbcSetpwent(void)
+wbcErr wbcCtxSetpwent(struct wbcContext *ctx)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
@@ -358,7 +386,7 @@ wbcErr wbcSetpwent(void)
ZERO_STRUCT(pw_response);
- wbc_status = wbcRequestResponse(WINBINDD_SETPWENT,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_SETPWENT,
NULL, NULL);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -366,8 +394,13 @@ wbcErr wbcSetpwent(void)
return wbc_status;
}
+wbcErr wbcSetpwent(void)
+{
+ return wbcCtxSetpwent(NULL);
+}
+
/* Close the passwd iterator */
-wbcErr wbcEndpwent(void)
+wbcErr wbcCtxEndpwent(struct wbcContext *ctx)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
@@ -376,7 +409,7 @@ wbcErr wbcEndpwent(void)
winbindd_free_response(&pw_response);
}
- wbc_status = wbcRequestResponse(WINBINDD_ENDPWENT,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_ENDPWENT,
NULL, NULL);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -384,8 +417,13 @@ wbcErr wbcEndpwent(void)
return wbc_status;
}
+wbcErr wbcEndpwent(void)
+{
+ return wbcCtxEndpwent(NULL);
+}
+
/* Return the next struct passwd* entry from the pwent iterator */
-wbcErr wbcGetpwent(struct passwd **pwd)
+wbcErr wbcCtxGetpwent(struct wbcContext *ctx, struct passwd **pwd)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -405,7 +443,7 @@ wbcErr wbcGetpwent(struct passwd **pwd)
ZERO_STRUCT(request);
request.data.num_entries = MAX_GETPWENT_USERS;
- wbc_status = wbcRequestResponse(WINBINDD_GETPWENT, &request,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GETPWENT, &request,
&pw_response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -426,6 +464,11 @@ done:
return wbc_status;
}
+wbcErr wbcGetpwent(struct passwd **pwd)
+{
+ return wbcCtxGetpwent(NULL, pwd);
+}
+
/** @brief Number of cached group structs
*
*/
@@ -442,7 +485,7 @@ static uint32_t gr_cache_idx;
static struct winbindd_response gr_response;
/* Reset the group iterator */
-wbcErr wbcSetgrent(void)
+wbcErr wbcCtxSetgrent(struct wbcContext *ctx)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
@@ -453,7 +496,7 @@ wbcErr wbcSetgrent(void)
ZERO_STRUCT(gr_response);
- wbc_status = wbcRequestResponse(WINBINDD_SETGRENT,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_SETGRENT,
NULL, NULL);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -461,8 +504,13 @@ wbcErr wbcSetgrent(void)
return wbc_status;
}
+wbcErr wbcSetgrent(void)
+{
+ return wbcCtxSetgrent(NULL);
+}
+
/* Close the group iterator */
-wbcErr wbcEndgrent(void)
+wbcErr wbcCtxEndgrent(struct wbcContext *ctx)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
@@ -471,7 +519,7 @@ wbcErr wbcEndgrent(void)
winbindd_free_response(&gr_response);
}
- wbc_status = wbcRequestResponse(WINBINDD_ENDGRENT,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_ENDGRENT,
NULL, NULL);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -479,8 +527,13 @@ wbcErr wbcEndgrent(void)
return wbc_status;
}
+wbcErr wbcEndgrent(void)
+{
+ return wbcCtxEndgrent(NULL);
+}
+
/* Return the next struct group* entry from the pwent iterator */
-wbcErr wbcGetgrent(struct group **grp)
+wbcErr wbcCtxGetgrent(struct wbcContext *ctx, struct group **grp)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -501,8 +554,8 @@ wbcErr wbcGetgrent(struct group **grp)
ZERO_STRUCT(request);
request.data.num_entries = MAX_GETGRENT_GROUPS;
- wbc_status = wbcRequestResponse(WINBINDD_GETGRENT, &request,
- &gr_response);
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GETGRENT,
+ &request, &gr_response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -526,8 +579,13 @@ done:
return wbc_status;
}
+wbcErr wbcGetgrent(struct group **grp)
+{
+ return wbcCtxGetgrent(NULL, grp);
+}
+
/* Return the next struct group* entry from the pwent iterator */
-wbcErr wbcGetgrlist(struct group **grp)
+wbcErr wbcCtxGetgrlist(struct wbcContext *ctx, struct group **grp)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -548,8 +606,8 @@ wbcErr wbcGetgrlist(struct group **grp)
ZERO_STRUCT(request);
request.data.num_entries = MAX_GETGRENT_GROUPS;
- wbc_status = wbcRequestResponse(WINBINDD_GETGRLST, &request,
- &gr_response);
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GETGRLST,
+ &request, &gr_response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -569,10 +627,14 @@ done:
return wbc_status;
}
+wbcErr wbcGetgrlist(struct group **grp)
+{
+ return wbcCtxGetgrlist(NULL, grp);
+}
+
/* Return the unix group array belonging to the given user */
-wbcErr wbcGetGroups(const char *account,
- uint32_t *num_groups,
- gid_t **_groups)
+wbcErr wbcCtxGetGroups(struct wbcContext *ctx, const char *account,
+ uint32_t *num_groups, gid_t **_groups)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -594,7 +656,7 @@ wbcErr wbcGetGroups(const char *account,
strncpy(request.data.username, account, sizeof(request.data.username)-1);
- wbc_status = wbcRequestResponse(WINBINDD_GETGROUPS,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GETGROUPS,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -618,3 +680,8 @@ wbcErr wbcGetGroups(const char *account,
wbcFreeMemory(groups);
return wbc_status;
}
+
+wbcErr wbcGetGroups(const char *account, uint32_t *num_groups, gid_t **_groups)
+{
+ return wbcCtxGetGroups(NULL, account, num_groups, _groups);
+}
diff --git a/nsswitch/libwbclient/wbc_sid.c b/nsswitch/libwbclient/wbc_sid.c
index 0877ed04ae..cc71b9e865 100644
--- a/nsswitch/libwbclient/wbc_sid.c
+++ b/nsswitch/libwbclient/wbc_sid.c
@@ -180,10 +180,11 @@ done:
/* Convert a domain and name to SID */
-wbcErr wbcLookupName(const char *domain,
- const char *name,
- struct wbcDomainSid *sid,
- enum wbcSidType *name_type)
+wbcErr wbcCtxLookupName(struct wbcContext *ctx,
+ const char *domain,
+ const char *name,
+ struct wbcDomainSid *sid,
+ enum wbcSidType *name_type)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -206,7 +207,7 @@ wbcErr wbcLookupName(const char *domain,
strncpy(request.data.name.name, name,
sizeof(request.data.name.name)-1);
- wbc_status = wbcRequestResponse(WINBINDD_LOOKUPNAME,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_LOOKUPNAME,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -222,12 +223,21 @@ wbcErr wbcLookupName(const char *domain,
return wbc_status;
}
+wbcErr wbcLookupName(const char *domain,
+ const char *name,
+ struct wbcDomainSid *sid,
+ enum wbcSidType *name_type)
+{
+ return wbcCtxLookupName(NULL, domain, name, sid, name_type);
+}
+
/* Convert a SID to a domain and name */
-wbcErr wbcLookupSid(const struct wbcDomainSid *sid,
- char **pdomain,
- char **pname,
- enum wbcSidType *pname_type)
+wbcErr wbcCtxLookupSid(struct wbcContext *ctx,
+ const struct wbcDomainSid *sid,
+ char **pdomain,
+ char **pname,
+ enum wbcSidType *pname_type)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -247,7 +257,8 @@ wbcErr wbcLookupSid(const struct wbcDomainSid *sid,
/* Make request */
- wbc_status = wbcRequestResponse(WINBINDD_LOOKUPSID, &request,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_LOOKUPSID,
+ &request,
&response);
if (!WBC_ERROR_IS_OK(wbc_status)) {
return wbc_status;
@@ -285,6 +296,14 @@ done:
return wbc_status;
}
+wbcErr wbcLookupSid(const struct wbcDomainSid *sid,
+ char **pdomain,
+ char **pname,
+ enum wbcSidType *pname_type)
+{
+ return wbcCtxLookupSid(NULL, sid, pdomain, pname, pname_type);
+}
+
static void wbcDomainInfosDestructor(void *ptr)
{
struct wbcDomainInfo *i = (struct wbcDomainInfo *)ptr;
@@ -306,9 +325,10 @@ static void wbcTranslatedNamesDestructor(void *ptr)
}
}
-wbcErr wbcLookupSids(const struct wbcDomainSid *sids, int num_sids,
- struct wbcDomainInfo **pdomains, int *pnum_domains,
- struct wbcTranslatedName **pnames)
+wbcErr wbcCtxLookupSids(struct wbcContext *ctx,
+ const struct wbcDomainSid *sids, int num_sids,
+ struct wbcDomainInfo **pdomains, int *pnum_domains,
+ struct wbcTranslatedName **pnames)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -350,7 +370,7 @@ wbcErr wbcLookupSids(const struct wbcDomainSid *sids, int num_sids,
request.extra_data.data = sidlist;
request.extra_len = p - sidlist;
- wbc_status = wbcRequestResponse(WINBINDD_LOOKUPSIDS,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_LOOKUPSIDS,
&request, &response);
free(sidlist);
if (!WBC_ERROR_IS_OK(wbc_status)) {
@@ -475,9 +495,17 @@ fail:
return wbc_status;
}
+wbcErr wbcLookupSids(const struct wbcDomainSid *sids, int num_sids,
+ struct wbcDomainInfo **pdomains, int *pnum_domains,
+ struct wbcTranslatedName **pnames)
+{
+ return wbcCtxLookupSids(NULL, sids, num_sids, pdomains,
+ pnum_domains, pnames);
+}
+
/* Translate a collection of RIDs within a domain to names */
-wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
+wbcErr wbcCtxLookupRids(struct wbcContext *ctx, struct wbcDomainSid *dom_sid,
int num_rids,
uint32_t *rids,
const char **pp_domain_name,
@@ -527,7 +555,7 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
request.extra_data.data = ridlist;
request.extra_len = len;
- wbc_status = wbcRequestResponse(WINBINDD_LOOKUPRIDS,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_LOOKUPRIDS,
&request,
&response);
free(ridlist);
@@ -599,11 +627,23 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
return wbc_status;
}
+wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
+ int num_rids,
+ uint32_t *rids,
+ const char **pp_domain_name,
+ const char ***pnames,
+ enum wbcSidType **ptypes)
+{
+ return wbcCtxLookupRids(NULL, dom_sid, num_rids, rids,
+ pp_domain_name, pnames, ptypes);
+}
+
/* 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)
+wbcErr wbcCtxLookupUserSids(struct wbcContext *ctx,
+ const struct wbcDomainSid *user_sid,
+ bool domain_groups_only,
+ uint32_t *num_sids,
+ struct wbcDomainSid **_sids)
{
uint32_t i;
const char *s;
@@ -631,7 +671,7 @@ wbcErr wbcLookupUserSids(const struct wbcDomainSid *user_sid,
cmd = WINBINDD_GETUSERSIDS;
}
- wbc_status = wbcRequestResponse(cmd,
+ wbc_status = wbcRequestResponse(ctx, cmd,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -672,6 +712,15 @@ wbcErr wbcLookupUserSids(const struct wbcDomainSid *user_sid,
return wbc_status;
}
+wbcErr wbcLookupUserSids(const struct wbcDomainSid *user_sid,
+ bool domain_groups_only,
+ uint32_t *num_sids,
+ struct wbcDomainSid **_sids)
+{
+ return wbcCtxLookupUserSids(NULL, user_sid, domain_groups_only,
+ num_sids, _sids);
+}
+
static inline
wbcErr _sid_to_rid(struct wbcDomainSid *sid, uint32_t *rid)
{
@@ -684,11 +733,12 @@ wbcErr _sid_to_rid(struct wbcDomainSid *sid, uint32_t *rid)
}
/* 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)
+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)
{
uint32_t i;
const char *s;
@@ -749,7 +799,7 @@ wbcErr wbcGetSidAliases(const struct wbcDomainSid *dom_sid,
request.extra_data.data = extra_data;
request.extra_len = extra_data_len;
- wbc_status = wbcRequestResponse(WINBINDD_GETSIDALIASES,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GETSIDALIASES,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -789,11 +839,22 @@ wbcErr wbcGetSidAliases(const struct wbcDomainSid *dom_sid,
return wbc_status;
}
+wbcErr wbcGetSidAliases(const struct wbcDomainSid *dom_sid,
+ struct wbcDomainSid *sids,
+ uint32_t num_sids,
+ uint32_t **alias_rids,
+ uint32_t *num_alias_rids)
+{
+ return wbcCtxGetSidAliases(NULL, dom_sid, sids, num_sids,
+ alias_rids, num_alias_rids);
+}
+
/* Lists Users */
-wbcErr wbcListUsers(const char *domain_name,
- uint32_t *_num_users,
- const char ***_users)
+wbcErr wbcCtxListUsers(struct wbcContext *ctx,
+ const char *domain_name,
+ uint32_t *_num_users,
+ const char ***_users)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -812,7 +873,7 @@ wbcErr wbcListUsers(const char *domain_name,
sizeof(request.domain_name)-1);
}
- wbc_status = wbcRequestResponse(WINBINDD_LIST_USERS,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_LIST_USERS,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -864,10 +925,18 @@ wbcErr wbcListUsers(const char *domain_name,
return wbc_status;
}
+wbcErr wbcListUsers(const char *domain_name,
+ uint32_t *_num_users,
+ const char ***_users)
+{
+ return wbcCtxListUsers(NULL, domain_name, _num_users, _users);
+}
+
/* Lists Groups */
-wbcErr wbcListGroups(const char *domain_name,
- uint32_t *_num_groups,
- const char ***_groups)
+wbcErr wbcCtxListGroups(struct wbcContext *ctx,
+ const char *domain_name,
+ uint32_t *_num_groups,
+ const char ***_groups)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -886,7 +955,7 @@ wbcErr wbcListGroups(const char *domain_name,
sizeof(request.domain_name)-1);
}
- wbc_status = wbcRequestResponse(WINBINDD_LIST_GROUPS,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_LIST_GROUPS,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -938,27 +1007,35 @@ wbcErr wbcListGroups(const char *domain_name,
return wbc_status;
}
-wbcErr wbcGetDisplayName(const struct wbcDomainSid *sid,
- char **pdomain,
- char **pfullname,
- enum wbcSidType *pname_type)
+wbcErr wbcListGroups(const char *domain_name,
+ uint32_t *_num_groups,
+ const char ***_groups)
+{
+ return wbcCtxListGroups(NULL, domain_name, _num_groups, _groups);
+}
+
+wbcErr wbcCtxGetDisplayName(struct wbcContext *ctx,
+ const struct wbcDomainSid *sid,
+ char **pdomain,
+ char **pfullname,
+ enum wbcSidType *pname_type)
{
wbcErr wbc_status;
char *domain = NULL;
char *name = NULL;
enum wbcSidType name_type;
- wbc_status = wbcLookupSid(sid, &domain, &name, &name_type);
+ wbc_status = wbcCtxLookupSid(ctx, sid, &domain, &name, &name_type);
BAIL_ON_WBC_ERROR(wbc_status);
if (name_type == WBC_SID_NAME_USER) {
uid_t uid;
struct passwd *pwd;
- wbc_status = wbcSidToUid(sid, &uid);
+ wbc_status = wbcCtxSidToUid(ctx, sid, &uid);
BAIL_ON_WBC_ERROR(wbc_status);
- wbc_status = wbcGetpwuid(uid, &pwd);
+ wbc_status = wbcCtxGetpwuid(ctx, uid, &pwd);
BAIL_ON_WBC_ERROR(wbc_status);
wbcFreeMemory(name);
@@ -983,6 +1060,14 @@ wbcErr wbcGetDisplayName(const struct wbcDomainSid *sid,
return wbc_status;
}
+wbcErr wbcGetDisplayName(const struct wbcDomainSid *sid,
+ char **pdomain,
+ char **pfullname,
+ enum wbcSidType *pname_type)
+{
+ return wbcCtxGetDisplayName(NULL, sid, pdomain, pfullname, pname_type);
+}
+
const char* wbcSidTypeString(enum wbcSidType type)
{
switch (type) {
diff --git a/nsswitch/libwbclient/wbc_util.c b/nsswitch/libwbclient/wbc_util.c
index 4060e2521c..3dab0a2de1 100644
--- a/nsswitch/libwbclient/wbc_util.c
+++ b/nsswitch/libwbclient/wbc_util.c
@@ -28,9 +28,11 @@
/** @brief Ping winbindd to see if the daemon is running
*
+ * @param *ctx wbclient Context
+ *
* @return #wbcErr
**/
-wbcErr wbcPing(void)
+wbcErr wbcCtxPing(struct wbcContext *ctx)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -40,7 +42,12 @@ wbcErr wbcPing(void)
ZERO_STRUCT(request);
ZERO_STRUCT(response);
- return wbcRequestResponse(WINBINDD_PING, &request, &response);
+ return wbcRequestResponse(ctx, WINBINDD_PING, &request, &response);
+}
+
+wbcErr wbcPing(void)
+{
+ return wbcCtxPing(NULL);
}
static void wbcInterfaceDetailsDestructor(void *ptr)
@@ -60,7 +67,8 @@ static void wbcInterfaceDetailsDestructor(void *ptr)
* @return #wbcErr
*/
-wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **_details)
+wbcErr wbcCtxInterfaceDetails(struct wbcContext *ctx,
+ struct wbcInterfaceDetails **_details)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct wbcInterfaceDetails *info;
@@ -79,12 +87,13 @@ wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **_details)
BAIL_ON_PTR_ERROR(info, wbc_status);
/* first the interface version */
- wbc_status = wbcRequestResponse(WINBINDD_INTERFACE_VERSION, NULL, &response);
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_INTERFACE_VERSION,
+ NULL, &response);
BAIL_ON_WBC_ERROR(wbc_status);
info->interface_version = response.data.interface_version;
/* then the samba version and the winbind separator */
- wbc_status = wbcRequestResponse(WINBINDD_INFO, NULL, &response);
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_INFO, NULL, &response);
BAIL_ON_WBC_ERROR(wbc_status);
info->winbind_version = strdup(response.data.info.samba_version);
@@ -92,20 +101,22 @@ wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **_details)
info->winbind_separator = response.data.info.winbind_separator;
/* then the local netbios name */
- wbc_status = wbcRequestResponse(WINBINDD_NETBIOS_NAME, NULL, &response);
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_NETBIOS_NAME,
+ NULL, &response);
BAIL_ON_WBC_ERROR(wbc_status);
info->netbios_name = strdup(response.data.netbios_name);
BAIL_ON_PTR_ERROR(info->netbios_name, wbc_status);
/* then the local workgroup name */
- wbc_status = wbcRequestResponse(WINBINDD_DOMAIN_NAME, NULL, &response);
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_DOMAIN_NAME,
+ NULL, &response);
BAIL_ON_WBC_ERROR(wbc_status);
info->netbios_domain = strdup(response.data.domain_name);
BAIL_ON_PTR_ERROR(info->netbios_domain, wbc_status);
- wbc_status = wbcDomainInfo(info->netbios_domain, &domain);
+ wbc_status = wbcCtxDomainInfo(ctx, info->netbios_domain, &domain);
if (wbc_status == WBC_ERR_DOMAIN_NOT_FOUND) {
/* maybe it's a standalone server */
domain = NULL;
@@ -132,6 +143,11 @@ done:
return wbc_status;
}
+wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **_details)
+{
+ return wbcCtxInterfaceDetails(NULL, _details);
+}
+
static void wbcDomainInfoDestructor(void *ptr)
{
struct wbcDomainInfo *i = (struct wbcDomainInfo *)ptr;
@@ -147,7 +163,9 @@ static void wbcDomainInfoDestructor(void *ptr)
* @return #wbcErr
*/
-wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo)
+wbcErr wbcCtxDomainInfo(struct wbcContext *ctx,
+ const char *domain,
+ struct wbcDomainInfo **dinfo)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -167,7 +185,7 @@ wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo)
strncpy(request.domain_name, domain,
sizeof(request.domain_name)-1);
- wbc_status = wbcRequestResponse(WINBINDD_DOMAIN_INFO,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_DOMAIN_INFO,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -203,9 +221,15 @@ wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo)
return wbc_status;
}
+wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo)
+{
+ return wbcCtxDomainInfo(NULL, domain, dinfo);
+}
+
/* Get the list of current DCs */
-wbcErr wbcDcInfo(const char *domain, size_t *num_dcs,
- const char ***dc_names, const char ***dc_ips)
+wbcErr wbcCtxDcInfo(struct wbcContext *ctx,
+ const char *domain, size_t *num_dcs,
+ const char ***dc_names, const char ***dc_ips)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -226,7 +250,7 @@ wbcErr wbcDcInfo(const char *domain, size_t *num_dcs,
sizeof(request.domain_name) - 1);
}
- wbc_status = wbcRequestResponse(WINBINDD_DC_INFO,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_DC_INFO,
&request, &response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -290,8 +314,15 @@ done:
return wbc_status;
}
+wbcErr wbcDcInfo(const char *domain, size_t *num_dcs,
+ const char ***dc_names, const char ***dc_ips)
+{
+ return wbcCtxDcInfo(NULL, domain, num_dcs, dc_names, dc_ips);
+}
+
/* Resolve a NetbiosName via WINS */
-wbcErr wbcResolveWinsByName(const char *name, char **ip)
+wbcErr wbcCtxResolveWinsByName(struct wbcContext *ctx,
+ const char *name, char **ip)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -306,7 +337,7 @@ wbcErr wbcResolveWinsByName(const char *name, char **ip)
strncpy(request.data.winsreq, name,
sizeof(request.data.winsreq)-1);
- wbc_status = wbcRequestResponse(WINBINDD_WINS_BYNAME,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_WINS_BYNAME,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -323,8 +354,14 @@ wbcErr wbcResolveWinsByName(const char *name, char **ip)
return wbc_status;
}
+wbcErr wbcResolveWinsByName(const char *name, char **ip)
+{
+ return wbcCtxResolveWinsByName(NULL, name, ip);
+}
+
/* Resolve an IP address via WINS into a NetbiosName */
-wbcErr wbcResolveWinsByIP(const char *ip, char **name)
+wbcErr wbcCtxResolveWinsByIP(struct wbcContext *ctx,
+ const char *ip, char **name)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -339,7 +376,7 @@ wbcErr wbcResolveWinsByIP(const char *ip, char **name)
strncpy(request.data.winsreq, ip,
sizeof(request.data.winsreq)-1);
- wbc_status = wbcRequestResponse(WINBINDD_WINS_BYIP,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_WINS_BYIP,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -356,6 +393,11 @@ wbcErr wbcResolveWinsByIP(const char *ip, char **name)
return wbc_status;
}
+wbcErr wbcResolveWinsByIP(const char *ip, char **name)
+{
+ return wbcCtxResolveWinsByIP(NULL, ip, name);
+}
+
/**
*/
@@ -489,7 +531,8 @@ static void wbcDomainInfoListDestructor(void *ptr)
}
/* Enumerate the domain trusts known by Winbind */
-wbcErr wbcListTrusts(struct wbcDomainInfo **domains, size_t *num_domains)
+wbcErr wbcCtxListTrusts(struct wbcContext *ctx,
+ struct wbcDomainInfo **domains, size_t *num_domains)
{
struct winbindd_response response;
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
@@ -505,7 +548,7 @@ wbcErr wbcListTrusts(struct wbcDomainInfo **domains, size_t *num_domains)
/* Send request */
- wbc_status = wbcRequestResponse(WINBINDD_LIST_TRUSTDOM,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_LIST_TRUSTDOM,
NULL,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -559,6 +602,11 @@ wbcErr wbcListTrusts(struct wbcDomainInfo **domains, size_t *num_domains)
return wbc_status;
}
+wbcErr wbcListTrusts(struct wbcDomainInfo **domains, size_t *num_domains)
+{
+ return wbcCtxListTrusts(NULL, domains, num_domains);
+}
+
static void wbcDomainControllerInfoDestructor(void *ptr)
{
struct wbcDomainControllerInfo *i =
@@ -567,9 +615,9 @@ static void wbcDomainControllerInfoDestructor(void *ptr)
}
/* Enumerate the domain trusts known by Winbind */
-wbcErr wbcLookupDomainController(const char *domain,
- uint32_t flags,
- struct wbcDomainControllerInfo **dc_info)
+wbcErr wbcCtxLookupDomainController(struct wbcContext *ctx,
+ const char *domain, uint32_t flags,
+ struct wbcDomainControllerInfo **dc_info)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -598,7 +646,7 @@ wbcErr wbcLookupDomainController(const char *domain,
/* Send request */
- wbc_status = wbcRequestResponse(WINBINDD_DSGETDCNAME,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_DSGETDCNAME,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -614,6 +662,12 @@ done:
return wbc_status;
}
+wbcErr wbcLookupDomainController(const char *domain, uint32_t flags,
+ struct wbcDomainControllerInfo **dc_info)
+{
+ return wbcCtxLookupDomainController(NULL, domain, flags, dc_info);
+}
+
static void wbcDomainControllerInfoExDestructor(void *ptr)
{
struct wbcDomainControllerInfoEx *i =
@@ -688,11 +742,12 @@ done:
}
/* Get extended domain controller information */
-wbcErr wbcLookupDomainControllerEx(const char *domain,
- struct wbcGuid *guid,
- const char *site,
- uint32_t flags,
- struct wbcDomainControllerInfoEx **dc_info)
+wbcErr wbcCtxLookupDomainControllerEx(struct wbcContext *ctx,
+ const char *domain,
+ struct wbcGuid *guid,
+ const char *site,
+ uint32_t flags,
+ struct wbcDomainControllerInfoEx **dc_info)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct winbindd_request request;
@@ -732,7 +787,7 @@ wbcErr wbcLookupDomainControllerEx(const char *domain,
/* Send request */
- wbc_status = wbcRequestResponse(WINBINDD_DSGETDCNAME,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_DSGETDCNAME,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
@@ -748,6 +803,16 @@ done:
return wbc_status;
}
+wbcErr wbcLookupDomainControllerEx(const char *domain,
+ struct wbcGuid *guid,
+ const char *site,
+ uint32_t flags,
+ struct wbcDomainControllerInfoEx **dc_info)
+{
+ return wbcCtxLookupDomainControllerEx(NULL, domain, guid, site,
+ flags, dc_info);
+}
+
static void wbcNamedBlobDestructor(void *ptr)
{
struct wbcNamedBlob *b = (struct wbcNamedBlob *)ptr;
diff --git a/nsswitch/libwbclient/wbclient.h b/nsswitch/libwbclient/wbclient.h
index 265cf43b96..6aa4e129c7 100644
--- a/nsswitch/libwbclient/wbclient.h
+++ b/nsswitch/libwbclient/wbclient.h
@@ -630,12 +630,23 @@ wbcErr wbcStringToGuid(const char *guid_string,
/**
* @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
+ *
* @return #wbcErr
**/
wbcErr wbcPing(void);
wbcErr wbcLibraryDetails(struct wbcLibraryDetails **details);
+wbcErr wbcCtxInterfaceDetails(struct wbcContext *ctx,
+ struct wbcInterfaceDetails **details);
wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **details);
/**********************************************************
@@ -645,6 +656,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
@@ -660,7 +688,24 @@ wbcErr wbcLookupName(const char *dom_name,
/**
* @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
@@ -678,6 +723,11 @@ struct wbcTranslatedName {
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);
@@ -685,6 +735,17 @@ wbcErr wbcLookupSids(const struct wbcDomainSid *sids, int num_sids,
/**
* @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,
@@ -695,6 +756,15 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
/*
* @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,
@@ -703,6 +773,16 @@ wbcErr wbcLookupUserSids(const struct wbcDomainSid *user_sid,
/*
* @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,
@@ -712,6 +792,14 @@ wbcErr wbcGetSidAliases(const struct wbcDomainSid *dom_sid,
/**
* @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);
@@ -719,10 +807,24 @@ wbcErr wbcListUsers(const char *domain_name,
/**
* @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);
+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,
@@ -735,6 +837,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
*
@@ -759,6 +875,19 @@ wbcErr wbcQuerySidToUid(const struct wbcDomainSid *sid,
/**
* @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
+ *
* @param uid Unix uid to be resolved
* @param *sid Pointer to the resolved domain SID
*
@@ -783,6 +912,20 @@ wbcErr wbcQueryUidToSid(uid_t uid,
/**
* @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
+ *
* @param *sid Pointer to the domain SID to be resolved
* @param *pgid Pointer to the resolved gid_t value
*
@@ -807,6 +950,19 @@ wbcErr wbcQuerySidToGid(const struct wbcDomainSid *sid,
/**
* @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
+ *
* @param gid Unix gid to be resolved
* @param *sid Pointer to the resolved domain SID
*
@@ -848,6 +1004,21 @@ struct wbcUnixId {
/**
* @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
@@ -861,7 +1032,17 @@ wbcErr wbcSidsToUnixIds(const struct wbcDomainSid *sids, uint32_t num_sids,
/**
* @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
**/
@@ -870,7 +1051,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
**/
@@ -960,6 +1151,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.
*
@@ -971,6 +1175,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.
*
@@ -982,6 +1199,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.
*
@@ -993,6 +1223,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.
*
@@ -1004,6 +1247,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.
*
@@ -1014,6 +1270,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);
@@ -1021,6 +1286,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);
@@ -1028,7 +1302,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
**/
@@ -1037,6 +1321,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);
@@ -1044,6 +1337,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);
@@ -1051,7 +1353,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
**/
@@ -1062,7 +1374,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
**/
@@ -1071,6 +1395,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.
@@ -1089,7 +1428,21 @@ 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.
*
@@ -1101,6 +1454,22 @@ wbcErr wbcDomainInfo(const char *domain,
/**
* @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
+ *
* @param domain The domain to query
*
* @param num_dcs Number of DCs currently known
@@ -1115,6 +1484,19 @@ wbcErr wbcDcInfo(const char *domain, size_t *num_dcs,
/**
* @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
+ *
* @param **domains Pointer to the allocated domain list array
* @param *num_domains Pointer to number of domains returned
*
@@ -1148,6 +1530,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
@@ -1161,6 +1558,25 @@ wbcErr wbcLookupDomainController(const char *domain,
/**
* @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
+ *
* @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
@@ -1182,6 +1598,19 @@ 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
*
@@ -1193,6 +1622,22 @@ wbcErr wbcAuthenticateUser(const char *username,
/**
* @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
+ *
* @param params Input parameters, WBC_AUTH_USER_LEVEL_HASH
* is not supported yet
* @param info Output details on WBC_ERR_SUCCESS
@@ -1207,6 +1652,23 @@ wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params,
/**
* @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
+ *
* @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
@@ -1222,6 +1684,22 @@ wbcErr wbcLogonUser(const struct wbcLogonUserParams *params,
/**
* @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
+ *
* @param username Name of user to remove from Winbind's list of
* logged on users.
* @param uid Uid assigned to the username
@@ -1237,6 +1715,19 @@ wbcErr wbcLogoffUser(const char *username,
/**
* @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
+ *
* @param params A wbcLogoffUserParams structure
* @param error User output details on error
*
@@ -1248,6 +1739,21 @@ wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params,
/**
* @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
+ *
* @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
@@ -1262,6 +1768,24 @@ wbcErr wbcChangeUserPassword(const char *username,
* @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
+ * failure
+ *
* @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
@@ -1277,6 +1801,21 @@ wbcErr wbcChangeUserPasswordEx(const struct wbcChangePasswordParams *params,
/**
* @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
+ *
* @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
@@ -1290,6 +1829,18 @@ wbcErr wbcCredentialCache(struct wbcCredentialCacheParams *params,
/**
* @brief Save a password with winbind for doing wbcCredentialCache() later
*
+ * @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
*
@@ -1304,6 +1855,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
*
@@ -1314,8 +1877,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
*
@@ -1329,6 +1905,18 @@ 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
*
@@ -1340,6 +1928,18 @@ wbcErr wbcCheckTrustCredentials(const char *domain,
/**
* @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
+ *
* @param *domain The name of the domain.
* @param error Output details on WBC_ERR_AUTH_ERROR
*
@@ -1352,6 +1952,21 @@ wbcErr wbcChangeTrustCredentials(const char *domain,
* @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
+ * 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.
@@ -1365,6 +1980,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.