components/openscap/patches/system_info3.c.patch
branchs11u2-sru
changeset 3380 ab1cb904871a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openscap/patches/system_info3.c.patch	Fri Oct 10 14:31:54 2014 -0700
@@ -0,0 +1,50 @@
+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;