summaryrefslogtreecommitdiff
path: root/kerberosIV/krb/getrealm.c
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-10-14 02:27:15 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-10-14 02:27:15 +0000
commit6b452ba479b123d389c56fbd5e31f3234e3a6e69 (patch)
tree6d401ed6851462514f108ade7858c5cfdbc34b4b /kerberosIV/krb/getrealm.c
parent2e94d6d27a567a3b60bc75b363068827868e9779 (diff)
Don't default a realm name to the domain part of a host name
Diffstat (limited to 'kerberosIV/krb/getrealm.c')
-rw-r--r--kerberosIV/krb/getrealm.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/kerberosIV/krb/getrealm.c b/kerberosIV/krb/getrealm.c
index ebd6ad164bc..10a3b20610c 100644
--- a/kerberosIV/krb/getrealm.c
+++ b/kerberosIV/krb/getrealm.c
@@ -75,14 +75,7 @@ krb_realmofhost(host)
/* prepare default */
if (domain) {
- char *cp;
-
- strncpy(ret_realm, &domain[1], REALM_SZ);
- ret_realm[REALM_SZ] = '\0';
- /* Upper-case realm */
- for (cp = ret_realm; *cp; cp++)
- if (islower(*cp))
- *cp = toupper(*cp);
+ ret_realm[0] = '\0';
} else {
krb_get_lrealm(ret_realm, 1);
}
@@ -94,14 +87,14 @@ krb_realmofhost(host)
strncat(tbuf, "/krb.realms", sizeof(tbuf));
tbuf[sizeof(tbuf)-1] = 0;
if ((trans_file = fopen(tbuf,"r")) == NULL)
- return(ret_realm); /* krb_errno = KRB_NO_TRANS */
+ return(ret_realm[0] ? ret_realm : NULL); /* krb_errno = KRB_NO_TRANS */
}
while (1) {
if ((retval = fscanf(trans_file, "%s %s",
trans_host, trans_realm)) != 2) {
if (retval == EOF) {
fclose(trans_file);
- return(ret_realm);
+ return(ret_realm[0] ? ret_realm : NULL);
}
continue; /* ignore broken lines */
}
@@ -111,7 +104,7 @@ krb_realmofhost(host)
/* exact match of hostname, so return the realm */
(void) strcpy(ret_realm, trans_realm);
fclose(trans_file);
- return(ret_realm);
+ return(ret_realm[0] ? ret_realm : NULL);
}
if ((trans_host[0] == '.') && domain) {
#if MATCH_SUBDOMAINS