From 4ef4c9eb06f10597ad73fd0bd053a0324bd7a909 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 26 Sep 2002 16:12:39 +0000 Subject: [PATCH] Return default referral if DN maps to empty domain. --- servers/slapd/back-dnssrv/referral.c | 6 ++---- servers/slapd/back-dnssrv/search.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) 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", -- 2.39.5