]> git.sur5r.net Git - openldap/commitdiff
Fix DNSSRV initialization bug
authorKurt Zeilenga <kurt@openldap.org>
Fri, 26 May 2000 18:05:27 +0000 (18:05 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 26 May 2000 18:05:27 +0000 (18:05 +0000)
libraries/libldap/dnssrv.c
servers/slapd/back-dnssrv/request.c

index a7a6f932ad626b7ca1f5f4c7389d9b91206572a5..243e16aa68ad0a858b2cfddd898873556d5acb57 100644 (file)
@@ -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;
 }
index 005c6c33a21386de20942a66b692aa17222434b8..1c224cfca4c8d24e9afdef58c0bae21350ecf4da 100644 (file)
@@ -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 );