[EXIM] LDAP problem solved (with patch)

Page principale
Supprimer ce message
Répondre à ce message
Auteur: michael
Date:  
À: exim-users
Sujet: [EXIM] LDAP problem solved (with patch)
Problem: If an LDAP search finds an entry that exists, but does not contain the
specified attributes, then uninitialised memory is returned.

Solution: A query that asks for attributes that do not exist, will fail, even
if the entry exists.

Patch:
--- src/lookups/ldap.c.orig    Fri Apr  9 09:05:28 1999
+++ src/lookups/ldap.c    Fri Apr  9 09:31:13 1999
@@ -88,6 +88,7 @@
 int   rc;
 int   ptr = 0;
 int   size = 0;
+int   found_attr_count = 0;
 BOOL  add_newline = FALSE;


 DEBUG(9) debug_printf("perform_ldap_search: ldap URL =\"%s\"\n", ldap_url);
@@ -295,6 +296,7 @@
           data = string_cat(data, &size, &ptr, *values, strlen(*values));
           data[ptr] = '\0';
           values++;
+          ++found_attr_count;
           }
         ldap_value_free(firstval);
         }
@@ -316,6 +318,14 @@


   if (ber != NULL) ber_free(ber, 0);
 #endif
+  }
+
+  /* Did we find an entry, which lacked the specified attributes? */
+  if (found_attr_count == 0) {
+    *errmsg = string_sprintf("perform_ldap_search: found no attributes");
+    DEBUG(9) debug_printf("%s\n", *errmsg);
+    /* should I free data here? */
+    return (FAIL);
   }


DEBUG(9) debug_printf("perform_ldap_search: LDAP exit entry loop data: %s\n",

Michael

--
*** Exim information can be found at http://www.exim.org/ ***