diff --git a/libselinux-rhat.patch b/libselinux-rhat.patch index 4becd62..010ea66 100644 --- a/libselinux-rhat.patch +++ b/libselinux-rhat.patch @@ -1,70 +1,12 @@ -diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux-1.21.9/src/matchpathcon.c +diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux-1.21.10/src/matchpathcon.c --- nsalibselinux/src/matchpathcon.c 2005-02-17 14:22:28.000000000 -0500 -+++ libselinux-1.21.9/src/matchpathcon.c 2005-02-11 02:36:46.000000000 -0500 -@@ -553,29 +553,27 @@ - nspec = 0; - while (fgets_unlocked(line_buf, sizeof line_buf, fp) && nspec < maxnspec) { - if (process_line(path, line_buf, pass, ++lineno) != 0) -- goto finish; -+ return -1; - } - if (homedirfp) - while (fgets_unlocked(line_buf, sizeof line_buf, homedirfp) && nspec < maxnspec) { - if (process_line(homedir_path, line_buf, pass, ++lineno) != 0) -- goto finish; -+ return -1; - } - - - if (localfp) - while (fgets_unlocked(line_buf, sizeof line_buf, localfp) && nspec < maxnspec) { - if (process_line(local_path, line_buf, pass, ++lineno) != 0) -- goto finish; -+ return -1; - } - - if (pass == 0) { -- if (nspec == 0) { -- status = 0; -- goto finish; -- } -+ if (nspec == 0) -+ return 0; - if ((spec_arr = malloc(sizeof(spec_t) * nspec)) == - NULL) -- goto finish; -+ return -1; - memset(spec_arr, '\0', sizeof(spec_t) * nspec); - maxnspec = nspec; - rewind(fp); -@@ -583,11 +581,13 @@ - if (localfp) rewind(localfp); - } ++++ libselinux-1.21.10/src/matchpathcon.c 2005-02-21 09:04:33.000000000 -0500 +@@ -401,7 +401,7 @@ + char *regex, *type, *context; + char *anchored_regex; + len = strlen(line_buf); +- if (line_buf[len - 1] != '\n') { ++ if ((line_buf[len - 1] != '\n') && (line_buf[len - 1 ] != 0)) { + myprintf("%s: line %d is too long, would be truncated, skipping\n", path, lineno); + return 0; } -- -+ fclose(fp); -+ if (homedirfp) fclose(homedirfp); -+ if (localfp) fclose(localfp); - /* Move exact pathname specifications to the end. */ - spec_copy = malloc(sizeof(spec_t) * nspec); - if (!spec_copy) -- goto finish; -+ return -1; - j = 0; - for (i = 0; i < nspec; i++) { - if (spec_arr[i].hasMetaChars) -@@ -602,13 +602,7 @@ - - nodups_specs(path); - -- status = 0; -- finish: -- fclose(fp); -- if (spec_arr != spec_copy) free(spec_arr); -- if (homedirfp) fclose(homedirfp); -- if (localfp) fclose(localfp); -- return status; -+ return 0; - } - hidden_def(matchpathcon_init) - diff --git a/libselinux.spec b/libselinux.spec index 03b0571..51d0fb0 100644 --- a/libselinux.spec +++ b/libselinux.spec @@ -1,10 +1,11 @@ Summary: SELinux library and simple utilities Name: libselinux Version: 1.21.10 -Release: 1 +Release: 2 License: Public domain (uncopyrighted) Group: System Environment/Libraries Source: http://www.nsa.gov/selinux/archives/%{name}-%{version}.tgz +Patch: libselinux-rhat.patch BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot @@ -34,6 +35,8 @@ needed for developing SELinux applications. %prep %setup -q +%patch -p1 -b .rhat + %build make CFLAGS="-g %{optflags}" @@ -83,6 +86,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_mandir}/man8/* %changelog +* Mon Feb 21 2005 Dan Walsh 1.21.10-2 +- Fix matchpathcon on eof. + * Thu Feb 17 2005 Dan Walsh 1.21.10-1 - Update from NSA * Merged matchpathcon patch for file_contexts.homedir from Dan Walsh.