krb5 commit: Don't canonicalize hostname in sim_client.c
Tom Yu
tlyu at mit.edu
Thu Jan 7 08:29:46 EST 2016
https://github.com/krb5/krb5/commit/0491c778064e80aaf2aaeb4475a0db333542fed9
commit 0491c778064e80aaf2aaeb4475a0db333542fed9
Author: Tom Yu <tlyu at mit.edu>
Date: Wed Dec 30 17:17:02 2015 -0500
Don't canonicalize hostname in sim_client.c
krb5_mk_req() already canonicalizes the target hostname, so don't try
to use a buffer of size MAXHOSTNAMELEN to canonicalize the hostname
beforehand. This buffer will be too short for some unusually long
FQDNs.
ticket: 8336 (new)
subject: MAXHOSTNAMELEN is too short for some FQDNs
src/appl/simple/client/sim_client.c | 10 +---------
1 files changed, 1 insertions(+), 9 deletions(-)
diff --git a/src/appl/simple/client/sim_client.c b/src/appl/simple/client/sim_client.c
index aaa6446..bd3c38c 100644
--- a/src/appl/simple/client/sim_client.c
+++ b/src/appl/simple/client/sim_client.c
@@ -67,7 +67,6 @@ main(int argc, char *argv[])
struct servent *serv;
struct hostent *host;
char *cp;
- char full_hname[MAXHOSTNAMELEN];
#ifdef BROKEN_STREAMS_SOCKETS
char my_hostname[MAXHOSTNAMELEN];
#endif
@@ -145,13 +144,6 @@ main(int argc, char *argv[])
fprintf(stderr, "%s: unknown host\n", hostname);
exit(1);
}
- strncpy(full_hname, host->h_name, sizeof(full_hname)-1);
- full_hname[sizeof(full_hname)-1] = '\0';
-
- /* lower-case to get name for "instance" part of service name */
- for (cp = full_hname; *cp; cp++)
- if (isupper((int) *cp))
- *cp = tolower((int) *cp);
/* Set server's address */
(void) memset(&s_sock, 0, sizeof(s_sock));
@@ -212,7 +204,7 @@ main(int argc, char *argv[])
exit(1);
}
- if ((retval = krb5_mk_req(context, &auth_context, 0, service, full_hname,
+ if ((retval = krb5_mk_req(context, &auth_context, 0, service, hostname,
&inbuf, ccdef, &packet))) {
com_err(progname, retval, "while preparing AP_REQ");
exit(1);
More information about the cvs-krb5
mailing list