From 7e1165a3eb54b6521014da6a8095f037451ba322 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Mon, 6 Jan 2014 10:15:40 -0500 Subject: [PATCH] revert unexplained change to rhat.patch which broke SELinux disablement --- .gitignore | 1 + libselinux-rhat.patch | 47 +++++++++++++++++++++++++++++++++++++++---- libselinux.spec | 4 ++-- sources | 2 +- 4 files changed, 47 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 2e9cec3..84665d1 100644 --- a/.gitignore +++ b/.gitignore @@ -197,3 +197,4 @@ libselinux-2.0.96.tgz /libselinux-2.1.13.tgz /libselinux-2.2.tgz /libselinux-2.2.1.tgz +/libselinux-2.2.2.tgz diff --git a/libselinux-rhat.patch b/libselinux-rhat.patch index e343ef1..2f74652 100644 --- a/libselinux-rhat.patch +++ b/libselinux-rhat.patch @@ -332,6 +332,25 @@ index 02dd829..6dfdb46 100644 ln -sf $@ $(TARGET) $(LIBPC): $(LIBPC).in ../VERSION +diff --git a/libselinux/src/fsetfilecon.c b/libselinux/src/fsetfilecon.c +index 9963f7a..37f9d74 100644 +--- a/libselinux/src/fsetfilecon.c ++++ b/libselinux/src/fsetfilecon.c +@@ -9,8 +9,12 @@ + + int fsetfilecon_raw(int fd, const security_context_t 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) { + security_context_t ccontext = NULL; + int err = errno; diff --git a/libselinux/src/load_policy.c b/libselinux/src/load_policy.c index e419f1a..fdeca93 100644 --- a/libselinux/src/load_policy.c @@ -512,24 +531,25 @@ index e419f1a..fdeca93 100644 close(fd); dlclose: diff --git a/libselinux/src/lsetfilecon.c b/libselinux/src/lsetfilecon.c -index fd9bb26..932fc62 100644 +index fd9bb26..af2d88c 100644 --- a/libselinux/src/lsetfilecon.c +++ b/libselinux/src/lsetfilecon.c -@@ -9,7 +9,13 @@ +@@ -9,8 +9,13 @@ int lsetfilecon_raw(const char *path, const security_context_t 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); ++ rc = lsetxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1, 0); if (rc < 0 && errno == ENOTSUP) { security_context_t ccontext = NULL; + int err = errno; diff --git a/libselinux/src/matchpathcon.c b/libselinux/src/matchpathcon.c index 2d7369e..2a00807 100644 --- a/libselinux/src/matchpathcon.c @@ -551,3 +571,22 @@ index 2d7369e..2a00807 100644 va_end(ap); } +diff --git a/libselinux/src/setfilecon.c b/libselinux/src/setfilecon.c +index 50cb228..e617039 100644 +--- a/libselinux/src/setfilecon.c ++++ b/libselinux/src/setfilecon.c +@@ -9,8 +9,12 @@ + + int setfilecon_raw(const char *path, const security_context_t 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) { + security_context_t ccontext = NULL; + int err = errno; diff --git a/libselinux.spec b/libselinux.spec index 40538a2..dadb1c4 100644 --- a/libselinux.spec +++ b/libselinux.spec @@ -9,8 +9,8 @@ Summary: SELinux library and simple utilities Name: libselinux -Version: 2.2.1 -Release: 6%{?dist} +Version: 2.2.2 +Release: 1%{?dist} License: Public Domain Group: System Environment/Libraries Source: %{name}-%{version}.tgz diff --git a/sources b/sources index 0d56678..a598d56 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -ada793adfb5683672f9cc8a99447939d libselinux-2.2.1.tgz +323a0d0b3cb0ec4e67c4f161207a90d1 libselinux-2.2.2.tgz