|
|
6aa9d48 |
diff --git libselinux-2.9/man/man8/selinux.8 libselinux-2.9/man/man8/selinux.8
|
|
|
2f49e06 |
index e37aee6..bf23b65 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/man/man8/selinux.8
|
|
|
6aa9d48 |
+++ libselinux-2.9/man/man8/selinux.8
|
|
|
e58e944 |
@@ -91,11 +91,13 @@ This manual page was written by Dan Walsh <dwalsh@redhat.com>.
|
|
|
e58e944 |
.BR sepolicy (8),
|
|
|
e58e944 |
.BR system-config-selinux (8),
|
|
|
e58e944 |
.BR togglesebool (8),
|
|
|
e58e944 |
-.BR restorecon (8),
|
|
|
e58e944 |
.BR fixfiles (8),
|
|
|
e58e944 |
+.BR restorecon (8),
|
|
|
e58e944 |
.BR setfiles (8),
|
|
|
e58e944 |
.BR semanage (8),
|
|
|
2f49e06 |
.BR sepolicy (8)
|
|
|
2f49e06 |
+.BR seinfo (8),
|
|
|
2f49e06 |
+.BR sesearch (8)
|
|
|
e58e944 |
|
|
|
e58e944 |
Every confined service on the system has a man page in the following format:
|
|
|
e58e944 |
.br
|
|
|
6aa9d48 |
diff --git libselinux-2.9/src/avc_sidtab.c libselinux-2.9/src/avc_sidtab.c
|
|
|
e58e944 |
index 9669264..c775430 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/src/avc_sidtab.c
|
|
|
6aa9d48 |
+++ libselinux-2.9/src/avc_sidtab.c
|
|
|
e58e944 |
@@ -81,6 +81,11 @@ sidtab_context_to_sid(struct sidtab *s,
|
|
|
e58e944 |
int hvalue, rc = 0;
|
|
|
e58e944 |
struct sidtab_node *cur;
|
|
|
e58e944 |
|
|
|
e58e944 |
+ if (! ctx) {
|
|
|
e58e944 |
+ errno=EINVAL;
|
|
|
e58e944 |
+ return -1;
|
|
|
e58e944 |
+ }
|
|
|
e58e944 |
+
|
|
|
e58e944 |
*sid = NULL;
|
|
|
e58e944 |
hvalue = sidtab_hash(ctx);
|
|
|
e58e944 |
|
|
|
6aa9d48 |
diff --git libselinux-2.9/src/canonicalize_context.c libselinux-2.9/src/canonicalize_context.c
|
|
|
2f49e06 |
index ba4c9a2..c815872 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/src/canonicalize_context.c
|
|
|
6aa9d48 |
+++ libselinux-2.9/src/canonicalize_context.c
|
|
|
e58e944 |
@@ -17,6 +17,11 @@ int security_canonicalize_context_raw(const char * con,
|
|
|
e58e944 |
size_t size;
|
|
|
e58e944 |
int fd, ret;
|
|
|
e58e944 |
|
|
|
e58e944 |
+ if (! con) {
|
|
|
e58e944 |
+ errno=EINVAL;
|
|
|
e58e944 |
+ return -1;
|
|
|
e58e944 |
+ }
|
|
|
e58e944 |
+
|
|
|
e58e944 |
if (!selinux_mnt) {
|
|
|
e58e944 |
errno = ENOENT;
|
|
|
e58e944 |
return -1;
|
|
|
6aa9d48 |
diff --git libselinux-2.9/src/check_context.c libselinux-2.9/src/check_context.c
|
|
|
2f49e06 |
index 8a7997f..5be8434 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/src/check_context.c
|
|
|
6aa9d48 |
+++ libselinux-2.9/src/check_context.c
|
|
|
e58e944 |
@@ -14,6 +14,11 @@ int security_check_context_raw(const char * con)
|
|
|
e58e944 |
char path[PATH_MAX];
|
|
|
e58e944 |
int fd, ret;
|
|
|
e58e944 |
|
|
|
e58e944 |
+ if (! con) {
|
|
|
e58e944 |
+ errno=EINVAL;
|
|
|
e58e944 |
+ return -1;
|
|
|
e58e944 |
+ }
|
|
|
e58e944 |
+
|
|
|
e58e944 |
if (!selinux_mnt) {
|
|
|
e58e944 |
errno = ENOENT;
|
|
|
e58e944 |
return -1;
|
|
|
6aa9d48 |
diff --git libselinux-2.9/src/compute_av.c libselinux-2.9/src/compute_av.c
|
|
|
813ea34 |
index a47cffe..6d285a2 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/src/compute_av.c
|
|
|
6aa9d48 |
+++ libselinux-2.9/src/compute_av.c
|
|
|
813ea34 |
@@ -27,6 +27,11 @@ int security_compute_av_flags_raw(const char * scon,
|
|
|
e58e944 |
return -1;
|
|
|
e58e944 |
}
|
|
|
e58e944 |
|
|
|
e58e944 |
+ if ((! scon) || (! tcon)) {
|
|
|
e58e944 |
+ errno=EINVAL;
|
|
|
e58e944 |
+ return -1;
|
|
|
e58e944 |
+ }
|
|
|
e58e944 |
+
|
|
|
e58e944 |
snprintf(path, sizeof path, "%s/access", selinux_mnt);
|
|
|
2f49e06 |
fd = open(path, O_RDWR | O_CLOEXEC);
|
|
|
e58e944 |
if (fd < 0)
|
|
|
6aa9d48 |
diff --git libselinux-2.9/src/compute_create.c libselinux-2.9/src/compute_create.c
|
|
|
2f49e06 |
index 0975aea..3e6a48c 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/src/compute_create.c
|
|
|
6aa9d48 |
+++ libselinux-2.9/src/compute_create.c
|
|
|
e58e944 |
@@ -64,6 +64,11 @@ int security_compute_create_name_raw(const char * scon,
|
|
|
e58e944 |
return -1;
|
|
|
e58e944 |
}
|
|
|
e58e944 |
|
|
|
e58e944 |
+ if ((! scon) || (! tcon)) {
|
|
|
e58e944 |
+ errno=EINVAL;
|
|
|
e58e944 |
+ return -1;
|
|
|
e58e944 |
+ }
|
|
|
e58e944 |
+
|
|
|
e58e944 |
snprintf(path, sizeof path, "%s/create", selinux_mnt);
|
|
|
2f49e06 |
fd = open(path, O_RDWR | O_CLOEXEC);
|
|
|
e58e944 |
if (fd < 0)
|
|
|
6aa9d48 |
diff --git libselinux-2.9/src/compute_member.c libselinux-2.9/src/compute_member.c
|
|
|
2f49e06 |
index 4e2d221..d1dd977 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/src/compute_member.c
|
|
|
6aa9d48 |
+++ libselinux-2.9/src/compute_member.c
|
|
|
e58e944 |
@@ -25,6 +25,11 @@ int security_compute_member_raw(const char * scon,
|
|
|
e58e944 |
return -1;
|
|
|
e58e944 |
}
|
|
|
e58e944 |
|
|
|
e58e944 |
+ if ((! scon) || (! tcon)) {
|
|
|
e58e944 |
+ errno=EINVAL;
|
|
|
e58e944 |
+ return -1;
|
|
|
e58e944 |
+ }
|
|
|
e58e944 |
+
|
|
|
e58e944 |
snprintf(path, sizeof path, "%s/member", selinux_mnt);
|
|
|
2f49e06 |
fd = open(path, O_RDWR | O_CLOEXEC);
|
|
|
e58e944 |
if (fd < 0)
|
|
|
6aa9d48 |
diff --git libselinux-2.9/src/compute_relabel.c libselinux-2.9/src/compute_relabel.c
|
|
|
2f49e06 |
index 49f77ef..c3db7c0 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/src/compute_relabel.c
|
|
|
6aa9d48 |
+++ libselinux-2.9/src/compute_relabel.c
|
|
|
e58e944 |
@@ -25,6 +25,11 @@ int security_compute_relabel_raw(const char * scon,
|
|
|
e58e944 |
return -1;
|
|
|
e58e944 |
}
|
|
|
e58e944 |
|
|
|
e58e944 |
+ if ((! scon) || (! tcon)) {
|
|
|
e58e944 |
+ errno=EINVAL;
|
|
|
e58e944 |
+ return -1;
|
|
|
e58e944 |
+ }
|
|
|
e58e944 |
+
|
|
|
e58e944 |
snprintf(path, sizeof path, "%s/relabel", selinux_mnt);
|
|
|
2f49e06 |
fd = open(path, O_RDWR | O_CLOEXEC);
|
|
|
e58e944 |
if (fd < 0)
|
|
|
6aa9d48 |
diff --git libselinux-2.9/src/compute_user.c libselinux-2.9/src/compute_user.c
|
|
|
2f49e06 |
index 7b88121..401fd10 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/src/compute_user.c
|
|
|
6aa9d48 |
+++ libselinux-2.9/src/compute_user.c
|
|
|
e58e944 |
@@ -24,6 +24,11 @@ int security_compute_user_raw(const char * scon,
|
|
|
e58e944 |
return -1;
|
|
|
e58e944 |
}
|
|
|
e58e944 |
|
|
|
e58e944 |
+ if (! scon) {
|
|
|
e58e944 |
+ errno=EINVAL;
|
|
|
e58e944 |
+ return -1;
|
|
|
e58e944 |
+ }
|
|
|
e58e944 |
+
|
|
|
e58e944 |
snprintf(path, sizeof path, "%s/user", selinux_mnt);
|
|
|
2f49e06 |
fd = open(path, O_RDWR | O_CLOEXEC);
|
|
|
e58e944 |
if (fd < 0)
|
|
|
6aa9d48 |
diff --git libselinux-2.9/src/fsetfilecon.c libselinux-2.9/src/fsetfilecon.c
|
|
|
e58e944 |
index 52707d0..0cbe12d 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/src/fsetfilecon.c
|
|
|
6aa9d48 |
+++ libselinux-2.9/src/fsetfilecon.c
|
|
|
e58e944 |
@@ -9,8 +9,12 @@
|
|
|
e58e944 |
|
|
|
e58e944 |
int fsetfilecon_raw(int fd, const char * context)
|
|
|
e58e944 |
{
|
|
|
e58e944 |
- int rc = fsetxattr(fd, XATTR_NAME_SELINUX, context, strlen(context) + 1,
|
|
|
e58e944 |
- 0);
|
|
|
e58e944 |
+ int rc;
|
|
|
e58e944 |
+ if (! context) {
|
|
|
e58e944 |
+ errno=EINVAL;
|
|
|
e58e944 |
+ return -1;
|
|
|
e58e944 |
+ }
|
|
|
e58e944 |
+ rc = fsetxattr(fd, XATTR_NAME_SELINUX, context, strlen(context) + 1, 0);
|
|
|
e58e944 |
if (rc < 0 && errno == ENOTSUP) {
|
|
|
e58e944 |
char * ccontext = NULL;
|
|
|
e58e944 |
int err = errno;
|
|
|
6aa9d48 |
diff --git libselinux-2.9/src/lsetfilecon.c libselinux-2.9/src/lsetfilecon.c
|
|
|
e58e944 |
index 1d3b28a..ea6d70b 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/src/lsetfilecon.c
|
|
|
6aa9d48 |
+++ libselinux-2.9/src/lsetfilecon.c
|
|
|
e58e944 |
@@ -9,8 +9,13 @@
|
|
|
e58e944 |
|
|
|
e58e944 |
int lsetfilecon_raw(const char *path, const char * context)
|
|
|
e58e944 |
{
|
|
|
e58e944 |
- int rc = lsetxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1,
|
|
|
e58e944 |
- 0);
|
|
|
e58e944 |
+ int rc;
|
|
|
e58e944 |
+ if (! context) {
|
|
|
e58e944 |
+ errno=EINVAL;
|
|
|
e58e944 |
+ return -1;
|
|
|
e58e944 |
+ }
|
|
|
e58e944 |
+
|
|
|
e58e944 |
+ rc = lsetxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1, 0);
|
|
|
e58e944 |
if (rc < 0 && errno == ENOTSUP) {
|
|
|
e58e944 |
char * ccontext = NULL;
|
|
|
e58e944 |
int err = errno;
|
|
|
6aa9d48 |
diff --git libselinux-2.9/src/procattr.c libselinux-2.9/src/procattr.c
|
|
|
6aa9d48 |
index c6799ef..cbb6824 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/src/procattr.c
|
|
|
6aa9d48 |
+++ libselinux-2.9/src/procattr.c
|
|
|
6aa9d48 |
@@ -24,6 +24,7 @@ static __thread char destructor_initialized;
|
|
|
f3c6251 |
|
|
|
6aa9d48 |
/* Bionic and glibc >= 2.30 declare gettid() system call wrapper in unistd.h and
|
|
|
6aa9d48 |
* has a definition for it */
|
|
|
f3c6251 |
+#ifndef OVERRIDE_GETTID
|
|
|
6aa9d48 |
#ifdef __BIONIC__
|
|
|
6aa9d48 |
#define OVERRIDE_GETTID 0
|
|
|
6aa9d48 |
#elif !defined(__GLIBC_PREREQ)
|
|
|
6aa9d48 |
@@ -33,6 +34,7 @@ static __thread char destructor_initialized;
|
|
|
6aa9d48 |
#else
|
|
|
6aa9d48 |
#define OVERRIDE_GETTID 0
|
|
|
6aa9d48 |
#endif
|
|
|
f3c6251 |
+#endif
|
|
|
6aa9d48 |
|
|
|
6aa9d48 |
#if OVERRIDE_GETTID
|
|
|
f3c6251 |
static pid_t gettid(void)
|
|
|
6aa9d48 |
diff --git libselinux-2.9/src/setfilecon.c libselinux-2.9/src/setfilecon.c
|
|
|
e58e944 |
index d05969c..3f0200e 100644
|
|
|
6aa9d48 |
--- libselinux-2.9/src/setfilecon.c
|
|
|
6aa9d48 |
+++ libselinux-2.9/src/setfilecon.c
|
|
|
e58e944 |
@@ -9,8 +9,12 @@
|
|
|
e58e944 |
|
|
|
e58e944 |
int setfilecon_raw(const char *path, const char * context)
|
|
|
e58e944 |
{
|
|
|
e58e944 |
- int rc = setxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1,
|
|
|
e58e944 |
- 0);
|
|
|
e58e944 |
+ int rc;
|
|
|
e58e944 |
+ if (! context) {
|
|
|
e58e944 |
+ errno=EINVAL;
|
|
|
e58e944 |
+ return -1;
|
|
|
e58e944 |
+ }
|
|
|
e58e944 |
+ rc = setxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1, 0);
|
|
|
e58e944 |
if (rc < 0 && errno == ENOTSUP) {
|
|
|
e58e944 |
char * ccontext = NULL;
|
|
|
e58e944 |
int err = errno;
|