File: secaatest.c

package info (click to toggle)
libvirt 0.8.3-5%2Bsqueeze5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 77,288 kB
  • ctags: 30,516
  • sloc: ansic: 177,367; xml: 26,161; sh: 13,271; python: 4,929; makefile: 2,083; ml: 472; perl: 221; awk: 48; sed: 16
file content (45 lines) | stat: -rw-r--r-- 1,001 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#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, "apparmor", false);
    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;
}