krb5_try_realm_txt_rr() should allow the resolv library to expand
authorJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 30 Jun 1999 15:12:42 +0000 (15:12 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 30 Jun 1999 15:12:42 +0000 (15:12 +0000)
the local domain or domain searchlist when the query is being
performed without the specification of a hostname or domain.
When 'name' is NULL or "", no '.' should be appended to the query.
Appending a '.' in that circumstance will result in an inability
to resolv the REALM if gethostname() does not return a fully
qualified domain name as on Windows and Solaris.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11536 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/hst_realm.c

index 13b3a7a3e7f00e041285340ae92dd152e5017079..a2c76ade21c70b148a39e6d82a881fa17813e906 100644 (file)
@@ -119,15 +119,21 @@ krb5_try_realm_txt_rr(prefix, name, realm)
         if ( strlen(prefix) + strlen(name) + 3 > MAX_DNS_NAMELEN )
             return KRB5_ERR_HOST_REALM_UNKNOWN;
         sprintf(host,"%s.%s", prefix, name);
-    }
-    /* Realm names don't (normally) end with ".", but if the query
-       doesn't end with "." and doesn't get an answer as is, the
-       resolv code will try appending the local domain.  Since the
-       realm names are absolutes, let's stop that.  */
-    h = host + strlen (host);
-    if (h > host && h[-1] != '.')
-       strcpy (h, ".");
 
+        /* Realm names don't (normally) end with ".", but if the query
+           doesn't end with "." and doesn't get an answer as is, the
+           resolv code will try appending the local domain.  Since the
+           realm names are absolutes, let's stop that.  
+
+           But only if a name has been specified.  If we are performing
+           a search on the prefix alone then the intention is to allow
+           the local domain or domain search lists to be expanded.
+        */
+
+        h = host + strlen (host);
+        if (h > host && h[-1] != '.')
+            strcpy (h, ".");
+    }
     size = res_search(host, C_IN, T_TXT, answer.bytes, sizeof(answer.bytes));
 
     if (size < 0)