Pass in directory to check_user_runchroot() and check_user_runcwd().

This way we do not rely on the runas_ctx global.
This commit is contained in:
Todd C. Miller
2023-08-14 13:25:13 -06:00
parent 2e8648ea0f
commit 737354390c
5 changed files with 20 additions and 22 deletions

View File

@@ -391,13 +391,13 @@ main(int argc, char *argv[])
CLR(validated, VALIDATE_SUCCESS);
SET(validated, VALIDATE_FAILURE);
}
if (check_user_runchroot() != true) {
if (check_user_runchroot(runas_ctx.chroot) != true) {
printf("\nUser %s is not allowed to change root directory to %s\n",
user_ctx.name, runas_ctx.chroot);
CLR(validated, VALIDATE_SUCCESS);
SET(validated, VALIDATE_FAILURE);
}
if (check_user_runcwd() != true) {
if (check_user_runcwd(runas_ctx.cwd) != true) {
printf("\nUser %s is not allowed to change directory to %s\n",
user_ctx.name, runas_ctx.cwd);
CLR(validated, VALIDATE_SUCCESS);