[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc/class.auth_ldap.inc.php, 1.17.2.1.2.10
From: |
nomail |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc/class.auth_ldap.inc.php, 1.17.2.1.2.10 |
Date: |
Fri, 10 Dec 2004 10:41:27 +0100 |
Update of /phpgwapi/inc
Modified Files:
Branch: Version-0_9_16-branch
class.auth_ldap.inc.php
date: 2004/12/10 09:41:27; author: Caeies; state: Exp; lines: +8 -15
Log Message:
Debian Bug #285024, about using v3 in ldap corrected
=====================================================================
Index: phpgwapi/inc/class.auth_ldap.inc.php
diff -u phpgwapi/inc/class.auth_ldap.inc.php:1.17.2.1.2.9
phpgwapi/inc/class.auth_ldap.inc.php:1.17.2.1.2.10
--- phpgwapi/inc/class.auth_ldap.inc.php:1.17.2.1.2.9 Mon Jun 28 07:08:09 2004
+++ phpgwapi/inc/class.auth_ldap.inc.php Fri Dec 10 09:41:27 2004
@@ -24,28 +24,18 @@
function authenticate($username, $passwd)
{
- /*
- error_reporting MUST be set to zero, otherwise you'll
get nasty LDAP errors with a bad login/pass...
- these are just "warnings" and can be ignored.....
- */
- error_reporting(0);
-
- if(!$ldap =
@ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']))
+ //Connect as Admin with v3 or v2 in LDAP server
+ if ( !$ldap = $GLOBALS['phpgw']->common->ldapConnect() )
{
$GLOBALS['phpgw']->log->message('F-Abort,
Failed connecting to LDAP server for authenication, execution stopped');
$GLOBALS['phpgw']->log->commit();
return false;
}
-
- /* Login with the LDAP Admin. User to find the User DN.
*/
- if(address@hidden($ldap,
$GLOBALS['phpgw_info']['server']['ldap_root_dn'],
$GLOBALS['phpgw_info']['server']['ldap_root_pw']))
- {
- return false;
- }
- /* find the dn for this uid, the uid is not always in
the dn */
+ //Search for the dn
$attributes = array( 'uid', 'dn', 'phpgwaccountstatus'
);
$sri = ldap_search($ldap,
$GLOBALS['phpgw_info']['server']['ldap_context'], "uid=$username", $attributes);
$allValues = ldap_get_entries($ldap, $sri);
+ error_reporting(0); // this avoid waring with ldap_bind
when user / password are not correct
if ($allValues['count'] > 0)
{
// let's check if its an inactive account
@@ -64,6 +54,8 @@
/* try to bind as the user with user
suplied password */
if (@ldap_bind($ldap, $userDN, $passwd))
{
+ @ldap_unbind($ldap); // we
don't need this connection anymore, so avoid a leak.
+ error_reporting(7);
return true;
}
}
@@ -72,6 +64,7 @@
{
}
+ @ldap_unbind($ldap);
/* Turn error reporting back to normal */
error_reporting(7);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc/class.auth_ldap.inc.php, 1.17.2.1.2.10,
nomail <=