- Fix strip_con call

This commit is contained in:
Daniel J Walsh 2005-09-16 18:42:27 +00:00
parent 96ff98944c
commit b86cfc3a43
3 changed files with 30 additions and 22 deletions

View File

@ -1,6 +1,6 @@
diff --exclude-from=exclude -N -u -r nsalibselinux/include/selinux/selinux.h libselinux-1.26/include/selinux/selinux.h diff --exclude-from=exclude -N -u -r nsalibselinux/include/selinux/selinux.h libselinux-1.26/include/selinux/selinux.h
--- nsalibselinux/include/selinux/selinux.h 2005-09-01 11:17:40.000000000 -0400 --- nsalibselinux/include/selinux/selinux.h 2005-09-01 11:17:40.000000000 -0400
+++ libselinux-1.26/include/selinux/selinux.h 2005-09-14 13:47:09.000000000 -0400 +++ libselinux-1.26/include/selinux/selinux.h 2005-09-16 14:16:26.000000000 -0400
@@ -304,6 +304,12 @@ @@ -304,6 +304,12 @@
extern int selinux_getenforcemode(int *enforce); extern int selinux_getenforcemode(int *enforce);
@ -16,29 +16,34 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/include/selinux/selinux.h lib
configuration files exist. configuration files exist.
diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux-1.26/src/matchpathcon.c diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux-1.26/src/matchpathcon.c
--- nsalibselinux/src/matchpathcon.c 2005-08-24 09:07:11.000000000 -0400 --- nsalibselinux/src/matchpathcon.c 2005-08-24 09:07:11.000000000 -0400
+++ libselinux-1.26/src/matchpathcon.c 2005-09-14 13:47:09.000000000 -0400 +++ libselinux-1.26/src/matchpathcon.c 2005-09-16 14:21:02.000000000 -0400
@@ -25,6 +25,20 @@ @@ -12,6 +12,7 @@
#include <regex.h>
#include <stdarg.h>
#include "policy.h"
+#include <selinux/context.h>
static void
#ifdef __GNUC__
@@ -25,6 +26,17 @@
va_end(ap); va_end(ap);
} }
+#define STRIP_LEVEL(CON) \ +#define STRIP_LEVEL(CON) \
+ if (! mls_enabled) { \ + if (! mls_enabled) { \
+ int i=0; \ + security_context_t newcon; \
+ int ctr=0; \ + context_t con=context_new(CON); \
+ while (CON[i]) { \ + context_range_set(con,NULL); \
+ if (CON[i] == ':') ctr++; \ + newcon=strdup(context_str(con));\
+ if (ctr==3) { \ + context_free(con); \
+ CON[i]=0; \ + freecon(CON); \
+ break; \ + CON=newcon; \
+ } \ + }
+ i++; \
+ } \
+ }
+ +
static void (*myprintf)(const char *fmt, ...) = &default_printf; static void (*myprintf)(const char *fmt, ...) = &default_printf;
void set_matchpathcon_printf(void (*f)(const char *fmt, ...)) void set_matchpathcon_printf(void (*f)(const char *fmt, ...))
@@ -415,7 +429,7 @@ @@ -415,7 +427,7 @@
} }
return; return;
} }
@ -47,7 +52,7 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux
int items, len, regerr; int items, len, regerr;
char *buf_p; char *buf_p;
char *regex, *type, *context; char *regex, *type, *context;
@@ -438,6 +452,7 @@ @@ -438,6 +450,7 @@
} else if (items == 2) { } else if (items == 2) {
/* The type field is optional. */ /* The type field is optional. */
free(context); free(context);
@ -55,7 +60,7 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux
context = type; context = type;
type = 0; type = 0;
} }
@@ -510,7 +525,7 @@ @@ -510,7 +523,7 @@
} }
skip_type: skip_type:
@ -64,7 +69,7 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux
spec_arr[nspec].context = context; spec_arr[nspec].context = context;
if (strcmp(context, "<<none>>")) { if (strcmp(context, "<<none>>")) {
@@ -557,6 +572,7 @@ @@ -557,6 +570,7 @@
unsigned int lineno, pass, i, j, maxnspec; unsigned int lineno, pass, i, j, maxnspec;
spec_t *spec_copy=NULL; spec_t *spec_copy=NULL;
int status=-1; int status=-1;
@ -72,7 +77,7 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux
/* Open the specification file. */ /* Open the specification file. */
if (!path) if (!path)
@@ -590,20 +606,20 @@ @@ -590,20 +604,20 @@
lineno = 0; lineno = 0;
nspec = 0; nspec = 0;
while (getline(&line_buf, &line_len, fp) > 0 && nspec < maxnspec) { while (getline(&line_buf, &line_len, fp) > 0 && nspec < maxnspec) {
@ -98,7 +103,7 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinux_config.c libselinux-1.26/src/selinux_config.c diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinux_config.c libselinux-1.26/src/selinux_config.c
--- nsalibselinux/src/selinux_config.c 2005-03-17 14:56:21.000000000 -0500 --- nsalibselinux/src/selinux_config.c 2005-03-17 14:56:21.000000000 -0500
+++ libselinux-1.26/src/selinux_config.c 2005-09-14 13:47:09.000000000 -0400 +++ libselinux-1.26/src/selinux_config.c 2005-09-16 14:16:26.000000000 -0400
@@ -85,6 +85,29 @@ @@ -85,6 +85,29 @@
static int use_compat_file_path; static int use_compat_file_path;

View File

@ -1,7 +1,7 @@
Summary: SELinux library and simple utilities Summary: SELinux library and simple utilities
Name: libselinux Name: libselinux
Version: 1.26 Version: 1.26
Release: 4 Release: 5
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
@ -86,6 +86,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_mandir}/man8/* %{_mandir}/man8/*
%changelog %changelog
* Tue Sep 12 2005 Dan Walsh <dwalsh@redhat.com> 1.26-5
- Fix strip_con call
* Tue Sep 12 2005 Dan Walsh <dwalsh@redhat.com> 1.26-3 * Tue Sep 12 2005 Dan Walsh <dwalsh@redhat.com> 1.26-3
- Go back to original libsetrans code - Go back to original libsetrans code

View File

@ -1 +1 @@
71d3d1a3e3b2df41d2ab0fb01be42ebb libselinux-1.27.1.tgz c6ec48d847c4b7d708e960e6dfb72603 libselinux-1.26.tgz