]> git.sur5r.net Git - openldap/commitdiff
Fix slap_known_controls initialization
authorHoward Chu <hyc@openldap.org>
Mon, 29 Nov 2004 08:55:50 +0000 (08:55 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 29 Nov 2004 08:55:50 +0000 (08:55 +0000)
servers/slapd/controls.c

index 9b98a911903660740d94a4f25fa7d9c739b06a10..76e470efe63a388c122593fdc3266596b609ae4b 100644 (file)
@@ -192,7 +192,7 @@ register_supported_control(const char *controloid,
        if ( controloid == NULL ) return LDAP_PARAM_ERROR;
 
        /* sanity check - should never happen */
-       for ( i = 1; slap_known_controls[ i ]; i++ ) {
+       for ( i = 0; slap_known_controls[ i ]; i++ ) {
                if ( strcmp( controloid, slap_known_controls[ i ] ) == 0 ) {
                        Debug( LDAP_DEBUG_ANY,
                                "Control %s already registered.\n",
@@ -221,8 +221,8 @@ register_supported_control(const char *controloid,
        sc->sc_cid = num_known_controls;
 
        /* Update slap_known_controls, too. */
-       slap_known_controls[num_known_controls++] = sc->sc_oid;
-       slap_known_controls[num_known_controls] = NULL;
+       slap_known_controls[num_known_controls-1] = sc->sc_oid;
+       slap_known_controls[num_known_controls++] = NULL;
 
        LDAP_SLIST_NEXT( sc, sc_next ) = NULL;
        LDAP_SLIST_INSERT_HEAD( &controls_list, sc, sc_next );