summaryrefslogtreecommitdiffstats
path: root/source3/pam_smbpass
diff options
context:
space:
mode:
Diffstat (limited to 'source3/pam_smbpass')
-rw-r--r--source3/pam_smbpass/pam_smb_acct.c9
-rw-r--r--source3/pam_smbpass/pam_smb_auth.c2
-rw-r--r--source3/pam_smbpass/pam_smb_passwd.c6
3 files changed, 9 insertions, 8 deletions
diff --git a/source3/pam_smbpass/pam_smb_acct.c b/source3/pam_smbpass/pam_smb_acct.c
index 8d5882bc931..cf53e04d7e7 100644
--- a/source3/pam_smbpass/pam_smb_acct.c
+++ b/source3/pam_smbpass/pam_smb_acct.c
@@ -79,10 +79,13 @@ int pam_sm_acct_mgmt( pam_handle_t *pamh, int flags,
}
/* Get the user's record. */
- pdb_init_sam(&sampass);
- pdb_getsampwnam(sampass, name );
- if (!sampass) {
+ if ( (sampass = samu_new( NULL )) != NULL ) {
+ pdb_getsampwnam(sampass, name );
+ }
+
+ /* check for lookup failure */
+ if ( !sampass || !strlen(pdb_get_username(sampass)) ) {
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return PAM_USER_UNKNOWN;
}
diff --git a/source3/pam_smbpass/pam_smb_auth.c b/source3/pam_smbpass/pam_smb_auth.c
index 3de752cd30e..f7980e2bb23 100644
--- a/source3/pam_smbpass/pam_smb_auth.c
+++ b/source3/pam_smbpass/pam_smb_auth.c
@@ -107,7 +107,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
AUTH_RETURN;
}
- pdb_init_sam(&sampass);
+ sampass = samu_new( NULL );
found = pdb_getsampwnam( sampass, name );
diff --git a/source3/pam_smbpass/pam_smb_passwd.c b/source3/pam_smbpass/pam_smb_passwd.c
index f0a94bd49cb..8eca1d6aa97 100644
--- a/source3/pam_smbpass/pam_smb_passwd.c
+++ b/source3/pam_smbpass/pam_smb_passwd.c
@@ -102,8 +102,6 @@ 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;
@@ -137,9 +135,9 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
}
/* obtain user record */
- if (!NT_STATUS_IS_OK(nt_status = pdb_init_sam(&sampass))) {
+ if ( !(sampass = samu_new( NULL )) ) {
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
- return nt_status_to_pam(nt_status);
+ return nt_status_to_pam(NT_STATUS_NO_MEMORY);
}
if (!pdb_getsampwnam(sampass,user)) {