summaryrefslogtreecommitdiff
path: root/source3/pam_smbpass
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-12-12 17:26:49 -0800
committerJeremy Allison <jra@samba.org>2007-12-12 17:26:49 -0800
commit9373e1ea90c088b4a1156554efb9e1da1738a8d3 (patch)
treece685c61705e1140f8f871ca020c50c125507f48 /source3/pam_smbpass
parent022014dba281a50d98ac2f00a4c941124065914f (diff)
downloadsamba-9373e1ea90c088b4a1156554efb9e1da1738a8d3.tar.gz
samba-9373e1ea90c088b4a1156554efb9e1da1738a8d3.tar.bz2
samba-9373e1ea90c088b4a1156554efb9e1da1738a8d3.zip
Fix bug #3727 with patch from Steve Langasek <vorlon@debian.org>
Jeremy. (This used to be commit 0723760ba47a465d2ff5a22a680f1b5196eca7d8)
Diffstat (limited to 'source3/pam_smbpass')
-rw-r--r--source3/pam_smbpass/pam_smb_acct.c5
-rw-r--r--source3/pam_smbpass/pam_smb_auth.c8
-rw-r--r--source3/pam_smbpass/pam_smb_passwd.c5
3 files changed, 17 insertions, 1 deletions
diff --git a/source3/pam_smbpass/pam_smb_acct.c b/source3/pam_smbpass/pam_smb_acct.c
index c7622fbaa2..59ed4eee8b 100644
--- a/source3/pam_smbpass/pam_smb_acct.c
+++ b/source3/pam_smbpass/pam_smb_acct.c
@@ -77,6 +77,11 @@ int pam_sm_acct_mgmt( pam_handle_t *pamh, int flags,
_log_err( LOG_DEBUG, "acct: username [%s] obtained", name );
}
+ if (geteuid() != 0) {
+ _log_err(pamh, LOG_DEBUG, "Cannot access samba password database, not running as root.");
+ return PAM_AUTHINFO_UNAVAIL;
+ }
+
/* Getting into places that might use LDAP -- protect the app
from a SIGPIPE it's not expecting */
oldsig_handler = CatchSignal(SIGPIPE, SIGNAL_CAST SIG_IGN);
diff --git a/source3/pam_smbpass/pam_smb_auth.c b/source3/pam_smbpass/pam_smb_auth.c
index 79856a111d..3a841adebd 100644
--- a/source3/pam_smbpass/pam_smb_auth.c
+++ b/source3/pam_smbpass/pam_smb_auth.c
@@ -108,6 +108,12 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
_log_err( LOG_DEBUG, "username [%s] obtained", name );
}
+ if (geteuid() != 0) {
+ _log_err( LOG_DEBUG, "Cannot access samba password database, not running as root.");
+ retval = PAM_AUTHINFO_UNAVAIL;
+ AUTH_RETURN;
+ }
+
if (!initialize_password_db(True, NULL)) {
_log_err( LOG_ALERT, "Cannot access samba password database" );
retval = PAM_AUTHINFO_UNAVAIL;
@@ -136,7 +142,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
sampass = NULL;
AUTH_RETURN;
}
-
+
/* if this user does not have a password... */
if (_smb_blankpasswd( ctrl, sampass )) {
diff --git a/source3/pam_smbpass/pam_smb_passwd.c b/source3/pam_smbpass/pam_smb_passwd.c
index f0fa018217..de5310761f 100644
--- a/source3/pam_smbpass/pam_smb_passwd.c
+++ b/source3/pam_smbpass/pam_smb_passwd.c
@@ -129,6 +129,11 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
_log_err( LOG_DEBUG, "username [%s] obtained", user );
}
+ if (geteuid() != 0) {
+ _log_err(pamh, LOG_DEBUG, "Cannot access samba password database, not running as root.");
+ return PAM_AUTHINFO_UNAVAIL;
+ }
+
/* Getting into places that might use LDAP -- protect the app
from a SIGPIPE it's not expecting */
oldsig_handler = CatchSignal(SIGPIPE, SIGNAL_CAST SIG_IGN);