phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc/class.common.inc.php, 1.219


From: nomail
Subject: [Phpgroupware-cvs] phpgwapi/inc/class.common.inc.php, 1.219
Date: Fri, 30 Jul 2004 16:47:05 +0200

Update of /phpgwapi/inc
Modified Files:
        Branch: 
          class.common.inc.php

date: 2004/07/30 14:47:05;  author: fipsfuchs;  state: Exp;  lines: +29 -25

Log Message:
function ldapConnect merged with 0.9.16
=====================================================================
Index: phpgwapi/inc/class.common.inc.php
diff -u phpgwapi/inc/class.common.inc.php:1.218 
phpgwapi/inc/class.common.inc.php:1.219
--- phpgwapi/inc/class.common.inc.php:1.218     Wed Nov 12 16:29:00 2003
+++ phpgwapi/inc/class.common.inc.php   Fri Jul 30 14:47:05 2004
@@ -253,32 +253,20 @@
                        return $retValue;
                }
 
-               // connect to the ldap server and return a handle
-               /*!
-               @function ldapConnect
-               @abstract connect to the ldap server and return a handle
-               @param $host ldap host
-               @param $dn ldap_root_dn
-               @param $passwd ldap_root_pw
+               /**
+               * Connect to the ldap server and return a handle
+               *
+               * @param string $host LDAP host name
+               * @param string $dn LDAP distinguised name
+               * @param string $passwd LDAP password
+               * @return resource LDAP link identifier
                */
                function ldapConnect($host = '', $dn = '', $passwd = '')
                {
-                       if (! $host)
-                       {
-                               $host = 
$GLOBALS['phpgw_info']['server']['ldap_host'];
-                       }
-
-                       if (! $dn)
-                       {
-                               $dn = 
$GLOBALS['phpgw_info']['server']['ldap_root_dn'];
-                       }
+                       $host = $host ? $host : 
$GLOBALS['phpgw_info']['server']['ldap_host'];
+                       $dn = $dn ? $dn : 
$GLOBALS['phpgw_info']['server']['ldap_root_dn'];
+                       $passwd = $passwd ? $passwd : 
$GLOBALS['phpgw_info']['server']['ldap_root_pw'];
 
-                       if (! $passwd)
-                       {
-                               $passwd = 
$GLOBALS['phpgw_info']['server']['ldap_root_pw'];
-                       }
-
-                       // connect to ldap server
                        if (! $ds = ldap_connect($host))
                        {
                                /* log does not exist in setup(, yet) */
@@ -291,9 +279,25 @@
                                printf("<b>Error: Can't connect to LDAP server 
%s!</b><br>",$host);
                                return False;
                        }
-
+                       
+                       if(! @ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 
3))//LDAP protocol v3 support
+                       {
+                               if(is_object($GLOBALS['phpgw']->log))
+                               {
+                                       
//$GLOBALS['phpgw']->log->message('set_option(protocol v3) failed using v2');
+                                       //$GLOBALS['phpgw']->log->commit();
+                               }
+                       }
+                       else
+                       {
+                               if(is_object($GLOBALS['phpgw']->log))
+                               {
+                                       
//$GLOBALS['phpgw']->log->message('set_option(protocol v3) succeded using v3');
+                                       //$GLOBALS['phpgw']->log->commit();
+                               }
+                       }
                        // bind as admin, we not to able to do everything
-                       if (! ldap_bind($ds,$dn,$passwd))
+                       if (! ldap_bind($ds, $dn, $passwd))
                        {
                                if(is_object($GLOBALS['phpgw']->log))
                                {




reply via email to

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