only create chroot directory when path policies are available

这个提交包含在:
Albert S. 2019-12-07 23:26:27 +01:00
父节点 7547644013
当前提交 ff2bc24c6b
共有 1 个文件被更改,包括 26 次插入27 次删除

15
qssb.h
查看文件

@ -481,7 +481,14 @@ int qssb_enable_policy(struct qssb_policy *policy)
return -EINVAL;
}
if(enter_namespaces(policy->namespace_options) < 0)
{
QSSB_LOG_ERROR("Error while trying to enter namespaces\n");
return -1;
}
if(policy->path_policies != NULL)
{
if(policy->chroot_target_path == NULL)
{
char *target_dir = (char *) calloc(1, PATH_MAX * sizeof(char));
@ -508,14 +515,6 @@ int qssb_enable_policy(struct qssb_policy *policy)
}
}
if(enter_namespaces(policy->namespace_options) < 0)
{
QSSB_LOG_ERROR("Error while trying to enter namespaces\n");
return -1;
}
if(policy->path_policies != NULL)
{
if(mount_to_chroot(policy->chroot_target_path, policy->path_policies) < 0)
{
QSSB_LOG_ERROR("mount_to_chroot: setup of path policies failed\n");