提交 7184af13 编写于 作者: D Daniel P. Berrange

Add missing stubs to securityselinuxhelper.c

Make sure we override both the raw and non-raw stubs in
securityselinuxhelper.c. Also add diagnostics if
securityselinuxlabeltest fails a test item
上级 688b3ecf
......@@ -46,6 +46,11 @@ int getcon_raw(security_context_t *context)
return 0;
}
int getcon(security_context_t *context)
{
return getcon_raw(context);
}
int getpidcon_raw(pid_t pid, security_context_t *context)
{
if (pid != getpid()) {
......@@ -63,22 +68,36 @@ int getpidcon_raw(pid_t pid, security_context_t *context)
return 0;
}
int getpidcon(pid_t pid, security_context_t *context)
{
return getpidcon_raw(pid, context);
}
int setcon_raw(security_context_t context)
{
return setenv("FAKE_CONTEXT", context, 1);
}
int setcon(security_context_t context)
{
return setcon_raw(context);
}
#if WITH_ATTR
int setfilecon(const char *path, security_context_t con)
int setfilecon_raw(const char *path, security_context_t con)
{
const char *constr = con;
return setxattr(path, "user.libvirt.selinux",
constr, strlen(constr), 0);
}
int setfilecon(const char *path, security_context_t con)
{
return setfilecon_raw(path, con);
}
int getfilecon(const char *path, security_context_t *con)
int getfilecon_raw(const char *path, security_context_t *con)
{
char *constr = NULL;
ssize_t len = getxattr(path, "user.libvirt.selinux",
......@@ -96,4 +115,8 @@ int getfilecon(const char *path, security_context_t *con)
constr[len] = '\0';
return 0;
}
int getfilecon(const char *path, security_context_t *con)
{
return getfilecon_raw(path, con);
}
#endif
......@@ -300,6 +300,10 @@ cleanup:
VIR_FREE(files[i].context);
}
VIR_FREE(files);
if (ret < 0 && virTestGetVerbose()) {
virErrorPtr err = virGetLastError();
fprintf(stderr, "%s\n", err ? err->message : "<unknown>");
}
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册