]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/dnssrv.c
Add #include <openssl/safestack.h> to fix ITS#1412
[openldap] / libraries / libldap / dnssrv.c
index 243e16aa68ad0a858b2cfddd898873556d5acb57..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];
@@ -217,7 +219,8 @@ int ldap_domain2hostlist(
     ldap_pvt_thread_mutex_lock(&ldap_int_resolv_mutex);
 #endif
 
-    len = res_search(request, C_IN, T_SRV, reply, sizeof(reply));
+    rc = LDAP_UNAVAILABLE;
+    len = res_query(request, C_IN, T_SRV, reply, sizeof(reply));
     if (len >= 0) {
        unsigned char *p;
        char host[1024];
@@ -299,5 +302,5 @@ int ldap_domain2hostlist(
     return rc;
 #else
     return LDAP_NOT_SUPPORTED;
-#endif                         /* HAVE_RES_SEARCH */
+#endif /* HAVE_RES_QUERY */
 }