Debian Codegraph @

src/OVAL/probes/independent/family_probe.c

raw symbols SCIP
1 /**
2 * @file family_probe.c
3 * @brief family probe
4 * @author "Tomas Heinrich" <[email protected]>
5 * @author "Daniel Kopecek" <[email protected]>
6 *
7 * 2010/06/13 [email protected]
8 * This probe is able to process a family_object as defined in OVAL 5.4 and 5.5.
9 *
10 */
11
12 /*
13 * Copyright 2009 Red Hat Inc., Durham, North Carolina.
14 * All Rights Reserved.
15 *
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 2.1 of the License, or (at your option) any later version.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 *
30 * Authors:
31 * "Tomas Heinrich" <[email protected]>
32 * "Daniel Kopecek" <[email protected]>
33 */
34
35 /*
36 * family probe:
37 *
38 * family_object
39 *
40 * family_item
41 * attrs
42 * id
43 * status_enum status
44 * [0..1] string family
45 */
46
47 #ifdef HAVE_CONFIG_H
48 #include <config.h>
49 #endif
50
51 #include "_seap.h"
52 #include <string.h>
53 #include <probe-api.h>
54 #include <probe/probe.h>
55 #include <probe/option.h>
56 #include "family_probe.h"
57
58 int family_probe_offline_mode_supported()
59 {
60 /* We say that the probe supports all offline modes, but in fact
61 it always returns the same hardocoded string. */
62 return PROBE_OFFLINE_ALL;
63 }
64
65 int family_probe_main(probe_ctx *ctx, void *arg)
66 {
67 SEXP_t *item;
68
69 (void)arg;
70
71 const char *family =
72 #if defined(OS_WINDOWS)
73 "windows";
74 #elif defined(OS_OSX)
75 "macos";
76 #elif defined(OSCAP_UNIX)
77 "unix";
78 #elif defined(CISCO_IOS) /* XXX: how to detect IOS? */
79 "ios";
80 #else
81 "error";
82 #endif
83
84 item = probe_item_create(OVAL_INDEPENDENT_FAMILY, NULL,
85 "family", OVAL_DATATYPE_STRING, family,
86 NULL);
87
88 probe_item_collect(ctx, item);
89
90 return (0);
91 }