From e47acb0147fa5e215a872f69984fb80515dd0c97 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 21 Aug 2002 11:15:10 +0000 Subject: Fix pam_smbpass to always check the return value of pdb_getsampwnam() to determine if the user exists. (from post on samba-technical) Andrew Bartlett (This used to be commit b43304c2aa406267ef157dd0ac59319d6c494ce4) --- source3/pam_smbpass/pam_smb_passwd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source3/pam_smbpass/pam_smb_passwd.c b/source3/pam_smbpass/pam_smb_passwd.c index 0f52755252..91eae3c7a1 100644 --- a/source3/pam_smbpass/pam_smb_passwd.c +++ b/source3/pam_smbpass/pam_smb_passwd.c @@ -96,6 +96,8 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags, char *pass_old; char *pass_new; + NTSTATUS nt_status; + /* Samba initialization. */ setup_logging( "pam_smbpass", False ); in_client = True; @@ -124,10 +126,11 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags, } /* obtain user record */ - pdb_init_sam(&sampass); - pdb_getsampwnam(sampass,user); + if (!NT_STATUS_IS_OK(nt_status = pdb_init_sam(&sampass))) { + return nt_status_to_pam(nt_status); + } - if (sampass == NULL) { + if (!pdb_getsampwnam(sampass,user)) { _log_err( LOG_ALERT, "Failed to find entry for user %s.", user ); return PAM_USER_UNKNOWN; } -- cgit