Make restorecon exit with an error on a bad path

This commit is contained in:
Dan Walsh 2012-05-24 11:39:55 -04:00
parent f7d5cb7960
commit b97e271674
2 changed files with 26 additions and 11 deletions

View File

@ -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;
}

View File

@ -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@redhat.com> - 2.1.11-18
- Make restorecon exit with an error on a bad path
* Thu May 24 2012 Dan Walsh <dwalsh@redhat.com> - 2.1.11-17
- Fix setsebool command, handling of = broken.
- Add missing error option in booleansPage