{
static char lastcell[MAXCELLCHARS+1] = { 0 };
static char confname[512] = { 0 };
- char username_copy[BUFSIZ];
- long viceId; /* AFS uid of user */
+ afs_int32 viceId; /* AFS uid of user */
#ifdef ALLOW_REGISTER
afs_int32 id;
#endif /* ALLOW_REGISTER */
if (dflag)
printf("About to resolve name %s to id\n", username);
- /*
- * Talk about DUMB! It turns out that there is a bug in
- * pr_Initialize -- even if you give a different cell name
- * to it, it still uses a connection to a previous AFS server
- * if one exists. The way to fix this is to change the
- * _filename_ argument to pr_Initialize - that forces it to
- * re-initialize the connection. We do this by adding and
- * removing a "/" on the end of the configuration directory name.
- */
-
- if (lastcell[0] != '\0' && (strcmp(lastcell, aserver->cell) != 0)) {
- int i = strlen(confname);
- if (confname[i - 1] == '/') {
- confname[i - 1] = '\0';
- } else {
- confname[i] = '/';
- confname[i + 1] = '\0';
- }
- }
-
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], *at;
+
+ strncpy(sname, username, PR_MAXNAMELEN);
+ sname[PR_MAXNAMELEN-1] = '\0';
+
+ at = strchr(sname, '@');
+ if (at && !stricmp(at+1, realm_of_cell))
+ *at = '\0';
+ *status = pr_SNameToId (sname, &viceId);
+ }
if (dflag)
{
}
}
- 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);