Package: slapd
Version: 2.4.17-2.1
Severity: wishlist
Tags: patch
The attached patches add support for autogroup contrib module
(which contrary to dynlist, behave correctly when searching by
attributes).
The attached patches solves this:
- autogroup.diff: upgrade to latest CVS version (should be added to
debian/patches)
- autogroup-debian-makefile.diff: fix the build (should be added to
debian/patches)
- debian-rules.diff: actually build during package building
I can rework the patch or send them differently (debdiff?).
I can also make the third patch more generic, accepting a list of
contrib modules to build.
Regards
Mathieu Parent
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (900, 'testing'), (300, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-4-686 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Seulement dans openldap-2.4.17-old/contrib//ldapc++: config.guess
Seulement dans openldap-2.4.17-old/contrib//ldapc++: config.sub
diff -ur openldap-2.4.17-old/contrib//slapd-modules/autogroup/autogroup.c openldap-2.4.17/contrib//slapd-modules/autogroup/autogroup.c
--- openldap-2.4.17-old/contrib//slapd-modules/autogroup/autogroup.c 2008-11-10 20:57:30.000000000 +0100
+++ openldap-2.4.17/contrib//slapd-modules/autogroup/autogroup.c 2010-03-30 12:04:00.000000000 +0200
@@ -1,7 +1,10 @@
/* autogroup.c - automatic group overlay */
-/* $OpenLDAP: pkg/ldap/contrib/slapd-modules/autogroup/autogroup.c,v 1.2.2.2 2008/11/10 19:57:30 quanah Exp $ */
-/*
- * Copyright 2007 Michał Szulczyński.
+/* $OpenLDAP: /contrib/slapd-modules/autogroup/autogroup.c,v 1.8 2009/09/08 06:15:08 ando Exp $ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2007-2009 The OpenLDAP Foundation.
+ * Portions Copyright 2007 Michał Szulczyński.
+ * Portions Copyright 2009 Howard Chu.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -12,6 +15,11 @@
* top-level directory of the distribution or, alternatively, at
* <http://www.OpenLDAP.org/license.html>.
*/
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by Michał Szulczyński for inclusion in
+ * OpenLDAP Software. Additional significant contributors include:
+ * Howard Chu
+ */
#include "portable.h"
@@ -196,8 +204,6 @@
static int
autogroup_member_search_cb( Operation *op, SlapReply *rs )
{
- slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
-
assert( op->o_tag == LDAP_REQ_SEARCH );
if ( rs->sr_type == REP_SEARCH ) {
@@ -238,20 +244,13 @@
static int
autogroup_member_search_modify_cb( Operation *op, SlapReply *rs )
{
- slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
-
assert( op->o_tag == LDAP_REQ_SEARCH );
if ( rs->sr_type == REP_SEARCH ) {
autogroup_ga_t *agg = (autogroup_ga_t *)op->o_callback->sc_private;
autogroup_entry_t *age = agg->agg_group;
- Operation o = *op;
Modifications *modlist;
- SlapReply sreply = {REP_RESULT};
- const char *text = NULL;
- char textbuf[1024];
struct berval vals[ 2 ], nvals[ 2 ];
- slap_callback cb = { NULL, slap_null_cb, NULL, NULL };
Debug(LDAP_DEBUG_TRACE, "==> autogroup_member_search_modify_cb <%s>\n",
rs->sr_entry ? rs->sr_entry->e_name.bv_val : "UNKNOWN_DN", 0, 0);
@@ -508,11 +507,8 @@
static int
autogroup_group_add_cb( Operation *op, SlapReply *rs )
{
- slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
-
assert( op->o_tag == LDAP_REQ_SEARCH );
-
if ( rs->sr_type == REP_SEARCH ) {
autogroup_sc_t *ags = (autogroup_sc_t *)op->o_callback->sc_private;
@@ -538,7 +534,6 @@
autogroup_def_t *agd = agi->agi_def;
autogroup_entry_t *age = agi->agi_entry;
autogroup_filter_t *agf;
- Attribute *a;
int rc = 0;
Debug( LDAP_DEBUG_TRACE, "==> autogroup_add_entry <%s>\n",
@@ -652,7 +647,6 @@
{
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
autogroup_info_t *agi = (autogroup_info_t *)on->on_bi.bi_private;
- autogroup_def_t *agd = agi->agi_def;
autogroup_entry_t *age = agi->agi_entry,
*age_prev, *age_next;
autogroup_filter_t *agf;
@@ -683,9 +677,6 @@
dnMatch( &match, 0, NULL, NULL, &e->e_nname, &age->age_ndn );
if ( match == 0 ) {
- autogroup_filter_t *agf = age->age_filter,
- *agf_next;
-
autogroup_delete_group( agi, age );
break;
}
@@ -1266,7 +1257,6 @@
autogroup_entry_t *age_next, *age_prev;
autogroup_filter_t *agf,
*agf_next;
- struct berval *bv;
ldap_pvt_thread_mutex_lock( &agi->agi_mutex );
@@ -1446,8 +1436,7 @@
BackendDB *be,
ConfigReply *cr )
{
- slap_overinst *on = (slap_overinst *) be->bd_info,
- *on_bd;
+ slap_overinst *on = (slap_overinst *) be->bd_info;
autogroup_info_t *agi = on->on_bi.bi_private;
autogroup_def_t *agd;
autogroup_sc_t ags;
@@ -1458,12 +1447,13 @@
void *thrctx = ldap_pvt_thread_pool_context();
Connection conn = { 0 };
OperationBuffer opbuf;
- BerValue bv;
- char *ptr;
- int rc = 0;
Debug( LDAP_DEBUG_TRACE, "==> autogroup_db_open\n", 0, 0, 0);
+ if ( agi == NULL ) {
+ return 0;
+ }
+
connection_fake_init( &conn, &opbuf, thrctx );
op = &opbuf.ob_op;
@@ -1482,31 +1472,28 @@
op->ors_slimit = SLAP_NO_LIMIT;
op->ors_attrs = slap_anlist_no_attrs;
- op->o_bd = select_backend(&op->o_req_ndn, 0);
+ op->o_bd = be;
+ op->o_bd->bd_info = (BackendInfo *)on->on_info;
+
+ ags.ags_info = agi;
+ cb.sc_private = &ags;
+ cb.sc_response = autogroup_group_add_cb;
+ cb.sc_cleanup = NULL;
+ cb.sc_next = NULL;
+
+ op->o_callback = &cb;
- ldap_pvt_thread_mutex_lock( &agi->agi_mutex );
for (agd = agi->agi_def ; agd ; agd = agd->agd_next) {
autogroup_build_def_filter(agd, op);
-
- ags.ags_info = agi;
ags.ags_def = agd;
- cb.sc_private = &ags;
- cb.sc_response = autogroup_group_add_cb;
- cb.sc_cleanup = NULL;
- cb.sc_next = NULL;
-
- op->o_callback = &cb;
- op->o_bd->bd_info = (BackendInfo *)on->on_info;
op->o_bd->be_search( op, &rs );
- op->o_bd->bd_info = (BackendInfo *)on;
filter_free_x( op, op->ors_filter, 1 );
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
}
- ldap_pvt_thread_mutex_unlock( &agi->agi_mutex );
return 0;
}
diff -ur openldap-2.4.17-old/contrib//slapd-modules/autogroup/Makefile openldap-2.4.17/contrib//slapd-modules/autogroup/Makefile
--- openldap-2.4.17-old/contrib//slapd-modules/autogroup/Makefile 2009-04-28 01:36:57.000000000 +0200
+++ openldap-2.4.17/contrib//slapd-modules/autogroup/Makefile 2010-03-30 12:05:18.000000000 +0200
@@ -1,3 +1,5 @@
+LIBTOOL=../../../libtool
+
CPPFLAGS+=-I../../../include -I../../../servers/slapd
all: autogroup.la
diff -ur openldap-2.4.17-old/contrib//slapd-modules/autogroup/README openldap-2.4.17/contrib//slapd-modules/autogroup/README
--- openldap-2.4.17-old/contrib//slapd-modules/autogroup/README 2008-04-14 21:11:17.000000000 +0200
+++ openldap-2.4.17/contrib//slapd-modules/autogroup/README 2010-03-30 12:04:07.000000000 +0200
@@ -69,4 +69,17 @@
of members may be slow.
ACKNOWLEDGEMENTS
- This module was written in 2007 by Michał Szulczyński.
+ This module was originally written in 2007 by Michał Szulczyński.
+
+---
+Copyright 1998-2009 The OpenLDAP Foundation.
+Portions Copyright (C) 2007 Michał Szulczyński.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted only as authorized by the OpenLDAP
+Public License.
+
+A copy of this license is available in file LICENSE in the
+top-level directory of the distribution or, alternatively, at
+http://www.OpenLDAP.org/license.html.
Seulement dans openldap-2.4.17-old/contrib//ldapc++: config.guess
Seulement dans openldap-2.4.17-old/contrib//ldapc++: config.sub
diff -ur openldap-2.4.17-old/contrib//slapd-modules/autogroup/Makefile openldap-2.4.17/contrib//slapd-modules/autogroup/Makefile
--- openldap-2.4.17-old/contrib//slapd-modules/autogroup/Makefile 2010-03-30 12:06:18.000000000 +0200
+++ openldap-2.4.17/contrib//slapd-modules/autogroup/Makefile 2010-03-30 12:05:32.000000000 +0200
@@ -1,5 +1,6 @@
-LIBTOOL=../../../libtool
+LIBTOOL=libtool
+CPPFLAGS+=-I../../../debian/build/include
CPPFLAGS+=-I../../../include -I../../../servers/slapd
all: autogroup.la
@@ -10,11 +11,16 @@
autogroup.la: autogroup.lo
$(LIBTOOL) --mode=link $(CC) -version-info 0:0:0 \
-rpath $(PREFIX)/lib -module -o $@ $?
+ #Why libtool doesn't call ld, ar and ranlib?
+ ld -Bshareable -o .libs/autogroup.so.0.0.0 .libs/autogroup.o
+ ar cru .libs/autogroup.a autogroup.o
+ ranlib .libs/autogroup.a
clean:
rm -f autogroup.lo autogroup.la
install: autogroup.la
- mkdir -p $(PREFIX)/lib/openldap
- $(LIBTOOL) --mode=install cp autogroup.la $(PREFIX)/lib/openldap
+ mkdir -p $(PREFIX)/lib/ldap
+ $(LIBTOOL) --mode=install install -c autogroup.la $(PREFIX)/lib/ldap
$(LIBTOOL) --finish $(PREFIX)/lib
+
--- openldap-2.4.17-old/debian/rules 2010-03-30 08:14:29.000000000 +0200
+++ openldap-2.4.17/debian/rules 2010-03-30 11:48:12.000000000 +0200
@@ -36,6 +36,7 @@
slapddir := $(CURDIR)/debian/slapd/usr/sbin
MAKEVARS := DESTDIR=$(installdir) STRIP=
+MAKEVARS_autogroup := PREFIX=$(installdir)/usr
# Include the quilt patch system.
include /usr/share/quilt/quilt.make
@@ -105,6 +106,7 @@
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
RESOLV_MULTI=off $(MAKE) -C $(builddir) test
endif
+ $(MAKE) -C $(CURDIR)/contrib/slapd-modules/autogroup
$(MAKEVARS_autogroup)
touch $@
# Check all built libraries for unresolved symbols except for the libslapi
@@ -114,6 +116,7 @@
install: install-stamp
install-stamp: build-stamp
$(MAKE) -C $(builddir) $(MAKEVARS) install
+ $(MAKE) -C $(CURDIR)/contrib/slapd-modules/autogroup
$(MAKEVARS_autogroup) install
for F in $(installdir)/usr/lib/*.so.*.*.*; do \
if echo "$$F" | grep -q libslapi ; then \
continue; \
@@ -184,6 +187,7 @@
dh_testdir
dh_testroot
rm -f install-stamp build-stamp configure-stamp
+ $(MAKE) -C $(CURDIR)/contrib/slapd-modules/autogroup
$(MAKEVARS_autogroup) clean
# Update translation templates for debconf
debconf-updatepo
# Remove our stripped schema from the upstream source area.