From: Kurt Zeilenga Date: Thu, 26 Sep 2002 16:12:39 +0000 (+0000) Subject: Return default referral if DN maps to empty domain. X-Git-Tag: NO_SLAP_OP_BLOCKS~939 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4ef4c9eb06f10597ad73fd0bd053a0324bd7a909;p=openldap Return default referral if DN maps to empty domain. --- diff --git a/servers/slapd/back-dnssrv/referral.c b/servers/slapd/back-dnssrv/referral.c index 4bd8fbe037..9aaf23c79c 100644 --- a/servers/slapd/back-dnssrv/referral.c +++ b/servers/slapd/back-dnssrv/referral.c @@ -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, diff --git a/servers/slapd/back-dnssrv/search.c b/servers/slapd/back-dnssrv/search.c index 1af13a27e4..2a831bb8f9 100644 --- a/servers/slapd/back-dnssrv/search.c +++ b/servers/slapd/back-dnssrv/search.c @@ -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",