seclabeltest.c 990 字节
Newer Older
1 2 3 4 5 6 7
#include <config.h>

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
8
#include "security/security_driver.h"
E
Eric Blake 已提交
9
#include "virrandom.h"
10 11

int
12
main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
13
{
14
    virSecurityManagerPtr mgr;
15 16
    const char *doi, *model;

17
    if (virThreadInitialize() < 0)
18
        return EXIT_FAILURE;
E
Eric Blake 已提交
19

20
    mgr = virSecurityManagerNew(NULL, "QEMU", false, true, false, false);
21
    if (mgr == NULL) {
22
        fprintf(stderr, "Failed to start security driver");
23
        return EXIT_FAILURE;
24 25
    }

26
    model = virSecurityManagerGetModel(mgr);
E
Eric Blake 已提交
27
    if (!model) {
28 29
        fprintf(stderr, "Failed to copy secModel model: %s",
                strerror(errno));
30
        return EXIT_FAILURE;
31 32
    }

33
    doi = virSecurityManagerGetDOI(mgr);
E
Eric Blake 已提交
34
    if (!doi) {
35 36
        fprintf(stderr, "Failed to copy secModel DOI: %s",
                strerror(errno));
37
        return EXIT_FAILURE;
38 39
    }

40
    virObjectUnref(mgr);
41

42 43
    return 0;
}