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 | b43304c2aa406267ef157dd0ac59319d6c494ce4 (patch) | |
tree | 159182d7e8d05ee114a40e761a824afc8f487dc1 /source/pam_smbpass | |
parent | c58e3d5c7d78dd02584b1490a27f7007e11b8712 (diff) | |
download | samba-b43304c2aa406267ef157dd0ac59319d6c494ce4.tar.gz samba-b43304c2aa406267ef157dd0ac59319d6c494ce4.tar.xz samba-b43304c2aa406267ef157dd0ac59319d6c494ce4.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
Diffstat (limited to 'source/pam_smbpass')
-rw-r--r-- | source/pam_smbpass/pam_smb_passwd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/pam_smbpass/pam_smb_passwd.c b/source/pam_smbpass/pam_smb_passwd.c index 0f527552525..91eae3c7a19 100644 --- a/source/pam_smbpass/pam_smb_passwd.c +++ b/source/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; } |