components/openscap/patches/file.c.patch
author Jacob Varughese <jacob.varughese@oracle.com>
Wed, 09 Oct 2013 09:17:23 -0700
changeset 1502 89c98773d0af
parent 1369 20813e08fff3
child 3595 3fab3649e6cd
permissions -rw-r--r--
17270625 textfilecontent54 probe fails to match patterns in file XScreensaver 17329762 file probe does not return has_extended_acl info 17329743 uname probe does not return processor type correctly 17382171 isainfo probe does not correct value for isainfo -n

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);