[package] openldap, update to 2.4.19, package slapd, cleanup makefile
authorFlorian Fainelli <florian@openwrt.org>
Mon, 23 Nov 2009 10:53:22 +0000 (10:53 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Mon, 23 Nov 2009 10:53:22 +0000 (10:53 +0000)
(#6150)

SVN-Revision: 18495

libs/openldap/Makefile
libs/openldap/files/ldap.init [new file with mode: 0644]
libs/openldap/patches/010-fix-asserts.patch [new file with mode: 0644]

index ed701e0dbf39045e98dde07f710c79be5961c2b5..49c2dc9468c66170ea936e70c283d8199efbc21c 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openldap
-PKG_VERSION:=2.4.16
+PKG_VERSION:=2.4.19
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
@@ -16,7 +16,7 @@ PKG_SOURCE_URL:=ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/ \
        ftp://sunsite.cnlab-switch.ch/mirror/OpenLDAP/openldap-release/ \
        ftp://ftp.nl.uu.net/pub/unix/db/openldap/openldap-release/ \
        ftp://ftp.plig.org/pub/OpenLDAP/openldap-release/
-PKG_MD5SUM:=ed5b86e9d2b372d10edfe3bb59fee165
+PKG_MD5SUM:=4a6dab2711fcf141f19bb680bc335887
 
 PKG_FIXUP = libtool
 
@@ -36,7 +36,6 @@ define Package/libopenldap
 endef
 
 define Package/libopenldap/description
-=
        OpenLDAP Software is an open source implementation of the 
        Lightweight Directory Access Protocol (LDAP).   
        This package contains the shared LDAP client libraries, needed by other programs.
@@ -55,12 +54,25 @@ define Package/openldap-utils
 endef
 
 define Package/openldap-utils/description
-=
        OpenLDAP Software is an open source implementation of the 
        Lightweight Directory Access Protocol (LDAP).   
        This package contains client programs required to access LDAP servers.
 endef
 
+define Package/openldap-server
+  $(call Package/openldap/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenldap +db47
+  TITLE+= (server)
+endef
+
+define Package/openldap-server/description
+       OpenLDAP Software is an open source implementation of the 
+       Lightweight Directory Access Protocol (LDAP).   
+       This package contains server programs required to provide LDAP services.
+endef
+
 TARGET_CFLAGS += $(FPIC)
 
 CONFIGURE_ARGS += \
@@ -70,7 +82,6 @@ CONFIGURE_ARGS += \
        --enable-dynamic \
        --enable-syslog \
        --disable-local \
-       --disable-slapd \
        --disable-slurpd \
        --with-cyrus-sasl \
        --without-fetch \
@@ -107,6 +118,17 @@ define Package/openldap-utils/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ldap* $(1)/usr/bin/
 endef
+       
+define Package/openldap-server/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/ldap.init $(1)/etc/init.d/ldap
+       $(INSTALL_DIR) $(1)/etc/openldap/schema
+       $(CP) $(PKG_INSTALL_DIR)/etc/openldap/schema/* $(1)/etc/openldap/schema/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       # OpenLDAP installs slapd into libexecdir, not sbindir:
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/slapd $(1)/usr/sbin/
+endef
 
 $(eval $(call BuildPackage,libopenldap))
 $(eval $(call BuildPackage,openldap-utils))
+$(eval $(call BuildPackage,openldap-server))
diff --git a/libs/openldap/files/ldap.init b/libs/openldap/files/ldap.init
new file mode 100644 (file)
index 0000000..9917525
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009 OpenWrt.org
+
+START=60
+
+start() {
+       mkdir -p /var/run/openldap
+       mkdir -p /var/lib/ldap
+       
+       /usr/sbin/slapd
+}
+
+stop() {
+       killall slapd 2> /dev/null
+}
diff --git a/libs/openldap/patches/010-fix-asserts.patch b/libs/openldap/patches/010-fix-asserts.patch
new file mode 100644 (file)
index 0000000..0141092
--- /dev/null
@@ -0,0 +1,50 @@
+diff -u --recursive openldap-2.4.19-vanilla/servers/slapd/connection.c openldap-2.4.19/servers/slapd/connection.c
+--- openldap-2.4.19-vanilla/servers/slapd/connection.c 2009-11-17 19:04:26.000000000 -0500
++++ openldap-2.4.19/servers/slapd/connection.c 2009-11-17 19:09:02.000000000 -0500
+@@ -783,7 +783,9 @@
+ {
+       assert( connections != NULL );
+       assert( c != NULL );
+-      assert( c->c_struct_state == SLAP_C_USED );
++
++      if ( c->c_struct_state != SLAP_C_USED ) return;
++
+       assert( c->c_conn_state != SLAP_C_INVALID );
+       /* c_mutex must be locked by caller */
+@@ -816,7 +818,9 @@
+ {
+       assert( connections != NULL );
+       assert( c != NULL );
+-      assert( c->c_struct_state == SLAP_C_USED );
++
++      if ( c->c_struct_state != SLAP_C_USED ) return;
++
+       assert( c->c_conn_state == SLAP_C_CLOSING );
+       /* NOTE: c_mutex should be locked by caller */
+diff -u --recursive openldap-2.4.19-vanilla/servers/slapd/daemon.c openldap-2.4.19/servers/slapd/daemon.c
+--- openldap-2.4.19-vanilla/servers/slapd/daemon.c     2009-11-17 19:04:26.000000000 -0500
++++ openldap-2.4.19/servers/slapd/daemon.c     2009-11-17 19:10:54.000000000 -0500
+@@ -989,13 +989,17 @@
+ void
+ slapd_set_read( ber_socket_t s, int wake )
+ {
++      int do_wake = 1;
+       ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
+-      assert( SLAP_SOCK_IS_ACTIVE( s ));
+-      if (!SLAP_SOCK_IS_READ( s )) SLAP_SOCK_SET_READ( s );
+-
++      if( SLAP_SOCK_IS_ACTIVE( s ) && !SLAP_SOCK_IS_READ( s )) {
++              SLAP_SOCK_SET_READ( s );
++      } else {
++              do_wake = 0;
++      }
+       ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
+-      WAKE_LISTENER(wake);
++      if ( do_wake )
++              WAKE_LISTENER(wake);
+ }
+ time_t