File dhcp-3.0.6-ldap-patch_hwaddr-icase.dif of Package dhcp

--- server/ldap.c
+++ server/ldap.c	2007/12/04 10:16:56
@@ -39,6 +39,7 @@
 
 #include "dhcpd.h"
 #include <signal.h>
+#include <ctype.h>
 
 #if defined(LDAP_CONFIGURATION)
 
@@ -87,6 +88,24 @@
   return strncat(dst, src, dst_size > len ? dst_size - len - 1: 0);
 }
 
+static char *
+x_strxform(char *dst, const char *src, size_t dst_size,
+           int (*xform)(int))
+{
+	if(dst && src && dst_size)
+	{
+		size_t len, pos;
+
+		len = strlen(src);
+		for(pos=0; pos < len && pos + 1 < dst_size; pos++)
+			dst[pos] = xform((int)src[pos]);
+		dst[pos] = '\0';
+
+		return dst;
+	}
+	return NULL;
+}
+
 static void
 ldap_parse_class (struct ldap_config_stack *item, struct parse *cfile)
 {
@@ -1707,6 +1726,8 @@
   struct host_decl * host;
   isc_result_t status;
   ldap_dn_node *curr;
+  char up_hwaddr[20];
+  char lo_hwaddr[20];
   int ret;
 
   if (ldap_method == LDAP_METHOD_STATIC)
@@ -1737,9 +1758,13 @@
   ** FIXME: It is not guaranteed, that the dhcpHWAddress attribute
   **        contains _exactly_ "type addr" with one space between!
   */
+  snprintf(lo_hwaddr, sizeof(lo_hwaddr), "%s",
+           print_hw_addr (htype, hlen, haddr));
+  x_strxform(up_hwaddr, lo_hwaddr, sizeof(up_hwaddr), toupper);
+
   snprintf (buf, sizeof (buf),
-            "(&(objectClass=dhcpHost)(dhcpHWAddress=%s %s))",
-           type_str, print_hw_addr (htype, hlen, haddr));
+            "(&(objectClass=dhcpHost)(|(dhcpHWAddress=%s %s)(dhcpHWAddress=%s %s)))",
+            type_str, lo_hwaddr, type_str, up_hwaddr);
 
   res = ent = NULL;
   for (curr = ldap_service_dn_head;