- 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
libselinux-1.21.8.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
--- nsalibselinux/src/matchpathcon.c 2005-01-31 13:50:18.000000000 -0500
+++ libselinux-1.21.9/src/matchpathcon.c 2005-02-10 16:51:59.000000000 -0500
@@ -519,10 +519,13 @@
{
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 @@
--- 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)
- return -1;
+ goto finish;
- 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;
+ }
+
+
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)
- return -1;
+ goto finish;
- goto finish;
+ return -1;
}
if (pass == 0) {
- if (nspec == 0)
- return 0;
+ if (nspec == 0) {
+ status = 0;
+ goto finish;
+ }
- if (nspec == 0) {
- status = 0;
- goto finish;
- }
+ if (nspec == 0)
+ return 0;
if ((spec_arr = malloc(sizeof(spec_t) * nspec)) ==
NULL)
- return -1;
+ goto finish;
- goto finish;
+ return -1;
memset(spec_arr, '\0', sizeof(spec_t) * nspec);
maxnspec = nspec;
rewind(fp);
+ if (homedirfp) rewind(homedirfp);
@@ -583,11 +581,13 @@
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. */
spec_copy = malloc(sizeof(spec_t) * nspec);
if (!spec_copy)
- return -1;
+ goto finish;
- goto finish;
+ return -1;
j = 0;
for (i = 0; i < nspec; i++) {
if (spec_arr[i].hasMetaChars)
@@ -588,7 +602,13 @@
@@ -602,13 +602,7 @@
nodups_specs(path);
- return 0;
+ status = 0;
+ finish:
+ fclose(fp);
+ if (spec_arr != spec_copy) free(spec_arr);
+ if (homedirfp) fclose(homedirfp);
+ if (localfp) fclose(localfp);
+ return status;
- 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)

View File

@ -1,11 +1,10 @@
Summary: SELinux library and simple utilities
Name: libselinux
Version: 1.21.9
Release: 2
Version: 1.21.10
Release: 1
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
@ -35,7 +34,6 @@ needed for developing SELinux applications.
%prep
%setup -q
%patch -p1 -b .rhat
%build
make CFLAGS="-g %{optflags}"
@ -85,6 +83,12 @@ rm -rf ${RPM_BUILD_ROOT}
%{_mandir}/man8/*
%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
- Process file_context.homedir

View File

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