summaryrefslogtreecommitdiffstats
path: root/lib/class/vauth.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-12-15 17:33:43 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-12-15 17:33:43 +0000
commit5b40b46ba06cbd6eb85defd5e0b24b20769cd633 (patch)
tree038931048c75b98190dfb91080d2b7a2b53a26a4 /lib/class/vauth.class.php
parent85e6e5ad1ce29b96fc5555a9e12d0e909b5e61e3 (diff)
downloadampache-5b40b46ba06cbd6eb85defd5e0b24b20769cd633.tar.gz
ampache-5b40b46ba06cbd6eb85defd5e0b24b20769cd633.tar.bz2
ampache-5b40b46ba06cbd6eb85defd5e0b24b20769cd633.zip
Added local auth method which allows use of pam_auth PHP module (Thx Vlet)
Diffstat (limited to 'lib/class/vauth.class.php')
-rw-r--r--lib/class/vauth.class.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/class/vauth.class.php b/lib/class/vauth.class.php
index 8b948f25..c2aa73bd 100644
--- a/lib/class/vauth.class.php
+++ b/lib/class/vauth.class.php
@@ -567,6 +567,30 @@ class vauth {
} // vieux_mysql_auth
/**
+ * local_auth
+ * Check to make sure the pam_auth function is implemented (module is installed) then check the credentials
+ */
+ private static function local_auth($username,$password) {
+ if (!function_exists('pam_auth')) {
+ $results['success'] = false;
+ $results['error'] = "The PAM authentication PHP module is not installed.";
+ return $results;
+ }
+
+ if (pam_auth($username, $password, &$results['error'])) {
+ $results['success'] = true;
+ $results['type'] = 'local';
+ $results['username'] = $username;
+ }
+ else {
+ $results['success'] = false;
+ $results['error'] = "PAM login attempt failed";
+ }
+
+ return $results;
+ } // local_auth
+
+ /**
* ldap_auth
* Step one, connect to the LDAP server and perform a search for teh username provided.
* If its found, attempt to bind using that username and the password provided.