From: Kurt Zeilenga Date: Fri, 26 May 2000 18:05:27 +0000 (+0000) Subject: Fix DNSSRV initialization bug X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2851 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1bc5314d620f79a27d9b15d6e5ba2e1e51a3bd9a;p=openldap Fix DNSSRV initialization bug --- diff --git a/libraries/libldap/dnssrv.c b/libraries/libldap/dnssrv.c index a7a6f932ad..243e16aa68 100644 --- a/libraries/libldap/dnssrv.c +++ b/libraries/libldap/dnssrv.c @@ -61,12 +61,15 @@ int ldap_dn2domain( return -3; } -#define LDAP_DC "dc=" -#define LDAP_DCOID "0.9.2342.19200300.100.1.25=" if( rdn[1] == NULL ) { + /* + * single-valued RDN + */ char *dc; - /* single RDN */ + +#define LDAP_DC "dc=" +#define LDAP_DCOID "0.9.2342.19200300.100.1.25=" if( strncasecmp( rdn[0], LDAP_DC, sizeof(LDAP_DC)-1 ) == 0 ) @@ -106,6 +109,8 @@ int ldap_dn2domain( return -5; } + if( domain == NULL ) ndomain[0] = '\0'; + strcat( ndomain, dc ); strcat( ndomain, "." ); @@ -114,11 +119,20 @@ int ldap_dn2domain( } } + /* + * multi-valued RDN or fall thru + */ + LDAP_VFREE( rdn ); LDAP_FREE( domain ); domain = NULL; } + if( domain != NULL && *domain == '\0' ) { + LDAP_FREE( domain ); + domain = NULL; + } + *domainp = domain; return 0; } diff --git a/servers/slapd/back-dnssrv/request.c b/servers/slapd/back-dnssrv/request.c index 005c6c33a2..1c224cfca4 100644 --- a/servers/slapd/back-dnssrv/request.c +++ b/servers/slapd/back-dnssrv/request.c @@ -40,7 +40,7 @@ dnssrv_back_request( dn == NULL ? "" : dn, domain == NULL ? "" : domain, 0 ); - + if( rc = ldap_domain2hostlist( domain, &hostlist ) ) { Debug( LDAP_DEBUG_TRACE, "DNSSRV: domain2hostlist returned %d\n", rc, 0, 0 );