exile_enable_policy(): Only chdir() post chroot()
This commit is contained in:
والد
ce7eb57998
کامیت
48deab0dde
22
exile.h
22
exile.h
@ -1656,6 +1656,17 @@ int exile_enable_policy(struct exile_policy *policy)
|
||||
EXILE_LOG_ERROR("chroot: failed to enter %s\n", policy->chroot_target_path);
|
||||
return -1;
|
||||
}
|
||||
const char *chdir_target_path = policy->chdir_path;
|
||||
if(chdir_target_path == NULL)
|
||||
{
|
||||
chdir_target_path = "/";
|
||||
}
|
||||
|
||||
if(chdir(chdir_target_path) < 0)
|
||||
{
|
||||
EXILE_LOG_ERROR("chdir to %s failed\n", policy->chdir_path);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_LANDLOCK == 1
|
||||
@ -1670,16 +1681,6 @@ int exile_enable_policy(struct exile_policy *policy)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(policy->chdir_path == NULL)
|
||||
{
|
||||
policy->chdir_path = "/";
|
||||
}
|
||||
|
||||
if(policy->chdir_path != NULL && chdir(policy->chdir_path) < 0)
|
||||
{
|
||||
EXILE_LOG_ERROR("chdir to %s failed\n", policy->chdir_path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(policy->no_fs)
|
||||
{
|
||||
@ -1742,6 +1743,7 @@ int exile_enable_policy(struct exile_policy *policy)
|
||||
return exile_enable_syscall_policy(policy);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
بارگذاری…
مرجع در شماره جدید
Block a user