diff options
author | Andrew Bartlett <abartlet@samba.org> | 2002-08-21 11:15:10 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2002-08-21 11:15:10 +0000 |
commit | e47acb0147fa5e215a872f69984fb80515dd0c97 (patch) | |
tree | 8716cd9f5430429d667ba9e5f14b728b6c19b204 | |
parent | 257dfc89814f555d1f7478f8e303f7925bc143d7 (diff) | |
download | samba-e47acb0147fa5e215a872f69984fb80515dd0c97.tar.gz samba-e47acb0147fa5e215a872f69984fb80515dd0c97.tar.bz2 samba-e47acb0147fa5e215a872f69984fb80515dd0c97.zip |
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)
-rw-r--r-- | source3/pam_smbpass/pam_smb_passwd.c | 9 |
1 files 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; } |