components/openscap/patches/file.c.patch
branchs11-update
changeset 3806 bdc70b98921a
parent 2821 8add1494802c
equal deleted inserted replaced
3804:83478bd23f4f 3806:bdc70b98921a
     1 Fixed issue with file probe not returning has_extended_acl on solaris.
     1 This patch is required to fix file probe to support the has_extended_acl
     2 This patch fixes the file probe from crashing on solaris when encountering file
     2 attribute in OVAL.
     3 types of door and port.
     3 This patch has not been contributed to upstream, but is planned to be
     4 This patch has not been contributed upstream, but is planned to be done by
     4 completed by 2015-Jan-31.
     5 2013-Jul-12.
     5  
     6 
     6 --- openscap-1.1.1/src/OVAL/probes/unix/file.c~1~	2014-10-27 12:41:33.138555312 -0700
     7 --- openscap-0.9.7/src/OVAL/probes/unix/file.c.~1~	2013-04-23 06:21:51.447000001 -0700
     7 +++ openscap-1.1.1/src/OVAL/probes/unix/file.c	2014-10-27 12:40:05.815261373 -0700
     8 +++ openscap-0.9.7/src/OVAL/probes/unix/file.c	2013-08-16 13:04:51.171523322 -0700
     8 @@ -261,7 +261,7 @@
     9 @@ -77,6 +77,9 @@
     9  	}
       
    10  	return (has_acl == 1) ? gr_true : gr_false;
       
    11  #elif defined(OS_SOLARIS)
       
    12 -	return acl_trivial(st_path) ? gr_true : gr_false;
       
    13 +	return acl_trivial(path) ? gr_true : gr_false;
    10  #else
    14  #else
    11  # error "Sorry, your OS isn't supported."
    15  	return NULL;
    12  #endif
    16  #endif
    13 +#if defined(__SVR4) && defined(__sun)
       
    14 +#include <sys/acl.h>
       
    15 +#endif
       
    16  
       
    17  oval_version_t over;
       
    18  
       
    19 @@ -84,6 +87,9 @@
       
    20  static SEXP_t *gr_t_dir  = NULL, *gr_t_lnk  = NULL, *gr_t_blk  = NULL;
       
    21  static SEXP_t *gr_t_fifo = NULL, *gr_t_sock = NULL, *gr_t_char = NULL;
       
    22  static SEXP_t  gr_lastpath;
       
    23 +#if defined(__SVR4) && defined(__sun)
       
    24 +static SEXP_t *gr_t_door = NULL, *gr_t_port = NULL;
       
    25 +#endif
       
    26  
       
    27  static SEXP_t *se_filetype (mode_t mode)
       
    28  {
       
    29 @@ -95,6 +101,10 @@
       
    30          case S_IFIFO:  return (gr_t_fifo);
       
    31          case S_IFSOCK: return (gr_t_sock);
       
    32          case S_IFCHR:  return (gr_t_char);
       
    33 +#if	defined(__SVR4) && defined(__sun)
       
    34 +	case S_IFDOOR: return (gr_t_door);
       
    35 +	case S_IFPORT: return (gr_t_port);
       
    36 +#endif
       
    37          default:
       
    38                  abort ();
       
    39          }
       
    40 @@ -286,8 +297,12 @@
       
    41  			se_acl = acl_extended_file(st_path) ? gr_true : gr_false;
       
    42  		}
       
    43  #else
       
    44 +#if defined(__SVR4) && defined(__sun)
       
    45 +		se_acl = acl_trivial(st_path) ? gr_true : gr_false;
       
    46 +#else
       
    47  		se_acl = NULL;
       
    48  #endif
       
    49 +#endif
       
    50  
       
    51                  item = probe_item_create(OVAL_UNIX_FILE, NULL,
       
    52                                           "filepath", OVAL_DATATYPE_SEXP, se_filepath,
       
    53 @@ -355,6 +370,10 @@
       
    54  #define STR_SOCKET    "socket"
       
    55  #define STR_CHARSPEC  "character special"
       
    56  #define STRLEN_PAIR(str) (str), strlen(str)
       
    57 +#if	defined(__SVR4) && (__sun)
       
    58 +#define	STR_DOOR	"door"
       
    59 +#define	STR_PORT	"port"
       
    60 +#endif
       
    61  
       
    62          gr_t_reg  = SEXP_string_new (STRLEN_PAIR(STR_REGULAR));
       
    63          gr_t_dir  = SEXP_string_new (STRLEN_PAIR(STR_DIRECTORY));
       
    64 @@ -363,6 +382,10 @@
       
    65          gr_t_fifo = SEXP_string_new (STRLEN_PAIR(STR_FIFO));
       
    66          gr_t_sock = SEXP_string_new (STRLEN_PAIR(STR_SOCKET));
       
    67          gr_t_char = SEXP_string_new (STRLEN_PAIR(STR_CHARSPEC));
       
    68 +#if	defined(__SVR4) && (__sun)
       
    69 +        gr_t_door = SEXP_string_new (STRLEN_PAIR(STR_DOOR));
       
    70 +        gr_t_port = SEXP_string_new (STRLEN_PAIR(STR_PORT));
       
    71 +#endif
       
    72  
       
    73  	SEXP_init(&gr_lastpath);
       
    74