]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/dnssrv.c
Sync with 2.x
[openldap] / libraries / libldap / dnssrv.c
index 94875c00ed3a69cd8c1af53a650284778d165727..f67cdbbe9df29905de1a18a7b9f948784d193250 100644 (file)
@@ -109,10 +109,13 @@ int ldap_dn2domain(
                                        return -5;
                                }
 
-                               if( domain == NULL ) ndomain[0] = '\0';
+                               if( domain == NULL ) {
+                                       ndomain[0] = '\0';
+                               } else {
+                                       strcat( ndomain, "." );
+                               }
 
                                strcat( ndomain, dc );
-                               strcat( ndomain, "." );
 
                                domain = ndomain;
                                continue;
@@ -191,9 +194,8 @@ int ldap_domain2hostlist(
        LDAP_CONST char *domain,
        char **list )
 {
-#ifdef HAVE_RES_SEARCH
+#ifdef HAVE_RES_QUERY
     char *request;
-    char *dn;
     char *hostlist = NULL;
     int rc, len, cur = 0;
     unsigned char reply[1024];
@@ -218,7 +220,7 @@ int ldap_domain2hostlist(
 #endif
 
     rc = LDAP_UNAVAILABLE;
-    len = res_search(request, C_IN, T_SRV, reply, sizeof(reply));
+    len = res_query(request, C_IN, T_SRV, reply, sizeof(reply));
     if (len >= 0) {
        unsigned char *p;
        char host[1024];
@@ -300,5 +302,5 @@ int ldap_domain2hostlist(
     return rc;
 #else
     return LDAP_NOT_SUPPORTED;
-#endif                         /* HAVE_RES_SEARCH */
+#endif /* HAVE_RES_QUERY */
 }