Update of /cvsroot/phpslash/phpslash-dev/include/modules/auth/authtypes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24068/include/modules/auth/authtypes
Modified Files:
slashAuthLDAP.class
Log Message:
still not ready for prime time... edging closer
Index: slashAuthLDAP.class
===================================================================
RCS file: /cvsroot/phpslash/phpslash-dev/include/modules/auth/authtypes/slashAuthLDAP.class,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** slashAuthLDAP.class 15 Sep 2004 23:36:30 -0000 1.1
--- slashAuthLDAP.class 20 Oct 2004 22:08:49 -0000 1.2
***************
*** 1,42 ****
<?php
!
! /* $Id$
! *
! * Mostly taken from Back-End LDAP.class which was:
! * Written by Peter Starowicz <pe...@op...> for OpenConcept.ca
! *
! * This module unfinished and untested - remove this when completed
! *
! */
class slashAuth extends slashAuth_base {
-
- // LDAP validation
- function psl_validate($username, $password, $user_info) {
- global $challenge;
-
- $is_user = false;
! $md5_pw = $this->ldap_pass($username);
! // generate the expected response
! $expected_response = md5("$md5_pw:$challenge");
! // True when JS is disabled
! if ($response == "") {
! $md5_pw_net = md5("$username:$password");
! $response = md5("$md5_pw_net:$challenge");
! }
! if ($expected_response != $response) {
! // failed - return with error message
! $this->auth["error"] = pslgetText("Either your username or password are invalid. Please try again.");
! $is_user = false;
! } else {
! // success
! $is_user = true;
! }
! return $is_user;
! }
! /**
*
* Find and return the MD5 encoded password for the specified user
--- 1,48 ----
<?php
! // vim: ft=php:ts=4:sts=4 :
! /** $Id$
! *
! * Mostly taken from Back-End LDAP.class which was:
! * Written by Peter Starowicz <pe...@op...> for OpenConcept.ca
! *
! * This module unfinished and untested - remove this when completed
! *
! */
class slashAuth extends slashAuth_base {
! /** PSL LDAP validation
! @param $username user name to validate
! @param $password ...
! @return boolean true if user is validated false otherwise
! @note The parent class loginform uses attempts to use Challenge-Response and the password argument will typically be blank
! */
! function psl_validate($username, $password, $response='', $user_info='') {
! global $challenge;
! $is_user = false;
! $md5_pw = $this->psl_ldap_pass($username);
! // generate the expected response
! $expected_response = md5("$md5_pw:$challenge");
!
! // True when JS is disabled
! if ( $response == "" ) {
! $md5_pw_net = md5("$username:$password");
! $response = md5("$md5_pw_net:$challenge");
! }
!
! if ($expected_response != $response) {
! // failed - return with error message
! $this->auth["error"] = pslgetText("Either your username or password are invalid. Please try again.");
! $is_user = false;
! } else {
! // success
! $is_user = true;
! }
! return $is_user;
! }
!
! /**
*
* Find and return the MD5 encoded password for the specified user
***************
*** 44,60 ****
*
**/
! function ldap_pass($username = "") {
! // debug('function LDAP_pass()', "");
!
! $ldap_user = $this->ldap_search_user($username);
! if ($ldap_user) {
! $md5_pw = md5($username .":". $ldap_user[0]["password"][0];
! // return $ldap_user[0]["password"][0];
! }
! //debug('function ldap_pass() ', 'failed');
! return false;
! }
! /**
*
* Find and return the specified LDAP user
--- 50,66 ----
*
**/
! function psl_ldap_pass($username = "") {
! // debug('function LDAP_pass()', "");
! $ldap_user = $this->psl_ldap_search_user($username);
! if ($ldap_user) {
! $md5_pw = md5($username .":". $ldap_user[0]["password"][0];
! // return $ldap_user[0]["password"][0];
! }
! //debug('function ldap_pass() ', 'failed');
! return false;
! }
!
! /**
*
* Find and return the specified LDAP user
***************
*** 62,80 ****
*
**/
! function ldap_search_user($username = "") {
! //debug('function LDAP_search_user()', "");
!
! $this->ds = @ldap_connect($this->Host, $this->Port);
! $ldap_search_result = @ldap_search($this->ds, $this->Base_dn, $this->Search_detail."=".$username);
! if ($ldap_search_result) {
! //debug("function LDAP_search() ldap_search_result",print_r($ldap_search_result));
! $result = ldap_get_entries($this->ds, $ldap_search_result);
! //debug("function LDAP_search() result",print_r($result));
! return $result;
! }
!
! //debug('function LDAP_search_user() ', ' failed');
! return false;
! }
}
?>
--- 68,86 ----
*
**/
! function psl_ldap_search_user($username = "") {
! //debug('function LDAP_search_user()', "");
!
! $this->ds = @ldap_connect($this->Host, $this->Port);
! $ldap_search_result = @ldap_search($this->ds, $this->Base_dn, $this->Search_detail."=".$username);
! if ($ldap_search_result) {
! //debug("function LDAP_search() ldap_search_result",print_r($ldap_search_result));
! $result = ldap_get_entries($this->ds, $ldap_search_result);
! //debug("function LDAP_search() result",print_r($result));
! return $result;
! }
!
! //debug('function LDAP_search_user() ', ' failed');
! return false;
! }
}
?>
|