components/openscap/patches/file.c.patch
author Norm Jacobs <Norm.Jacobs@Oracle.COM>
Fri, 21 Mar 2014 00:13:55 -0700
branchs11-update
changeset 2996 9d8e1fd67549
parent 2821 8add1494802c
child 3595 3fab3649e6cd
permissions -rw-r--r--
15818459 SUNBT7200992 gcc45 needs a 'link path=usr/gcc/4.5/share/info/dir ...' action

Fixed issue with file probe not returning has_extended_acl on solaris.
This patch fixes the file probe from crashing on solaris when encountering file
types of door and port.
This patch has not been contributed upstream, but is planned to be done by
2013-Jul-12.

--- openscap-0.9.7/src/OVAL/probes/unix/file.c.~1~	2013-04-23 06:21:51.447000001 -0700
+++ openscap-0.9.7/src/OVAL/probes/unix/file.c	2013-08-16 13:04:51.171523322 -0700
@@ -77,6 +77,9 @@
 #else
 # error "Sorry, your OS isn't supported."
 #endif
+#if defined(__SVR4) && defined(__sun)
+#include <sys/acl.h>
+#endif
 
 oval_version_t over;
 
@@ -84,6 +87,9 @@
 static SEXP_t *gr_t_dir  = NULL, *gr_t_lnk  = NULL, *gr_t_blk  = NULL;
 static SEXP_t *gr_t_fifo = NULL, *gr_t_sock = NULL, *gr_t_char = NULL;
 static SEXP_t  gr_lastpath;
+#if defined(__SVR4) && defined(__sun)
+static SEXP_t *gr_t_door = NULL, *gr_t_port = NULL;
+#endif
 
 static SEXP_t *se_filetype (mode_t mode)
 {
@@ -95,6 +101,10 @@
         case S_IFIFO:  return (gr_t_fifo);
         case S_IFSOCK: return (gr_t_sock);
         case S_IFCHR:  return (gr_t_char);
+#if	defined(__SVR4) && defined(__sun)
+	case S_IFDOOR: return (gr_t_door);
+	case S_IFPORT: return (gr_t_port);
+#endif
         default:
                 abort ();
         }
@@ -286,8 +297,12 @@
 			se_acl = acl_extended_file(st_path) ? gr_true : gr_false;
 		}
 #else
+#if defined(__SVR4) && defined(__sun)
+		se_acl = acl_trivial(st_path) ? gr_true : gr_false;
+#else
 		se_acl = NULL;
 #endif
+#endif
 
                 item = probe_item_create(OVAL_UNIX_FILE, NULL,
                                          "filepath", OVAL_DATATYPE_SEXP, se_filepath,
@@ -355,6 +370,10 @@
 #define STR_SOCKET    "socket"
 #define STR_CHARSPEC  "character special"
 #define STRLEN_PAIR(str) (str), strlen(str)
+#if	defined(__SVR4) && (__sun)
+#define	STR_DOOR	"door"
+#define	STR_PORT	"port"
+#endif
 
         gr_t_reg  = SEXP_string_new (STRLEN_PAIR(STR_REGULAR));
         gr_t_dir  = SEXP_string_new (STRLEN_PAIR(STR_DIRECTORY));
@@ -363,6 +382,10 @@
         gr_t_fifo = SEXP_string_new (STRLEN_PAIR(STR_FIFO));
         gr_t_sock = SEXP_string_new (STRLEN_PAIR(STR_SOCKET));
         gr_t_char = SEXP_string_new (STRLEN_PAIR(STR_CHARSPEC));
+#if	defined(__SVR4) && (__sun)
+        gr_t_door = SEXP_string_new (STRLEN_PAIR(STR_DOOR));
+        gr_t_port = SEXP_string_new (STRLEN_PAIR(STR_PORT));
+#endif
 
 	SEXP_init(&gr_lastpath);