From: Derrick Brashear Date: Sun, 15 Mar 2009 18:02:41 +0000 (+0000) Subject: DEVEL15-aklog-old-principal-conversion-sans-524-20090315 X-Git-Tag: openafs-devel-1_5_58~116 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=af7da2a90b93203044534a8f5b1ee950842ff8bc;p=packages%2Fo%2Fopenafs.git DEVEL15-aklog-old-principal-conversion-sans-524-20090315 LICENSE IPL10 we'll want to fix this differently later; since 524 is dying perhaps we need to just ship heimdal's version of this code (cherry picked from commit fd9e5ffb4653b87f92438574083185a55086b661) --- diff --git a/src/aklog/aklog_main.c b/src/aklog/aklog_main.c index f17f3d675..d62898fc6 100644 --- a/src/aklog/aklog_main.c +++ b/src/aklog/aklog_main.c @@ -643,6 +643,7 @@ static int auth_to_cell(krb5_context context, char *cell, char *realm) if (dflag) printf("Using Kerberos V5 ticket natively\n"); +#ifndef HAVE_NO_KRB5_524 status = krb5_524_conv_principal (context, v5cred->client, &k4name, &k4inst, &k4realm); if (status) { afs_com_err(progname, status, "while converting principal " @@ -654,6 +655,22 @@ static int auth_to_cell(krb5_context context, char *cell, char *realm) strcat (username, "."); strcat (username, k4inst); } +#else + len = min(get_princ_len(context, v5cred->client, 0), + second_comp(context, v5cred->client) ? + MAXKTCNAMELEN - 2 : MAXKTCNAMELEN - 1); + strncpy(username, get_princ_str(context, v5cred->client, 0), len); + username[len] = '\0'; + + if (second_comp(context, v5cred->client)) { + strcat(username, "."); + p = username + strlen(username); + len = min(get_princ_len(context, v5cred->client, 1), + MAXKTCNAMELEN - strlen(username) - 1); + strncpy(p, get_princ_str(context, v5cred->client, 1), len); + p[len] = '\0'; + } +#endif memset(&atoken, 0, sizeof(atoken)); atoken.kvno = RXKAD_TKT_TYPE_KERBEROS_V5;