From 8a60b820c9e8a01924029050f4ae9b1408ceaaa2 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 30 Jun 1999 15:12:42 +0000 Subject: [PATCH] krb5_try_realm_txt_rr() should allow the resolv library to expand 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 | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/lib/krb5/os/hst_realm.c b/src/lib/krb5/os/hst_realm.c index 13b3a7a3e..a2c76ade2 100644 --- a/src/lib/krb5/os/hst_realm.c +++ b/src/lib/krb5/os/hst_realm.c @@ -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) -- 2.26.2