Return default referral if DN maps to empty domain.

This commit is contained in:
Kurt Zeilenga 2002-09-26 16:12:39 +00:00
parent b4e1ea15f3
commit 4ef4c9eb06
2 changed files with 4 additions and 8 deletions

View File

@ -45,16 +45,14 @@ dnssrv_back_referrals(
return LDAP_OTHER; 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, send_ldap_result( conn, op, LDAP_REFERRAL,
NULL, NULL, default_referral, NULL ); NULL, NULL, default_referral, NULL );
return LDAP_REFERRAL; return LDAP_REFERRAL;
} }
Debug( LDAP_DEBUG_TRACE, "DNSSRV: dn=\"%s\" -> domain=\"%s\"\n", Debug( LDAP_DEBUG_TRACE, "DNSSRV: dn=\"%s\" -> domain=\"%s\"\n",
dn->bv_val, dn->bv_val, domain, 0 );
domain == NULL ? "" : domain,
0 );
if( ( rc = ldap_domain2hostlist( domain, &hostlist ) ) ) { if( ( rc = ldap_domain2hostlist( domain, &hostlist ) ) ) {
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,

View File

@ -44,16 +44,14 @@ dnssrv_back_search(
assert( get_manageDSAit( op ) ); 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, send_ldap_result( conn, op, LDAP_REFERRAL,
NULL, NULL, default_referral, NULL ); NULL, NULL, default_referral, NULL );
goto done; goto done;
} }
Debug( LDAP_DEBUG_TRACE, "DNSSRV: dn=\"%s\" -> domain=\"%s\"\n", Debug( LDAP_DEBUG_TRACE, "DNSSRV: dn=\"%s\" -> domain=\"%s\"\n",
dn->bv_len ? dn->bv_val : "", dn->bv_len ? dn->bv_val : "", domain, 0 );
domain == NULL ? "" : domain,
0 );
if( ( rc = ldap_domain2hostlist( domain, &hostlist ) ) ) { if( ( rc = ldap_domain2hostlist( domain, &hostlist ) ) ) {
Debug( LDAP_DEBUG_TRACE, "DNSSRV: domain2hostlist returned %d\n", Debug( LDAP_DEBUG_TRACE, "DNSSRV: domain2hostlist returned %d\n",