stuart: server/kolab-resource-handlers/kolab-resource-handlers/freebusy freebusy.php, 1.23, 1.24

cvs at intevation.de cvs at intevation.de
Thu Sep 16 16:52:26 CEST 2004


Author: stuart

Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy
In directory doto:/tmp/cvs-serv18409

Modified Files:
	freebusy.php 
Log Message:
If the user is not found in LDAP in a multi-location setup, don't exit with an error; instead let the script carry on (e.g. there might be a cached .ifb file that can be returned)


Index: freebusy.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/freebusy.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- freebusy.php	14 Sep 2004 20:33:19 -0000	1.23
+++ freebusy.php	16 Sep 2004 14:52:24 -0000	1.24
@@ -419,34 +419,41 @@
     $ldapresults = @ldap_get_entries($ldap, $ldapsearch);
     testLDAPError();
 
+    /*
     if ($ldapresults['count'] == 0) {
         notFound("$user does not exist in the LDAP hierarchy");
     } else if ($ldapresults['count'] > 1) {
         notFound("More than one entry for $user were found in the LDAP hierarchy");
     }
-
-    if (array_key_exists(strtolower($params['home_server']), $ldapresults[0])) {
-        $homeServer = $ldapresults[0][strtolower($params['home_server'])][0];
-    } else {
-        $homeServer = $params['server'];
-    }
-
-    // Redirect if the user is on a different server
-    if ($homeServer != $params['server']) {
-        $redirect = 'https://'.$homeServer . $_SERVER['REQUEST_URI'];
-        if ($params['redirect']) {
-            header("Location: $redirect");
+    */
+    
+    // We only handle multi-domain situations when we receive exactly one result
+    // back from LDAP; otherwise we fall through and let the script carry on as
+    // usual.
+    if ($ldapresults['count'] == 1) {
+        if (array_key_exists(strtolower($params['home_server']), $ldapresults[0])) {
+            $homeServer = $ldapresults[0][strtolower($params['home_server'])][0];
         } else {
-            header("X-Redirect-To: $redirect");
-            $redirect = 'https://' . urlencode($_SERVER['PHP_AUTH_USER']) . ':'
-                . urlencode($_SERVER['PHP_AUTH_PW']) . '@' . $homeServer
-                . $_SERVER['REQUEST_URI'];
-            if (!@readfile($redirect)) {
-                notFound("Unable to read free/busy information from $redirect");
+            $homeServer = $params['server'];
+        }
+    
+        // Redirect if the user is on a different server
+        if ($homeServer != $params['server']) {
+            $redirect = 'https://'.$homeServer . $_SERVER['REQUEST_URI'];
+            if ($params['redirect']) {
+                header("Location: $redirect");
+            } else {
+                header("X-Redirect-To: $redirect");
+                $redirect = 'https://' . urlencode($_SERVER['PHP_AUTH_USER']) . ':'
+                    . urlencode($_SERVER['PHP_AUTH_PW']) . '@' . $homeServer
+                    . $_SERVER['REQUEST_URI'];
+                if (!@readfile($redirect)) {
+                    notFound("Unable to read free/busy information from $redirect");
+                }
             }
+            shutdown();
+            exit;
         }
-        shutdown();
-        exit;
     }
 }
 





More information about the commits mailing list