- Update from NSA

Merged matchpathcon patch for file_contexts.homedir from Dan Walsh.
Added selinux_users_path() for path to directory containing system.users
    and local.users.
This commit is contained in:
Daniel J Walsh 2005-02-17 19:27:56 +00:00
parent 03d51ea8f7
commit 8e994c6484
4 changed files with 49 additions and 66 deletions

View File

@ -22,3 +22,4 @@ nsadiff
nsalibselinux nsalibselinux
libselinux-1.21.8.tgz libselinux-1.21.8.tgz
libselinux-1.21.9.tgz libselinux-1.21.9.tgz
libselinux-1.21.10.tgz

View File

@ -1,92 +1,70 @@
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.9/src/matchpathcon.c
--- nsalibselinux/src/matchpathcon.c 2005-01-31 13:50:18.000000000 -0500 --- nsalibselinux/src/matchpathcon.c 2005-02-17 14:22:28.000000000 -0500
+++ libselinux-1.21.9/src/matchpathcon.c 2005-02-10 16:51:59.000000000 -0500 +++ libselinux-1.21.9/src/matchpathcon.c 2005-02-11 02:36:46.000000000 -0500
@@ -519,10 +519,13 @@ @@ -553,29 +553,27 @@
{
FILE *fp;
FILE *localfp;
+ FILE *homedirfp;
char local_path[PATH_MAX + 1];
+ char homedir_path[PATH_MAX + 1];
char line_buf[BUFSIZ + 1];
unsigned int lineno, pass, i, j, maxnspec;
spec_t *spec_copy;
+ int status=-1;
/* Open the specification file. */
if (!path)
@@ -530,6 +533,9 @@
if ((fp = fopen(path, "r")) == NULL)
return -1;
+ snprintf(homedir_path, sizeof(homedir_path), "%s.homedirs", path);
+ homedirfp = fopen(homedir_path, "r");
+
snprintf(local_path, sizeof(local_path), "%s.local", path);
localfp = fopen(local_path, "r");
@@ -547,33 +553,41 @@
nspec = 0; nspec = 0;
while (fgets_unlocked(line_buf, sizeof line_buf, fp) && nspec < maxnspec) { while (fgets_unlocked(line_buf, sizeof line_buf, fp) && nspec < maxnspec) {
if (process_line(path, line_buf, pass, ++lineno) != 0) if (process_line(path, line_buf, pass, ++lineno) != 0)
- return -1; - goto finish;
+ goto finish; + return -1;
} }
+ if (homedirfp) if (homedirfp)
+ while (fgets_unlocked(line_buf, sizeof line_buf, homedirfp) && nspec < maxnspec) { while (fgets_unlocked(line_buf, sizeof line_buf, homedirfp) && nspec < maxnspec) {
+ if (process_line(homedir_path, line_buf, pass, ++lineno) != 0) if (process_line(homedir_path, line_buf, pass, ++lineno) != 0)
+ goto finish; - goto finish;
+ } + return -1;
+ }
+
if (localfp) if (localfp)
while (fgets_unlocked(line_buf, sizeof line_buf, localfp) && nspec < maxnspec) { while (fgets_unlocked(line_buf, sizeof line_buf, localfp) && nspec < maxnspec) {
if (process_line(local_path, line_buf, pass, ++lineno) != 0) if (process_line(local_path, line_buf, pass, ++lineno) != 0)
- return -1; - goto finish;
+ goto finish; + return -1;
} }
if (pass == 0) { if (pass == 0) {
- if (nspec == 0) - if (nspec == 0) {
- return 0; - status = 0;
+ if (nspec == 0) { - goto finish;
+ status = 0; - }
+ goto finish; + if (nspec == 0)
+ } + return 0;
if ((spec_arr = malloc(sizeof(spec_t) * nspec)) == if ((spec_arr = malloc(sizeof(spec_t) * nspec)) ==
NULL) NULL)
- return -1; - goto finish;
+ goto finish; + return -1;
memset(spec_arr, '\0', sizeof(spec_t) * nspec); memset(spec_arr, '\0', sizeof(spec_t) * nspec);
maxnspec = nspec; maxnspec = nspec;
rewind(fp); rewind(fp);
+ if (homedirfp) rewind(homedirfp); @@ -583,11 +581,13 @@
if (localfp) rewind(localfp); if (localfp) rewind(localfp);
} }
} }
- fclose(fp); -
- if (localfp) fclose(localfp); + fclose(fp);
+ if (homedirfp) fclose(homedirfp);
+ if (localfp) fclose(localfp);
/* Move exact pathname specifications to the end. */ /* Move exact pathname specifications to the end. */
spec_copy = malloc(sizeof(spec_t) * nspec); spec_copy = malloc(sizeof(spec_t) * nspec);
if (!spec_copy) if (!spec_copy)
- return -1; - goto finish;
+ goto finish; + return -1;
j = 0; j = 0;
for (i = 0; i < nspec; i++) { for (i = 0; i < nspec; i++) {
if (spec_arr[i].hasMetaChars) if (spec_arr[i].hasMetaChars)
@@ -588,7 +602,13 @@ @@ -602,13 +602,7 @@
nodups_specs(path); nodups_specs(path);
- return 0; - status = 0;
+ status = 0; - finish:
+ finish: - fclose(fp);
+ fclose(fp); - if (spec_arr != spec_copy) free(spec_arr);
+ if (spec_arr != spec_copy) free(spec_arr); - if (homedirfp) fclose(homedirfp);
+ if (homedirfp) fclose(homedirfp); - if (localfp) fclose(localfp);
+ if (localfp) fclose(localfp); - return status;
+ return status; + return 0;
} }
hidden_def(matchpathcon_init) hidden_def(matchpathcon_init)

View File

@ -1,11 +1,10 @@
Summary: SELinux library and simple utilities Summary: SELinux library and simple utilities
Name: libselinux Name: libselinux
Version: 1.21.9 Version: 1.21.10
Release: 2 Release: 1
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
@ -35,7 +34,6 @@ 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}"
@ -85,6 +83,12 @@ rm -rf ${RPM_BUILD_ROOT}
%{_mandir}/man8/* %{_mandir}/man8/*
%changelog %changelog
* Thu Feb 17 2005 Dan Walsh <dwalsh@redhat.com> 1.21.10-1
- Update from NSA
* Merged matchpathcon patch for file_contexts.homedir from Dan Walsh.
* Added selinux_users_path() for path to directory containing
system.users and local.users.
* Thu Feb 10 2005 Dan Walsh <dwalsh@redhat.com> 1.21.9-2 * Thu Feb 10 2005 Dan Walsh <dwalsh@redhat.com> 1.21.9-2
- Process file_context.homedir - Process file_context.homedir

View File

@ -1 +1 @@
d949858f86b40ef974bfdf6a18c893b4 libselinux-1.21.9.tgz 0539a827b8e8c20be18d025916bf1122 libselinux-1.21.10.tgz