From 2d9b36b51e1d0c7b6f7a2f7ed6ff313ea16a323c Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Jun 21 2006 13:12:11 +0000 Subject: - Fix error reporting of matchpathcon --- diff --git a/libselinux-rhat.patch b/libselinux-rhat.patch index b4dc163..e40aa28 100644 --- a/libselinux-rhat.patch +++ b/libselinux-rhat.patch @@ -181,8 +181,8 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux +} diff --exclude-from=exclude -N -u -r nsalibselinux/utils/matchpathcon.c libselinux-1.30.15/utils/matchpathcon.c --- nsalibselinux/utils/matchpathcon.c 2006-05-18 12:11:17.000000000 -0400 -+++ libselinux-1.30.15/utils/matchpathcon.c 2006-06-20 11:30:26.000000000 -0400 -@@ -12,19 +12,43 @@ ++++ libselinux-1.30.15/utils/matchpathcon.c 2006-06-21 09:05:20.000000000 -0400 +@@ -12,19 +12,44 @@ exit(1); } @@ -190,8 +190,8 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/utils/matchpathcon.c libselin + char *buf; + int rc = matchpathcon(path, 0, &buf); + if (rc < 0) { -+ fprintf(stderr, "matchpathcon(%s) failed\n", path); -+ return 2; ++ fprintf(stderr, "matchpathcon(%s) failed: %s\n", path, strerror(errno)); ++ return 1; + } + if (header) + printf("%s\t%s\n", path, buf); @@ -210,6 +210,7 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/utils/matchpathcon.c libselin int header=1, opt; + int verify=0; + int notrans=0; ++ int error=0; if (argc < 2) usage(argv[0]); @@ -229,7 +230,7 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/utils/matchpathcon.c libselin case 'f': if (init) { fprintf(stderr, "%s: -f and -p are exclusive\n", argv[0]); -@@ -54,17 +78,29 @@ +@@ -54,18 +79,30 @@ } } for (i = optind; i < argc; i++) { @@ -256,16 +257,18 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/utils/matchpathcon.c libselin - freecon(buf); + if (rc >= 0) { + printf("%s has context %s, should be ", argv[i], con); -+ printmatchpathcon(argv[i], 0); ++ error += printmatchpathcon(argv[i], 0); + freecon(con); + } else { + printf("actual context unknown: %s, should be ", strerror(errno)); -+ printmatchpathcon(argv[i], 0); ++ error += printmatchpathcon(argv[i], 0); + } + } + } else { -+ printmatchpathcon(argv[i], header); ++ error += printmatchpathcon(argv[i], header); + } } matchpathcon_fini(); - return 0; +- return 0; ++ return error; + } diff --git a/libselinux.spec b/libselinux.spec index ffae193..141a6db 100644 --- a/libselinux.spec +++ b/libselinux.spec @@ -2,7 +2,7 @@ Summary: SELinux library and simple utilities Name: libselinux Version: 1.30.15 -Release: 2 +Release: 3 License: Public domain (uncopyrighted) Group: System Environment/Libraries Source: http://www.nsa.gov/selinux/archives/%{name}-%{version}.tgz @@ -117,6 +117,9 @@ exit 0 %{_libdir}/python*/site-packages/selinux.py* %changelog +* Wed Jun 21 2006 Dan Walsh 1.30.15-3 +- Fix error reporting of matchpathcon + * Mon Jun 19 2006 Dan Walsh 1.30.15-2 - Add function to compare file context on disk versus contexts in file_contexts file.