2005-03-25 10:59:48 +01:00
|
|
|
<?php
|
2010-01-28 05:22:37 +01:00
|
|
|
/**
|
|
|
|
* eGroupWare API - Auth from PAM
|
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @license http://opensource.org/licenses/lgpl-license.php LGPL - GNU Lesser General Public License
|
|
|
|
* @package api
|
|
|
|
* @subpackage authentication
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
2005-03-25 10:59:48 +01:00
|
|
|
|
2010-01-28 05:22:37 +01:00
|
|
|
/**
|
|
|
|
* Auth from PAM
|
|
|
|
*
|
|
|
|
* Requires php_pam extension!
|
|
|
|
*/
|
|
|
|
class auth_pam implements auth_backend
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* password authentication
|
|
|
|
*
|
|
|
|
* @param string $username username of account to authenticate
|
|
|
|
* @param string $passwd corresponding password
|
|
|
|
* @param string $passwd_type='text' 'text' for cleartext passwords (default)
|
|
|
|
* @return boolean true if successful authenticated, false otherwise
|
|
|
|
*/
|
|
|
|
function authenticate($username, $passwd, $passwd_type='text')
|
2005-03-25 10:59:48 +01:00
|
|
|
{
|
2010-01-28 05:22:37 +01:00
|
|
|
if (pam_auth($username, get_magic_quotes_gpc() ? stripslashes($passwd) : $passwd, &$error))
|
2005-03-25 10:59:48 +01:00
|
|
|
{
|
2010-01-28 05:22:37 +01:00
|
|
|
return True;
|
2005-03-25 10:59:48 +01:00
|
|
|
}
|
2010-01-28 05:22:37 +01:00
|
|
|
return False;
|
|
|
|
}
|
2005-03-25 10:59:48 +01:00
|
|
|
|
2010-01-28 05:22:37 +01:00
|
|
|
/**
|
|
|
|
* changes password
|
|
|
|
*
|
|
|
|
* @param string $old_passwd must be cleartext or empty to not to be checked
|
|
|
|
* @param string $new_passwd must be cleartext
|
|
|
|
* @param int $account_id=0 account id of user whose passwd should be changed
|
|
|
|
* @return boolean true if password successful changed, false otherwise
|
|
|
|
*/
|
|
|
|
function change_password($old_passwd, $new_passwd, $account_id=0)
|
|
|
|
{
|
|
|
|
// deny password changes.
|
|
|
|
return False;
|
2005-03-25 10:59:48 +01:00
|
|
|
}
|
2010-01-28 05:22:37 +01:00
|
|
|
}
|