tiniparser_freedict(ctx->dict);
}
+ wbcCtxFree(ctx->wbc_ctx);
+
return 0;
}
}
r->ctrl = ctrl_code;
+ r->wbc_ctx = wbcCtxCreate();
+ if (r->wbc_ctx == NULL) {
+ TALLOC_FREE(r);
+ return PAM_SYSTEM_ERR;
+ }
+
*ctx_p = r;
return PAM_SUCCESS;
_pam_log_debug(ctx, LOG_DEBUG,
"no sid given, looking up: %s\n", name);
- wbc_status = wbcLookupName("", name, &sid, &type);
+ wbc_status = wbcCtxLookupName(ctx->wbc_ctx,
+ "",
+ name,
+ &sid,
+ &type);
if (!WBC_ERROR_IS_OK(wbc_status)) {
_pam_log(ctx, LOG_INFO,
"could not lookup name: %s\n", name);
}
}
- wbc_status = wbcLogonUser(&logon, &info, &error, &policy);
+ wbc_status = wbcCtxLogonUser(ctx->wbc_ctx,
+ &logon,
+ &info,
+ &error,
+ &policy);
ret = wbc_auth_error_to_pam_error(ctx, error, wbc_status,
user, "wbcLogonUser");
wbcFreeMemory(logon.blobs);
params.new_password.plaintext = newpass;
params.flags = flags;
- wbc_status = wbcChangeUserPasswordEx(¶ms, &error, &reject_reason, &policy);
+ wbc_status = wbcCtxChangeUserPasswordEx(ctx->wbc_ctx,
+ ¶ms,
+ &error,
+ &reject_reason,
+ &policy);
ret = wbc_auth_error_to_pam_error(ctx, error, wbc_status,
user, "wbcChangeUserPasswordEx");
return 1;
}
- wbc_status = wbcGetpwnam(user, &wb_pwd);
+ wbc_status = wbcCtxGetpwnam(ctx->wbc_ctx, user, &wb_pwd);
wbcFreeMemory(wb_pwd);
if (!WBC_ERROR_IS_OK(wbc_status)) {
_pam_log(ctx, LOG_DEBUG, "valid_user: wbcGetpwnam gave %s\n",
wbcErr wbc_status;
static struct wbcInterfaceDetails *details = NULL;
- wbc_status = wbcInterfaceDetails(&details);
+ wbc_status = wbcCtxInterfaceDetails(ctx->wbc_ctx, &details);
if (!WBC_ERROR_IS_OK(wbc_status)) {
_pam_log(ctx, LOG_ERR,
"Could not retrieve winbind interface details: %s",
/* Convert the UPN to a SID */
- wbc_status = wbcLookupName(domain, name, &sid, &type);
+ wbc_status = wbcCtxLookupName(ctx->wbc_ctx, domain, name, &sid, &type);
if (!WBC_ERROR_IS_OK(wbc_status)) {
return NULL;
}
/* Convert the the SID back to the sAMAccountName */
- wbc_status = wbcLookupSid(&sid, &domain, &name, &type);
+ wbc_status = wbcCtxLookupSid(ctx->wbc_ctx, &sid, &domain, &name, &type);
if (!WBC_ERROR_IS_OK(wbc_status)) {
return NULL;
}
goto out;
}
- wbc_status = wbcLogoffUserEx(&logoff, &error);
+ wbc_status = wbcCtxLogoffUserEx(ctx->wbc_ctx, &logoff, &error);
retval = wbc_auth_error_to_pam_error(ctx, error, wbc_status,
user, "wbcLogoffUser");
wbcFreeMemory(error);