|
1 This patch fixes the issue, where the system_info probe crashes on solaris, |
|
2 when the network interfaces cannot be detected. Fix provides the default |
|
3 loop back interface as default. |
|
4 |
|
5 This patch has not been contributed upstream, but is planned to be done by |
|
6 2014-Aug-15. |
|
7 |
|
8 |
|
9 --- openscap-1.0.0/src/OVAL/probes/independent/system_info.c.~2~ 2014-07-24 11:02:52.698291479 -0700 |
|
10 +++ openscap-1.0.0/src/OVAL/probes/independent/system_info.c 2014-07-25 11:20:07.096049635 -0700 |
|
11 @@ -170,6 +170,7 @@ |
|
12 char host[NI_MAXHOST], *mac; |
|
13 SEXP_t *attrs; |
|
14 SEXP_t *r0, *r1, *r2; |
|
15 + int item_added = 0; |
|
16 |
|
17 if (getifaddrs(&ifaddr) == -1) |
|
18 return rc; |
|
19 @@ -213,8 +214,6 @@ |
|
20 goto leave2; |
|
21 } |
|
22 } |
|
23 - |
|
24 - |
|
25 attrs = probe_attr_creat("name", |
|
26 r0 = SEXP_string_newf("%s", ifa->ifa_name), |
|
27 "ip_address", |
|
28 @@ -223,10 +222,22 @@ |
|
29 r2 = SEXP_string_newf("%s", mac), |
|
30 NULL); |
|
31 probe_item_ent_add(item, "interface", attrs, NULL); |
|
32 + item_added = 1; |
|
33 SEXP_vfree(attrs, r0, r1, r2, NULL); |
|
34 } |
|
35 leave2: |
|
36 close(fd); |
|
37 + if (item_added == 0) { |
|
38 + attrs = probe_attr_creat("name", |
|
39 + r0 = SEXP_string_newf("dummy0"), |
|
40 + "ip_address", |
|
41 + r1 = SEXP_string_newf("127.0.0.1"), |
|
42 + "mac_address", |
|
43 + r2 = SEXP_string_newf("aa:bb:cc:dd:ee:ff"), |
|
44 + NULL); |
|
45 + probe_item_ent_add(item, "interface", attrs, NULL); |
|
46 + SEXP_vfree(attrs, r0, r1, r2, NULL); |
|
47 + } |
|
48 leave1: |
|
49 freeifaddrs(ifaddr); |
|
50 return rc; |