From a61ff319b7a9cec29b02579c20a338c46a8d2c55 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 24 Jun 2005 04:01:48 +0000 Subject: [PATCH] windows-aklog-naming-20050624 Correct for the behavior of pr_SNameToId() lowercasing the username --- src/WINNT/afsd/afskfw.c | 11 ++++++++--- src/WINNT/aklog/aklog.c | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/WINNT/afsd/afskfw.c b/src/WINNT/afsd/afskfw.c index a7b78abe6..7c376ce98 100644 --- a/src/WINNT/afsd/afskfw.c +++ b/src/WINNT/afsd/afskfw.c @@ -2544,8 +2544,12 @@ ViceIDToUsername(char *username, strcpy(lastcell, aserver->cell); - if (!pr_Initialize (0, confname, aserver->cell)) - status = pr_SNameToId (username, &viceId); + if (!pr_Initialize (0, confname, aserver->cell)) { + char sname[PR_MAXNAMELEN]; + strncpy(sname, username, PR_MAXNAMELEN); + sname[PR_MAXNAMELEN-1] = '\0'; + status = pr_SNameToId (sname, &viceId); + } /* * This is a crock, but it is Transarc's crock, so @@ -2948,7 +2952,8 @@ KFW_AFS_klog( strcpy(aclient.cell, realm_of_cell); len = min(k5creds->client->realm.length,strlen(realm_of_cell)); - if ( strncmp(realm_of_cell, k5creds->client->realm.data, len) ) { + /* For Khimaira, always append the realm name */ + if ( 1 /* strncmp(realm_of_cell, k5creds->client->realm.data, len) */ ) { char * p; strcat(aclient.name, "@"); p = aclient.name + strlen(aclient.name); diff --git a/src/WINNT/aklog/aklog.c b/src/WINNT/aklog/aklog.c index efce84c29..5bb3b0264 100644 --- a/src/WINNT/aklog/aklog.c +++ b/src/WINNT/aklog/aklog.c @@ -220,8 +220,12 @@ void ViceIDToUsername(char *username, char *realm_of_user, char *realm_of_cell, strcpy(lastcell, aserver->cell); - if (!pr_Initialize (0, confname, aserver->cell)) - *status = pr_SNameToId (username, &viceId); + if (!pr_Initialize (0, confname, aserver->cell)) { + char sname[PR_MAXNAMELEN]; + strncpy(sname, username, PR_MAXNAMELEN); + sname[PR_MAXNAMELEN-1] = '\0'; + *status = pr_SNameToId (sname, &viceId); + } if (dflag) { @@ -763,7 +767,8 @@ static int auth_to_cell(krb5_context context, char *cell, char *realm) } } - if (strcmp(realm_of_user, realm_of_cell)) + /* For Khimaira we want to always append the realm to the name */ + if (1 /* strcmp(realm_of_user, realm_of_cell) */) { strcat(username, "@"); strcat(username, realm_of_user); -- 2.39.5