From 08b7b66e7615acdb08ce7940c4ad18f85aab40f2 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 18 Jan 2012 08:16:04 -0500
Subject: [PATCH] - Handle ldap_public misconfiguration

---
 program/include/rcmail.php |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index abfb498..6587737 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -489,7 +489,11 @@
 
     if ($ldap_config) {
       $ldap_config = (array) $ldap_config;
-      foreach ($ldap_config as $id => $prop)
+      foreach ($ldap_config as $id => $prop) {
+        // handle misconfiguration
+        if (empty($prop) || !is_array($prop)) {
+          continue;
+        }
         $list[$id] = array(
           'id'       => $id,
           'name'     => $prop['name'],
@@ -498,6 +502,7 @@
           'hidden'   => $prop['hidden'],
           'autocomplete' => in_array($id, $autocomplete)
         );
+      }
     }
 
     $plugin = $this->plugins->exec_hook('addressbooks_list', array('sources' => $list));

--
Gitblit v1.9.1