- Fix matchpathcon on eof.
This commit is contained in:
parent
8e994c6484
commit
31e19c1580
@ -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
|
--- 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
|
+++ libselinux-1.21.10/src/matchpathcon.c 2005-02-21 09:04:33.000000000 -0500
|
||||||
@@ -553,29 +553,27 @@
|
@@ -401,7 +401,7 @@
|
||||||
nspec = 0;
|
char *regex, *type, *context;
|
||||||
while (fgets_unlocked(line_buf, sizeof line_buf, fp) && nspec < maxnspec) {
|
char *anchored_regex;
|
||||||
if (process_line(path, line_buf, pass, ++lineno) != 0)
|
len = strlen(line_buf);
|
||||||
- goto finish;
|
- if (line_buf[len - 1] != '\n') {
|
||||||
+ return -1;
|
+ 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;
|
||||||
}
|
}
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-
|
|
||||||
+ 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)
|
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
Summary: SELinux library and simple utilities
|
Summary: SELinux library and simple utilities
|
||||||
Name: libselinux
|
Name: libselinux
|
||||||
Version: 1.21.10
|
Version: 1.21.10
|
||||||
Release: 1
|
Release: 2
|
||||||
License: Public domain (uncopyrighted)
|
License: Public domain (uncopyrighted)
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
Source: http://www.nsa.gov/selinux/archives/%{name}-%{version}.tgz
|
Source: http://www.nsa.gov/selinux/archives/%{name}-%{version}.tgz
|
||||||
|
Patch: libselinux-rhat.patch
|
||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||||
|
|
||||||
@ -34,6 +35,8 @@ needed for developing SELinux applications.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch -p1 -b .rhat
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make CFLAGS="-g %{optflags}"
|
make CFLAGS="-g %{optflags}"
|
||||||
|
|
||||||
@ -83,6 +86,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
|||||||
%{_mandir}/man8/*
|
%{_mandir}/man8/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Feb 21 2005 Dan Walsh <dwalsh@redhat.com> 1.21.10-2
|
||||||
|
- Fix matchpathcon on eof.
|
||||||
|
|
||||||
* Thu Feb 17 2005 Dan Walsh <dwalsh@redhat.com> 1.21.10-1
|
* Thu Feb 17 2005 Dan Walsh <dwalsh@redhat.com> 1.21.10-1
|
||||||
- Update from NSA
|
- Update from NSA
|
||||||
* Merged matchpathcon patch for file_contexts.homedir from Dan Walsh.
|
* Merged matchpathcon patch for file_contexts.homedir from Dan Walsh.
|
||||||
|
Loading…
Reference in New Issue
Block a user