]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/schema_init.c
Use recursive mutex to avoid deadlocks
[openldap] / servers / slapd / schema_init.c
index 52cb7f8550e5a78cc7f3209bbffb464cdeac1896..fe237767a4ec85d2adb273a7b599d26ca296eafa 100644 (file)
 #define csnIndexer                             generalizedTimeIndexer
 #define csnFilter                              generalizedTimeFilter
 
-#ifdef SLAP_AUTHZ_SYNTAX
 /* FIXME: temporary */
 #define authzMatch                             octetStringMatch
-#endif /* SLAP_AUTHZ_SYNTAX */
 
 unsigned int index_substr_if_minlen = SLAP_INDEX_SUBSTR_IF_MINLEN_DEFAULT;
 unsigned int index_substr_if_maxlen = SLAP_INDEX_SUBSTR_IF_MAXLEN_DEFAULT;
@@ -1010,7 +1008,7 @@ uniqueMemberNormalize(
        struct berval out;
        int rc;
 
-       assert( SLAP_MR_IS_VALUE_OF_SYNTAX( usage ));
+       assert( SLAP_MR_IS_VALUE_OF_SYNTAX( usage ) != 0 );
 
        ber_dupbv_x( &out, val, ctx );
        if ( BER_BVISEMPTY( &out ) ) {
@@ -1423,7 +1421,7 @@ UTF8StringNormalize(
        int flags;
        int i, wasspace;
 
-       assert( SLAP_MR_IS_VALUE_OF_SYNTAX( use ));
+       assert( SLAP_MR_IS_VALUE_OF_SYNTAX( use ) != 0 );
 
        if( BER_BVISNULL( val ) ) {
                /* assume we're dealing with a syntax (e.g., UTF8String)
@@ -1854,7 +1852,7 @@ telephoneNumberNormalize(
 {
        char *p, *q;
 
-       assert( SLAP_MR_IS_VALUE_OF_SYNTAX( usage ));
+       assert( SLAP_MR_IS_VALUE_OF_SYNTAX( usage ) != 0 );
 
        /* validator should have refused an empty string */
        assert( !BER_BVISEMPTY( val ) );
@@ -2106,7 +2104,7 @@ IA5StringNormalize(
 
        assert( !BER_BVISEMPTY( val ) );
 
-       assert( SLAP_MR_IS_VALUE_OF_SYNTAX( use ));
+       assert( SLAP_MR_IS_VALUE_OF_SYNTAX( use ) != 0 );
 
        p = val->bv_val;
 
@@ -3275,7 +3273,7 @@ certificateExactNormalize(
                return serialNumberAndIssuerNormalize(0,NULL,NULL,val,normalized,ctx);
        }
 
-       assert( SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX(usage) );
+       assert( SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX(usage) != 0 );
 
        p = (unsigned char *)val->bv_val;
        xcert = d2i_X509( NULL, &p, val->bv_len);
@@ -4180,11 +4178,9 @@ static slap_syntax_defs_rec syntax_defs[] = {
        {"( 1.3.6.1.4.1.4203.1.1.1 DESC 'OpenLDAP void' )" ,
                SLAP_SYNTAX_HIDE, inValidate, NULL},
 
-#ifdef SLAP_AUTHZ_SYNTAX
        /* FIXME: OID is unused, but not registered yet */
        {"( 1.3.6.1.4.1.4203.666.2.7 DESC 'OpenLDAP authz' )",
                SLAP_SYNTAX_HIDE, authzValidate, authzPretty},
-#endif /* SLAP_AUTHZ_SYNTAX */
 
        {NULL, 0, NULL, NULL}
 };
@@ -4618,7 +4614,6 @@ static slap_mrule_defs_rec mrule_defs[] = {
                NULL, NULL,
                "CSNMatch" },
 
-#ifdef SLAP_AUTHZ_SYNTAX
        /* FIXME: OID is unused, but not registered yet */
        {"( 1.3.6.1.4.1.4203.666.4.12 NAME 'authzMatch' "
                "SYNTAX 1.3.6.1.4.1.4203.666.2.7 )",
@@ -4626,7 +4621,6 @@ static slap_mrule_defs_rec mrule_defs[] = {
                NULL, authzNormalize, authzMatch,
                NULL, NULL,
                NULL},
-#endif /* SLAP_AUTHZ_SYNTAX */
 
        {NULL, SLAP_MR_NONE, NULL,
                NULL, NULL, NULL, NULL, NULL,
@@ -4687,6 +4681,8 @@ schema_destroy( void )
        mru_destroy();
        syn_destroy();
 
-       ldap_pvt_thread_mutex_destroy( &ad_undef_mutex );
-       ldap_pvt_thread_mutex_destroy( &oc_undef_mutex );
+       if( schema_init_done ) {
+               ldap_pvt_thread_mutex_destroy( &ad_undef_mutex );
+               ldap_pvt_thread_mutex_destroy( &oc_undef_mutex );
+       }
 }