]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/schema_init.c
Add BackendInfo.bi_extra for backend custom APIs
[openldap] / servers / slapd / schema_init.c
index 854a49b5c1fd1c8ea086b817b80913e06a7e823a..f1a96bd0815115ba66b3342850ec6981155179f1 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;
@@ -2355,16 +2353,11 @@ numericStringNormalize(
  * Integer conversion macros that will use the largest available
  * type.
  */
-#if defined(HAVE_STRTOLL) && defined(LLONG_MAX) \
-       && defined(LLONG_MIN) && defined(HAVE_LONG_LONG)
+#if defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG)
 # define SLAP_STRTOL(n,e,b)  strtoll(n,e,b) 
-# define SLAP_LONG_MAX       LLONG_MAX
-# define SLAP_LONG_MIN       LLONG_MIN
 # define SLAP_LONG           long long
 #else
 # define SLAP_STRTOL(n,e,b)  strtol(n,e,b)
-# define SLAP_LONG_MAX       LONG_MAX
-# define SLAP_LONG_MIN       LONG_MIN
 # define SLAP_LONG           long
 #endif /* HAVE_STRTOLL ... */
 
@@ -2379,18 +2372,17 @@ integerBitAndMatch(
 {
        SLAP_LONG lValue, lAssertedValue;
 
+       errno = 0;
        /* safe to assume integers are NUL terminated? */
        lValue = SLAP_STRTOL(value->bv_val, NULL, 10);
-       if(( lValue == SLAP_LONG_MIN || lValue == SLAP_LONG_MAX) &&
-               errno == ERANGE )
+       if( errno == ERANGE )
        {
                return LDAP_CONSTRAINT_VIOLATION;
        }
 
        lAssertedValue = SLAP_STRTOL(((struct berval *)assertedValue)->bv_val,
                NULL, 10);
-       if(( lAssertedValue == SLAP_LONG_MIN || lAssertedValue == SLAP_LONG_MAX ) &&
-               errno == ERANGE )
+       if( errno == ERANGE )
        {
                return LDAP_CONSTRAINT_VIOLATION;
        }
@@ -2410,18 +2402,17 @@ integerBitOrMatch(
 {
        SLAP_LONG lValue, lAssertedValue;
 
+       errno = 0;
        /* safe to assume integers are NUL terminated? */
        lValue = SLAP_STRTOL(value->bv_val, NULL, 10);
-       if(( lValue == SLAP_LONG_MIN || lValue == SLAP_LONG_MAX ) &&
-               errno == ERANGE )
+       if( errno == ERANGE )
        {
                return LDAP_CONSTRAINT_VIOLATION;
        }
 
        lAssertedValue = SLAP_STRTOL( ((struct berval *)assertedValue)->bv_val,
                NULL, 10);
-       if(( lAssertedValue == SLAP_LONG_MIN || lAssertedValue == SLAP_LONG_MAX ) &&
-               errno == ERANGE )
+       if( errno == ERANGE )
        {
                return LDAP_CONSTRAINT_VIOLATION;
        }
@@ -4180,11 +4171,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 +4607,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 +4614,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 +4674,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 );
+       }
 }