From: John Kohl Date: Thu, 21 Mar 1991 13:55:56 +0000 (+0000) Subject: use new krb5_sname_to_principal X-Git-Tag: krb5-1.0-alpha4~31 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=95177e90d7dd48cf155d5a952a455133f8972e45;p=krb5.git use new krb5_sname_to_principal git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1942 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/movemail/movemail.c b/src/appl/movemail/movemail.c index 4ff3d342c..1bf9bb88f 100644 --- a/src/appl/movemail/movemail.c +++ b/src/appl/movemail/movemail.c @@ -350,6 +350,7 @@ xmalloc (size) #include #endif /* KRB4 */ #ifdef KRB5 +#include #include #include #endif /* KRB5 */ @@ -507,12 +508,9 @@ char *host; #endif /* KRB4 */ #ifdef KRB5 krb5_error_code retval; - char **hrealms; - krb5_data aserver[3], *server[4]; krb5_ccache ccdef; - krb5_principal client; + krb5_principal client, server; krb5_error *err_ret; - char *remote_host; register char *cp; #endif /* KRB5 */ #endif /* KERBEROS */ @@ -584,29 +582,18 @@ char *host; goto krb5error; } - /* copy the hostname into non-volatile storage */ - remote_host = malloc(strlen(hp->h_name) + 1); - (void) strcpy(remote_host, hp->h_name); - - if (retval = krb5_get_host_realm(remote_host, &hrealms)) { - goto krb5error; - } - /* lower-case to get name for "instance" part of service name */ - for (cp = remote_host; *cp; cp++) + for (cp = hp->h_name; *cp; cp++) if (isupper(*cp)) *cp = tolower(*cp); - aserver[0].length = strlen(hrealms[0]); - aserver[0].data = hrealms[0]; - aserver[1].length = strlen(POP_SERVICE); - aserver[1].data = POP_SERVICE; - aserver[2].length = strlen(remote_host); - aserver[2].data = remote_host; - server[0] = &aserver[0]; - server[1] = &aserver[1]; - server[2] = &aserver[2]; - server[3] = 0; + if (retval = krb5_sname_to_principal(hp->h_name, POP_SERVICE, + FALSE, /* FALSE means don't + canonicalize hostname + (we already have...) */ + &server)) { + goto krb5error; + } retval = krb5_sendauth((krb5_pointer) &s, "KPOPV1.0", client, server, AP_OPTS_MUTUAL_REQUIRED,