packages: dhcp/dhcp-ldap.patch - http://github.com/dcantrell/ldap-for-dhcp/...

zbyniu zbyniu at pld-linux.org
Tue Mar 30 21:11:44 CEST 2010


Author: zbyniu                       Date: Tue Mar 30 19:11:44 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- http://github.com/dcantrell/ldap-for-dhcp/raw/9cfd4c277d7615777f372ea08f44cc7de9ed7959/dhcp-4.0.1-ldap.patch

---- Files affected:
packages/dhcp:
   dhcp-ldap.patch (1.10 -> 1.11) 

---- Diffs:

================================================================
Index: packages/dhcp/dhcp-ldap.patch
diff -u packages/dhcp/dhcp-ldap.patch:1.10 packages/dhcp/dhcp-ldap.patch:1.11
--- packages/dhcp/dhcp-ldap.patch:1.10	Sun Apr 27 16:22:13 2008
+++ packages/dhcp/dhcp-ldap.patch	Tue Mar 30 21:11:39 2010
@@ -1,45 +1,261 @@
-diff -up dhcp-4.0.0/server/Makefile.am.ldap dhcp-4.0.0/server/Makefile.am
---- dhcp-4.0.0/server/Makefile.am.ldap	2007-05-29 06:32:11.000000000 -1000
-+++ dhcp-4.0.0/server/Makefile.am	2008-02-06 14:34:44.000000000 -1000
-@@ -4,12 +4,10 @@ dist_sysconf_DATA = dhcpd.conf
- sbin_PROGRAMS = dhcpd
- dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
- 		omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c \
--		dhcpv6.c mdb6.c
-+		dhcpv6.c mdb6.c ldap.c ldap_casa.c
+diff -up dhcp-4.0.1/common/conflex.c.ldap dhcp-4.0.1/common/conflex.c
+--- dhcp-4.0.1/common/conflex.c.ldap	2008-03-07 10:17:52.000000000 -1000
++++ dhcp-4.0.1/common/conflex.c	2009-07-08 07:24:34.000000000 -1000
+@@ -43,6 +43,7 @@ static enum dhcp_token read_string PROTO
+ static enum dhcp_token read_number PROTO ((int, struct parse *));
+ static enum dhcp_token read_num_or_name PROTO ((int, struct parse *));
+ static enum dhcp_token intern PROTO ((char *, enum dhcp_token));
++static int read_function PROTO ((struct parse *));
  
--# libomapi.a this is here twice to handle circular library dependencies :(
--dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../dst/libdst.a \
--	      ../dhcpctl/libdhcpctl.a ../minires/libres.a \
--	      ../omapip/libomapi.a
-+dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../minires/libres.a \
-+	      ../dhcpctl/libdhcpctl.a ../dst/libdstnomd5.a -lldap
+ isc_result_t new_parse (cfile, file, inbuf, buflen, name, eolp)
+ 	struct parse **cfile;
+@@ -73,6 +74,10 @@ isc_result_t new_parse (cfile, file, inb
+ 	tmp->file = file;
+ 	tmp->eol_token = eolp;
  
- man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
- EXTRA_DIST = $(man_MANS)
-diff -up dhcp-4.0.0/server/mdb.c.ldap dhcp-4.0.0/server/mdb.c
---- dhcp-4.0.0/server/mdb.c.ldap	2007-11-30 11:51:43.000000000 -1000
-+++ dhcp-4.0.0/server/mdb.c	2008-02-06 14:34:44.000000000 -1000
-@@ -600,6 +600,12 @@ int find_hosts_by_haddr (struct host_dec
- 			 const char *file, int line)
++	if (file != -1) {
++		tmp -> read_function = read_function;
++	}
++
+ 	if (inbuf != NULL) {
+ 		tmp->inbuf = inbuf;
+ 		tmp->buflen = buflen;
+@@ -177,9 +182,13 @@ static int get_char (cfile)
+ 	/* My kingdom for WITH... */
+ 	int c;
+ 
+-	if (cfile->bufix == cfile->buflen)
+-		c = EOF;
+-	else {
++	if (cfile->bufix == cfile->buflen) {
++		if (cfile -> read_function) {
++			c = cfile -> read_function (cfile);
++		} else {
++			c = EOF;
++		}
++	} else {
+ 		c = cfile->inbuf [cfile->bufix];
+ 		cfile->bufix++;
+ 	}
+@@ -1422,3 +1431,25 @@ intern(char *atom, enum dhcp_token dfv) 
+ 	}
+ 	return dfv;
+ }
++
++static int
++read_function (struct parse * cfile)
++{
++	int c;
++
++	ssize_t n = read (cfile -> file, cfile -> inbuf, cfile -> bufsiz);
++	if (n == 0) {
++		c = EOF;
++		cfile -> bufix = 0;
++		cfile -> buflen = 0;
++	} else if (n < 0) {
++		c = EOF;
++		cfile -> bufix = cfile -> buflen = 0;
++	} else {
++		c = cfile -> inbuf [0];
++		cfile -> bufix = 1;
++		cfile -> buflen = n;
++	}
++
++	return c;
++}
+diff -up dhcp-4.0.1/common/print.c.ldap dhcp-4.0.1/common/print.c
+--- dhcp-4.0.1/common/print.c.ldap	2007-10-01 04:47:35.000000000 -1000
++++ dhcp-4.0.1/common/print.c	2009-07-08 07:24:34.000000000 -1000
+@@ -163,9 +163,9 @@ char *print_base64 (const unsigned char 
+ }
+ 
+ char *print_hw_addr (htype, hlen, data)
+-	int htype;
+-	int hlen;
+-	unsigned char *data;
++	const int htype;
++	const int hlen;
++	const unsigned char *data;
  {
- 	struct hardware h;
-+	int ret;
+ 	static char habuf [49];
+ 	char *s;
+diff -up dhcp-4.0.1/configure.ac.ldap dhcp-4.0.1/configure.ac
+--- dhcp-4.0.1/configure.ac.ldap	2008-12-23 09:01:39.000000000 -1000
++++ dhcp-4.0.1/configure.ac	2009-07-08 07:24:34.000000000 -1000
+@@ -284,6 +284,33 @@ AC_CHECK_MEMBER(struct msghdr.msg_contro
+ #include <sys/socket.h>
+ 	])
+ 
++# OpenLDAP support in dhcpd is disabled by default
++AC_ARG_WITH(ldap,
++    AC_HELP_STRING([--with-ldap],
++                   [enable OpenLDAP support in dhcpd (default is no)]),
++    [ldap=$withval],
++    [ldap=no])
++if test x$ldap = xyes ; then
++    AC_CHECK_LIB([ldap], [ldap_initialize], [],
++        [AC_MSG_FAILURE([*** libldap not usable.])])
++
++    ldap_libs="-lldap"
++    AC_SUBST(LDAP_CFLAGS, [-DLDAP_CONFIGURATION])
++    AC_SUBST(LDAP_LIBS, [$ldap_libs])
++fi
++
++# OpenLDAP with SSL support is optional
++AC_ARG_WITH(ldapcrypto,
++    AC_HELP_STRING([--with-ldapcrypto],
++                   [enable OpenLDAP crypto support in dhcpd (default is no)]),
++    [ldapcrypto=$withval],
++    [ldapcrypto=no])
++if test x$ldapcrypto = xyes ; then
++    AC_SUBST(LDAPSSL_CFLAGS, [-DUSE_SSL])
++fi
++
++AM_CONDITIONAL(USE_LDAP, [test x$ldap == xyes])
++
+ # Append selected warning levels to CFLAGS before substitution (but after
+ # AC_TRY_COMPILE & etc).
+ CFLAGS="$CFLAGS $STD_CWARNINGS"
+diff -up dhcp-4.0.1/dst/Makefile.am.ldap dhcp-4.0.1/dst/Makefile.am
+--- dhcp-4.0.1/dst/Makefile.am.ldap	2007-05-29 06:32:10.000000000 -1000
++++ dhcp-4.0.1/dst/Makefile.am	2009-07-08 07:24:34.000000000 -1000
+@@ -2,7 +2,11 @@ AM_CPPFLAGS = -DMINIRES_LIB -DHMAC_MD5
+ 
+ lib_LIBRARIES = libdst.a
+ 
+-libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \
++libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c \
+ 		   base64.c prandom.c
+ 
++if USE_LDAP
++libdst_a_SOURCES += md5_dgst.c
++endif
 +
+ EXTRA_DIST = dst_internal.h md5.h md5_locl.h
+diff -up dhcp-4.0.1/includes/dhcpd.h.ldap dhcp-4.0.1/includes/dhcpd.h
+--- dhcp-4.0.1/includes/dhcpd.h.ldap	2008-02-08 08:46:34.000000000 -1000
++++ dhcp-4.0.1/includes/dhcpd.h	2009-07-08 07:26:37.000000000 -1000
+@@ -102,6 +102,11 @@ typedef time_t TIME;
+ #include <isc-dhcp/result.h>
+ #include <omapip/omapip_p.h>
+ 
 +#if defined(LDAP_CONFIGURATION)
-+	if ((ret = find_haddr_in_ldap (hp, htype, hlen, haddr, file, line)))
-+		return ret;
++# include <ldap.h>
++# include <sys/utsname.h> /* for uname() */
 +#endif
++
+ #if !defined (BYTE_NAME_HASH_SIZE)
+ # define BYTE_NAME_HASH_SIZE	401	/* Default would be ridiculous. */
+ #endif
+@@ -291,6 +296,8 @@ struct parse {
+ 	size_t bufsiz;
  
- 	h.hlen = hlen + 1;
- 	h.hbuf [0] = htype;
-diff -up /dev/null dhcp-4.0.0/server/ldap_casa.c
---- /dev/null	2008-02-04 11:13:29.142014072 -1000
-+++ dhcp-4.0.0/server/ldap_casa.c	2008-02-06 14:34:44.000000000 -1000
-@@ -0,0 +1,138 @@
-+/* ldap_casa.c
+ 	struct parse *saved_state;
++
++	int (*read_function) (struct parse *);
+ };
+ 
+ /* Variable-length array of data. */
+@@ -422,6 +429,32 @@ struct hardware {
+ 	u_int8_t hbuf [17];
+ };
+ 
++#if defined(LDAP_CONFIGURATION)
++# define LDAP_BUFFER_SIZE		8192
++# define LDAP_METHOD_STATIC		0
++# define LDAP_METHOD_DYNAMIC	1
++#if defined (USE_SSL)
++# define LDAP_SSL_OFF			0
++# define LDAP_SSL_ON			1
++# define LDAP_SSL_TLS			2
++# define LDAP_SSL_LDAPS			3
++#endif
++
++/* This is a tree of the current configuration we are building from LDAP */
++struct ldap_config_stack {
++	LDAPMessage * res;	/* Pointer returned from ldap_search */
++	LDAPMessage * ldent;	/* Current item in LDAP that we're processing.
++							in res */
++	int close_brace;	/* Put a closing } after we're through with
++						this item */
++	int processed;	/* We set this flag if this base item has been
++					processed. After this base item is processed,
++					we can start processing the children */
++	struct ldap_config_stack *children;
++	struct ldap_config_stack *next;
++};
++#endif
++
+ typedef enum {
+ 	server_startup = 0,
+ 	server_running = 1,
+@@ -627,6 +660,29 @@ struct lease_state {
+ # define DEFAULT_PING_TIMEOUT 1
+ #endif
+ 
++#if defined(LDAP_CONFIGURATION)
++# define SV_LDAP_SERVER			57
++# define SV_LDAP_PORT			58
++# define SV_LDAP_USERNAME		59
++# define SV_LDAP_PASSWORD		60
++# define SV_LDAP_BASE_DN		61
++# define SV_LDAP_METHOD			62
++# define SV_LDAP_DEBUG_FILE		63
++# define SV_LDAP_DHCP_SERVER_CN		64
++# define SV_LDAP_REFERRALS		65
++#if defined (USE_SSL)
++# define SV_LDAP_SSL			66
++# define SV_LDAP_TLS_REQCERT		67
++# define SV_LDAP_TLS_CA_FILE		68
++# define SV_LDAP_TLS_CA_DIR		69
++# define SV_LDAP_TLS_CERT		70
++# define SV_LDAP_TLS_KEY		71
++# define SV_LDAP_TLS_CRLCHECK		72
++# define SV_LDAP_TLS_CIPHERS		73
++# define SV_LDAP_TLS_RANDFILE		74
++#endif
++#endif
++
+ #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
+ # define DEFAULT_DEFAULT_LEASE_TIME 43200
+ #endif
+@@ -2036,7 +2092,7 @@ extern int db_time_format;
+ char *quotify_string (const char *, const char *, int);
+ char *quotify_buf (const unsigned char *, unsigned, const char *, int);
+ char *print_base64 (const unsigned char *, unsigned, const char *, int);
+-char *print_hw_addr PROTO ((int, int, unsigned char *));
++char *print_hw_addr PROTO ((const int, const int, const unsigned char *));
+ void print_lease PROTO ((struct lease *));
+ void dump_raw PROTO ((const unsigned char *, unsigned));
+ void dump_packet_option (struct option_cache *, struct packet *,
+@@ -3159,6 +3215,20 @@ OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_l
+ 
+ const char *binding_state_print (enum failover_state);
+ 
++/* ldap.c */
++#if defined(LDAP_CONFIGURATION)
++extern struct enumeration ldap_methods;
++#if defined (USE_SSL)
++extern struct enumeration ldap_ssl_usage_enum;
++extern struct enumeration ldap_tls_reqcert_enum;
++extern struct enumeration ldap_tls_crlcheck_enum;
++#endif
++isc_result_t ldap_read_config (void);
++int find_haddr_in_ldap (struct host_decl **, int, unsigned,
++                        const unsigned char *, const char *, int);
++int find_subclass_in_ldap (struct class *, struct class **,
++                           struct data_string *);
++#endif
+ 
+ /* mdb6.c */
+ HASH_FUNCTIONS_DECL(ia_na, unsigned char *, struct ia_na, ia_na_hash_t);
+diff -up /dev/null dhcp-4.0.1/includes/ldap_casa.h
+--- /dev/null	2009-07-08 03:35:30.103138421 -1000
++++ dhcp-4.0.1/includes/ldap_casa.h	2009-07-08 07:24:34.000000000 -1000
+@@ -0,0 +1,83 @@
++/* ldap_casa.h
 +   
-+   CASA routines for DHCPD... */
++   Definition for CASA modules... */
 +
 +/* Copyright (c) 2004 Internet Systems Consorium, Inc. ("ISC")
 + * Copyright (c) 1995-2003 Internet Software Consortium.
@@ -73,112 +289,129 @@
 + */
 +
 +#if defined(LDAP_CASA_AUTH)
-+#include "ldap_casa.h"
-+#include "dhcpd.h"
-+
-+int
-+load_casa (void)
-+{
-+       if( !(casaIDK = dlopen(MICASA_LIB,RTLD_LAZY)))
-+       	  return 0;
-+       p_miCASAGetCredential = (CASA_GetCredential_T) dlsym(casaIDK, "miCASAGetCredential");
-+       p_miCASASetCredential = (CASA_SetCredential_T) dlsym(casaIDK, "miCASASetCredential");
-+       p_miCASARemoveCredential = (CASA_RemoveCredential_T) dlsym(casaIDK, "miCASARemoveCredential");
-+
-+       if((p_miCASAGetCredential == NULL) ||
-+         (p_miCASASetCredential == NULL) ||
-+         (p_miCASARemoveCredential == NULL))
-+       {
-+          if(casaIDK)
-+            dlclose(casaIDK);
-+          casaIDK = NULL;
-+          p_miCASAGetCredential = NULL;
-+          p_miCASASetCredential = NULL;
-+          p_miCASARemoveCredential = NULL;
-+          return 0;
-+       }
-+       else
-+          return 1;
-+}
-+
-+static void
-+release_casa(void)
-+{
-+   if(casaIDK)
-+   {
-+      dlclose(casaIDK);
-+      casaIDK = NULL;
-+   }
++#ifndef __LDAP_CASA_H__
++#define __LDAP_CASA_H__
 +
-+   p_miCASAGetCredential = NULL;
-+   p_miCASASetCredential = NULL;
-+   p_miCASARemoveCredential = NULL;
++#include <micasa_mgmd.h>
++#include <dlfcn.h>
++#include <string.h>
 +
-+}
++#define MICASA_LIB     "libmicasa.so.1"
 +
-+int
-+load_uname_pwd_from_miCASA (char **ldap_username, char **ldap_password)
-+ {
-+   int                     result = 0;
-+   uint32_t                credentialtype = SSCS_CRED_TYPE_SERVER_F;
-+   SSCS_BASIC_CREDENTIAL   credential;
-+   SSCS_SECRET_ID_T        applicationSecretId;
-+   char                    *tempVar = NULL;
-+
-+   const char applicationName[10] = "dhcp-ldap";
-+
-+   if ( load_casa() )
-+   {
-+      memset(&credential, 0, sizeof(SSCS_BASIC_CREDENTIAL));
-+      memset(&applicationSecretId, 0, sizeof(SSCS_SECRET_ID_T));
-+
-+      applicationSecretId.len = strlen(applicationName) + 1;
-+      memcpy (applicationSecretId.id, applicationName, applicationSecretId.len);
++SSCS_TYPEDEF_LIBCALL(int, CASA_GetCredential_T)
++(
++       uint32_t            ssFlags,
++       SSCS_SECRET_ID_T   *appSecretID,
++       SSCS_SECRET_ID_T   *sharedSecretID,
++       uint32_t           *credentialType,
++       void               *credential,
++       SSCS_EXT_T         *ext 
++);
++SSCS_TYPEDEF_LIBCALL(int, CASA_SetCredential_T)
++(
++       uint32_t            ssFlags,
++       SSCS_SECRET_ID_T   *appSecretID,
++       SSCS_SECRET_ID_T   *sharedSecretID,
++       uint32_t            credentialType,
++       void               *credential,
++       SSCS_EXT_T         *ext
++);
 +
-+      credential.unFlags = USERNAME_TYPE_CN_F;
++SSCS_TYPEDEF_LIBCALL(int, CASA_RemoveCredential_T)
++(
++       uint32_t            ssFlags,
++       SSCS_SECRET_ID_T   *appSecretID,
++       SSCS_SECRET_ID_T   *sharedSecretID,
++       SSCS_EXT_T         *ext
++);
++static CASA_GetCredential_T            p_miCASAGetCredential = NULL;
++static CASA_SetCredential_T            p_miCASASetCredential = NULL;
++static CASA_RemoveCredential_T         p_miCASARemoveCredential = NULL;
++static void                            *casaIDK = NULL;
 +
-+      result = p_miCASAGetCredential (0,
-+                 &applicationSecretId,NULL,&credentialtype,
-+                 &credential,NULL);
++int load_casa(void);
++static void release_casa(void);
++int load_uname_pwd_from_miCASA(char **, char **);
 +
-+      if(credential.unLen)
-+      {
-+         tempVar = dmalloc (credential.unLen + 1, MDL);
-+         if (!tempVar)
-+             log_fatal ("no memory for ldap_username");
-+         memcpy(tempVar , credential.username, credential.unLen);
-+         *ldap_username = tempVar;
++#endif /* __LDAP_CASA_H__ */
++#endif /* LDAP_CASA_AUTH */
 +
-+         tempVar = dmalloc (credential.pwordLen + 1, MDL);
-+         if (!tempVar)
-+             log_fatal ("no memory for ldap_password");
-+         memcpy(tempVar, credential.password, credential.pwordLen);
-+         *ldap_password = tempVar;
+diff -up dhcp-4.0.1/server/Makefile.am.ldap dhcp-4.0.1/server/Makefile.am
+--- dhcp-4.0.1/server/Makefile.am.ldap	2007-05-29 06:32:11.000000000 -1000
++++ dhcp-4.0.1/server/Makefile.am	2009-07-08 07:24:34.000000000 -1000
+@@ -4,12 +4,11 @@ dist_sysconf_DATA = dhcpd.conf
+ sbin_PROGRAMS = dhcpd
+ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
+ 		omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c \
+-		dhcpv6.c mdb6.c
++		dhcpv6.c mdb6.c ldap.c ldap_casa.c
+ 
+-# libomapi.a this is here twice to handle circular library dependencies :(
+-dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../dst/libdst.a \
+-	      ../dhcpctl/libdhcpctl.a ../minires/libres.a \
+-	      ../omapip/libomapi.a
++dhcpd_CFLAGS = $(LDAP_CFLAGS) $(LDAPSSL_CFLAGS)
++dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../minires/libres.a \
++	      ../dhcpctl/libdhcpctl.a ../dst/libdst.a $(LDAP_LIBS)
+ 
+ man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
+ EXTRA_DIST = $(man_MANS)
+diff -up dhcp-4.0.1/server/class.c.ldap dhcp-4.0.1/server/class.c
+--- dhcp-4.0.1/server/class.c.ldap	2007-09-05 07:32:10.000000000 -1000
++++ dhcp-4.0.1/server/class.c	2009-07-08 07:24:34.000000000 -1000
+@@ -84,6 +84,7 @@ int check_collection (packet, lease, col
+ 	int matched = 0;
+ 	int status;
+ 	int ignorep;
++	int classfound;
+ 
+ 	for (class = collection -> classes; class; class = class -> nic) {
+ #if defined (DEBUG_CLASS_MATCHING)
+@@ -129,9 +130,15 @@ int check_collection (packet, lease, col
+ 				   class -> submatch, MDL));
+ 			if (status && data.len) {
+ 				nc = (struct class *)0;
+-				if (class_hash_lookup (&nc, class -> hash,
+-						       (const char *)data.data,
+-						       data.len, MDL)) {
++				classfound = class_hash_lookup (&nc, class -> hash,
++					(const char *)data.data, data.len, MDL);
 +
-+#if defined (DEBUG_LDAP)
-+         log_info ("Authentication credential taken from CASA");
++#ifdef LDAP_CONFIGURATION
++				if (!classfound && find_subclass_in_ldap (class, &nc, &data))
++					classfound = 1;
 +#endif
 +
-+         release_casa();
-+         return 1;
-+
-+        }
-+        else
-+        {
-+            release_casa();
-+            return 0;
-+        }
-+      }
-+      else
-+          return 0; //casa libraries not loaded
-+ }
++				if (classfound) {
+ #if defined (DEBUG_CLASS_MATCHING)
+ 					log_info ("matches subclass %s.",
+ 					      print_hex_1 (data.len,
+diff -up dhcp-4.0.1/server/confpars.c.ldap dhcp-4.0.1/server/confpars.c
+--- dhcp-4.0.1/server/confpars.c.ldap	2008-03-07 10:17:52.000000000 -1000
++++ dhcp-4.0.1/server/confpars.c	2009-07-08 07:24:34.000000000 -1000
+@@ -60,7 +60,17 @@ void parse_trace_setup ()
+ 
+ isc_result_t readconf ()
+ {
+-	return read_conf_file (path_dhcpd_conf, root_group, ROOT_GROUP, 0);
++	isc_result_t res;
 +
-+#endif /* LDAP_CASA_AUTH */
++	res = read_conf_file (path_dhcpd_conf, root_group, ROOT_GROUP, 0);
++#if defined(LDAP_CONFIGURATION)
++	if (res != ISC_R_SUCCESS)
++		return (res);
 +
-diff -up dhcp-4.0.0/server/dhcpd.c.ldap dhcp-4.0.0/server/dhcpd.c
---- dhcp-4.0.0/server/dhcpd.c.ldap	2007-11-30 11:51:43.000000000 -1000
-+++ dhcp-4.0.0/server/dhcpd.c	2008-02-06 14:34:44.000000000 -1000
-@@ -505,6 +505,14 @@ main(int argc, char **argv) {
++	return ldap_read_config ();
++#else
++	return (res);
++#endif
+ }
+ 
+ isc_result_t read_conf_file (const char *filename, struct group *group,
+diff -up dhcp-4.0.1/server/dhcpd.c.ldap dhcp-4.0.1/server/dhcpd.c
+--- dhcp-4.0.1/server/dhcpd.c.ldap	2008-03-18 08:29:16.000000000 -1000
++++ dhcp-4.0.1/server/dhcpd.c	2009-07-08 07:24:34.000000000 -1000
+@@ -507,6 +507,14 @@ main(int argc, char **argv) {
  	/* Add the ddns update style enumeration prior to parsing. */
  	add_enumeration (&ddns_styles);
  	add_enumeration (&syslog_enum);
@@ -193,9 +426,9 @@
  
  	if (!group_allocate (&root_group, MDL))
  		log_fatal ("Can't allocate root group!");
-diff -up /dev/null dhcp-4.0.0/server/ldap.c
---- /dev/null	2008-02-04 11:13:29.142014072 -1000
-+++ dhcp-4.0.0/server/ldap.c	2008-02-06 14:35:19.000000000 -1000
+diff -up /dev/null dhcp-4.0.1/server/ldap.c
+--- /dev/null	2009-07-08 03:35:30.103138421 -1000
++++ dhcp-4.0.1/server/ldap.c	2009-07-08 07:24:34.000000000 -1000
 @@ -0,0 +1,2004 @@
 +/* ldap.c
 +
@@ -1073,8 +1306,8 @@
 +      creds.bv_val = strdup(ldap_password);
 +      creds.bv_len = strlen(ldap_password);
 +
-+      if ((ret == ldap_sasl_bind_s (ld, ldap_username, LDAP_SASL_SIMPLE,
-+                                    &creds, NULL, NULL, NULL)) != LDAP_SUCCESS)
++      if ((ret = ldap_sasl_bind_s (ld, ldap_username, LDAP_SASL_SIMPLE,
++                                   &creds, NULL, NULL, NULL)) != LDAP_SUCCESS)
 +        {
 +          log_error ("Error: Cannot login into ldap server %s:%d: %s",
 +                     ldap_server, ldap_port, ldap_err2string (ret));
@@ -1478,7 +1711,7 @@
 +    return (EOF);
 +
 +  cfile->bufix = 1;
-+  cfile->buflen = strlen (cfile->inbuf);
++  cfile->buflen = strlen (cfile->inbuf) - 1;
 +  if (cfile->buflen > 0)
 +    ldap_write_debug (cfile->inbuf, cfile->buflen);
 +
@@ -2201,111 +2434,217 @@
 +}
 +
 +#endif
-diff -up dhcp-4.0.0/server/confpars.c.ldap dhcp-4.0.0/server/confpars.c
---- dhcp-4.0.0/server/confpars.c.ldap	2007-11-30 11:51:43.000000000 -1000
-+++ dhcp-4.0.0/server/confpars.c	2008-02-06 14:34:44.000000000 -1000
-@@ -60,7 +60,17 @@ void parse_trace_setup ()
- 
- isc_result_t readconf ()
- {
--	return read_conf_file (path_dhcpd_conf, root_group, ROOT_GROUP, 0);
-+	isc_result_t res;
+diff -up /dev/null dhcp-4.0.1/server/ldap_casa.c
+--- /dev/null	2009-07-08 03:35:30.103138421 -1000
++++ dhcp-4.0.1/server/ldap_casa.c	2009-07-08 07:24:34.000000000 -1000
+@@ -0,0 +1,138 @@
++/* ldap_casa.c
++   
++   CASA routines for DHCPD... */
 +
-+	res = read_conf_file (path_dhcpd_conf, root_group, ROOT_GROUP, 0);
-+#if defined(LDAP_CONFIGURATION)
-+	if (res != ISC_R_SUCCESS)
-+		return (res);
++/* Copyright (c) 2004 Internet Systems Consorium, Inc. ("ISC")
++ * Copyright (c) 1995-2003 Internet Software Consortium.
++ * Copyright (c) 2006 Novell, Inc.
 +
-+	return ldap_read_config ();
-+#else
-+	return (res);
-+#endif
- }
- 
- isc_result_t read_conf_file (const char *filename, struct group *group,
-diff -up dhcp-4.0.0/server/class.c.ldap dhcp-4.0.0/server/class.c
---- dhcp-4.0.0/server/class.c.ldap	2007-09-05 07:32:10.000000000 -1000
-+++ dhcp-4.0.0/server/class.c	2008-02-06 14:34:44.000000000 -1000
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/dhcp/dhcp-ldap.patch?r1=1.10&r2=1.11&f=u



More information about the pld-cvs-commit mailing list