#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;
/* 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);
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)
}
/* 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;
/* 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);
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)
*
**/
-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;
/* 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);
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 */
/* 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;
/* 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);
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)
}
/* 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;
/* Make request */
- wbc_status = wbcRequestResponsePriv(WINBINDD_ALLOCATE_UID,
+ wbc_status = wbcRequestResponsePriv(ctx, WINBINDD_ALLOCATE_UID,
&request, &response);
BAIL_ON_WBC_ERROR(wbc_status);
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;
/* Make request */
- wbc_status = wbcRequestResponsePriv(WINBINDD_ALLOCATE_GID,
+ wbc_status = wbcRequestResponsePriv(ctx, WINBINDD_ALLOCATE_GID,
&request, &response);
BAIL_ON_WBC_ERROR(wbc_status);
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
}
/* 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;
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)) {
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);
+}
#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;
params.level = WBC_AUTH_USER_LEVEL_PLAIN;
params.password.plaintext = password;
- wbc_status = wbcAuthenticateUserEx(¶ms, NULL, NULL);
+ wbc_status = wbcCtxAuthenticateUserEx(ctx, ¶ms, 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)
/* 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;
ZERO_STRUCT(sep_response);
- wbc_status = wbcRequestResponse(WINBINDD_INFO,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_INFO,
NULL, &sep_response);
BAIL_ON_WBC_ERROR(wbc_status);
}
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) {
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;
/* 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) {
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;
/* 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,
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);
* 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;
/* Send request */
- wbc_status = wbcRequestResponse(WINBINDD_PING_DC,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_PING_DC,
&request,
&response);
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;
/* Send request */
- wbc_status = wbcRequestResponse(WINBINDD_PAM_LOGOFF,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_PAM_LOGOFF,
&request,
&response);
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;
/* Send request */
- wbc_status = wbcRequestResponse(WINBINDD_PAM_LOGOFF,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_PAM_LOGOFF,
&request,
&response);
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;
/* Send request */
- wbc_status = wbcRequestResponse(cmd,
+ wbc_status = wbcRequestResponse(ctx, cmd,
&request,
&response);
if (WBC_ERROR_IS_OK(wbc_status)) {
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;
params.old_password.plaintext = old_password;
params.new_password.plaintext = new_password;
- wbc_status = wbcChangeUserPasswordEx(¶ms,
- NULL,
- NULL,
- NULL);
+ wbc_status = wbcCtxChangeUserPasswordEx(ctx, ¶ms,
+ 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;
}
}
- wbc_status = wbcRequestResponse(WINBINDD_PAM_AUTH,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_PAM_AUTH,
&request,
&response);
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 =
}
/* 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;
}
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;
}
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;
}
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;
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);
}
}
/* 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;
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);
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;
request.data.uid = uid;
- wbc_status = wbcRequestResponse(WINBINDD_GETPWUID,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GETPWUID,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
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;
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);
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;
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);
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;
request.data.gid = gid;
- wbc_status = wbcRequestResponse(WINBINDD_GETGRGID,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_GETGRGID,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
return wbc_status;
}
+wbcErr wbcGetgrgid(gid_t gid, struct group **grp)
+{
+ return wbcCtxGetgrgid(NULL, gid, grp);
+}
+
/** @brief Number of cached passwd structs
*
*/
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;
ZERO_STRUCT(pw_response);
- wbc_status = wbcRequestResponse(WINBINDD_SETPWENT,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_SETPWENT,
NULL, NULL);
BAIL_ON_WBC_ERROR(wbc_status);
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;
winbindd_free_response(&pw_response);
}
- wbc_status = wbcRequestResponse(WINBINDD_ENDPWENT,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_ENDPWENT,
NULL, NULL);
BAIL_ON_WBC_ERROR(wbc_status);
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;
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);
return wbc_status;
}
+wbcErr wbcGetpwent(struct passwd **pwd)
+{
+ return wbcCtxGetpwent(NULL, pwd);
+}
+
/** @brief Number of cached group structs
*
*/
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;
ZERO_STRUCT(gr_response);
- wbc_status = wbcRequestResponse(WINBINDD_SETGRENT,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_SETGRENT,
NULL, NULL);
BAIL_ON_WBC_ERROR(wbc_status);
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;
winbindd_free_response(&gr_response);
}
- wbc_status = wbcRequestResponse(WINBINDD_ENDGRENT,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_ENDGRENT,
NULL, NULL);
BAIL_ON_WBC_ERROR(wbc_status);
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;
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);
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;
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);
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;
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);
wbcFreeMemory(groups);
return wbc_status;
}
+
+wbcErr wbcGetGroups(const char *account, uint32_t *num_groups, gid_t **_groups)
+{
+ return wbcCtxGetGroups(NULL, account, num_groups, _groups);
+}
/* 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;
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);
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;
/* 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;
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;
}
}
-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;
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)) {
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,
request.extra_data.data = ridlist;
request.extra_len = len;
- wbc_status = wbcRequestResponse(WINBINDD_LOOKUPRIDS,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_LOOKUPRIDS,
&request,
&response);
free(ridlist);
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;
cmd = WINBINDD_GETUSERSIDS;
}
- wbc_status = wbcRequestResponse(cmd,
+ wbc_status = wbcRequestResponse(ctx, cmd,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
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)
{
}
/* 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;
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);
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;
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);
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;
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);
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);
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) {
#include "../winbind_client.h"
/** @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;
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)
* @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;
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);
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;
return wbc_status;
}
+wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **_details)
+{
+ return wbcCtxInterfaceDetails(NULL, _details);
+}
+
static void wbcDomainInfoDestructor(void *ptr)
{
struct wbcDomainInfo *i = (struct wbcDomainInfo *)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;
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);
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;
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);
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;
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);
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;
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);
return wbc_status;
}
+wbcErr wbcResolveWinsByIP(const char *ip, char **name)
+{
+ return wbcCtxResolveWinsByIP(NULL, ip, name);
+}
+
/**
*/
}
/* 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;
/* Send request */
- wbc_status = wbcRequestResponse(WINBINDD_LIST_TRUSTDOM,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_LIST_TRUSTDOM,
NULL,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
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 =
}
/* 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;
/* Send request */
- wbc_status = wbcRequestResponse(WINBINDD_DSGETDCNAME,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_DSGETDCNAME,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
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 =
}
/* 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;
/* Send request */
- wbc_status = wbcRequestResponse(WINBINDD_DSGETDCNAME,
+ wbc_status = wbcRequestResponse(ctx, WINBINDD_DSGETDCNAME,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
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;
wbcErr wbcStringToGuid(const char *guid_string,
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
*
wbcErr wbcLibraryDetails(struct wbcLibraryDetails **details);
+wbcErr wbcCtxInterfaceDetails(struct wbcContext *ctx,
+ struct wbcInterfaceDetails **details);
wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **details);
/**********************************************************
* Name/SID conversion
**********************************************************/
+/**
+ * @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
*
/**
* @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
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);
+/**
+ * @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
*/
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
**/
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
**/
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
**/
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
**/
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,
* SID/uid/gid Mappings
**********************************************************/
+/**
+ * @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
*
wbcErr wbcQuerySidToUid(const struct wbcDomainSid *sid,
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
*
wbcErr wbcQueryUidToSid(uid_t uid,
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
*
wbcErr wbcQuerySidToGid(const struct wbcDomainSid *sid,
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
*
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
*
/**
* @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
**/
/**
* @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
**/
* NSS Lookup User/Group details
**********************************************************/
+/**
+ * @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
**/
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
**/
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
**/
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
**/
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
**/
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
*
**/
wbcErr wbcSetpwent(void);
+/**
+ * @brief Close the passwd iterator
+ *
+ * @param *ctx wbclient Context
+ *
+ * @return #wbcErr
+ **/
+wbcErr wbcCtxEndpwent(struct wbcContext *ctx);
+
/**
* @brief Close the passwd iterator
*
/**
* @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
**/
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
*
**/
wbcErr wbcSetgrent(void);
+/**
+ * @brief Close the group iterator
+ *
+ * @param *ctx wbclient Context
+ *
+ * @return #wbcErr
+ **/
+wbcErr wbcCtxEndgrent(struct wbcContext *ctx);
+
/**
* @brief Close the group iterator
*
/**
* @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
**/
*
* 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
**/
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
*
/**
* @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.
*
wbcErr wbcDomainInfo(const char *domain,
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
*
wbcErr wbcDcInfo(const char *domain, size_t *num_dcs,
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
*
#define WBC_LOOKUP_DC_RETURN_DNS_NAME 0x40000000
#define WBC_LOOKUP_DC_RETURN_FLAT_NAME 0x80000000
+/**
+ * @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
*
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
*
* Athenticate functions
**********************************************************/
+/**
+ * @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
*
wbcErr wbcAuthenticateUser(const char *username,
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
*
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
*
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
*
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
*
wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params,
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
*
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
* failure
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
*
struct wbcCredentialCacheInfo **info,
struct wbcAuthErrorInfo **error);
+/**
+ * @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
*
* Resolve functions
**********************************************************/
+/**
+ * @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
*
/**
* @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
*
* Trusted domain functions
**********************************************************/
+/**
+ * @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
*
wbcErr wbcCheckTrustCredentials(const char *domain,
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
*
wbcErr wbcChangeTrustCredentials(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
+ *
+ * @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
**/
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