2009-04-03 18:55:51 +08:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
2009-09-16 02:06:37 +08:00
|
|
|
#include "security/security_driver.h"
|
2009-04-03 18:55:51 +08:00
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
const char *doi, *model;
|
|
|
|
virSecurityDriverPtr security_drv;
|
|
|
|
|
2010-06-16 00:58:58 +08:00
|
|
|
ret = virSecurityDriverStartup (&security_drv, "selinux", false);
|
2009-04-03 18:55:51 +08:00
|
|
|
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;
|
|
|
|
}
|