author | Jacob Varughese <jacob.varughese@oracle.com> |
Fri, 10 Oct 2014 14:31:54 -0700 | |
branch | s11u2-sru |
changeset 3380 | ab1cb904871a |
permissions | -rw-r--r-- |
3380
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
1 |
This patch fixes the issue, where the system_info probe fails on solaris, |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
2 |
when the network interfaces cannot be detected. Fix provides the default |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
3 |
loop back interface as default. The earlier patch was not a complete fix. |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
4 |
|
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
5 |
This patch has not been contributed upstream, but is planned to be done by |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
6 |
2014-Oct-15. |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
7 |
|
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
8 |
|
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
9 |
--- openscap-1.0.0/src/OVAL/probes/independent/system_info.c.~3~ 2014-09-18 11:08:42.983747329 -0700 |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
10 |
+++ openscap-1.0.0/src/OVAL/probes/independent/system_info.c 2014-09-18 12:41:13.266535881 -0700 |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
11 |
@@ -166,14 +166,16 @@ |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
12 |
static int get_ifs(SEXP_t *item) |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
13 |
{ |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
14 |
struct ifaddrs *ifaddr, *ifa; |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
15 |
- int family, rc=1; |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
16 |
+ int family, rc=0; |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
17 |
char host[NI_MAXHOST], *mac; |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
18 |
SEXP_t *attrs; |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
19 |
SEXP_t *r0, *r1, *r2; |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
20 |
- int item_added = 0; |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
21 |
+#if defined(__SVR4) && defined(__sun) |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
22 |
+ int item_added = 0; |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
23 |
+#endif |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
24 |
|
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
25 |
if (getifaddrs(&ifaddr) == -1) |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
26 |
- return rc; |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
27 |
+ return 1; |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
28 |
|
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
29 |
fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
30 |
if (fd < 0) |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
31 |
@@ -222,12 +224,15 @@ |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
32 |
r2 = SEXP_string_newf("%s", mac), |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
33 |
NULL); |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
34 |
probe_item_ent_add(item, "interface", attrs, NULL); |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
35 |
+#if defined(__SVR4) && defined(__sun) |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
36 |
item_added = 1; |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
37 |
+#endif |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
38 |
SEXP_vfree(attrs, r0, r1, r2, NULL); |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
39 |
} |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
40 |
leave2: |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
41 |
close(fd); |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
42 |
- if (item_added == 0) { |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
43 |
+#if defined(__SVR4) && defined(__sun) |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
44 |
+ if (item_added == 0 && rc == 0) { |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
45 |
attrs = probe_attr_creat("name", |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
46 |
r0 = SEXP_string_newf("dummy0"), |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
47 |
"ip_address", |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
48 |
@@ -238,6 +243,7 @@ |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
49 |
probe_item_ent_add(item, "interface", attrs, NULL); |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
50 |
SEXP_vfree(attrs, r0, r1, r2, NULL); |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
51 |
} |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
52 |
+#endif |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
53 |
leave1: |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
54 |
freeifaddrs(ifaddr); |
ab1cb904871a
19262735 The file probe needs to be zone aware
Jacob Varughese <jacob.varughese@oracle.com>
parents:
diff
changeset
|
55 |
return rc; |