]> git.sur5r.net Git - openldap/commitdiff
new call unregister_supported_control(), will be
authorRalf Haferkamp <ralf@openldap.org>
Wed, 30 Jun 2010 12:38:01 +0000 (12:38 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 7 Nov 2011 20:34:08 +0000 (12:34 -0800)
needed for cn=config delete support

servers/slapd/controls.c
servers/slapd/proto-slap.h

index 96df34ef2ac402d594391c05e47957ac195efb4e..3c73debd2924ec95c8d110d7e531d226b4f122a6 100644 (file)
@@ -344,6 +344,38 @@ register_supported_control2(const char *controloid,
        return LDAP_SUCCESS;
 }
 
+#ifdef SLAP_CONFIG_DELETE
+int
+unregister_supported_control( const char *controloid )
+{
+       struct slap_control *sc;
+       int i;
+
+       if ( controloid == NULL || (sc = find_ctrl( controloid )) == NULL ){
+               return -1;
+       }
+
+       for ( i = 0; slap_known_controls[ i ]; i++ ) {
+               if ( strcmp( controloid, slap_known_controls[ i ] ) == 0 ) {
+                       while ( slap_known_controls[i] ) {
+                               slap_known_controls[i++] = slap_known_controls[i];
+                       }
+                       num_known_controls--;
+                       break;
+               }
+       }
+
+       LDAP_SLIST_REMOVE(&controls_list, sc, slap_control, sc_next);
+       ch_free( sc->sc_oid );
+       if ( sc->sc_extendedopsbv != NULL ) {
+               ber_bvarray_free( sc->sc_extendedopsbv );
+       }
+       ch_free( sc );
+
+       return 0;
+}
+#endif /* SLAP_CONFIG_DELETE */
+
 /*
  * One-time initialization of internal controls.
  */
index 2cf926b723df309850a9fdcf6a104894cbfdd0ef..99a3b947dfa4b36bdab34cba1ab323dc34caf65a 100644 (file)
@@ -660,6 +660,10 @@ LDAP_SLAPD_F (int) register_supported_control2 LDAP_P((
        int *controlcid ));
 #define register_supported_control(oid, mask, exops, fn, cid) \
        register_supported_control2((oid), (mask), (exops), (fn), 0, (cid))
+#ifdef SLAP_CONFIG_DELETE
+LDAP_SLAPD_F (int) unregister_supported_control LDAP_P((
+       const char* controloid ));
+#endif /* SLAP_CONFIG_DELETE */
 LDAP_SLAPD_F (int) slap_controls_init LDAP_P ((void));
 LDAP_SLAPD_F (void) controls_destroy LDAP_P ((void));
 LDAP_SLAPD_F (int) controls_root_dse_info LDAP_P ((Entry *e));