2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/man/man8/selinux.8 libselinux-2.8-rc3/man/man8/selinux.8
|
2017-08-07 11:56:34 +00:00
|
|
|
index e37aee6..bf23b65 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/man/man8/selinux.8
|
|
|
|
+++ libselinux-2.8-rc3/man/man8/selinux.8
|
2016-01-08 21:39:45 +00:00
|
|
|
@@ -91,11 +91,13 @@ This manual page was written by Dan Walsh <dwalsh@redhat.com>.
|
|
|
|
.BR sepolicy (8),
|
|
|
|
.BR system-config-selinux (8),
|
|
|
|
.BR togglesebool (8),
|
|
|
|
-.BR restorecon (8),
|
|
|
|
.BR fixfiles (8),
|
|
|
|
+.BR restorecon (8),
|
|
|
|
.BR setfiles (8),
|
|
|
|
.BR semanage (8),
|
2017-08-07 11:56:34 +00:00
|
|
|
.BR sepolicy (8)
|
|
|
|
+.BR seinfo (8),
|
|
|
|
+.BR sesearch (8)
|
2016-01-08 21:39:45 +00:00
|
|
|
|
|
|
|
Every confined service on the system has a man page in the following format:
|
|
|
|
.br
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/src/avc_sidtab.c libselinux-2.8-rc3/src/avc_sidtab.c
|
2016-01-08 21:39:45 +00:00
|
|
|
index 9669264..c775430 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/src/avc_sidtab.c
|
|
|
|
+++ libselinux-2.8-rc3/src/avc_sidtab.c
|
2016-01-08 21:39:45 +00:00
|
|
|
@@ -81,6 +81,11 @@ sidtab_context_to_sid(struct sidtab *s,
|
|
|
|
int hvalue, rc = 0;
|
|
|
|
struct sidtab_node *cur;
|
|
|
|
|
|
|
|
+ if (! ctx) {
|
|
|
|
+ errno=EINVAL;
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
*sid = NULL;
|
|
|
|
hvalue = sidtab_hash(ctx);
|
|
|
|
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/src/booleans.c libselinux-2.8-rc3/src/booleans.c
|
|
|
|
index b3ea362..a6d46fe 100644
|
|
|
|
--- libselinux-2.8-rc3/src/booleans.c
|
|
|
|
+++ libselinux-2.8-rc3/src/booleans.c
|
2017-03-22 09:15:36 +00:00
|
|
|
@@ -55,6 +55,7 @@ int security_get_boolean_names(char ***names, int *len)
|
|
|
|
snprintf(path, sizeof path, "%s%s", selinux_mnt, SELINUX_BOOL_DIR);
|
|
|
|
*len = scandir(path, &namelist, &filename_select, alphasort);
|
|
|
|
if (*len <= 0) {
|
|
|
|
+ errno = ENOENT;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/src/canonicalize_context.c libselinux-2.8-rc3/src/canonicalize_context.c
|
2017-08-07 11:56:34 +00:00
|
|
|
index ba4c9a2..c815872 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/src/canonicalize_context.c
|
|
|
|
+++ libselinux-2.8-rc3/src/canonicalize_context.c
|
2016-01-08 21:39:45 +00:00
|
|
|
@@ -17,6 +17,11 @@ int security_canonicalize_context_raw(const char * con,
|
|
|
|
size_t size;
|
|
|
|
int fd, ret;
|
|
|
|
|
|
|
|
+ if (! con) {
|
|
|
|
+ errno=EINVAL;
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (!selinux_mnt) {
|
|
|
|
errno = ENOENT;
|
|
|
|
return -1;
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/src/check_context.c libselinux-2.8-rc3/src/check_context.c
|
2017-08-07 11:56:34 +00:00
|
|
|
index 8a7997f..5be8434 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/src/check_context.c
|
|
|
|
+++ libselinux-2.8-rc3/src/check_context.c
|
2016-01-08 21:39:45 +00:00
|
|
|
@@ -14,6 +14,11 @@ int security_check_context_raw(const char * con)
|
|
|
|
char path[PATH_MAX];
|
|
|
|
int fd, ret;
|
|
|
|
|
|
|
|
+ if (! con) {
|
|
|
|
+ errno=EINVAL;
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (!selinux_mnt) {
|
|
|
|
errno = ENOENT;
|
|
|
|
return -1;
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/src/compute_av.c libselinux-2.8-rc3/src/compute_av.c
|
2017-08-07 11:56:34 +00:00
|
|
|
index 1d05e7b..d9095cc 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/src/compute_av.c
|
|
|
|
+++ libselinux-2.8-rc3/src/compute_av.c
|
2016-01-08 21:39:45 +00:00
|
|
|
@@ -26,6 +26,11 @@ int security_compute_av_flags_raw(const char * scon,
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if ((! scon) || (! tcon)) {
|
|
|
|
+ errno=EINVAL;
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
snprintf(path, sizeof path, "%s/access", selinux_mnt);
|
2017-08-07 11:56:34 +00:00
|
|
|
fd = open(path, O_RDWR | O_CLOEXEC);
|
2016-01-08 21:39:45 +00:00
|
|
|
if (fd < 0)
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/src/compute_create.c libselinux-2.8-rc3/src/compute_create.c
|
2017-08-07 11:56:34 +00:00
|
|
|
index 0975aea..3e6a48c 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/src/compute_create.c
|
|
|
|
+++ libselinux-2.8-rc3/src/compute_create.c
|
2016-01-08 21:39:45 +00:00
|
|
|
@@ -64,6 +64,11 @@ int security_compute_create_name_raw(const char * scon,
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if ((! scon) || (! tcon)) {
|
|
|
|
+ errno=EINVAL;
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
snprintf(path, sizeof path, "%s/create", selinux_mnt);
|
2017-08-07 11:56:34 +00:00
|
|
|
fd = open(path, O_RDWR | O_CLOEXEC);
|
2016-01-08 21:39:45 +00:00
|
|
|
if (fd < 0)
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/src/compute_member.c libselinux-2.8-rc3/src/compute_member.c
|
2017-08-07 11:56:34 +00:00
|
|
|
index 4e2d221..d1dd977 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/src/compute_member.c
|
|
|
|
+++ libselinux-2.8-rc3/src/compute_member.c
|
2016-01-08 21:39:45 +00:00
|
|
|
@@ -25,6 +25,11 @@ int security_compute_member_raw(const char * scon,
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if ((! scon) || (! tcon)) {
|
|
|
|
+ errno=EINVAL;
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
snprintf(path, sizeof path, "%s/member", selinux_mnt);
|
2017-08-07 11:56:34 +00:00
|
|
|
fd = open(path, O_RDWR | O_CLOEXEC);
|
2016-01-08 21:39:45 +00:00
|
|
|
if (fd < 0)
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/src/compute_relabel.c libselinux-2.8-rc3/src/compute_relabel.c
|
2017-08-07 11:56:34 +00:00
|
|
|
index 49f77ef..c3db7c0 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/src/compute_relabel.c
|
|
|
|
+++ libselinux-2.8-rc3/src/compute_relabel.c
|
2016-01-08 21:39:45 +00:00
|
|
|
@@ -25,6 +25,11 @@ int security_compute_relabel_raw(const char * scon,
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if ((! scon) || (! tcon)) {
|
|
|
|
+ errno=EINVAL;
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
snprintf(path, sizeof path, "%s/relabel", selinux_mnt);
|
2017-08-07 11:56:34 +00:00
|
|
|
fd = open(path, O_RDWR | O_CLOEXEC);
|
2016-01-08 21:39:45 +00:00
|
|
|
if (fd < 0)
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/src/compute_user.c libselinux-2.8-rc3/src/compute_user.c
|
2017-08-07 11:56:34 +00:00
|
|
|
index 7b88121..401fd10 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/src/compute_user.c
|
|
|
|
+++ libselinux-2.8-rc3/src/compute_user.c
|
2016-01-08 21:39:45 +00:00
|
|
|
@@ -24,6 +24,11 @@ int security_compute_user_raw(const char * scon,
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (! scon) {
|
|
|
|
+ errno=EINVAL;
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
snprintf(path, sizeof path, "%s/user", selinux_mnt);
|
2017-08-07 11:56:34 +00:00
|
|
|
fd = open(path, O_RDWR | O_CLOEXEC);
|
2016-01-08 21:39:45 +00:00
|
|
|
if (fd < 0)
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/src/fsetfilecon.c libselinux-2.8-rc3/src/fsetfilecon.c
|
2016-01-08 21:39:45 +00:00
|
|
|
index 52707d0..0cbe12d 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/src/fsetfilecon.c
|
|
|
|
+++ libselinux-2.8-rc3/src/fsetfilecon.c
|
2016-01-08 21:39:45 +00:00
|
|
|
@@ -9,8 +9,12 @@
|
|
|
|
|
|
|
|
int fsetfilecon_raw(int fd, const char * context)
|
|
|
|
{
|
|
|
|
- int rc = fsetxattr(fd, XATTR_NAME_SELINUX, context, strlen(context) + 1,
|
|
|
|
- 0);
|
|
|
|
+ int rc;
|
|
|
|
+ if (! context) {
|
|
|
|
+ errno=EINVAL;
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ rc = fsetxattr(fd, XATTR_NAME_SELINUX, context, strlen(context) + 1, 0);
|
|
|
|
if (rc < 0 && errno == ENOTSUP) {
|
|
|
|
char * ccontext = NULL;
|
|
|
|
int err = errno;
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/src/lsetfilecon.c libselinux-2.8-rc3/src/lsetfilecon.c
|
2016-01-08 21:39:45 +00:00
|
|
|
index 1d3b28a..ea6d70b 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/src/lsetfilecon.c
|
|
|
|
+++ libselinux-2.8-rc3/src/lsetfilecon.c
|
2016-01-08 21:39:45 +00:00
|
|
|
@@ -9,8 +9,13 @@
|
|
|
|
|
|
|
|
int lsetfilecon_raw(const char *path, const char * context)
|
|
|
|
{
|
|
|
|
- int rc = lsetxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1,
|
|
|
|
- 0);
|
|
|
|
+ int rc;
|
|
|
|
+ if (! context) {
|
|
|
|
+ errno=EINVAL;
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ rc = lsetxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1, 0);
|
|
|
|
if (rc < 0 && errno == ENOTSUP) {
|
|
|
|
char * ccontext = NULL;
|
|
|
|
int err = errno;
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/src/setfilecon.c libselinux-2.8-rc3/src/setfilecon.c
|
2016-01-08 21:39:45 +00:00
|
|
|
index d05969c..3f0200e 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/src/setfilecon.c
|
|
|
|
+++ libselinux-2.8-rc3/src/setfilecon.c
|
2016-01-08 21:39:45 +00:00
|
|
|
@@ -9,8 +9,12 @@
|
|
|
|
|
|
|
|
int setfilecon_raw(const char *path, const char * context)
|
|
|
|
{
|
|
|
|
- int rc = setxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1,
|
|
|
|
- 0);
|
|
|
|
+ int rc;
|
|
|
|
+ if (! context) {
|
|
|
|
+ errno=EINVAL;
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ rc = setxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1, 0);
|
|
|
|
if (rc < 0 && errno == ENOTSUP) {
|
|
|
|
char * ccontext = NULL;
|
|
|
|
int err = errno;
|
2018-05-14 17:00:16 +00:00
|
|
|
diff --git libselinux-2.8-rc3/utils/matchpathcon.c libselinux-2.8-rc3/utils/matchpathcon.c
|
2017-08-07 11:56:34 +00:00
|
|
|
index 67e4a43..9756d7d 100644
|
2018-05-14 17:00:16 +00:00
|
|
|
--- libselinux-2.8-rc3/utils/matchpathcon.c
|
|
|
|
+++ libselinux-2.8-rc3/utils/matchpathcon.c
|
2017-08-07 11:56:34 +00:00
|
|
|
@@ -14,7 +14,7 @@
|
|
|
|
static __attribute__ ((__noreturn__)) void usage(const char *progname)
|
2017-03-22 09:15:36 +00:00
|
|
|
{
|
|
|
|
fprintf(stderr,
|
|
|
|
- "usage: %s [-N] [-n] [-f file_contexts] [ -P policy_root_path ] [-p prefix] [-Vq] path...\n",
|
|
|
|
+ "usage: %s [-V] [-N] [-n] [-m type] [-f file_contexts_file] [-p prefix] [-P policy_root_path] filepath...\n",
|
|
|
|
progname);
|
|
|
|
exit(1);
|
|
|
|
}
|