Dear List,
this is in advance a bit, but I thought I might as well chuck it in.

The latest "stable" release of the OpenLDAP sources (2.3.17 as I write this)
contains an ignominious bug, and won't build using '--without-debug' .

Anyway, the necessary repairs are in the live CVS tree.  I've accepted
the relevant updated source file servers/slapd/slapcommon.c : in
effect I move to version 1.68, which includes the relevant repair and another
obviously good alteration following.  The attached patch is simply the diff
between the version as released and 1.68 in CVS.  The release-specific
header comment diff has been removed, however, because it prevents the
patch being used for both 2.3.14 (for which I originally prepared it) and
2.3.17.

Only the --{en,dis}able-debug option is relevant, but for what it's worth,
here is my 'configure' invocation:

../"${SRCDIR}"/configure --prefix=/usr \
   --libexecdir=/usr/sbin \
   --localstatedir=/srv/ldap \
   --enable-spasswd --enable-rlookups --enable-slp \
   --enable-wrappers --enable-backends=mod --enable-denyop \
   --enable-retcode --enable-translucent --enable-valsort \
   --disable-debug --enable-dynamic --enable-crypt \
   --enable-modules --enable-ldap --enable-ldbm \
   --enable-dyngroup --enable-dynlist --enable-ppolicy \
   --with-cyrus-sasl --with-threads --with-multiple-precision=gmp \
   --enable-ipv6 --enable-local --with-gnu-ld \
   --sysconfdir=/etc

(note: some of these are redundant - but they ensure that
I get configuration errors if the relevant bits are not available,
so they are still useful).  The resulting build executes the
test-suite with no errors reported.

Bernard Leak
--
Before they made me, they broke the mould







\#Output of diff -Nru openldap-2.3.14/servers/slapd/slapcommon.c{-old,}
--- openldap-2.3.14/servers/slapd/slapcommon.c-old      2005-11-26 
23:54:49.000000000 +0000
+++ openldap-2.3.14/servers/slapd/slapcommon.c  2006-01-23 15:51:52.000000000 
+0000
@@ -174,6 +174,8 @@
  *     argc, argv      command line arguments
  */
 
+static int need_shutdown;
+
 void
 slap_tool_init(
        const char* progname,
@@ -195,7 +197,7 @@
 #ifdef LDAP_DEBUG
        /* tools default to "none", so that at least LDAP_DEBUG_ANY 
         * messages show up; use -d 0 to reset */
-       ldap_debug = LDAP_DEBUG_NONE;
+       slap_debug = LDAP_DEBUG_NONE;
 #endif
 
 #ifdef CSRIMALLOC
@@ -262,32 +264,59 @@
                        continuemode++;
                        break;
 
-               case 'd':       /* turn on debugging */
-                       {
-#ifdef LDAP_DEBUG
-                       int     level;
+               case 'd': {     /* turn on debugging */
+                       int     level = 0;
 
+#ifdef LDAP_DEBUG
                        if ( optarg != NULL && optarg[ 0 ] != '-' && !isdigit( 
optarg[ 0 ] ) )
                        {
-                               if ( str2loglevel( optarg, &level ) ) {
+                               int     i, goterr = 0;
+                               char    **levels;
+
+                               levels = ldap_str2charray( optarg, "," );
+
+                               for ( i = 0; levels[ i ] != NULL; i++ ) {
+                                       level = 0;
+
+                                       if ( str2loglevel( levels[ i ], &level 
) ) {
+                                               fprintf( stderr,
+                                                       "unrecognized log level 
"
+                                                       "\"%s\"\n", levels[ i ] 
);
+                                               goterr = 1;
+                                               /* but keep parsing... */
+
+                                       } else {
+                                               if ( level != 0 ) {
+                                                       slap_debug |= level;
+
+                                               } else {
+                                                       /* allow to reset log 
level */
+                                                       slap_debug = 0;
+                                               }
+                                       }
+                               }
+
+                               ldap_charray_free( levels );
+
+                               if ( goterr ) {
+                                       usage( tool, progname );
+                               }
+
+                       } else {
+                               if ( lutil_atoix( &level, optarg, 0 ) != 0 ) {
                                        fprintf( stderr,
                                                "unrecognized log level "
                                                "\"%s\"\n", optarg );
-                                       exit( EXIT_FAILURE );
+                                       usage( tool, progname );
                                }
 
-                       } else if ( lutil_atoix( &level, optarg, 0 ) != 0 ) {
-                               fprintf( stderr,
-                                       "unrecognized log level "
-                                       "\"%s\"\n", optarg );
-                               exit( EXIT_FAILURE );
-                       }
+                               if ( level != 0 ) {
+                                       slap_debug |= level;
 
-                       if ( level ) {
-                               ldap_debug |= level;
-                       } else {
-                               /* allow to reset log level */
-                               ldap_debug = 0;
+                               } else {
+                                       /* allow to reset log level */
+                                       slap_debug = 0;
+                               }
                        }
 #else
                        if ( lutil_atoi( &level, optarg ) != 0 || level != 0 )
@@ -636,6 +665,8 @@
 
        /* slapdn doesn't specify a backend to startup */
        if ( !dryrun && tool != SLAPDN && slap_startup( be ) ) {
+               need_shutdown = 1;
+
                switch ( tool ) {
                case SLAPTEST:
                        fprintf( stderr, "slap_startup failed "
@@ -655,7 +686,9 @@
 void slap_tool_destroy( void )
 {
        if ( !dryrun ) {
-               slap_shutdown( be );
+               if ( need_shutdown ) {
+                       slap_shutdown( be );
+               }
                slap_destroy();
        }
 #ifdef SLAPD_MODULES


-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to