19559867 compliance fails when no network interface are defined
authorJacob Varughese <jacob.varughese@oracle.com>
Fri, 19 Sep 2014 14:19:10 -0700
changeset 2103 92b50cf5c69e
parent 2102 eaee380e5cad
child 2104 72ce614559ff
19559867 compliance fails when no network interface are defined
components/openscap/patches/system_info4.c.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openscap/patches/system_info4.c.patch	Fri Sep 19 14:19:10 2014 -0700
@@ -0,0 +1,55 @@
+This patch fixes the issue, where the system_info probe fails on solaris,
+ when the network interfaces cannot be detected. Fix provides the default
+ loop back interface as default. The earlier patch was not a complete fix.
+
+This patch has not been contributed upstream, but is planned to be done by
+ 2014-Oct-15.
+
+
+--- openscap-1.0.0/src/OVAL/probes/independent/system_info.c.~3~	2014-09-18 11:08:42.983747329 -0700
++++ openscap-1.0.0/src/OVAL/probes/independent/system_info.c	2014-09-18 12:41:13.266535881 -0700
[email protected]@ -166,14 +166,16 @@
+ static int get_ifs(SEXP_t *item)
+ {
+        struct ifaddrs *ifaddr, *ifa;
+-       int family, rc=1;
++       int family, rc=0;
+        char host[NI_MAXHOST], *mac;
+        SEXP_t *attrs;
+        SEXP_t *r0, *r1, *r2;
+-	int item_added = 0;
++#if defined(__SVR4) && defined(__sun)
++       int item_added = 0;
++#endif
+ 
+        if (getifaddrs(&ifaddr) == -1)
+-               return rc;
++               return 1;
+ 
+        fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
+        if (fd < 0)
[email protected]@ -222,12 +224,15 @@
+                                  r2 = SEXP_string_newf("%s", mac),
+                                  NULL);
+ 	        probe_item_ent_add(item, "interface", attrs, NULL);
++#if defined(__SVR4) && defined(__sun)
+ 		item_added = 1;
++#endif
+         	SEXP_vfree(attrs, r0, r1, r2, NULL);
+ 	}
+ leave2:
+         close(fd);
+-	if (item_added == 0) {
++#if defined(__SVR4) && defined(__sun)
++	if (item_added == 0 && rc == 0) {
+ 		attrs = probe_attr_creat("name",
+ 					 r0 = SEXP_string_newf("dummy0"),
+ 					 "ip_address",
[email protected]@ -238,6 +243,7 @@
+ 		probe_item_ent_add(item, "interface", attrs, NULL);
+ 		SEXP_vfree(attrs, r0, r1, r2, NULL);
+ 	}
++#endif
+ leave1:
+         freeifaddrs(ifaddr);
+         return rc;