diff --git a/.gitignore b/.gitignore index 1b2a47e..bfada18 100644 --- a/.gitignore +++ b/.gitignore @@ -200,3 +200,4 @@ libselinux-2.0.96.tgz /libselinux-2.2.2.tgz /libselinux-2.3.tgz /libselinux-2.3.tar.gz +/libselinux-2.4.tar.gz diff --git a/libselinux-rhat.patch b/libselinux-rhat.patch index c226b08..c7ab814 100644 --- a/libselinux-rhat.patch +++ b/libselinux-rhat.patch @@ -1,18 +1,18 @@ -diff --git libselinux-2.3/Makefile libselinux-2.3/Makefile +diff --git libselinux-2.4/Makefile libselinux-2.4/Makefile index 6142b60..bdf9de8 100644 ---- libselinux-2.3/Makefile -+++ libselinux-2.3/Makefile +--- libselinux-2.4/Makefile ++++ libselinux-2.4/Makefile @@ -1,4 +1,4 @@ -SUBDIRS = src include utils man +SUBDIRS = src include utils man golang DISABLE_AVC ?= n DISABLE_SETRANS ?= n -diff --git libselinux-2.3/golang/Makefile libselinux-2.3/golang/Makefile +diff --git libselinux-2.4/golang/Makefile libselinux-2.4/golang/Makefile new file mode 100644 index 0000000..b75677b --- /dev/null -+++ libselinux-2.3/golang/Makefile ++++ libselinux-2.4/golang/Makefile @@ -0,0 +1,22 @@ +# Installation directories. +PREFIX ?= $(DESTDIR)/usr @@ -36,11 +36,11 @@ index 0000000..b75677b +indent: + +relabel: -diff --git libselinux-2.3/golang/selinux.go libselinux-2.3/golang/selinux.go +diff --git libselinux-2.4/golang/selinux.go libselinux-2.4/golang/selinux.go new file mode 100644 index 0000000..34bf6bb --- /dev/null -+++ libselinux-2.3/golang/selinux.go ++++ libselinux-2.4/golang/selinux.go @@ -0,0 +1,412 @@ +package selinux + @@ -454,11 +454,11 @@ index 0000000..34bf6bb + fmt.Println(Getfscreatecon()) + fmt.Println(Getpidcon(1)) +} -diff --git libselinux-2.3/golang/test.go libselinux-2.3/golang/test.go +diff --git libselinux-2.4/golang/test.go libselinux-2.4/golang/test.go new file mode 100644 index 0000000..fed6de8 --- /dev/null -+++ libselinux-2.3/golang/test.go ++++ libselinux-2.4/golang/test.go @@ -0,0 +1,9 @@ +package main + @@ -469,10 +469,10 @@ index 0000000..fed6de8 +func main() { + selinux.Test() +} -diff --git libselinux-2.3/include/selinux/selinux.h libselinux-2.3/include/selinux/selinux.h +diff --git libselinux-2.4/include/selinux/selinux.h libselinux-2.4/include/selinux/selinux.h index d0eb5c6..4beb170 100644 ---- libselinux-2.3/include/selinux/selinux.h -+++ libselinux-2.3/include/selinux/selinux.h +--- libselinux-2.4/include/selinux/selinux.h ++++ libselinux-2.4/include/selinux/selinux.h @@ -543,6 +543,7 @@ extern const char *selinux_virtual_image_context_path(void); extern const char *selinux_lxc_contexts_path(void); extern const char *selinux_x_context_path(void); @@ -481,10 +481,10 @@ index d0eb5c6..4beb170 100644 extern const char *selinux_systemd_contexts_path(void); extern const char *selinux_contexts_path(void); extern const char *selinux_securetty_types_path(void); -diff --git libselinux-2.3/man/man3/getfscreatecon.3 libselinux-2.3/man/man3/getfscreatecon.3 +diff --git libselinux-2.4/man/man3/getfscreatecon.3 libselinux-2.4/man/man3/getfscreatecon.3 index e348d3b..8cc4df5 100644 ---- libselinux-2.3/man/man3/getfscreatecon.3 -+++ libselinux-2.3/man/man3/getfscreatecon.3 +--- libselinux-2.4/man/man3/getfscreatecon.3 ++++ libselinux-2.4/man/man3/getfscreatecon.3 @@ -49,6 +49,11 @@ Signal handlers that perform a must take care to save, reset, and restore the fscreate context to avoid unexpected behavior. @@ -497,10 +497,10 @@ index e348d3b..8cc4df5 100644 .SH "RETURN VALUE" On error \-1 is returned. On success 0 is returned. -diff --git libselinux-2.3/man/man3/getkeycreatecon.3 libselinux-2.3/man/man3/getkeycreatecon.3 +diff --git libselinux-2.4/man/man3/getkeycreatecon.3 libselinux-2.4/man/man3/getkeycreatecon.3 index 4d70f10..b51008d 100644 ---- libselinux-2.3/man/man3/getkeycreatecon.3 -+++ libselinux-2.3/man/man3/getkeycreatecon.3 +--- libselinux-2.4/man/man3/getkeycreatecon.3 ++++ libselinux-2.4/man/man3/getkeycreatecon.3 @@ -48,6 +48,10 @@ Signal handlers that perform a .BR setkeycreatecon () must take care to @@ -512,10 +512,10 @@ index 4d70f10..b51008d 100644 . .SH "RETURN VALUE" On error \-1 is returned. -diff --git libselinux-2.3/man/man3/getsockcreatecon.3 libselinux-2.3/man/man3/getsockcreatecon.3 +diff --git libselinux-2.4/man/man3/getsockcreatecon.3 libselinux-2.4/man/man3/getsockcreatecon.3 index 4dd8f30..26086d9 100644 ---- libselinux-2.3/man/man3/getsockcreatecon.3 -+++ libselinux-2.3/man/man3/getsockcreatecon.3 +--- libselinux-2.4/man/man3/getsockcreatecon.3 ++++ libselinux-2.4/man/man3/getsockcreatecon.3 @@ -49,6 +49,11 @@ Signal handlers that perform a must take care to save, reset, and restore the sockcreate context to avoid unexpected behavior. @@ -528,10 +528,10 @@ index 4dd8f30..26086d9 100644 .SH "RETURN VALUE" On error \-1 is returned. On success 0 is returned. -diff --git libselinux-2.3/man/man3/matchpathcon.3 libselinux-2.3/man/man3/matchpathcon.3 +diff --git libselinux-2.4/man/man3/matchpathcon.3 libselinux-2.4/man/man3/matchpathcon.3 index 1bc7ba1..177f15d 100644 ---- libselinux-2.3/man/man3/matchpathcon.3 -+++ libselinux-2.3/man/man3/matchpathcon.3 +--- libselinux-2.4/man/man3/matchpathcon.3 ++++ libselinux-2.4/man/man3/matchpathcon.3 @@ -7,7 +7,7 @@ matchpathcon, matchpathcon_index \- get the default SELinux security context for .sp .BI "int matchpathcon_init(const char *" path ");" @@ -605,10 +605,10 @@ index 1bc7ba1..177f15d 100644 configuration and sets the security context .I con to refer to the -diff --git libselinux-2.3/man/man5/selabel_file.5 libselinux-2.3/man/man5/selabel_file.5 +diff --git libselinux-2.4/man/man5/selabel_file.5 libselinux-2.4/man/man5/selabel_file.5 index 79eca95..e738824 100644 ---- libselinux-2.3/man/man5/selabel_file.5 -+++ libselinux-2.3/man/man5/selabel_file.5 +--- libselinux-2.4/man/man5/selabel_file.5 ++++ libselinux-2.4/man/man5/selabel_file.5 @@ -55,7 +55,9 @@ A non-null value for this option specifies a path to a file that will be opened A non-null value for this option indicates that any local customizations to the file contexts mapping should be ignored. .TP @@ -629,19 +629,10 @@ index 79eca95..e738824 100644 .IP "3." 4 Depending on the version of SELinux it is possible that a \fIfile_contexts.template\fR file may also be present, however this is now deprecated. .br -diff --git libselinux-2.3/man/man8/selinux.8 libselinux-2.3/man/man8/selinux.8 -index e89b1ef..fd20363 100644 ---- libselinux-2.3/man/man8/selinux.8 -+++ libselinux-2.3/man/man8/selinux.8 -@@ -74,7 +74,7 @@ The best way to relabel the file system is to create the flag file - and reboot. - .BR system\-config\-selinux , - also has this capability. The --.BR restorcon / fixfiles -+.BR restorecon / fixfiles - commands are also available for relabeling files. - . - .SH AUTHOR +diff --git libselinux-2.4/man/man8/selinux.8 libselinux-2.4/man/man8/selinux.8 +index 9e3bdc4..fd20363 100644 +--- libselinux-2.4/man/man8/selinux.8 ++++ libselinux-2.4/man/man8/selinux.8 @@ -91,11 +91,13 @@ This manual page was written by Dan Walsh . .BR sepolicy (8), .BR system-config-selinux (8), @@ -658,10 +649,10 @@ index e89b1ef..fd20363 100644 Every confined service on the system has a man page in the following format: .br -diff --git libselinux-2.3/src/Makefile libselinux-2.3/src/Makefile -index 4d07ba6..0a34d9b 100644 ---- libselinux-2.3/src/Makefile -+++ libselinux-2.3/src/Makefile +diff --git libselinux-2.4/src/Makefile libselinux-2.4/src/Makefile +index 82cb6ed..ac25c1f 100644 +--- libselinux-2.4/src/Makefile ++++ libselinux-2.4/src/Makefile @@ -59,7 +59,7 @@ CFLAGS ?= -O -Wall -W -Wundef -Wformat-y2k -Wformat-security -Winit-self -Wmissi -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes \ -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute \ @@ -671,10 +662,10 @@ index 4d07ba6..0a34d9b 100644 -Wsync-nand -Wattributes -Wcoverage-mismatch -Wmultichar -Wcpp \ -Wdeprecated-declarations -Wdiv-by-zero -Wdouble-promotion -Wendif-labels -Wextra \ -Wformat-contains-nul -Wformat-extra-args -Wformat-zero-length -Wformat=2 -Wmultichar \ -diff --git libselinux-2.3/src/avc.c libselinux-2.3/src/avc.c +diff --git libselinux-2.4/src/avc.c libselinux-2.4/src/avc.c index 2bd7d13..b1ec57f 100644 ---- libselinux-2.3/src/avc.c -+++ libselinux-2.3/src/avc.c +--- libselinux-2.4/src/avc.c ++++ libselinux-2.4/src/avc.c @@ -288,7 +288,7 @@ void avc_av_stats(void) avc_release_lock(avc_lock); @@ -693,10 +684,10 @@ index 2bd7d13..b1ec57f 100644 ae->avd.seqno, avc_cache.latest_notif); errno = EAGAIN; rc = -1; -diff --git libselinux-2.3/src/avc_internal.c libselinux-2.3/src/avc_internal.c +diff --git libselinux-2.4/src/avc_internal.c libselinux-2.4/src/avc_internal.c index f735e73..be94857 100644 ---- libselinux-2.3/src/avc_internal.c -+++ libselinux-2.3/src/avc_internal.c +--- libselinux-2.4/src/avc_internal.c ++++ libselinux-2.4/src/avc_internal.c @@ -125,14 +125,14 @@ static int avc_netlink_receive(char *buf, unsigned buflen, int blocking) if (nladdrlen != sizeof nladdr) { @@ -723,10 +714,10 @@ index f735e73..be94857 100644 avc_prefix, msg->seqno); rc = avc_ss_reset(msg->seqno); if (rc < 0) { -diff --git libselinux-2.3/src/avc_sidtab.c libselinux-2.3/src/avc_sidtab.c +diff --git libselinux-2.4/src/avc_sidtab.c libselinux-2.4/src/avc_sidtab.c index 52f21df..c775430 100644 ---- libselinux-2.3/src/avc_sidtab.c -+++ libselinux-2.3/src/avc_sidtab.c +--- libselinux-2.4/src/avc_sidtab.c ++++ libselinux-2.4/src/avc_sidtab.c @@ -81,6 +81,11 @@ sidtab_context_to_sid(struct sidtab *s, int hvalue, rc = 0; struct sidtab_node *cur; @@ -748,10 +739,10 @@ index 52f21df..c775430 100644 "chain length %d\n", avc_prefix, h->nel, slots_used, SIDTAB_SIZE, max_chain_len); } -diff --git libselinux-2.3/src/canonicalize_context.c libselinux-2.3/src/canonicalize_context.c +diff --git libselinux-2.4/src/canonicalize_context.c libselinux-2.4/src/canonicalize_context.c index 7cf3139..364a746 100644 ---- libselinux-2.3/src/canonicalize_context.c -+++ libselinux-2.3/src/canonicalize_context.c +--- libselinux-2.4/src/canonicalize_context.c ++++ libselinux-2.4/src/canonicalize_context.c @@ -17,6 +17,11 @@ int security_canonicalize_context_raw(const char * con, size_t size; int fd, ret; @@ -764,10 +755,10 @@ index 7cf3139..364a746 100644 if (!selinux_mnt) { errno = ENOENT; return -1; -diff --git libselinux-2.3/src/check_context.c libselinux-2.3/src/check_context.c +diff --git libselinux-2.4/src/check_context.c libselinux-2.4/src/check_context.c index 52063fa..234749c 100644 ---- libselinux-2.3/src/check_context.c -+++ libselinux-2.3/src/check_context.c +--- libselinux-2.4/src/check_context.c ++++ libselinux-2.4/src/check_context.c @@ -14,6 +14,11 @@ int security_check_context_raw(const char * con) char path[PATH_MAX]; int fd, ret; @@ -780,10 +771,10 @@ index 52063fa..234749c 100644 if (!selinux_mnt) { errno = ENOENT; return -1; -diff --git libselinux-2.3/src/compute_av.c libselinux-2.3/src/compute_av.c +diff --git libselinux-2.4/src/compute_av.c libselinux-2.4/src/compute_av.c index 937e5c3..35ace7f 100644 ---- libselinux-2.3/src/compute_av.c -+++ libselinux-2.3/src/compute_av.c +--- libselinux-2.4/src/compute_av.c ++++ libselinux-2.4/src/compute_av.c @@ -26,6 +26,11 @@ int security_compute_av_flags_raw(const char * scon, return -1; } @@ -796,10 +787,10 @@ index 937e5c3..35ace7f 100644 snprintf(path, sizeof path, "%s/access", selinux_mnt); fd = open(path, O_RDWR); if (fd < 0) -diff --git libselinux-2.3/src/compute_create.c libselinux-2.3/src/compute_create.c +diff --git libselinux-2.4/src/compute_create.c libselinux-2.4/src/compute_create.c index 9559d42..14a65d1 100644 ---- libselinux-2.3/src/compute_create.c -+++ libselinux-2.3/src/compute_create.c +--- libselinux-2.4/src/compute_create.c ++++ libselinux-2.4/src/compute_create.c @@ -64,6 +64,11 @@ int security_compute_create_name_raw(const char * scon, return -1; } @@ -812,10 +803,10 @@ index 9559d42..14a65d1 100644 snprintf(path, sizeof path, "%s/create", selinux_mnt); fd = open(path, O_RDWR); if (fd < 0) -diff --git libselinux-2.3/src/compute_member.c libselinux-2.3/src/compute_member.c +diff --git libselinux-2.4/src/compute_member.c libselinux-2.4/src/compute_member.c index 1fc7e41..065d996 100644 ---- libselinux-2.3/src/compute_member.c -+++ libselinux-2.3/src/compute_member.c +--- libselinux-2.4/src/compute_member.c ++++ libselinux-2.4/src/compute_member.c @@ -25,6 +25,11 @@ int security_compute_member_raw(const char * scon, return -1; } @@ -828,10 +819,10 @@ index 1fc7e41..065d996 100644 snprintf(path, sizeof path, "%s/member", selinux_mnt); fd = open(path, O_RDWR); if (fd < 0) -diff --git libselinux-2.3/src/compute_relabel.c libselinux-2.3/src/compute_relabel.c +diff --git libselinux-2.4/src/compute_relabel.c libselinux-2.4/src/compute_relabel.c index 4615aee..cc77f36 100644 ---- libselinux-2.3/src/compute_relabel.c -+++ libselinux-2.3/src/compute_relabel.c +--- libselinux-2.4/src/compute_relabel.c ++++ libselinux-2.4/src/compute_relabel.c @@ -25,6 +25,11 @@ int security_compute_relabel_raw(const char * scon, return -1; } @@ -844,10 +835,10 @@ index 4615aee..cc77f36 100644 snprintf(path, sizeof path, "%s/relabel", selinux_mnt); fd = open(path, O_RDWR); if (fd < 0) -diff --git libselinux-2.3/src/compute_user.c libselinux-2.3/src/compute_user.c +diff --git libselinux-2.4/src/compute_user.c libselinux-2.4/src/compute_user.c index b37c5d3..7703c26 100644 ---- libselinux-2.3/src/compute_user.c -+++ libselinux-2.3/src/compute_user.c +--- libselinux-2.4/src/compute_user.c ++++ libselinux-2.4/src/compute_user.c @@ -24,6 +24,11 @@ int security_compute_user_raw(const char * scon, return -1; } @@ -860,10 +851,10 @@ index b37c5d3..7703c26 100644 snprintf(path, sizeof path, "%s/user", selinux_mnt); fd = open(path, O_RDWR); if (fd < 0) -diff --git libselinux-2.3/src/enabled.c libselinux-2.3/src/enabled.c +diff --git libselinux-2.4/src/enabled.c libselinux-2.4/src/enabled.c index 5c252dd..bb659a9 100644 ---- libselinux-2.3/src/enabled.c -+++ libselinux-2.3/src/enabled.c +--- libselinux-2.4/src/enabled.c ++++ libselinux-2.4/src/enabled.c @@ -11,26 +11,14 @@ int is_selinux_enabled(void) @@ -896,10 +887,10 @@ index 5c252dd..bb659a9 100644 } hidden_def(is_selinux_enabled) -diff --git libselinux-2.3/src/file_path_suffixes.h libselinux-2.3/src/file_path_suffixes.h +diff --git libselinux-2.4/src/file_path_suffixes.h libselinux-2.4/src/file_path_suffixes.h index 3c92424..d1f9b48 100644 ---- libselinux-2.3/src/file_path_suffixes.h -+++ libselinux-2.3/src/file_path_suffixes.h +--- libselinux-2.4/src/file_path_suffixes.h ++++ libselinux-2.4/src/file_path_suffixes.h @@ -23,6 +23,7 @@ S_(BINPOLICY, "/policy/policy") S_(VIRTUAL_DOMAIN, "/contexts/virtual_domain_context") S_(VIRTUAL_IMAGE, "/contexts/virtual_image_context") @@ -908,10 +899,10 @@ index 3c92424..d1f9b48 100644 S_(SYSTEMD_CONTEXTS, "/contexts/systemd_contexts") S_(FILE_CONTEXT_SUBS, "/contexts/files/file_contexts.subs") S_(FILE_CONTEXT_SUBS_DIST, "/contexts/files/file_contexts.subs_dist") -diff --git libselinux-2.3/src/fsetfilecon.c libselinux-2.3/src/fsetfilecon.c +diff --git libselinux-2.4/src/fsetfilecon.c libselinux-2.4/src/fsetfilecon.c index 52707d0..0cbe12d 100644 ---- libselinux-2.3/src/fsetfilecon.c -+++ libselinux-2.3/src/fsetfilecon.c +--- libselinux-2.4/src/fsetfilecon.c ++++ libselinux-2.4/src/fsetfilecon.c @@ -9,8 +9,12 @@ int fsetfilecon_raw(int fd, const char * context) @@ -927,10 +918,10 @@ index 52707d0..0cbe12d 100644 if (rc < 0 && errno == ENOTSUP) { char * ccontext = NULL; int err = errno; -diff --git libselinux-2.3/src/init.c libselinux-2.3/src/init.c +diff --git libselinux-2.4/src/init.c libselinux-2.4/src/init.c index 6d1ef33..3c687a2 100644 ---- libselinux-2.3/src/init.c -+++ libselinux-2.3/src/init.c +--- libselinux-2.4/src/init.c ++++ libselinux-2.4/src/init.c @@ -21,6 +21,8 @@ char *selinux_mnt = NULL; int selinux_page_size = 0; int obj_class_compat = 1; @@ -950,10 +941,10 @@ index 6d1ef33..3c687a2 100644 } static void fini_lib(void) __attribute__ ((destructor)); -diff --git libselinux-2.3/src/label_android_property.c libselinux-2.3/src/label_android_property.c +diff --git libselinux-2.4/src/label_android_property.c libselinux-2.4/src/label_android_property.c index b00eb07..5e1b76e 100644 ---- libselinux-2.3/src/label_android_property.c -+++ libselinux-2.3/src/label_android_property.c +--- libselinux-2.4/src/label_android_property.c ++++ libselinux-2.4/src/label_android_property.c @@ -101,7 +101,7 @@ static int process_line(struct selabel_handle *rec, items = sscanf(line_buf, "%255s %255s", prop, context); if (items != 2) { @@ -981,10 +972,10 @@ index b00eb07..5e1b76e 100644 path, lineno, context); return -1; } -diff --git libselinux-2.3/src/label_db.c libselinux-2.3/src/label_db.c -index ab0696a..00503a5 100644 ---- libselinux-2.3/src/label_db.c -+++ libselinux-2.3/src/label_db.c +diff --git libselinux-2.4/src/label_db.c libselinux-2.4/src/label_db.c +index 999dd46..1b48735 100644 +--- libselinux-2.4/src/label_db.c ++++ libselinux-2.4/src/label_db.c @@ -105,12 +105,12 @@ process_line(const char *path, char *line_buf, unsigned int line_num, * */ @@ -1000,8 +991,8 @@ index ab0696a..00503a5 100644 path, line_num); goto skip; } -@@ -142,7 +142,7 @@ process_line(const char *path, char *line_buf, unsigned int line_num, - spec->type = SELABEL_DB_LANGUAGE; +@@ -146,7 +146,7 @@ process_line(const char *path, char *line_buf, unsigned int line_num, + spec->type = SELABEL_DB_DATATYPE; else { selinux_log(SELINUX_WARNING, - "%s: line %d has invalid object type %s\n", @@ -1009,10 +1000,10 @@ index ab0696a..00503a5 100644 path, line_num, type); goto skip; } -diff --git libselinux-2.3/src/label_file.c libselinux-2.3/src/label_file.c -index 615aea9..c01991c 100644 ---- libselinux-2.3/src/label_file.c -+++ libselinux-2.3/src/label_file.c +diff --git libselinux-2.4/src/label_file.c libselinux-2.4/src/label_file.c +index 8e7b288..2a43310 100644 +--- libselinux-2.4/src/label_file.c ++++ libselinux-2.4/src/label_file.c @@ -170,10 +170,10 @@ static int process_line(struct selabel_handle *rec, /* Skip comment lines and empty lines. */ if (*buf_p == '#' || *buf_p == 0) @@ -1038,16 +1029,16 @@ index 615aea9..c01991c 100644 @@ -214,7 +214,7 @@ static int process_line(struct selabel_handle *rec, if (type) { mode_t mode = string_to_mode(type); - if (mode == -1) { + if (mode == (mode_t)-1) { - COMPAT_LOG(SELINUX_WARNING, "%s: line %d has invalid file type %s\n", + COMPAT_LOG(SELINUX_WARNING, "%s: line %u has invalid file type %s\n", path, lineno, type); mode = 0; } -diff --git libselinux-2.3/src/label_media.c libselinux-2.3/src/label_media.c +diff --git libselinux-2.4/src/label_media.c libselinux-2.4/src/label_media.c index 227785f..a09486b 100644 ---- libselinux-2.3/src/label_media.c -+++ libselinux-2.3/src/label_media.c +--- libselinux-2.4/src/label_media.c ++++ libselinux-2.4/src/label_media.c @@ -44,10 +44,10 @@ static int process_line(const char *path, char *line_buf, int pass, /* Skip comment lines and empty lines. */ if (*buf_p == '#' || *buf_p == 0) @@ -1061,10 +1052,10 @@ index 227785f..a09486b 100644 lineno); if (items == 1) free(key); -diff --git libselinux-2.3/src/label_x.c libselinux-2.3/src/label_x.c +diff --git libselinux-2.4/src/label_x.c libselinux-2.4/src/label_x.c index 896ef02..8435b76 100644 ---- libselinux-2.3/src/label_x.c -+++ libselinux-2.3/src/label_x.c +--- libselinux-2.4/src/label_x.c ++++ libselinux-2.4/src/label_x.c @@ -46,10 +46,10 @@ static int process_line(const char *path, char *line_buf, int pass, /* Skip comment lines and empty lines. */ if (*buf_p == '#' || *buf_p == 0) @@ -1087,10 +1078,10 @@ index 896ef02..8435b76 100644 path, lineno, type); return 0; } -diff --git libselinux-2.3/src/lsetfilecon.c libselinux-2.3/src/lsetfilecon.c +diff --git libselinux-2.4/src/lsetfilecon.c libselinux-2.4/src/lsetfilecon.c index 1d3b28a..ea6d70b 100644 ---- libselinux-2.3/src/lsetfilecon.c -+++ libselinux-2.3/src/lsetfilecon.c +--- libselinux-2.4/src/lsetfilecon.c ++++ libselinux-2.4/src/lsetfilecon.c @@ -9,8 +9,13 @@ int lsetfilecon_raw(const char *path, const char * context) @@ -1107,10 +1098,10 @@ index 1d3b28a..ea6d70b 100644 if (rc < 0 && errno == ENOTSUP) { char * ccontext = NULL; int err = errno; -diff --git libselinux-2.3/src/matchpathcon.c libselinux-2.3/src/matchpathcon.c +diff --git libselinux-2.4/src/matchpathcon.c libselinux-2.4/src/matchpathcon.c index 3b96b1d..3868711 100644 ---- libselinux-2.3/src/matchpathcon.c -+++ libselinux-2.3/src/matchpathcon.c +--- libselinux-2.4/src/matchpathcon.c ++++ libselinux-2.4/src/matchpathcon.c @@ -2,6 +2,7 @@ #include #include @@ -1137,10 +1128,10 @@ index 3b96b1d..3868711 100644 path, lineno, *ctx); } else { COMPAT_LOG(SELINUX_WARNING, -diff --git libselinux-2.3/src/selinux_config.c libselinux-2.3/src/selinux_config.c +diff --git libselinux-2.4/src/selinux_config.c libselinux-2.4/src/selinux_config.c index 30e9dc7..bec5f3b 100644 ---- libselinux-2.3/src/selinux_config.c -+++ libselinux-2.3/src/selinux_config.c +--- libselinux-2.4/src/selinux_config.c ++++ libselinux-2.4/src/selinux_config.c @@ -13,8 +13,6 @@ #include "selinux_internal.h" #include "get_default_type_internal.h" @@ -1176,10 +1167,10 @@ index 30e9dc7..bec5f3b 100644 const char *selinux_systemd_contexts_path(void) { return get_path(SYSTEMD_CONTEXTS); -diff --git libselinux-2.3/src/selinux_internal.h libselinux-2.3/src/selinux_internal.h +diff --git libselinux-2.4/src/selinux_internal.h libselinux-2.4/src/selinux_internal.h index afb2170..9b1ca4d 100644 ---- libselinux-2.3/src/selinux_internal.h -+++ libselinux-2.3/src/selinux_internal.h +--- libselinux-2.4/src/selinux_internal.h ++++ libselinux-2.4/src/selinux_internal.h @@ -82,6 +82,7 @@ hidden_proto(selinux_mkload_policy) hidden_proto(selinux_customizable_types_path) hidden_proto(selinux_media_context_path) @@ -1197,10 +1188,10 @@ index afb2170..9b1ca4d 100644 +#define SELINUXCONFIG SELINUXDIR "config" + +extern int has_selinux_config hidden; -diff --git libselinux-2.3/src/selinuxswig_python.i libselinux-2.3/src/selinuxswig_python.i +diff --git libselinux-2.4/src/selinuxswig_python.i libselinux-2.4/src/selinuxswig_python.i index ae72246..c9a2341 100644 ---- libselinux-2.3/src/selinuxswig_python.i -+++ libselinux-2.3/src/selinuxswig_python.i +--- libselinux-2.4/src/selinuxswig_python.i ++++ libselinux-2.4/src/selinuxswig_python.i @@ -31,9 +31,9 @@ def restorecon(path, recursive=False): lsetfilecon(path, context) @@ -1214,10 +1205,10 @@ index ae72246..c9a2341 100644 def chcon(path, context, recursive=False): """ Set the SELinux context on a given path """ -diff --git libselinux-2.3/src/setfilecon.c libselinux-2.3/src/setfilecon.c +diff --git libselinux-2.4/src/setfilecon.c libselinux-2.4/src/setfilecon.c index d05969c..3f0200e 100644 ---- libselinux-2.3/src/setfilecon.c -+++ libselinux-2.3/src/setfilecon.c +--- libselinux-2.4/src/setfilecon.c ++++ libselinux-2.4/src/setfilecon.c @@ -9,8 +9,12 @@ int setfilecon_raw(const char *path, const char * context) @@ -1233,10 +1224,10 @@ index d05969c..3f0200e 100644 if (rc < 0 && errno == ENOTSUP) { char * ccontext = NULL; int err = errno; -diff --git libselinux-2.3/utils/Makefile libselinux-2.3/utils/Makefile +diff --git libselinux-2.4/utils/Makefile libselinux-2.4/utils/Makefile index f469924..5499538 100644 ---- libselinux-2.3/utils/Makefile -+++ libselinux-2.3/utils/Makefile +--- libselinux-2.4/utils/Makefile ++++ libselinux-2.4/utils/Makefile @@ -11,7 +11,7 @@ CFLAGS ?= -O -Wall -W -Wundef -Wformat-y2k -Wformat-security -Winit-self -Wmissi -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes \ -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute \ @@ -1246,66 +1237,23 @@ index f469924..5499538 100644 -Wsync-nand -Wattributes -Wcoverage-mismatch -Wmultichar -Wcpp \ -Wdeprecated-declarations -Wdiv-by-zero -Wdouble-promotion -Wendif-labels -Wextra \ -Wformat-contains-nul -Wformat-extra-args -Wformat-zero-length -Wformat=2 -Wmultichar \ -diff --git libselinux-2.3/utils/sefcontext_compile.c libselinux-2.3/utils/sefcontext_compile.c -index 0adc968..fa392d1 100644 ---- libselinux-2.3/utils/sefcontext_compile.c -+++ libselinux-2.3/utils/sefcontext_compile.c -@@ -4,6 +4,9 @@ - #include - #include - #include -+#include -+#include -+#include - - #include - -@@ -70,7 +73,7 @@ static int process_file(struct saved_data *data, const char *filename) +diff --git libselinux-2.4/utils/sefcontext_compile.c libselinux-2.4/utils/sefcontext_compile.c +index 504699d..adb2b0c 100644 +--- libselinux-2.4/utils/sefcontext_compile.c ++++ libselinux-2.4/utils/sefcontext_compile.c +@@ -73,7 +73,7 @@ static int process_file(struct saved_data *data, const char *filename) spec->lr.ctx_raw = context; spec->mode = string_to_mode(mode); - if (spec->mode == -1) { + if (spec->mode == (mode_t)-1) { - fprintf(stderr, "%s: line %d has invalid file type %s\n", + fprintf(stderr, "%s: line %u has invalid file type %s\n", regex, line_num + 1, mode); spec->mode = 0; } -@@ -323,6 +326,7 @@ int main(int argc, char *argv[]) - int rc; - char *tmp= NULL; - int fd; -+ struct stat buf; - - if (argc != 2) { - fprintf(stderr, "usage: %s input_file\n", argv[0]); -@@ -333,6 +337,11 @@ int main(int argc, char *argv[]) - - path = argv[1]; - -+ if (stat(path, &buf) < 0) { -+ fprintf(stderr, "Can not stat: %s: %m\n", argv[0]); -+ exit(EXIT_FAILURE); -+ } -+ - rc = process_file(&data, path); - if (rc < 0) - return rc; -@@ -352,6 +361,12 @@ int main(int argc, char *argv[]) - if (fd < 0) - goto err; - -+ rc = fchmod(fd, buf.st_mode); -+ if (rc < 0) { -+ perror("fchmod failed to set permission on compiled regexs"); -+ goto err; -+ } -+ - rc = write_binary_file(&data, fd); - - if (rc < 0) -diff --git libselinux-2.3/utils/togglesebool.c libselinux-2.3/utils/togglesebool.c +diff --git libselinux-2.4/utils/togglesebool.c libselinux-2.4/utils/togglesebool.c index ad0d2a2..309f83b 100644 ---- libselinux-2.3/utils/togglesebool.c -+++ libselinux-2.3/utils/togglesebool.c +--- libselinux-2.4/utils/togglesebool.c ++++ libselinux-2.4/utils/togglesebool.c @@ -86,7 +86,7 @@ int main(int argc, char **argv) argv[i], pwd->pw_name); else diff --git a/libselinux.spec b/libselinux.spec index fff8f6c..85e6795 100644 --- a/libselinux.spec +++ b/libselinux.spec @@ -3,29 +3,29 @@ %endif %define ruby_inc %(pkg-config --cflags ruby) -%define libsepolver 2.1.9-1 +%define libsepolver 2.4-1 %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} Summary: SELinux library and simple utilities Name: libselinux -Version: 2.3 -Release: 11%{?dist} +Version: 2.4 +Release: 1%{?dist} License: Public Domain Group: System Environment/Libraries # https://github.com/SELinuxProject/selinux/wiki/Releases -Source: https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20140506/%{name}-%{version}.tgz +Source: https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20150202/%{name}-%{version}.tar.gz Source1: selinuxconlist.8 Source2: selinuxdefcon.8 Url: https://github.com/SELinuxProject/selinux/wiki # use make-rhat-patches.sh to create following patches from https://github.com/fedora-selinux/selinux/ -# HEAD https://github.com/fedora-selinux/selinux/commit/abdc02a720ed5ff430887758ec254b104f2d727d +# HEAD https://github.com/fedora-selinux/selinux/commit/36fd8bb4b36bb1ca3aa10e3226136459e6ed2498 Patch1: libselinux-rhat.patch BuildRequires: pkgconfig python-devel ruby-devel ruby libsepol-static >= %{libsepolver} swig pcre-devel xz-devel %if 0%{?with_python3} BuildRequires: python3-devel %endif # if with_python3 Requires: libsepol >= %{libsepolver} pcre -Conflicts: filesystem < 3 +Conflicts: filesystem < 3, selinux-policy < 3.13.1-138 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description @@ -245,6 +245,9 @@ rm -rf %{buildroot} %{ruby_vendorarchdir}/selinux.so %changelog +* Thu Jul 16 2015 Petr Lautrbach 2.4-1 +- Update to 2.4 release + * Wed Jun 17 2015 Fedora Release Engineering - 2.3-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild diff --git a/make-rhat-patches.sh b/make-rhat-patches.sh index 646d370..9a47cda 100755 --- a/make-rhat-patches.sh +++ b/make-rhat-patches.sh @@ -1,6 +1,6 @@ #!/bin/bash -LIBSELINUX_VERSION=2.3 +LIBSELINUX_VERSION=2.4 BRANCH=master REBASEDIR=`mktemp -d rebase.XXXXXX` diff --git a/sources b/sources index e992084..15159ba 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -e3383194da6a923f40d3a75178b86a7a libselinux-2.3.tgz -b11d4d95ef4bde732dbc8462df57a1e5 libselinux-2.3.tar.gz +d19af2a367a81fb00bedc1b381694995 libselinux-2.4.tar.gz