From 7e0b88ed77d47a71fa7ce6b49ce6cd023ff79d51 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 8 Sep 2011 11:34:52 +1200 Subject: [PATCH] Decruftify, and allow the squid pam to use 'path' instead of 'script' in it's config. --- inc/drivers_pwauth_pam.php | 9 --------- inc/drivers_squid_pam.php | 16 ++++------------ 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/inc/drivers_pwauth_pam.php b/inc/drivers_pwauth_pam.php index 8564a800..03583df9 100644 --- a/inc/drivers_pwauth_pam.php +++ b/inc/drivers_pwauth_pam.php @@ -25,15 +25,6 @@ class pwauthPamDrivers /**#@-*/ - /** - * Constructor. - * @param string $config path where pwauth is - */ - function pwauthPamDrivers($config){ - $this->__construct($config); - } - - /** * The constructor * diff --git a/inc/drivers_squid_pam.php b/inc/drivers_squid_pam.php index 82637616..2cfab0e5 100644 --- a/inc/drivers_squid_pam.php +++ b/inc/drivers_squid_pam.php @@ -22,22 +22,12 @@ class squidPamDrivers /**#@-*/ - /** - * Constructor. - * @param string $config path where /usr/lib/squid/pam_auth is - */ - function squidPamDrivers($config){ - $this->__construct($config); - } - - /** * The constructor * * @param string $config path where /usr/lib/squid/pam_auth is */ - function __construct($config) - { + function __construct($config) { global $c; if (! file_exists($config)){ $c->messages[] = sprintf(i18n( 'drivers_squid_pam : Unable to find %s file'), $config ); @@ -54,8 +44,10 @@ class squidPamDrivers function SQUID_PAM_check($username, $password ){ global $c; + $script = $c->authenticate_hook['config']['script']; + if ( empty($script) ) $script = $c->authenticate_hook['config']['path']; $cmd = sprintf( 'echo %s %s | %s -n common-auth', escapeshellarg($username), escapeshellarg($password), - $c->authenticate_hook['config']['script']); + $script); $auth_result = exec($cmd); if ( $auth_result == "OK") { dbg_error_log('pwauth', 'User %s successfully authenticated', $username);