phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: phpgwapi/inc class.auth_ldap.inc.php,1.17,1.18


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.auth_ldap.inc.php,1.17,1.18
Date: Sat, 23 Nov 2002 20:45:30 -0500

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv18991

Modified Files:
        class.auth_ldap.inc.php 
Log Message:
update

Index: class.auth_ldap.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.auth_ldap.inc.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** class.auth_ldap.inc.php     3 Sep 2001 03:56:12 -0000       1.17
--- class.auth_ldap.inc.php     24 Nov 2002 01:45:28 -0000      1.18
***************
*** 37,49 ****
                        error_reporting(0); 
  
!                       $ldap = 
ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']);
!                       if (! $ldap)
                        {
                                $GLOBALS['phpgw']->log->message('F-Abort, 
Failed connecting to LDAP server for authenication, execution stopped');
                                $GLOBALS['phpgw']->log->commit();
                        }
  
                        /* find the dn for this uid, the uid is not always in 
the dn */
!                       $sri = ldap_search($ldap, 
$GLOBALS['phpgw_info']['server']['ldap_context'], 'uid='.$username);
                        $allValues = ldap_get_entries($ldap, $sri);
                        if ($allValues['count'] > 0)
--- 37,56 ----
                        error_reporting(0); 
  
!                       if(!$ldap = 
@ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']))
                        {
                                $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 */
!                       $attributes = array( "uid", "dn" );
!                       $sri = ldap_search($ldap, 
$GLOBALS['phpgw_info']['server']['ldap_context'], "(uid=$username)", 
$attributes);
                        $allValues = ldap_get_entries($ldap, $sri);
                        if ($allValues['count'] > 0)
***************
*** 51,55 ****
                                /* we only care about the first dn */
                                $userDN = $allValues[0]['dn'];
- 
                                /*
                                generate a bogus password to pass if the user 
doesn't give us one 
--- 58,61 ----
***************
*** 61,65 ****
                                }
                                /* try to bind as the user with user suplied 
password */
!                               if (ldap_bind($ldap,$userDN, $passwd))
                                {
                                        return True;
--- 67,71 ----
                                }
                                /* try to bind as the user with user suplied 
password */
!                               if (@ldap_bind($ldap, $userDN, $passwd))
                                {
                                        return True;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]