krb5 commit [krb5-1.14]: Don't canonicalize hostname in sim_client.c

Tom Yu tlyu at mit.edu
Thu Jan 7 17:13:50 EST 2016


https://github.com/krb5/krb5/commit/40afd7e5165de5459dabdebee10c5ccfd7322dec
commit 40afd7e5165de5459dabdebee10c5ccfd7322dec
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.
    
    (cherry picked from commit 0491c778064e80aaf2aaeb4475a0db333542fed9)
    
    ticket: 8336
    version_fixed: 1.14.1

 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