]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/dnssrv.c
fix non-printable flag detection; improve dn test (passes all but last in http:/...
[openldap] / libraries / libldap / dnssrv.c
index 94875c00ed3a69cd8c1af53a650284778d165727..2ae700d4183f26dd41a8975b7c4b2fd57d07caff 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT 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 */
 }