mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 06:35:24 +00:00
e56c6a83b4
* src/Makefile.am, src/qemu/qemu_conf.h, src/qemu/qemu_driver.c, tests/seclabeltest.c: Adapt for changed paths * src/security.c: Rename to src/security/security_driver.c * src/security.h: Rename to src/security/security_driver.h * src/security_selinux.c, src/security_selinux.h: Move to src/security/
46 lines
993 B
C
46 lines
993 B
C
#include <config.h>
|
|
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include "security/security_driver.h"
|
|
|
|
int
|
|
main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
|
{
|
|
int ret;
|
|
|
|
const char *doi, *model;
|
|
virSecurityDriverPtr security_drv;
|
|
|
|
ret = virSecurityDriverStartup (&security_drv, "selinux");
|
|
if (ret == -1)
|
|
{
|
|
fprintf (stderr, "Failed to start security driver");
|
|
exit (-1);
|
|
}
|
|
/* No security driver wanted to be enabled: just return */
|
|
if (ret == -2)
|
|
return 0;
|
|
|
|
model = virSecurityDriverGetModel (security_drv);
|
|
if (!model)
|
|
{
|
|
fprintf (stderr, "Failed to copy secModel model: %s",
|
|
strerror (errno));
|
|
exit (-1);
|
|
}
|
|
|
|
doi = virSecurityDriverGetDOI (security_drv);
|
|
if (!doi)
|
|
{
|
|
fprintf (stderr, "Failed to copy secModel DOI: %s",
|
|
strerror (errno));
|
|
exit (-1);
|
|
}
|
|
|
|
return 0;
|
|
}
|