revert unexplained change to rhat.patch which broke SELinux disablement

This commit is contained in:
Dan Walsh 2014-01-06 10:15:40 -05:00
parent 9ba3cdd05f
commit 7e1165a3eb
4 changed files with 47 additions and 7 deletions

1
.gitignore vendored
View File

@ -197,3 +197,4 @@ libselinux-2.0.96.tgz
/libselinux-2.1.13.tgz /libselinux-2.1.13.tgz
/libselinux-2.2.tgz /libselinux-2.2.tgz
/libselinux-2.2.1.tgz /libselinux-2.2.1.tgz
/libselinux-2.2.2.tgz

View File

@ -332,6 +332,25 @@ index 02dd829..6dfdb46 100644
ln -sf $@ $(TARGET) ln -sf $@ $(TARGET)
$(LIBPC): $(LIBPC).in ../VERSION $(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 diff --git a/libselinux/src/load_policy.c b/libselinux/src/load_policy.c
index e419f1a..fdeca93 100644 index e419f1a..fdeca93 100644
--- a/libselinux/src/load_policy.c --- a/libselinux/src/load_policy.c
@ -512,24 +531,25 @@ index e419f1a..fdeca93 100644
close(fd); close(fd);
dlclose: dlclose:
diff --git a/libselinux/src/lsetfilecon.c b/libselinux/src/lsetfilecon.c 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 --- a/libselinux/src/lsetfilecon.c
+++ b/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 lsetfilecon_raw(const char *path, const security_context_t context)
{ {
- int rc = lsetxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1, - int rc = lsetxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1,
- 0);
+ int rc; + int rc;
+ if (! context) { + if (! context) {
+ errno=EINVAL; + errno=EINVAL;
+ return -1; + return -1;
+ } + }
+ +
+ rc = lsetxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1, + rc = lsetxattr(path, XATTR_NAME_SELINUX, context, strlen(context) + 1, 0);
0);
if (rc < 0 && errno == ENOTSUP) { if (rc < 0 && errno == ENOTSUP) {
security_context_t ccontext = NULL; security_context_t ccontext = NULL;
int err = errno;
diff --git a/libselinux/src/matchpathcon.c b/libselinux/src/matchpathcon.c diff --git a/libselinux/src/matchpathcon.c b/libselinux/src/matchpathcon.c
index 2d7369e..2a00807 100644 index 2d7369e..2a00807 100644
--- a/libselinux/src/matchpathcon.c --- a/libselinux/src/matchpathcon.c
@ -551,3 +571,22 @@ index 2d7369e..2a00807 100644
va_end(ap); 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;

View File

@ -9,8 +9,8 @@
Summary: SELinux library and simple utilities Summary: SELinux library and simple utilities
Name: libselinux Name: libselinux
Version: 2.2.1 Version: 2.2.2
Release: 6%{?dist} Release: 1%{?dist}
License: Public Domain License: Public Domain
Group: System Environment/Libraries Group: System Environment/Libraries
Source: %{name}-%{version}.tgz Source: %{name}-%{version}.tgz

View File

@ -1 +1 @@
ada793adfb5683672f9cc8a99447939d libselinux-2.2.1.tgz 323a0d0b3cb0ec4e67c4f161207a90d1 libselinux-2.2.2.tgz