当前位置: 首页>>代码示例>>PHP>>正文


PHP pam_auth函数代码示例

本文整理汇总了PHP中pam_auth函数的典型用法代码示例。如果您正苦于以下问题:PHP pam_auth函数的具体用法?PHP pam_auth怎么用?PHP pam_auth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pam_auth函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authenticate

 function authenticate($username, $passwd)
 {
     if (pam_auth($username, get_magic_quotes_gpc() ? stripslashes($passwd) : $passwd, $error)) {
         return True;
     } else {
         return False;
     }
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:8,代码来源:class.auth_pam.inc.php

示例2: _pamAuth

 /**
  * Perform RSA SecurID authentication. In the current implementation, we rely on a correctly configured PAM setup
  * on the server.
  *
  * @param Mfa_OtpdeviceDao $otpDevice
  * @param Mfa_ApitokenDao $token
  * @return bool
  * @throws Zend_Exception
  */
 protected function _pamAuth($otpDevice, $token)
 {
     if (!function_exists('pam_auth')) {
         throw new Zend_Exception('PAM is not enabled on the server');
     }
     $err = '';
     return pam_auth($otpDevice->getSecret(), $token, $err, false);
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:17,代码来源:OtpComponent.php

示例3: _authenticate

 /**
  * Find out if a set of login credentials are valid.
  *
  * @param string $userId      The userId to check.
  * @param array $credentials  An array of login credentials.
  *
  * @throws Horde_Auth_Exception
  */
 protected function _authenticate($userId, $credentials)
 {
     if (empty($credentials['password'])) {
         throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
     }
     $error = null;
     if (!pam_auth($userId, $credentials['password'], $error)) {
         throw new Horde_Auth_Exception($error);
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:18,代码来源:Pam.php

示例4: checkCredentials

 public function checkCredentials($user, $pass)
 {
     if ($this->app['debug'] && !function_exists('ICFS\\Model\\pam_auth') && !function_exists('pam_auth')) {
         function pam_auth($user, $pass)
         {
             if ($user == 'dm1911' && $pass == "sexy" || $user == 'txl11' && $pass == "sexy") {
                 return true;
             }
             return false;
         }
     }
     return pam_auth($user, $pass);
 }
开发者ID:pk13,项目名称:website,代码行数:13,代码来源:User.php

示例5: user_login

 /**
  * Returns true if the username and password work and false if they are
  * wrong or don't exist.
  *
  * @param string $username The username
  * @param string $password The password
  * @return bool Authentication success or failure.
  */
 function user_login($username, $password)
 {
     // variable to store possible errors during authentication
     $errormessage = str_repeat(' ', 2048);
     // just for testing and debugging
     // error_reporting(E_ALL);
     // call_time_pass_reference of errormessage is deprecated - throws warnings in multiauth
     //if (pam_auth($username, $password, &$errormessage)) {
     if (pam_auth($username, $password)) {
         return true;
     } else {
         $this->lasterror = $errormessage;
         return false;
     }
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:23,代码来源:auth.php

示例6: password_save

/**
 * PAM Password Driver
 *
 * @version 1.0
 * @author Aleksander Machniak
 */
function password_save($currpass, $newpass)
{
    $user = $_SESSION['username'];
    if (extension_loaded('pam')) {
        if (pam_auth($user, $currpass, $error, false)) {
            if (pam_chpass($user, $currpass, $newpass)) {
                return PASSWORD_SUCCESS;
            }
        } else {
            raise_error(array('code' => 600, 'type' => 'php', 'file' => __FILE__, 'message' => "Password plugin: PAM authentication failed for user {$user}: {$error}"), true, false);
        }
    } else {
        raise_error(array('code' => 600, 'type' => 'php', 'file' => __FILE__, 'message' => "Password plugin: PECL-PAM module not loaded"), true, false);
    }
    return PASSWORD_ERROR;
}
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:22,代码来源:pam.php

示例7: _valid_pam

function _valid_pam($name, $pass, $admin_auser = 0)
{
    global $pam_email_suffix;
    $exists = 0;
    if ($admin_auser) {
        $exists = 1;
    }
    if ($exists || pam_auth($name, $pass, &$error)) {
        $x = array();
        $x[user] = $name;
        $x[pass] = $pass;
        $x[type] = "stud";
        $x[email] = $name . '@' . $pam_email_suffix;
        $x[method] = 'pam';
        $x[fullname] = $name;
        $x = _auth_check_db($x, 1);
        return $x;
    } else {
        return 0;
    }
}
开发者ID:adamfranco,项目名称:segue-1.x,代码行数:21,代码来源:pam.inc.php

示例8: pamAuth

 /**
  * @param $username
  * @param $password
  * @return bool
  */
 protected function pamAuth($username, $password)
 {
     return pam_auth($username, $password);
 }
开发者ID:spolischook,项目名称:ylang-ylang,代码行数:9,代码来源:PamAuthenticator.php

示例9: hash

 # SSO Code for HTTPAUTH PassTrough by Juergen Vigna
 $form_pass = $_POST['pass'];
 $pass = hash("sha256", "NeDi" . $user . $_POST['pass']);
 # Salt & pw
 $link = DbConnect($dbhost, $dbuser, $dbpass, $dbname);
 if ($guiauth == 'none') {
     $uok = 1;
     $query = GenQuery('users', 's', '*', '', '', array('usrname'), array('='), array($user));
     $res = DbQuery($query, $link);
 } elseif (strstr($guiauth, 'pam') && $user != "admin") {
     # PAM code by Owen Brotherhood & Bruberg
     if (!extension_loaded('pam_auth')) {
         dl('pam_auth.so');
     }
     # dl removed in PHP5.3?
     $uok = pam_auth($user, $_POST['pass']);
     $query = GenQuery('users', 's', '*', '', '', array('usrname'), array('='), array($user));
     $res = DbQuery($query, $link);
 } elseif (strstr($guiauth, 'radius') && $user != "admin") {
     # Radius code by Till Elsner
     $radres = radius_auth_open();
     if (!$radres) {
         $raderr = "Error while preparing RADIUS authentication: " . radius_strerror($radres);
     }
     foreach ($radsrv as $rs) {
         if (!radius_add_server($radres, $rs[0], $rs[1], $rs[2], $rs[3], $rs[4])) {
             echo "<h4>RADIUS: " . radius_strerror($radres) . "</h4>";
         }
     }
     if (!radius_create_request($radres, RADIUS_ACCESS_REQUEST)) {
         $raderr = "RADIUS create: " . radius_strerror($radres);
开发者ID:pl0o0f,项目名称:nedi-puppet,代码行数:31,代码来源:index.php

示例10: validate_user_pam

	function validate_user_pam($user, $pass)
	{
		global $tikilib, $prefs;

		// just make sure we're supposed to be here
		if ($prefs['auth_method'] != 'pam')
			return false;

		// Read page AuthPAM at tw.o, it says about a php module required.
		// maybe and if extension line could be added here... module requires $error
		// as reference.
		$error = '';
		if (pam_auth($user, $pass, $error)) {
			return USER_VALID;
		} else {
			// Uncomment the following to see errors on that
			// error_log("TIKI ERROR PAM: $error User: $user Pass: $pass");
			return PASSWORD_INCORRECT;
		}
	}
开发者ID:railfuture,项目名称:tiki-website,代码行数:20,代码来源:userslib.php

示例11: pam_auth

 /**
  * pam_auth
  *
  * Check to make sure the pam_auth function is implemented (module is
  * installed), then check the credentials.
  */
 private static function pam_auth($username, $password)
 {
     $results = array();
     if (!function_exists('pam_auth')) {
         $results['success'] = false;
         $results['error'] = 'The PAM PHP module is not installed';
         return $results;
     }
     $password = scrub_in($password);
     if (pam_auth($username, $password)) {
         $results['success'] = true;
         $results['type'] = 'pam';
         $results['username'] = $username;
     } else {
         $results['success'] = false;
         $results['error'] = 'PAM login attempt failed';
     }
     return $results;
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:25,代码来源:auth.class.php

示例12: sanitize

    include_once 'inc/libcsv.php';
} else {
    print 'Backend not configured!';
    die;
}
$_POST = sanitize($_POST);
$failed = 0;
if (isset($_POST['user'])) {
    $pass = md5($_POST['pass']);
    $link = @DbConnect($dbhost, $dbuser, $dbpass, $dbname);
    if (stristr('p', $guiauth) && $_POST['user'] != "admin") {
        # PAM code by Owen Brotherhood & bruberg
        if (!extension_loaded('pam_auth')) {
            dl("pam_auth.so");
        }
        $uok = pam_auth($_POST['user'], $_POST['pass']);
        $query = GenQuery('user', 's', '*', '', '', array('name'), array('='), array($_POST[user]));
        $res = @DbQuery($query, $link);
    } else {
        $pass = md5($_POST['pass']);
        $query = GenQuery('user', 's', '*', '', '', array('name', 'password'), array('=', '='), array($_POST['user'], $pass), array('AND'));
        $res = @DbQuery($query, $link);
        $uok = @DbNumRows($res);
    }
    if ($uok == 1) {
        $usr = @DbFetchRow($res);
        session_start();
        $_SESSION['user'] = $_POST['user'];
        $_SESSION['group'] = "usr,";
        if ($usr[2]) {
            $_SESSION['group'] .= "adm,";
开发者ID:BackupTheBerlios,项目名称:nedi-svn,代码行数:31,代码来源:index.php

示例13: AuthUserPAM

function AuthUserPAM($pagename, $id, $pw, $pwlist)
{
    if (strlen($id) <= 2 || strlen($pw) <= 2) {
        return false;
    }
    return pam_auth($id, $pw) && in_array($id, $pwlist);
}
开发者ID:LOZORD,项目名称:UPL-Website-Revamp,代码行数:7,代码来源:authuser.php

示例14: renderForm

<html>
<head>
</head>
<body>
<?php 
if (isset($_POST['user']) && isset($_POST['pwd'])) {
    $username = $_POST['user'];
    $password = $_POST['pwd'];
    if (pam_auth($username, $password, &$error)) {
        echo "Yeah baby, we're authenticated!";
    } else {
        echo "<h3>Error: {$error}</h3>";
        renderForm();
    }
} else {
    renderForm();
}
function renderForm()
{
    $form = <<<EOT
<h3>Login</h3>
<form action="test-pam.php" method="POST">
\t<input name="user" type="text"/>
\t<input name="pwd"  type="password" />
\t<input type="submit"/>
</form>
EOT;
    echo $form;
}
?>
</body>
开发者ID:nwwells,项目名称:mws-php,代码行数:31,代码来源:test-pam.php

示例15: login

 /**
  * Login the user.
  */
 function login($username, $password)
 {
     $error = NULL;
     $res = pam_auth($username, $password, $error);
     if (!$res) {
         $this->showLoginForm($error);
     }
     $_SESSION["email"] = $username . "@" . $this->config["actorDomain"];
     $this->redirect();
 }
开发者ID:derickp,项目名称:swag,代码行数:13,代码来源:MainController.php


注:本文中的pam_auth函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。