add removable_context path
This commit is contained in:
parent
0474ff5fef
commit
dfa5fafe1b
@ -1,101 +1,64 @@
|
|||||||
diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchmediacon.c libselinux-1.17.10/src/matchmediacon.c
|
diff --exclude-from=exclude -N -u -r nsalibselinux/include/selinux/selinux.h libselinux-1.17.12/include/selinux/selinux.h
|
||||||
--- nsalibselinux/src/matchmediacon.c 1969-12-31 19:00:00.000000000 -0500
|
--- nsalibselinux/include/selinux/selinux.h 2004-09-14 09:31:35.000000000 -0400
|
||||||
+++ libselinux-1.17.10/src/matchmediacon.c 2004-09-10 14:40:16.000000000 -0400
|
+++ libselinux-1.17.12/include/selinux/selinux.h 2004-09-15 16:36:13.000000000 -0400
|
||||||
@@ -0,0 +1,65 @@
|
@@ -197,6 +197,7 @@
|
||||||
+#include <unistd.h>
|
policy root directory. */
|
||||||
+#include <fcntl.h>
|
extern const char *selinux_binary_policy_path(void);
|
||||||
+#include <sys/stat.h>
|
extern const char *selinux_failsafe_context_path(void);
|
||||||
+#include <string.h>
|
+extern const char *selinux_removable_context_path(void);
|
||||||
+#include "selinux_internal.h"
|
extern const char *selinux_default_context_path(void);
|
||||||
+#include <stdio.h>
|
extern const char *selinux_user_contexts_path(void);
|
||||||
+#include <stdlib.h>
|
extern const char *selinux_file_context_path(void);
|
||||||
+#include <ctype.h>
|
diff --exclude-from=exclude -N -u -r nsalibselinux/src/compat_file_path.h libselinux-1.17.12/src/compat_file_path.h
|
||||||
+#include <errno.h>
|
--- nsalibselinux/src/compat_file_path.h 2004-09-14 09:31:35.000000000 -0400
|
||||||
+#include <limits.h>
|
+++ libselinux-1.17.12/src/compat_file_path.h 2004-09-15 16:41:01.000000000 -0400
|
||||||
+#include <regex.h>
|
@@ -8,3 +8,5 @@
|
||||||
+#include <stdarg.h>
|
S_(DEFAULT_TYPE, SECURITYDIR "/default_type")
|
||||||
|
S_(BOOLEANS, SECURITYDIR "/booleans")
|
||||||
|
S_(MEDIA_CONTEXTS, SECURITYDIR "/default_media")
|
||||||
|
+S_(REMOVABLE_CONTEXT, SECURITYDIR "/removable_context")
|
||||||
+
|
+
|
||||||
+int matchmediacon(const char *media,
|
diff --exclude-from=exclude -N -u -r nsalibselinux/src/file_path_suffixes.h libselinux-1.17.12/src/file_path_suffixes.h
|
||||||
+ security_context_t *con)
|
--- nsalibselinux/src/file_path_suffixes.h 2004-09-14 09:31:35.000000000 -0400
|
||||||
+{
|
+++ libselinux-1.17.12/src/file_path_suffixes.h 2004-09-15 16:38:30.000000000 -0400
|
||||||
+ const char *path = selinux_media_context_path();
|
@@ -8,3 +8,4 @@
|
||||||
+ FILE *infile;
|
S_(DEFAULT_TYPE, "/contexts/default_type")
|
||||||
+ char *ptr, *ptr2;
|
S_(BOOLEANS, "/booleans")
|
||||||
+ char *target;
|
S_(MEDIA_CONTEXTS, "/contexts/files/media")
|
||||||
+ int found=-1;
|
+S_(REMOVABLE_CONTEXT, "/contexts/removable_context")
|
||||||
+ char current_line[PATH_MAX];
|
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinux_config.c libselinux-1.17.12/src/selinux_config.c
|
||||||
+ if ((infile = fopen(path, "r")) == NULL)
|
--- nsalibselinux/src/selinux_config.c 2004-09-14 09:31:36.000000000 -0400
|
||||||
+ return -1;
|
+++ libselinux-1.17.12/src/selinux_config.c 2004-09-15 16:39:02.000000000 -0400
|
||||||
+ while (!feof_unlocked (infile)) {
|
@@ -25,7 +25,8 @@
|
||||||
+ if (!fgets_unlocked(current_line, sizeof(current_line), infile)) {
|
#define DEFAULT_TYPE 6
|
||||||
+ return -1;
|
#define BOOLEANS 7
|
||||||
+ }
|
#define MEDIA_CONTEXTS 8
|
||||||
+ if (current_line[strlen(current_line) - 1])
|
-#define NEL 9
|
||||||
+ current_line[strlen(current_line) - 1] = 0;
|
+#define REMOVABLE_CONTEXT 9
|
||||||
+ /* Skip leading whitespace before the partial context. */
|
+#define NEL 10
|
||||||
+ ptr = current_line;
|
|
||||||
+ while (*ptr && isspace(*ptr))
|
/* New layout is relative to SELINUXDIR/policytype. */
|
||||||
+ ptr++;
|
static char *file_paths[NEL];
|
||||||
+
|
@@ -192,6 +193,11 @@
|
||||||
+ if (!(*ptr))
|
}
|
||||||
+ continue;
|
hidden_def(selinux_failsafe_context_path)
|
||||||
+
|
|
||||||
+
|
+const char *selinux_removable_context_path() {
|
||||||
+ /* Find the end of the media context. */
|
+ return get_path(REMOVABLE_CONTEXT);
|
||||||
+ ptr2 = ptr;
|
|
||||||
+ while (*ptr2 && !isspace(*ptr2))
|
|
||||||
+ ptr2++;
|
|
||||||
+ if (!(*ptr2))
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ *ptr2++=NULL;
|
|
||||||
+ if (strcmp (media, ptr) == 0) {
|
|
||||||
+ found = 1;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (!found)
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ /* Skip whitespace. */
|
|
||||||
+ while (*ptr2 && isspace(*ptr2))
|
|
||||||
+ ptr2++;
|
|
||||||
+ if (!(*ptr2)) {
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ *con = strdup(ptr2);
|
|
||||||
+ return 0;
|
|
||||||
+}
|
+}
|
||||||
diff --exclude-from=exclude -N -u -r nsalibselinux/utils/matchmediacon.c libselinux-1.17.10/utils/matchmediacon.c
|
+hidden_def(selinux_removable_context_path)
|
||||||
--- nsalibselinux/utils/matchmediacon.c 1969-12-31 19:00:00.000000000 -0500
|
|
||||||
+++ libselinux-1.17.10/utils/matchmediacon.c 2004-09-10 14:40:17.000000000 -0400
|
|
||||||
@@ -0,0 +1,28 @@
|
|
||||||
+#include <unistd.h>
|
|
||||||
+#include <stdio.h>
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+#include <selinux/selinux.h>
|
|
||||||
+#include <errno.h>
|
|
||||||
+#include <string.h>
|
|
||||||
+
|
+
|
||||||
+int main(int argc, char **argv)
|
const char *selinux_binary_policy_path() {
|
||||||
+{
|
return get_path(BINPOLICY);
|
||||||
+ char *buf;
|
}
|
||||||
+ int rc, i;
|
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinux_internal.h libselinux-1.17.12/src/selinux_internal.h
|
||||||
+
|
--- nsalibselinux/src/selinux_internal.h 2004-08-25 08:44:17.000000000 -0400
|
||||||
+ if (argc < 2) {
|
+++ libselinux-1.17.12/src/selinux_internal.h 2004-09-15 16:32:14.000000000 -0400
|
||||||
+ fprintf(stderr, "usage: %s media...\n", argv[0]);
|
@@ -16,6 +16,7 @@
|
||||||
+ exit(1);
|
hidden_proto(security_getenforce)
|
||||||
+ }
|
hidden_proto(selinux_default_context_path)
|
||||||
+
|
hidden_proto(selinux_failsafe_context_path)
|
||||||
+ for (i = 1; i < argc; i++) {
|
+hidden_proto(selinux_removable_context_path)
|
||||||
+ rc = matchmediacon(argv[i], &buf);
|
hidden_proto(selinux_file_context_path)
|
||||||
+ if (rc < 0) {
|
hidden_proto(selinux_user_contexts_path)
|
||||||
+ fprintf(stderr, "%s: matchmediacon(%s) failed: %s\n", argv[0], argv[i]);
|
hidden_proto(selinux_booleans_path)
|
||||||
+ exit(2);
|
|
||||||
+ }
|
|
||||||
+ printf("%s\t%s\n", argv[i], buf);
|
|
||||||
+ freecon(buf);
|
|
||||||
+ }
|
|
||||||
+ exit(0);
|
|
||||||
+}
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
Summary: SELinux library and simple utilities
|
Summary: SELinux library and simple utilities
|
||||||
Name: libselinux
|
Name: libselinux
|
||||||
Version: 1.17.12
|
Version: 1.17.12
|
||||||
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/libselinux-%{version}.tgz
|
Source: http://www.nsa.gov/selinux/archives/libselinux-%{version}.tgz
|
||||||
|
Patch: libselinux-rhat.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -33,6 +34,7 @@ needed for developing SELinux applications.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch -p1 -b .rhat
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make CFLAGS="%{optflags}"
|
make CFLAGS="%{optflags}"
|
||||||
@ -67,6 +69,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
|||||||
%{_mandir}/man8/*
|
%{_mandir}/man8/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Sep 16 2004 Dan Walsh <dwalsh@redhat.com> 1.17.12-2
|
||||||
|
- Add selinux_removable_context_path
|
||||||
|
|
||||||
* Tue Sep 14 2004 Dan Walsh <dwalsh@redhat.com> 1.17.12-1
|
* Tue Sep 14 2004 Dan Walsh <dwalsh@redhat.com> 1.17.12-1
|
||||||
- Update from NSA
|
- Update from NSA
|
||||||
* Add matchmediacon
|
* Add matchmediacon
|
||||||
|
Loading…
Reference in New Issue
Block a user