2009-04-03 10:55:51 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <errno.h>
|
2009-09-15 19:06:37 +01:00
|
|
|
#include "security/security_driver.h"
|
2012-07-20 14:44:54 -06:00
|
|
|
#include "virrandom.h"
|
2016-02-25 17:13:00 +01:00
|
|
|
#include "testutils.h"
|
2009-04-03 10:55:51 +00:00
|
|
|
|
2016-02-25 17:13:00 +01:00
|
|
|
static int
|
|
|
|
|
mymain(void)
|
2009-04-03 10:55:51 +00:00
|
|
|
{
|
2010-11-17 20:26:30 +00:00
|
|
|
virSecurityManagerPtr mgr;
|
2009-04-03 10:55:51 +00:00
|
|
|
const char *doi, *model;
|
|
|
|
|
|
2012-08-03 17:15:00 -06:00
|
|
|
if (virThreadInitialize() < 0)
|
2013-02-22 15:42:39 -07:00
|
|
|
return EXIT_FAILURE;
|
2012-07-20 14:44:54 -06:00
|
|
|
|
2015-10-06 17:01:48 +02:00
|
|
|
mgr = virSecurityManagerNew(NULL, "QEMU", VIR_SECURITY_MANAGER_DEFAULT_CONFINED);
|
2010-11-17 20:26:30 +00:00
|
|
|
if (mgr == NULL) {
|
2012-10-17 10:23:12 +01:00
|
|
|
fprintf(stderr, "Failed to start security driver");
|
2013-02-22 15:42:39 -07:00
|
|
|
return EXIT_FAILURE;
|
2009-04-03 10:55:51 +00:00
|
|
|
}
|
|
|
|
|
|
2010-11-17 20:26:30 +00:00
|
|
|
model = virSecurityManagerGetModel(mgr);
|
2014-09-03 16:24:43 -06:00
|
|
|
if (!model) {
|
2012-10-17 10:23:12 +01:00
|
|
|
fprintf(stderr, "Failed to copy secModel model: %s",
|
|
|
|
|
strerror(errno));
|
2013-02-22 15:42:39 -07:00
|
|
|
return EXIT_FAILURE;
|
2009-04-03 10:55:51 +00:00
|
|
|
}
|
|
|
|
|
|
2010-11-17 20:26:30 +00:00
|
|
|
doi = virSecurityManagerGetDOI(mgr);
|
2014-09-03 16:24:43 -06:00
|
|
|
if (!doi) {
|
2012-10-17 10:23:12 +01:00
|
|
|
fprintf(stderr, "Failed to copy secModel DOI: %s",
|
|
|
|
|
strerror(errno));
|
2013-02-22 15:42:39 -07:00
|
|
|
return EXIT_FAILURE;
|
2009-04-03 10:55:51 +00:00
|
|
|
}
|
|
|
|
|
|
2013-02-05 17:54:55 +00:00
|
|
|
virObjectUnref(mgr);
|
2010-11-17 20:26:30 +00:00
|
|
|
|
2009-04-03 10:55:51 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
2016-02-25 17:13:00 +01:00
|
|
|
|
|
|
|
|
VIRT_TEST_MAIN(mymain)
|