From: Tom Yu Date: Wed, 30 Dec 2015 22:17:02 +0000 (-0500) Subject: Don't canonicalize hostname in sim_client.c X-Git-Tag: krb5-1.15-beta1~298 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0491c778064e80aaf2aaeb4475a0db333542fed9;p=thirdparty%2Fkrb5.git 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 --- diff --git a/src/appl/simple/client/sim_client.c b/src/appl/simple/client/sim_client.c index aaa6446c67..bd3c38c72a 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);