summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-08-14 18:15:29 +0200
committerGünther Deschner <gd@samba.org>2008-10-10 15:39:05 +0200
commit377e4f929a4e0913fcc4b531437049db450659ea (patch)
tree5c6a52d1df27662d6960f8848ef141eddf57c70a /source3/nsswitch
parentb1282d720cffeb4b89bc5276b827e60ccef3f110 (diff)
downloadsamba-377e4f929a4e0913fcc4b531437049db450659ea.tar.gz
samba-377e4f929a4e0913fcc4b531437049db450659ea.tar.bz2
samba-377e4f929a4e0913fcc4b531437049db450659ea.zip
pam_winbind: use libwbclient for WINBINDD_GETPWNAM.
Guenther
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/pam_winbind.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/source3/nsswitch/pam_winbind.c b/source3/nsswitch/pam_winbind.c
index 41dacd7105..4f4f043df4 100644
--- a/source3/nsswitch/pam_winbind.c
+++ b/source3/nsswitch/pam_winbind.c
@@ -718,7 +718,6 @@ static int pam_winbind_request(struct pwb_context *ctx,
/* no need to check for pam_error codes for getpwnam() */
switch (req_type) {
- case WINBINDD_GETPWNAM:
case WINBINDD_LOOKUPNAME:
if (strlen(response->data.auth.nt_status_string) > 0) {
_pam_log(ctx, LOG_ERR,
@@ -1723,29 +1722,26 @@ static int valid_user(struct pwb_context *ctx,
* sure it's really a winbind user, this is important when stacking PAM
* modules in the 'account' or 'password' facility. */
+ wbcErr wbc_status;
struct passwd *pwd = NULL;
- struct winbindd_request request;
- struct winbindd_response response;
- int ret;
-
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
+ struct passwd *wb_pwd = NULL;
pwd = getpwnam(user);
if (pwd == NULL) {
return 1;
}
- strncpy(request.data.username, user,
- sizeof(request.data.username) - 1);
-
- ret = pam_winbind_request_log(ctx, WINBINDD_GETPWNAM,
- &request, &response, user);
+ wbc_status = wbcGetpwnam(user, &wb_pwd);
+ wbcFreeMemory(wb_pwd);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ _pam_log(ctx, LOG_DEBUG, "valid_user: wbcGetpwnam gave %s\n",
+ wbcErrorString(wbc_status));
+ }
- switch (ret) {
- case PAM_USER_UNKNOWN:
+ switch (wbc_status) {
+ case WBC_ERR_UNKNOWN_USER:
return 1;
- case PAM_SUCCESS:
+ case WBC_ERR_SUCCESS:
return 0;
default:
break;