mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-24 02:24:39 +00:00
Decruftify, and allow the squid pam to use 'path' instead of 'script' in it's config.
This commit is contained in:
parent
d78620398c
commit
7e0b88ed77
@ -25,15 +25,6 @@ class pwauthPamDrivers
|
|||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
* @param string $config path where pwauth is
|
|
||||||
*/
|
|
||||||
function pwauthPamDrivers($config){
|
|
||||||
$this->__construct($config);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor
|
* The constructor
|
||||||
*
|
*
|
||||||
|
|||||||
@ -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
|
* The constructor
|
||||||
*
|
*
|
||||||
* @param string $config path where /usr/lib/squid/pam_auth is
|
* @param string $config path where /usr/lib/squid/pam_auth is
|
||||||
*/
|
*/
|
||||||
function __construct($config)
|
function __construct($config) {
|
||||||
{
|
|
||||||
global $c;
|
global $c;
|
||||||
if (! file_exists($config)){
|
if (! file_exists($config)){
|
||||||
$c->messages[] = sprintf(i18n( 'drivers_squid_pam : Unable to find %s file'), $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 ){
|
function SQUID_PAM_check($username, $password ){
|
||||||
global $c;
|
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),
|
$cmd = sprintf( 'echo %s %s | %s -n common-auth', escapeshellarg($username), escapeshellarg($password),
|
||||||
$c->authenticate_hook['config']['script']);
|
$script);
|
||||||
$auth_result = exec($cmd);
|
$auth_result = exec($cmd);
|
||||||
if ( $auth_result == "OK") {
|
if ( $auth_result == "OK") {
|
||||||
dbg_error_log('pwauth', 'User %s successfully authenticated', $username);
|
dbg_error_log('pwauth', 'User %s successfully authenticated', $username);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user