components/openscap/patches/system_info3.c.patch
author Jacob Varughese <jacob.varughese@oracle.com>
Fri, 10 Oct 2014 14:31:54 -0700
branchs11u2-sru
changeset 3380 ab1cb904871a
permissions -rw-r--r--
19262735 The file probe needs to be zone aware 19173594 oscap crashes when compliance is run 19559867 compliance fails when no network interface are defined

This patch fixes the issue, where the system_info probe crashes on solaris,
 when the network interfaces cannot be detected. Fix provides the default
 loop back interface as default.

This patch has not been contributed upstream, but is planned to be done by
 2014-Aug-15.


--- openscap-1.0.0/src/OVAL/probes/independent/system_info.c.~2~	2014-07-24 11:02:52.698291479 -0700
+++ openscap-1.0.0/src/OVAL/probes/independent/system_info.c	2014-07-25 11:20:07.096049635 -0700
@@ -170,6 +170,7 @@
        char host[NI_MAXHOST], *mac;
        SEXP_t *attrs;
        SEXP_t *r0, *r1, *r2;
+	int item_added = 0;
 
        if (getifaddrs(&ifaddr) == -1)
                return rc;
@@ -213,8 +214,6 @@
 				goto leave2;
 			}
 		}
-
-
 	        attrs = probe_attr_creat("name",
                                  r0 = SEXP_string_newf("%s", ifa->ifa_name),
                                  "ip_address",
@@ -223,10 +222,22 @@
                                  r2 = SEXP_string_newf("%s", mac),
                                  NULL);
 	        probe_item_ent_add(item, "interface", attrs, NULL);
+		item_added = 1;
         	SEXP_vfree(attrs, r0, r1, r2, NULL);
 	}
 leave2:
         close(fd);
+	if (item_added == 0) {
+		attrs = probe_attr_creat("name",
+					 r0 = SEXP_string_newf("dummy0"),
+					 "ip_address",
+					 r1 = SEXP_string_newf("127.0.0.1"),
+					 "mac_address",
+					 r2 = SEXP_string_newf("aa:bb:cc:dd:ee:ff"),
+					 NULL);
+		probe_item_ent_add(item, "interface", attrs, NULL);
+		SEXP_vfree(attrs, r0, r1, r2, NULL);
+	}
 leave1:
         freeifaddrs(ifaddr);
         return rc;