]> git.sur5r.net Git - openldap/commitdiff
check the value of the olcSubordinate attribute
authorPierangelo Masarati <ando@openldap.org>
Thu, 16 Jul 2009 15:41:05 +0000 (15:41 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 16 Jul 2009 15:41:05 +0000 (15:41 +0000)
servers/slapd/bconfig.c

index 57b8438223f8a86afaa2edbf3e86d26c9b77bbd2..b10713ab6c9bffc6f3a8099f62c13936ebadf8b9 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:
@@ -2360,10 +2360,27 @@ config_subordinate(ConfigArgs *c)
                        rc = 1;
                        break;
                }
-               advertise = ( c->argc == 2 && !strcasecmp( c->argv[1], "advertise" ));
+
+               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;
 }