]> git.sur5r.net Git - openldap/commitdiff
ITS#6216
authorQuanah Gibson-Mount <quanah@openldap.org>
Wed, 22 Jul 2009 22:26:49 +0000 (22:26 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 22 Jul 2009 22:26:49 +0000 (22:26 +0000)
CHANGES
servers/slapd/bconfig.c

diff --git a/CHANGES b/CHANGES
index f2e22f9712930dfc01aff7e30543430225ea8700..07ab26c9e03bf2c26666f5fa98cb8186237414c2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@ OpenLDAP 2.4 Change Log
 
 OpenLDAP 2.4.18 Engineering
        Fixed slapd incorrectly applying writetimeout when not set (ITS#6220)
+       Fixed slapd subordinate needs a suffix (ITS#6216)
        Fixed slapd-ndb startup (ITS#6203)
        Build Environment
                Fixed test056-monitor with custom ports (ITS#6213)
index ad3649bbbd0dfbb8079915789d81ae9a3fbca68e..90f82e6769be79dfd84d03f20dcf3ff80b23ccb8 100644 (file)
@@ -2325,7 +2325,7 @@ static int
 config_subordinate(ConfigArgs *c)
 {
        int rc = 1;
-       int advertise;
+       int advertise = 0;
 
        switch( c->op ) {
        case SLAP_CONFIG_EMIT:
@@ -2350,10 +2350,37 @@ config_subordinate(ConfigArgs *c)
                break;
        case LDAP_MOD_ADD:
        case SLAP_CONFIG_ADD:
-               advertise = ( c->argc == 2 && !strcasecmp( c->argv[1], "advertise" ));
+               if ( c->be->be_nsuffix == NULL ) {
+                       /* log error */
+                       snprintf( c->cr_msg, sizeof( c->cr_msg),
+                               "subordinate configuration needs a suffix" );
+                       Debug( LDAP_DEBUG_ANY,
+                               "%s: %s.\n",
+                               c->log, c->cr_msg, 0 );
+                       rc = 1;
+                       break;
+               }
+
+               if ( c->argc == 2 ) {
+                       if ( strcasecmp( c->argv[1], "advertise" ) == 0 ) {
+                               advertise = 1;
+
+                       } else if ( strcasecmp( c->argv[1], "TRUE" ) != 0 ) {
+                               /* log error */
+                               snprintf( c->cr_msg, sizeof( c->cr_msg),
+                                       "subordinate must be \"TRUE\" or \"advertise\"" );
+                               Debug( LDAP_DEBUG_ANY,
+                                       "%s: suffix \"%s\": %s.\n",
+                                       c->log, c->be->be_suffix[0].bv_val, c->cr_msg );
+                               rc = 1;
+                               break;
+                       }
+               }
+
                rc = glue_sub_add( c->be, advertise, CONFIG_ONLINE_ADD( c ));
                break;
        }
+
        return rc;
 }