--- samba-3.0.23a/source/nsswitch/pam_winbind.c.valid_user 2006-09-08 17:07:24.000000000 +0200 +++ samba-3.0.23a/source/nsswitch/pam_winbind.c 2006-09-08 17:07:34.000000000 +0200 @@ -610,33 +610,38 @@ * sure it's really a winbind user, this is important when stacking PAM * modules in the 'account' or 'password' facility. */ - struct passwd *pwd = NULL; struct winbindd_request request; struct winbindd_response response; - int ret; ZERO_STRUCT(request); ZERO_STRUCT(response); - pwd = getpwnam(user); - if (pwd == NULL) { - return 1; - } - strncpy(request.data.username, user, sizeof(request.data.username) - 1); - ret = pam_winbind_request_log(pamh, ctrl, WINBINDD_GETPWNAM, &request, &response, user); + /* Fill in request and send down pipe */ + init_request(&request, WINBINDD_GETPWNAM); - switch (ret) { - case PAM_USER_UNKNOWN: - return 1; - case PAM_SUCCESS: - return 0; - default: - break; - } - return -1; + if (write_sock(&request, sizeof(request), 0) == -1) { + _pam_log(LOG_ERR, "write to socket failed!"); + close_sock(); + return -1; + } + + /* Wait for reply */ + if (read_reply(&response) == -1) { + _pam_log(LOG_ERR, "read from socket failed!"); + close_sock(); + return -1; + } + + /* We are done with the socket - close it and avoid mischeif */ + close_sock(); + + if (response.result != WINBINDD_OK) + return 1; + + return 0; } static char *_pam_delete(register char *xx)