]> git.sur5r.net Git - openldap/commitdiff
DNS SRV default referral handling
authorKurt Zeilenga <kurt@openldap.org>
Sun, 29 Sep 2002 20:21:28 +0000 (20:21 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 29 Sep 2002 20:21:28 +0000 (20:21 +0000)
Sync with HEAD

20 files changed:
CHANGES
servers/slapd/add.c
servers/slapd/at.c
servers/slapd/back-dnssrv/referral.c
servers/slapd/back-dnssrv/search.c
servers/slapd/backend.c
servers/slapd/compare.c
servers/slapd/config.c
servers/slapd/delete.c
servers/slapd/modify.c
servers/slapd/modrdn.c
servers/slapd/mr.c
servers/slapd/oc.c
servers/slapd/operational.c
servers/slapd/proto-slap.h
servers/slapd/schema.c
servers/slapd/search.c
servers/slapd/slap.h
servers/slapd/syntax.c
tests/README

diff --git a/CHANGES b/CHANGES
index acd209630b0ff28035803cfe9acada030405d90e..7fb6b76196b3acd6cfb855085a07d279337445e9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,7 @@ OpenLDAP 2.1 Change Log
 OpenLDAP 2.1.6 Engineering
        Fixed slapd unsupported non-critical control handling
        Fixed slapd value_find() uninitialized variable bug (ITS#2097)
+       Fixed back-dnssrv default referral handling
        Updated libldap_r Pth support (ITS#724) (ITS#1033)
        Updated slapd adlist support
        Build Environment
index a90787227341feee6ddaaebe95b781a5d93d9d9f..85e6f7ca50012614f79f411d4612bcf235fa5baa 100644 (file)
@@ -188,13 +188,11 @@ do_add( Connection *conn, Operation *op )
                        NULL, NULL );
                goto done;
 
-#if defined( SLAPD_SCHEMA_DN )
        } else if ( bvmatch( &e->e_nname, &global_schemandn ) ) {
                send_ldap_result( conn, op, rc = LDAP_ALREADY_EXISTS,
                        NULL, "subschema subentry already exists",
                        NULL, NULL );
                goto done;
-#endif
        }
 
        manageDSAit = get_manageDSAit( op );
index bec3acc7be99bd23a11cf1dfba6248f82fd8555a..6542c81fa5368c426b2bbed68567fb5666341610 100644 (file)
@@ -583,7 +583,6 @@ at_index_print( void )
 }
 #endif
 
-#if defined( SLAPD_SCHEMA_DN )
 int
 at_schema_info( Entry *e )
 {
@@ -601,13 +600,8 @@ at_schema_info( Entry *e )
 
                if( at->sat_flags & SLAP_AT_HIDE ) continue;
 
-#if 0
-               Debug( LDAP_DEBUG_TRACE, "Merging at [%ld] %s\n",
-                      (long) vals[0].bv_len, vals[0].bv_val, 0 );
-#endif
                attr_merge( e, ad_attributeTypes, vals );
                ldap_memfree( vals[0].bv_val );
        }
        return 0;
 }
-#endif
index 4bd8fbe037827c2e57655f2fa87d86d335c9e1f6..9aaf23c79c84509c3fa8d649e7e85b27c6b7d285 100644 (file)
@@ -45,16 +45,14 @@ dnssrv_back_referrals(
                return LDAP_OTHER;
        } 
 
-       if( ldap_dn2domain( dn->bv_val, &domain ) ) {
+       if( ldap_dn2domain( dn->bv_val, &domain ) || domain == NULL ) {
                send_ldap_result( conn, op, LDAP_REFERRAL,
                        NULL, NULL, default_referral, NULL );
                return LDAP_REFERRAL;
        }
 
        Debug( LDAP_DEBUG_TRACE, "DNSSRV: dn=\"%s\" -> domain=\"%s\"\n",
-               dn->bv_val,
-               domain == NULL ? "" : domain,
-               0 );
+               dn->bv_val, domain, 0 );
 
        if( ( rc = ldap_domain2hostlist( domain, &hostlist ) ) ) {
                Debug( LDAP_DEBUG_TRACE,
index 1af13a27e4f4c73fd22427c432a779bd1d282dcd..2a831bb8f9d1bdcf883876b32fa9950315c74b40 100644 (file)
@@ -44,16 +44,14 @@ dnssrv_back_search(
 
        assert( get_manageDSAit( op ) );
 
-       if( ldap_dn2domain( dn->bv_val, &domain ) ) {
+       if( ldap_dn2domain( dn->bv_val, &domain ) || domain == NULL ) {
                send_ldap_result( conn, op, LDAP_REFERRAL,
                        NULL, NULL, default_referral, NULL );
                goto done;
        }
 
        Debug( LDAP_DEBUG_TRACE, "DNSSRV: dn=\"%s\" -> domain=\"%s\"\n",
-               dn->bv_len ? dn->bv_val : "",
-               domain == NULL ? "" : domain,
-               0 );
+               dn->bv_len ? dn->bv_val : "", domain, 0 );
 
        if( ( rc = ldap_domain2hostlist( domain, &hostlist ) ) ) {
                Debug( LDAP_DEBUG_TRACE, "DNSSRV: domain2hostlist returned %d\n",
index b5405dd3513fa8abc60b74372d3563ff58765a2b..23ee665e881f34244c5854335b228144da9c466a 100644 (file)
@@ -1104,13 +1104,12 @@ Attribute *backend_operational(
         * and the backend supports specific operational attributes, 
         * add them to the attribute list
         */
-#ifdef SLAPD_SCHEMA_DN
        if ( opattrs || ( attrs &&
                ad_inlist( slap_schema.si_ad_subschemaSubentry, attrs )) ) {
                *ap = slap_operational_subschemaSubentry( be );
                ap = &(*ap)->a_next;
        }
-#endif
+
        if ( ( opattrs || attrs ) && be && be->be_operational != NULL ) {
                ( void )be->be_operational( be, conn, op, e, attrs, opattrs, ap );
        }
index 61a8f6882ef9fd19253ab4aef568e2ccd6cd3552..7934821fd4f6e1c4f091df50c388950dce0e44a5 100644 (file)
@@ -169,7 +169,6 @@ do_compare(
                        goto cleanup;
                }
 
-#ifdef SLAPD_SCHEMA_DN
        } else if ( bvmatch( &ndn, &global_schemandn ) ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ARGS, 
@@ -199,7 +198,6 @@ do_compare(
                        rc = 0;
                        goto cleanup;
                }
-#endif /* SLAPD_SCHEMA_DN */
        }
 
        if( entry ) {
index 14b092b19cae6d1f6be1e1c3fe84cc7bcc29b808..5a58e83baf97f648fe75967ffc9ce6c62d9bc585 100644 (file)
@@ -52,10 +52,8 @@ char **cargv;
 struct berval default_search_base = { 0, NULL };
 struct berval default_search_nbase = { 0, NULL };
 unsigned               num_subordinates = 0;
-#ifdef SLAPD_SCHEMA_DN
 struct berval global_schemadn = { 0, NULL };
 struct berval global_schemandn = { 0, NULL };
-#endif
 
 ber_len_t sockbuf_max_incoming = SLAP_SB_MAX_INCOMING_DEFAULT;
 ber_len_t sockbuf_max_incoming_auth= SLAP_SB_MAX_INCOMING_AUTH;
@@ -568,7 +566,6 @@ read_config( const char *fname, int depth )
                                return 1;
 #endif /* HAVE_CYRUS_SASL */
 
-#ifdef SLAPD_SCHEMA_DN
                } else if ( strcasecmp( cargv[0], "schemadn" ) == 0 ) {
                        struct berval dn;
                        if ( cargc < 2 ) {
@@ -603,7 +600,7 @@ read_config( const char *fname, int depth )
 #endif
                                return 1;
                        }
-#endif /* SLAPD_SCHEMA_DN */
+
                /* set UCDATA path */
                } else if ( strcasecmp( cargv[0], "ucdata-path" ) == 0 ) {
                        int err;
@@ -2301,13 +2298,11 @@ read_config( const char *fname, int depth )
 
        if ( depth == 0 ) ch_free( cargv );
 
-#ifdef SLAPD_SCHEMA_DN
        if ( !global_schemadn.bv_val ) {
                ber_str2bv( SLAPD_SCHEMA_DN, sizeof(SLAPD_SCHEMA_DN)-1, 1,
                        &global_schemadn );
                dnNormalize2( NULL, &global_schemadn, &global_schemandn );
        }
-#endif
 
        if ( load_ucdata( NULL ) < 0 ) return 1;
        return( 0 );
@@ -2528,10 +2523,8 @@ void
 config_destroy( )
 {
        ucdata_unload( UCDATA_ALL );
-#ifdef SLAPD_SCHEMA_DN
        free( global_schemandn.bv_val );
        free( global_schemadn.bv_val );
-#endif
        free( line );
        if ( slapd_args_file )
                free ( slapd_args_file );
index 057206c269f8c9d425325a7b97026ef5ff65c868..97f073e1b9c4e0aceec34ba0283252949f192a22 100644 (file)
@@ -102,8 +102,6 @@ do_delete(
                        NULL, "cannot delete the root DSE", NULL, NULL );
                goto cleanup;
 
-#ifdef SLAPD_SCHEMA_DN
-
        } else if ( bvmatch( &ndn, &global_schemandn ) ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, INFO, "do_delete: conn %d: "
@@ -115,8 +113,6 @@ do_delete(
                send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
                        NULL, "cannot delete the root DSE", NULL, NULL );
                goto cleanup;
-
-#endif
        }
 
        Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu DEL dn=\"%s\"\n",
index 799aefee9380e3ba8ae87974447aa90a4df82e0b..0f0c716375f167e6de35b1ba47d6d786746912de 100644 (file)
@@ -204,7 +204,6 @@ do_modify(
                        NULL, "modify upon the root DSE not supported", NULL, NULL );
                goto cleanup;
 
-#if defined( SLAPD_SCHEMA_DN )
        } else if ( bvmatch( &ndn, &global_schemandn ) ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ERR,
@@ -217,7 +216,6 @@ do_modify(
                        NULL, "modification of subschema subentry not supported",
                        NULL, NULL );
                goto cleanup;
-#endif
        }
 
 #ifdef LDAP_DEBUG
index 7c8b4390bfeb8436ac01a9230dfd42e8343cc4aa..372f0a33e8a15b19a581a1486cd52731edbd1ba4 100644 (file)
@@ -201,7 +201,6 @@ do_modrdn(
                        NULL, "cannot rename the root DSE", NULL, NULL );
                goto cleanup;
 
-#ifdef SLAPD_SCHEMA_DN
        } else if ( bvmatch( &ndn, &global_schemandn ) ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ERR,
@@ -215,7 +214,6 @@ do_modrdn(
                send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
                        NULL, "cannot rename subschema subentry", NULL, NULL );
                goto cleanup;
-#endif
        }
 
        /* FIXME: should have/use rdnPretty / rdnNormalize routines */
index 701c646c18d8962a1013638d9c89f5aa37fb8b48..069b72b370f685df24595810b1df211e6440d566 100644 (file)
@@ -447,8 +447,6 @@ int mr_usable_with_at(
        return 0;
 }
 
-#if defined( SLAPD_SCHEMA_DN )
-
 int mr_schema_info( Entry *e )
 {
        MatchingRule    *mr;
@@ -506,5 +504,3 @@ int mru_schema_info( Entry *e )
        }
        return 0;
 }
-
-#endif
index 1920762bc9c5c89420be899cc07bc5e496dafcce..16a64ebf514af8e002b31686b97608263676b61f 100644 (file)
@@ -466,7 +466,6 @@ oc_add(
 }
 
 #ifdef LDAP_DEBUG
-
 static void
 oc_print( ObjectClass *oc )
 {
@@ -489,12 +488,8 @@ oc_print( ObjectClass *oc )
                printf( "\n" );
        }
 }
-
 #endif
 
-
-#if defined( SLAPD_SCHEMA_DN )
-
 int
 oc_schema_info( Entry *e )
 {
@@ -521,5 +516,3 @@ oc_schema_info( Entry *e )
        }
        return 0;
 }
-
-#endif
index f6b45221f8e889bb4aaf1df6469752877122b818..3eca598b574101df9131aa395b7db14d3d1fdbf8 100644 (file)
@@ -12,7 +12,6 @@
  * helpers for on-the-fly operational attribute generation
  */
 
-#ifdef SLAPD_SCHEMA_DN
 Attribute *
 slap_operational_subschemaSubentry( Backend *be )
 {
@@ -34,7 +33,6 @@ slap_operational_subschemaSubentry( Backend *be )
 
        return a;
 }
-#endif /* SLAPD_SCHEMA_DN */
 
 Attribute *
 slap_operational_hasSubordinate( int hs )
index c77416108bd7f5d173d4645362d723b34e2e4423..74f2b2655b452d6d5ca8668efd75d69b4f49fb42 100644 (file)
@@ -1073,10 +1073,8 @@ LDAP_SLAPD_V (int)               ldap_syslog;
 LDAP_SLAPD_V (struct berval)   default_search_base;
 LDAP_SLAPD_V (struct berval)   default_search_nbase;
 
-#ifdef SLAPD_SCHEMA_DN
 LDAP_SLAPD_V (struct berval)   global_schemadn;
 LDAP_SLAPD_V (struct berval)   global_schemandn;
-#endif
 
 LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) num_sent_mutex;
 LDAP_SLAPD_V (unsigned long)           num_bytes_sent;
index 452a679ff26f85f8abb2a7f25363720898470ab4..bc218fcca8dc71afa47c3549d8fa4a6fba9607d7 100644 (file)
@@ -18,8 +18,6 @@
 #include "lutil.h"
 
 
-#if defined( SLAPD_SCHEMA_DN )
-
 int
 schema_info( Entry **entry, const char **text )
 {
@@ -128,4 +126,3 @@ schema_info( Entry **entry, const char **text )
        *entry = e;
        return LDAP_SUCCESS;
 }
-#endif
index fada8cb8cdec9f3bebfc1fe3831aade9efb4693a..9b4492ea115b3f289e663e57adfe15b7caf12588 100644 (file)
@@ -234,10 +234,8 @@ do_search(
                        }
 
                        rc = root_dse_info( conn, &entry, &text );
-               }
 
-#if defined( SLAPD_SCHEMA_DN )
-               else if ( bvmatch( &nbase, &global_schemandn ) ) {
+               } else if ( bvmatch( &nbase, &global_schemandn ) ) {
                        /* check restrictions */
                        rc = backend_check_restrictions( NULL, conn, op, NULL, &text ) ;
                        if( rc != LDAP_SUCCESS ) {
@@ -248,7 +246,6 @@ do_search(
 
                        rc = schema_info( &entry, &text );
                }
-#endif
 
                if( rc != LDAP_SUCCESS ) {
                        send_ldap_result( conn, op, rc,
index e57053f94e59357e1d3a62b80e86ae43f4f34b3a..fc3eb5e8cf6c95b30f4a39e5f6379f0c986d73d1 100644 (file)
@@ -248,6 +248,7 @@ typedef union slap_sockaddr {
        struct sockaddr sa_addr;
        struct sockaddr_in sa_in_addr;
 #ifdef LDAP_PF_INET6
+       struct sockaddr_storage sa_storage;
        struct sockaddr_in6 sa_in6_addr;
 #endif
 #ifdef LDAP_PF_LOCAL
@@ -1268,10 +1269,8 @@ struct slap_backend_db {
        BerVarray       be_suffix;      /* the DN suffixes of data in this backend */
        BerVarray       be_nsuffix;     /* the normalized DN suffixes in this backend */
        BerVarray       be_suffixAlias; /* pairs of DN suffix aliases and deref values */
-#ifdef SLAPD_SCHEMA_DN
        struct berval be_schemadn;      /* per-backend subschema subentry DN */
        struct berval be_schemandn;     /* normalized subschema DN */
-#endif
        struct berval be_rootdn;        /* the magic "root" name (DN) for this db */
        struct berval be_rootndn;       /* the magic "root" normalized name (DN) for this db */
        struct berval be_rootpw;        /* the magic "root" password for this db        */
index 994761b92c606790f2d50d76d2b0880f63fe8a0e..2c1bc91f6d07ac334e206f21ead440c29ac557da 100644 (file)
@@ -188,8 +188,6 @@ register_syntax(
        return( 0 );
 }
 
-#if defined( SLAPD_SCHEMA_DN )
-
 int
 syn_schema_info( Entry *e )
 {
@@ -230,4 +228,3 @@ syn_schema_info( Entry *e )
        return 0;
 }
 
-#endif
index 1e4633b675cd68b0d8484f7efe34d534029f2482..e10fb9107d65da6bc22b311097916f19fa0d2bd0 100644 (file)
@@ -1,3 +1,19 @@
 This directory contains a series of test scripts which are used to
 verify basic functionality of the LDAP libraries, slapd, and slurpd.
-To run the tests, type "make" in the ./tests directory.
+
+       To run all of the tests, type "make test".
+       To run BDB tests, type "make bdb".
+       To run LDBM tests, type "make ldbm".
+
+The test scripts depends on a number of tools commonly available on
+Unix (and Unix-like) systems.  While attempts have been made to make
+these scripts reasonable portable, they may not run properly on your
+system.  You may have to adjust your path so that compatible versions
+of tools used are available to the scripts and/or you may have to
+install replacement tools.  Platform specific hints may be found at:
+       http://www.openldap.org/faq/index.cgi?file=9
+
+To modify the debug level the tests run slapd with, set the SLAPD_DEBUG
+environment variable.
+       env SLAPD_DEBUG=1 make test
+