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