only create chroot directory when path policies are available
This commit is contained in:
parent
7547644013
commit
ff2bc24c6b
15
qssb.h
15
qssb.h
@ -481,7 +481,14 @@ int qssb_enable_policy(struct qssb_policy *policy)
|
|||||||
return -EINVAL;
|
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)
|
if(policy->chroot_target_path == NULL)
|
||||||
{
|
{
|
||||||
char *target_dir = (char *) calloc(1, PATH_MAX * sizeof(char));
|
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)
|
if(mount_to_chroot(policy->chroot_target_path, policy->path_policies) < 0)
|
||||||
{
|
{
|
||||||
QSSB_LOG_ERROR("mount_to_chroot: setup of path policies failed\n");
|
QSSB_LOG_ERROR("mount_to_chroot: setup of path policies failed\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user