setauthdb() only sets the "old" registry if it was set by a previous
call to setauthdb(). To restore the original value, passing NULL (or an empty string) to setauthdb() is sufficient.
This commit is contained in:
13
common/aix.c
13
common/aix.c
@@ -55,10 +55,6 @@ struct aix_limit {
|
|||||||
int factor;
|
int factor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_SETAUTHDB
|
|
||||||
static char saved_registry[16]; /* 15 chars plus NUL as per setauthdb(3) */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static struct aix_limit aix_limits[] = {
|
static struct aix_limit aix_limits[] = {
|
||||||
{ RLIMIT_FSIZE, S_UFSIZE, S_UFSIZE_HARD, 512 },
|
{ RLIMIT_FSIZE, S_UFSIZE, S_UFSIZE_HARD, 512 },
|
||||||
{ RLIMIT_CPU, S_UCPU, S_UCPU_HARD, 1 },
|
{ RLIMIT_CPU, S_UCPU, S_UCPU_HARD, 1 },
|
||||||
@@ -146,7 +142,7 @@ aix_setauthdb(char *user)
|
|||||||
if (setuserdb(S_READ) != 0)
|
if (setuserdb(S_READ) != 0)
|
||||||
error(1, "unable to open userdb");
|
error(1, "unable to open userdb");
|
||||||
if (getuserattr(user, S_REGISTRY, ®istry, SEC_CHAR) == 0) {
|
if (getuserattr(user, S_REGISTRY, ®istry, SEC_CHAR) == 0) {
|
||||||
if (setauthdb(registry, saved_registry) != 0)
|
if (setauthdb(registry, NULL) != 0)
|
||||||
error(1, "unable to switch to registry \"%s\" for %s",
|
error(1, "unable to switch to registry \"%s\" for %s",
|
||||||
registry, user);
|
registry, user);
|
||||||
}
|
}
|
||||||
@@ -160,11 +156,8 @@ aix_setauthdb(char *user)
|
|||||||
void
|
void
|
||||||
aix_restoreauthdb(void)
|
aix_restoreauthdb(void)
|
||||||
{
|
{
|
||||||
if (saved_registry[0]) {
|
if (setauthdb(NULL, NULL) != 0)
|
||||||
if (setauthdb(saved_registry, NULL) != 0)
|
error(1, "unable to restore registry");
|
||||||
error(1, "unable to restore registry \"%s\"", saved_registry);
|
|
||||||
saved_registry[0] = '\0';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user