Decruftify, and allow the squid pam to use 'path' instead of 'script' in it's config.

This commit is contained in:
Andrew McMillan 2011-09-08 11:34:52 +12:00
parent d78620398c
commit 7e0b88ed77
2 changed files with 4 additions and 21 deletions

View File

@ -25,15 +25,6 @@ class pwauthPamDrivers
/**#@-*/
/**
* Constructor.
* @param string $config path where pwauth is
*/
function pwauthPamDrivers($config){
$this->__construct($config);
}
/**
* The constructor
*

View File

@ -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);