mirror of
https://git.openafs.org/openafs.git
synced 2025-02-01 14:07:39 +00:00
STABLE14-pr_init-fix-20050623
remove the pr_Initialize force cell change hack from afskfw lib ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== for the longest time aklog implementations with automatic pts registration have included a work around for a bug in pr_Initialize. The bug fails to reset the connection when the cell changes. pr_Initialize has been fixed so we can remove the hack. (cherry picked from commit c4b1decf6caacb13db666f516ceaf9b65e4371ab)
This commit is contained in:
parent
cefbcedb24
commit
86f3df47e9
@ -196,6 +196,28 @@ void ViceIDToUsername(char *username, char *realm_of_user, char *realm_of_cell,
|
||||
if (dflag)
|
||||
printf("About to resolve name %s to id\n", username);
|
||||
|
||||
#ifdef COMMENT
|
||||
/*
|
||||
* 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';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
strcpy(lastcell, aserver->cell);
|
||||
|
||||
if (!pr_Initialize (0, confname, aserver->cell)) {
|
||||
@ -257,6 +279,13 @@ void ViceIDToUsername(char *username, char *realm_of_user, char *realm_of_cell,
|
||||
return ;
|
||||
}
|
||||
|
||||
/*
|
||||
* In case you're wondering, we don't need to change the
|
||||
* filename here because we're still connecting to the
|
||||
* same cell -- we're just using a different authentication
|
||||
* level
|
||||
*/
|
||||
|
||||
if ((*status = pr_Initialize(1L, confname, aserver->cell))) {
|
||||
printf("Error %d\n", status);
|
||||
return;
|
||||
|
@ -694,26 +694,6 @@ static int auth_to_cell(context, cell, realm)
|
||||
params.pstdout(msgbuf);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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, 0))
|
||||
|
@ -73,6 +73,7 @@ pr_Initialize(IN afs_int32 secLevel, IN char *confDir, IN char *cell)
|
||||
struct rx_securityClass *sc[3];
|
||||
static struct afsconf_dir *tdir = 0; /* only do this once */
|
||||
static char tconfDir[100];
|
||||
static char tcell[64];
|
||||
struct ktc_token ttoken;
|
||||
afs_int32 scIndex;
|
||||
static struct afsconf_cell info;
|
||||
@ -84,32 +85,11 @@ pr_Initialize(IN afs_int32 secLevel, IN char *confDir, IN char *cell)
|
||||
initialize_ACFG_error_table();
|
||||
initialize_KTC_error_table();
|
||||
|
||||
if (strcmp(confDir, tconfDir)) {
|
||||
/*
|
||||
* Different conf dir; force re-evaluation.
|
||||
*/
|
||||
if (tdir)
|
||||
afsconf_Close(tdir);
|
||||
tdir = (struct afsconf_dir *)0;
|
||||
pruclient = (struct ubik_client *)0;
|
||||
}
|
||||
if (tdir == 0) {
|
||||
strncpy(tconfDir, confDir, sizeof(tconfDir));
|
||||
#if defined(UKERNEL)
|
||||
tdir = afs_cdir;
|
||||
if (!cell) {
|
||||
cell = afs_LclCellName;
|
||||
}
|
||||
#else /* defined(UKERNEL) */
|
||||
tdir = afsconf_Open(confDir);
|
||||
if (!tdir) {
|
||||
if (confDir && strcmp(confDir, ""))
|
||||
fprintf(stderr,
|
||||
"libprot: Could not open configuration directory: %s.\n",
|
||||
confDir);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!cell) {
|
||||
code = afsconf_GetLocalCell(tdir, cellstr, sizeof(cellstr));
|
||||
if (code) {
|
||||
@ -122,6 +102,33 @@ pr_Initialize(IN afs_int32 secLevel, IN char *confDir, IN char *cell)
|
||||
}
|
||||
#endif /* defined(UKERNEL) */
|
||||
|
||||
if (strcmp(confDir, tconfDir) || strcmp(cell, tcell)) {
|
||||
/*
|
||||
* Different conf dir; force re-evaluation.
|
||||
*/
|
||||
if (tdir)
|
||||
afsconf_Close(tdir);
|
||||
tdir = (struct afsconf_dir *)0;
|
||||
pruclient = (struct ubik_client *)0;
|
||||
}
|
||||
|
||||
if (tdir == 0) {
|
||||
strncpy(tconfDir, confDir, sizeof(tconfDir));
|
||||
strncpy(tcell, cell, sizeof(tcell));
|
||||
|
||||
#if defined(UKERNEL)
|
||||
tdir = afs_cdir;
|
||||
#else /* defined(UKERNEL) */
|
||||
tdir = afsconf_Open(confDir);
|
||||
if (!tdir) {
|
||||
if (confDir && strcmp(confDir, ""))
|
||||
fprintf(stderr,
|
||||
"libprot: Could not open configuration directory: %s.\n",
|
||||
confDir);
|
||||
return -1;
|
||||
}
|
||||
#endif /* defined(UKERNEL) */
|
||||
|
||||
code = afsconf_GetCellInfo(tdir, cell, "afsprot", &info);
|
||||
if (code) {
|
||||
fprintf(stderr, "libprot: Could not locate cell %s in %s/%s\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user