[policycoreutils/f17] Make restorecon exit with an error on a bad path

Daniel J Walsh dwalsh at fedoraproject.org
Thu May 24 15:41:07 UTC 2012


commit cca543296e064838226299d773a2deb6d77e8c0b
Author: Dan Walsh <dwalsh at redhat.com>
Date:   Thu May 24 11:41:02 2012 -0400

    Make restorecon exit with an error on a bad path

 policycoreutils-rhat.patch |   32 ++++++++++++++++++++++----------
 policycoreutils.spec       |    5 ++++-
 2 files changed, 26 insertions(+), 11 deletions(-)
---
diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch
index f8caa4f..c11300c 100644
--- a/policycoreutils-rhat.patch
+++ b/policycoreutils-rhat.patch
@@ -286809,7 +286809,7 @@ index 764d476..17b4fa5 100644
  			build = 1;
  			break;
 diff --git a/policycoreutils/setfiles/restore.c b/policycoreutils/setfiles/restore.c
-index 9a7d315..1b59e2f 100644
+index 9a7d315..1d0c354 100644
 --- a/policycoreutils/setfiles/restore.c
 +++ b/policycoreutils/setfiles/restore.c
 @@ -1,5 +1,6 @@
@@ -286956,7 +286956,7 @@ index 9a7d315..1b59e2f 100644
 +		if (! conb) {
 +			context_free(cona);
 +			goto out;
-+		}
+ 		}
 +
 +		types_differ = strcmp(context_type_get(cona), context_type_get(conb));
 +		if (types_differ) {
@@ -286973,16 +286973,16 @@ index 9a7d315..1b59e2f 100644
 +
 +		if (!types_differ || err) {
 +			goto out;
- 		}
++		}
++	}
++
++	if (r_opts->verbose) {
++		printf("%s reset %s context %s->%s\n",
++		       r_opts->progname, my_file, curcon ?: "", newcon);
  	}
  
 -	if (r_opts->logging && !user_only_changed) {
 -		if (context)
-+	if (r_opts->verbose) {
-+		printf("%s reset %s context %s->%s\n",
-+		       r_opts->progname, my_file, curcon ?: "", newcon);
-+	}
-+
 +	if (r_opts->logging && r_opts->change) {
 +		if (curcon)
  			syslog(LOG_INFO, "relabeling %s from %s to %s\n",
@@ -287117,7 +287117,19 @@ index 9a7d315..1b59e2f 100644
  	if (fts_handle)
  		fts_close(fts_handle);
  	return rc;
-@@ -341,7 +446,9 @@ int process_glob(char *name, int recurse) {
+@@ -328,10 +433,7 @@ int process_glob(char *name, int recurse) {
+ 	size_t i = 0;
+ 	int errors;
+ 	memset(&globbuf, 0, sizeof(globbuf));
+-	errors = glob(name, GLOB_TILDE | GLOB_PERIOD, NULL, &globbuf);
+-	if (errors == GLOB_NOMATCH)
+-		return 0;
+-
++	errors = glob(name, GLOB_TILDE | GLOB_PERIOD | GLOB_NOCHECK, NULL, &globbuf);
+ 	if (errors) 
+ 		return errors;
+ 
+@@ -341,7 +443,9 @@ int process_glob(char *name, int recurse) {
  			continue;
  		if (len > 0 && strcmp(&globbuf.gl_pathv[i][len], "/..") == 0)
  			continue;
@@ -287128,7 +287140,7 @@ index 9a7d315..1b59e2f 100644
  	}
  	globfree(&globbuf);
  	return errors;
-@@ -447,22 +554,6 @@ int add_exclude(const char *directory)
+@@ -447,22 +551,6 @@ int add_exclude(const char *directory)
  	return 0;
  }
  
diff --git a/policycoreutils.spec b/policycoreutils.spec
index 34ab42f..29830e1 100644
--- a/policycoreutils.spec
+++ b/policycoreutils.spec
@@ -7,7 +7,7 @@
 Summary: SELinux policy core utilities
 Name:	 policycoreutils
 Version: 2.1.11
-Release: 17%{?dist}
+Release: 18%{?dist}
 License: GPLv2
 Group:	 System Environment/Base
 # Based on git repository with tag 20101221
@@ -340,6 +340,9 @@ fi
 %{_bindir}/systemctl try-restart restorecond.service >/dev/null 2>&1 || :
 
 %changelog
+* Thu May 24 2012 Dan Walsh <dwalsh at redhat.com> - 2.1.11-18
+- Make restorecon exit with an error on a bad path
+
 * Thu May 24 2012 Dan Walsh <dwalsh at redhat.com> - 2.1.11-17
 - Fix setsebool command, handling of = broken.
 - Add missing error option in booleansPage


More information about the scm-commits mailing list