remember to lower-case host names. bug reported by <amu@mit.edu>

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7846 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-02-02 04:42:57 +00:00
parent c7ffabb148
commit b267a04468

View File

@@ -43,6 +43,7 @@ copy_hostname(krb5_context context,
*new_hostname = strdup (orig_hostname); *new_hostname = strdup (orig_hostname);
if (*new_hostname == NULL) if (*new_hostname == NULL)
return ENOMEM; return ENOMEM;
strlwr (*new_hostname);
return 0; return 0;
} }
@@ -92,6 +93,7 @@ krb5_expand_hostname_realms (krb5_context context,
{ {
struct addrinfo *ai, *a, hints; struct addrinfo *ai, *a, hints;
int error; int error;
krb5_error_code ret = 0;
memset (&hints, 0, sizeof(hints)); memset (&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME; hints.ai_flags = AI_CANONNAME;
@@ -101,17 +103,18 @@ krb5_expand_hostname_realms (krb5_context context,
return copy_hostname (context, orig_hostname, new_hostname); return copy_hostname (context, orig_hostname, new_hostname);
for (a = ai; a != NULL; a = a->ai_next) { for (a = ai; a != NULL; a = a->ai_next) {
if (a->ai_canonname != NULL) { if (a->ai_canonname != NULL) {
krb5_error_code ret = krb5_get_host_realm (context, ret = copy_hostname (context, orig_hostname, new_hostname);
a->ai_canonname, if (ret)
realms); goto out;
strlwr (*new_hostname);
if (ret == 0) { ret = krb5_get_host_realm (context, *new_hostname, realms);
ret = copy_hostname (context, a->ai_canonname, new_hostname); if (ret == 0)
goto out;
free (*new_hostname);
}
}
ret = copy_hostname (context, orig_hostname, new_hostname);
out:
freeaddrinfo (ai); freeaddrinfo (ai);
return ret; return ret;
} }
}
}
freeaddrinfo (ai);
return copy_hostname (context, orig_hostname, new_hostname);
}