1 |
pebenito 07/12/18 16:35:52 |
2 |
|
3 |
Added: findutils-4.3.11-selinux.diff |
4 |
Log: |
5 |
sys-apps/findutils: Update SELinux patch for 4.3.11. |
6 |
(Portage version: 2.1.4_rc10) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 sys-apps/findutils/files/findutils-4.3.11-selinux.diff |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/findutils/files/findutils-4.3.11-selinux.diff?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/findutils/files/findutils-4.3.11-selinux.diff?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: findutils-4.3.11-selinux.diff |
15 |
=================================================================== |
16 |
diff -purN findutils-4.3.11.orig/find/Makefile.am findutils-4.3.11/find/Makefile.am |
17 |
--- findutils-4.3.11.orig/find/Makefile.am 2007-07-22 08:29:31.000000000 -0400 |
18 |
+++ findutils-4.3.11/find/Makefile.am 2007-12-18 11:17:19.184032698 -0500 |
19 |
@@ -2,6 +2,7 @@ AUTOMAKE_OPTIONS = std-options |
20 |
localedir = $(datadir)/locale |
21 |
# noinst_PROGRAMS = regexprops |
22 |
# regexprops_SOURCES = regexprops.c |
23 |
+DEFS = @DEFS@ -I. -I$(srcdir) -I.. -DWITH_SELINUX |
24 |
|
25 |
noinst_LIBRARIES = libfindtools.a |
26 |
libfindtools_a_SOURCES = finddata.c fstype.c parser.c pred.c tree.c util.c |
27 |
@@ -26,7 +27,7 @@ endif |
28 |
|
29 |
EXTRA_DIST = defs.h $(man_MANS) |
30 |
INCLUDES = -I../gnulib/lib -I$(top_srcdir)/lib -I$(top_srcdir)/gnulib/lib -I../intl -DLOCALEDIR=\"$(localedir)\" |
31 |
-LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@ @LIB_CLOCK_GETTIME@ @FINDLIBS@ |
32 |
+LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@ @LIB_CLOCK_GETTIME@ @FINDLIBS@ -lselinux |
33 |
man_MANS = find.1 |
34 |
SUBDIRS = . testsuite |
35 |
|
36 |
diff -purN findutils-4.3.11.orig/find/Makefile.in findutils-4.3.11/find/Makefile.in |
37 |
--- findutils-4.3.11.orig/find/Makefile.in 2007-12-02 08:14:50.000000000 -0500 |
38 |
+++ findutils-4.3.11/find/Makefile.in 2007-12-18 11:18:33.088244259 -0500 |
39 |
@@ -275,7 +275,7 @@ CPP = @CPP@ |
40 |
CPPFLAGS = @CPPFLAGS@ |
41 |
CYGPATH_W = @CYGPATH_W@ |
42 |
DEFAULT_ARG_SIZE = @DEFAULT_ARG_SIZE@ |
43 |
-DEFS = @DEFS@ |
44 |
+DEFS = @DEFS@ -I. -I$(srcdir) -I.. -DWITH_SELINUX |
45 |
DEPDIR = @DEPDIR@ |
46 |
DIRENT_H = @DIRENT_H@ |
47 |
ECHO_C = @ECHO_C@ |
48 |
@@ -601,7 +601,7 @@ libfindtools_a_SOURCES = finddata.c fsty |
49 |
@WITH_FTS_TRUE@oldfind_SOURCES = find.c |
50 |
@WITH_FTS_FALSE@ftsfind_SOURCES = ftsfind.c |
51 |
EXTRA_DIST = defs.h $(man_MANS) |
52 |
-LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@ @LIB_CLOCK_GETTIME@ @FINDLIBS@ |
53 |
+LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@ @LIB_CLOCK_GETTIME@ @FINDLIBS@ -lselinux |
54 |
man_MANS = find.1 |
55 |
SUBDIRS = . testsuite |
56 |
all: all-recursive |
57 |
diff -purN findutils-4.3.11.orig/find/defs.h findutils-4.3.11/find/defs.h |
58 |
--- findutils-4.3.11.orig/find/defs.h 2007-11-30 05:19:58.000000000 -0500 |
59 |
+++ findutils-4.3.11/find/defs.h 2007-12-18 11:17:19.184032698 -0500 |
60 |
@@ -90,6 +90,9 @@ int get_statinfo PARAMS((const char *pat |
61 |
#define MODE_RWX (S_IXUSR | S_IXGRP | S_IXOTH | MODE_RW) |
62 |
#define MODE_ALL (S_ISUID | S_ISGID | S_ISVTX | MODE_RWX) |
63 |
|
64 |
+#ifdef WITH_SELINUX |
65 |
+#include <selinux/selinux.h> |
66 |
+#endif /*WITH_SELINUX*/ |
67 |
|
68 |
struct predicate; |
69 |
struct options; |
70 |
@@ -314,6 +317,9 @@ struct predicate |
71 |
struct samefile_file_id samefileid; /* samefile */ |
72 |
mode_t type; /* type */ |
73 |
struct format_val printf_vec; /* printf fprintf fprint ls fls print0 fprint0 print */ |
74 |
+#ifdef WITH_SELINUX |
75 |
+ security_context_t scontext; /* scontext */ |
76 |
+#endif /*WITH_SELINUX*/ |
77 |
} args; |
78 |
|
79 |
/* The next predicate in the user input sequence, |
80 |
@@ -458,7 +464,9 @@ PREDICATEFUNCTION pred_used; |
81 |
PREDICATEFUNCTION pred_user; |
82 |
PREDICATEFUNCTION pred_writable; |
83 |
PREDICATEFUNCTION pred_xtype; |
84 |
- |
85 |
+#ifdef WITH_SELINUX |
86 |
+PREDICATEFUNCTION pred_scontext; |
87 |
+#endif /* WITH_SELINUX */ |
88 |
|
89 |
|
90 |
int launch PARAMS((const struct buildcmd_control *ctl, |
91 |
@@ -605,10 +613,13 @@ struct options |
92 |
*/ |
93 |
unsigned short optimisation_level; |
94 |
|
95 |
- |
96 |
/* How should we quote filenames in error messages and so forth? |
97 |
*/ |
98 |
enum quoting_style err_quoting_style; |
99 |
+ |
100 |
+#ifdef WITH_SELINUX |
101 |
+ int (*x_getfilecon)(); |
102 |
+#endif /* WITH_SELINUX */ |
103 |
}; |
104 |
extern struct options options; |
105 |
|
106 |
diff -purN findutils-4.3.11.orig/find/find.1 findutils-4.3.11/find/find.1 |
107 |
--- findutils-4.3.11.orig/find/find.1 2007-12-02 06:41:55.000000000 -0500 |
108 |
+++ findutils-4.3.11/find/find.1 2007-12-18 11:17:19.184032698 -0500 |
109 |
@@ -740,6 +740,9 @@ links: if the \-H or \-P option was spec |
110 |
link to a file of type \fIc\fR; if the \-L option has been given, true |
111 |
if \fIc\fR is `l'. In other words, for symbolic links, \-xtype checks |
112 |
the type of the file that \-type does not check. |
113 |
+.IP "\-context \fIscontext\fR" |
114 |
+.IP "\--context \fIscontext\fR" |
115 |
+(SELinux only) File has the security context \fIscontext\fR. |
116 |
|
117 |
.SS ACTIONS |
118 |
.IP "\-delete\fR" |
119 |
@@ -1103,6 +1106,8 @@ File's numeric user ID. |
120 |
File's type (like in ls \-l), U=unknown type (shouldn't happen) |
121 |
.IP %Y |
122 |
File's type (like %y), plus follow symlinks: L=loop, N=nonexistent |
123 |
+.IP %Z |
124 |
+(SELinux only) file's security context. |
125 |
.PP |
126 |
A `%' character followed by any other character is discarded, but the |
127 |
other character is printed (don't rely on this, as further format |
128 |
diff -purN findutils-4.3.11.orig/find/find.c findutils-4.3.11/find/find.c |
129 |
--- findutils-4.3.11.orig/find/find.c 2007-11-22 03:22:10.000000000 -0500 |
130 |
+++ findutils-4.3.11/find/find.c 2007-12-18 11:17:19.188032926 -0500 |
131 |
@@ -1248,7 +1248,7 @@ process_path (char *pathname, char *name |
132 |
static void |
133 |
process_dir (char *pathname, char *name, int pathlen, const struct stat *statp, char *parent) |
134 |
{ |
135 |
- int subdirs_left; /* Number of unexamined subdirs in PATHNAME. */ |
136 |
+ int subdirs_left=0; /* Number of unexamined subdirs in PATHNAME. */ |
137 |
boolean subdirs_unreliable; /* if true, cannot use dir link count as subdir limif (if false, it may STILL be unreliable) */ |
138 |
unsigned int idx; /* Which entry are we on? */ |
139 |
struct stat stat_buf; |
140 |
diff -purN findutils-4.3.11.orig/find/parser.c findutils-4.3.11/find/parser.c |
141 |
--- findutils-4.3.11.orig/find/parser.c 2007-11-30 05:19:58.000000000 -0500 |
142 |
+++ findutils-4.3.11/find/parser.c 2007-12-18 11:17:19.188032926 -0500 |
143 |
@@ -53,6 +53,13 @@ |
144 |
#include <unistd.h> |
145 |
#include <sys/stat.h> |
146 |
|
147 |
+#ifdef WITH_SELINUX |
148 |
+#include <selinux/selinux.h> |
149 |
+int optionh_getfilecon(const char *name, security_context_t *p); |
150 |
+int optionl_getfilecon(const char *name, security_context_t *p); |
151 |
+int optionp_getfilecon(const char *name, security_context_t *p); |
152 |
+#endif /*WITH_SELINUX*/ |
153 |
+ |
154 |
#if ENABLE_NLS |
155 |
# include <libintl.h> |
156 |
# define _(Text) gettext (Text) |
157 |
@@ -156,6 +163,9 @@ static boolean parse_noignore_race PARAM |
158 |
static boolean parse_warn PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); |
159 |
static boolean parse_xtype PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); |
160 |
static boolean parse_quit PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); |
161 |
+#ifdef WITH_SELINUX |
162 |
+static boolean parse_scontext PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); |
163 |
+#endif /*WITH_SELINUX*/ |
164 |
|
165 |
boolean parse_print PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); |
166 |
|
167 |
@@ -341,6 +351,8 @@ static struct parser_table const parse_t |
168 |
{ARG_TEST, "-help", parse_help, NULL}, /* GNU */ |
169 |
{ARG_TEST, "version", parse_version, NULL}, /* GNU */ |
170 |
{ARG_TEST, "-version", parse_version, NULL}, /* GNU */ |
171 |
+ {ARG_TEST, "context", parse_scontext, pred_scontext}, /* SELinux */ |
172 |
+ {ARG_TEST, "-context", parse_scontext, pred_scontext}, /* SELinux */ |
173 |
{0, 0, 0, 0} |
174 |
}; |
175 |
|
176 |
@@ -452,10 +464,16 @@ set_follow_state(enum SymlinkOption opt) |
177 |
case SYMLINK_ALWAYS_DEREF: /* -L */ |
178 |
options.xstat = optionl_stat; |
179 |
options.no_leaf_check = true; |
180 |
+#ifdef WITH_SELINUX |
181 |
+ options.x_getfilecon = optionl_getfilecon; |
182 |
+#endif /* WITH_SELINUX */ |
183 |
break; |
184 |
|
185 |
case SYMLINK_NEVER_DEREF: /* -P (default) */ |
186 |
options.xstat = optionp_stat; |
187 |
+#ifdef WITH_SELINUX |
188 |
+ options.x_getfilecon = optionp_getfilecon; |
189 |
+#endif /* WITH_SELINUX */ |
190 |
/* Can't turn no_leaf_check off because the user might have specified |
191 |
* -noleaf anyway |
192 |
*/ |
193 |
@@ -464,6 +482,9 @@ set_follow_state(enum SymlinkOption opt) |
194 |
case SYMLINK_DEREF_ARGSONLY: /* -H */ |
195 |
options.xstat = optionh_stat; |
196 |
options.no_leaf_check = true; |
197 |
+#ifdef WITH_SELINUX |
198 |
+ options.x_getfilecon = optionh_getfilecon; |
199 |
+#endif /* WITH_SELINUX */ |
200 |
} |
201 |
} |
202 |
options.symlink_handling = opt; |
203 |
@@ -667,6 +688,94 @@ collect_arg_stat_info(char **argv, int * |
204 |
|
205 |
The predicate structure is updated with the new information. */ |
206 |
|
207 |
+#ifdef WITH_SELINUX |
208 |
+ |
209 |
+static int |
210 |
+fallback_getfilecon(const char *name, security_context_t *p, int prev_rv) |
211 |
+{ |
212 |
+ /* Our original getfilecon() call failed. Perhaps we can't follow a |
213 |
+ * symbolic link. If that might be the problem, lgetfilecon() the link. |
214 |
+ * Otherwise, admit defeat. |
215 |
+ */ |
216 |
+ switch (errno) |
217 |
+ { |
218 |
+ case ENOENT: |
219 |
+ case ENOTDIR: |
220 |
+#ifdef DEBUG_STAT |
221 |
+ fprintf(stderr, "fallback_getfilecon(): getfilecon(%s) failed; falling back on lgetfilecon()\n", name); |
222 |
+#endif |
223 |
+ return lgetfilecon(name, p); |
224 |
+ |
225 |
+ case EACCES: |
226 |
+ case EIO: |
227 |
+ case ELOOP: |
228 |
+ case ENAMETOOLONG: |
229 |
+#ifdef EOVERFLOW |
230 |
+ case EOVERFLOW: /* EOVERFLOW is not #defined on UNICOS. */ |
231 |
+#endif |
232 |
+ default: |
233 |
+ return prev_rv; |
234 |
+ } |
235 |
+} |
236 |
+ |
237 |
+ |
238 |
+/* optionh_getfilecon() implements the getfilecon operation when the |
239 |
+ * -H option is in effect. |
240 |
+ * |
241 |
+ * If the item to be examined is a command-line argument, we follow |
242 |
+ * symbolic links. If the getfilecon() call fails on the command-line |
243 |
+ * item, we fall back on the properties of the symbolic link. |
244 |
+ * |
245 |
+ * If the item to be examined is not a command-line argument, we |
246 |
+ * examine the link itself. |
247 |
+ */ |
248 |
+int |
249 |
+optionh_getfilecon(const char *name, security_context_t *p) |
250 |
+{ |
251 |
+ if (0 == state.curdepth) |
252 |
+ { |
253 |
+ /* This file is from the command line; deference the link (if it |
254 |
+ * is a link). |
255 |
+ */ |
256 |
+ int rv = getfilecon(name, p); |
257 |
+ if (0 == rv) |
258 |
+ return 0; /* success */ |
259 |
+ else |
260 |
+ return fallback_getfilecon(name, p, rv); |
261 |
+ } |
262 |
+ else |
263 |
+ { |
264 |
+ /* Not a file on the command line; do not derefernce the link. |
265 |
+ */ |
266 |
+ return lgetfilecon(name, p); |
267 |
+ } |
268 |
+} |
269 |
+ |
270 |
+/* optionl_getfilecon() implements the getfilecon operation when the |
271 |
+ * -L option is in effect. That option makes us examine the thing the |
272 |
+ * symbolic link points to, not the symbolic link itself. |
273 |
+ */ |
274 |
+int |
275 |
+optionl_getfilecon(const char *name, security_context_t *p) |
276 |
+{ |
277 |
+ int rv = getfilecon(name, p); |
278 |
+ if (0 == rv) |
279 |
+ return 0; /* normal case. */ |
280 |
+ else |
281 |
+ return fallback_getfilecon(name, p, rv); |
282 |
+} |
283 |
+ |
284 |
+/* optionp_getfilecon() implements the stat operation when the -P |
285 |
+ * option is in effect (this is also the default). That option makes |
286 |
+ * us examine the symbolic link itself, not the thing it points to. |
287 |
+ */ |
288 |
+int |
289 |
+optionp_getfilecon(const char *name, security_context_t *p) |
290 |
+{ |
291 |
+ return lgetfilecon(name, p); |
292 |
+} |
293 |
+#endif /* WITH_SELINUX */ |
294 |
+ |
295 |
|
296 |
static boolean |
297 |
parse_and (const struct parser_table* entry, char **argv, int *arg_ptr) |
298 |
@@ -1124,6 +1233,10 @@ tests (N can be +N or -N or N): -amin N |
299 |
-readable -writable -executable\n\ |
300 |
-wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N\n\ |
301 |
-used N -user NAME -xtype [bcdpfls]\n")); |
302 |
+#ifdef WITH_SELINUX |
303 |
+ puts (_("\ |
304 |
+ -context CONTEXT\n")); |
305 |
+#endif /*WITH_SELINUX*/ |
306 |
puts (_("\ |
307 |
actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print \n\ |
308 |
-fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit\n\ |
309 |
@@ -2519,6 +2632,29 @@ parse_version (const struct parser_table |
310 |
exit (0); |
311 |
} |
312 |
|
313 |
+#ifdef WITH_SELINUX |
314 |
+ |
315 |
+static boolean |
316 |
+parse_scontext ( const struct parser_table* entry, char **argv, int *arg_ptr) |
317 |
+{ |
318 |
+ struct predicate *our_pred; |
319 |
+ |
320 |
+ if ( (argv == NULL) || (argv[*arg_ptr] == NULL) ) |
321 |
+ return( false ); |
322 |
+ |
323 |
+ our_pred = insert_primary(entry); |
324 |
+ our_pred->need_stat = false; |
325 |
+#ifdef DEBUG |
326 |
+ our_pred->p_name = find_pred_name (pred_scontext); |
327 |
+#endif /*DEBUG*/ |
328 |
+ our_pred->args.scontext = argv[*arg_ptr];; |
329 |
+ |
330 |
+ (*arg_ptr)++; |
331 |
+ return( true ); |
332 |
+} |
333 |
+ |
334 |
+#endif /*WITH_SELINUX*/ |
335 |
+ |
336 |
static boolean |
337 |
parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr) |
338 |
{ |
339 |
@@ -2770,7 +2906,11 @@ insert_fprintf (struct format_val *vec, |
340 |
if (*scan2 == '.') |
341 |
for (scan2++; ISDIGIT (*scan2); scan2++) |
342 |
/* Do nothing. */ ; |
343 |
+#ifdef WITH_SELINUX |
344 |
+ if (strchr ("abcdDfFgGhHiklmMnpPsStuUyYZ", *scan2)) |
345 |
+#else |
346 |
if (strchr ("abcdDfFgGhHiklmMnpPsStuUyY", *scan2)) |
347 |
+#endif |
348 |
{ |
349 |
segmentp = make_segment (segmentp, format, scan2 - format, |
350 |
KIND_FORMAT, *scan2, 0, |
351 |
diff -purN findutils-4.3.11.orig/find/pred.c findutils-4.3.11/find/pred.c |
352 |
--- findutils-4.3.11.orig/find/pred.c 2007-12-02 06:41:55.000000000 -0500 |
353 |
+++ findutils-4.3.11/find/pred.c 2007-12-18 11:17:19.192033154 -0500 |
354 |
@@ -47,6 +47,14 @@ |
355 |
#include "error.h" |
356 |
#include "verify.h" |
357 |
|
358 |
+#ifdef WITH_SELINUX |
359 |
+#include <selinux/selinux.h> |
360 |
+#endif /*WITH_SELINUX*/ |
361 |
+ |
362 |
+#ifndef FNM_CASEFOLD |
363 |
+#define FNM_CASEFOLD (1<<4) |
364 |
+#endif /*FNM_CASEFOLD*/ |
365 |
+ |
366 |
#if ENABLE_NLS |
367 |
# include <libintl.h> |
368 |
# define _(Text) gettext (Text) |
369 |
@@ -229,6 +237,9 @@ struct pred_assoc pred_table[] = |
370 |
{pred_user, "user "}, |
371 |
{pred_writable, "writable "}, |
372 |
{pred_xtype, "xtype "}, |
373 |
+#ifdef WITH_SELINUX |
374 |
+ {pred_scontext, "context"}, |
375 |
+#endif /*WITH_SELINUX*/ |
376 |
{0, "none "} |
377 |
}; |
378 |
#endif |
379 |
@@ -1040,6 +1051,26 @@ do_fprintf(struct format_val *dest, |
380 |
mode_to_filetype(stat_buf->st_mode & S_IFMT)); |
381 |
} |
382 |
break; |
383 |
+#ifdef WITH_SELINUX |
384 |
+ case 'Z': /* SELinux security context */ |
385 |
+ { |
386 |
+ security_context_t scontext; |
387 |
+ int rv; |
388 |
+ rv = (*options.x_getfilecon)(state.rel_pathname, &scontext); |
389 |
+ |
390 |
+ if ( rv < 0 ) { |
391 |
+ fprintf(stderr, "getfileconf(%s): %s", |
392 |
+ pathname, strerror(errno)); |
393 |
+ fflush(stderr); |
394 |
+ } |
395 |
+ else { |
396 |
+ segment->text[segment->text_len] = 's'; |
397 |
+ checked_fprintf (dest, segment->text, scontext); |
398 |
+ freecon(scontext); |
399 |
+ } |
400 |
+ } |
401 |
+ break ; |
402 |
+#endif /* WITH_SELINUX */ |
403 |
} |
404 |
/* end of KIND_FORMAT case */ |
405 |
break; |
406 |
@@ -1829,6 +1860,31 @@ pred_xtype (const char *pathname, struct |
407 |
*/ |
408 |
return (pred_type (pathname, &sbuf, pred_ptr)); |
409 |
} |
410 |
+ |
411 |
+ |
412 |
+#ifdef WITH_SELINUX |
413 |
+ |
414 |
+boolean |
415 |
+pred_scontext (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) |
416 |
+{ |
417 |
+ int rv; |
418 |
+ security_context_t scontext; |
419 |
+ |
420 |
+ rv = (* options.x_getfilecon)(state.rel_pathname, &scontext); |
421 |
+ |
422 |
+ if ( rv < 0 ) { |
423 |
+ (void) fprintf(stderr, "getfilecon(%s): %s\n", pathname, strerror(errno)); |
424 |
+ (void) fflush(stderr); |
425 |
+ return ( false ); |
426 |
+ } |
427 |
+ |
428 |
+ rv = (fnmatch(pred_ptr->args.scontext, scontext,0)==0); |
429 |
+ freecon(scontext); |
430 |
+ return rv; |
431 |
+} |
432 |
+ |
433 |
+#endif /*WITH_SELINUX*/ |
434 |
+ |
435 |
|
436 |
/* 1) fork to get a child; parent remembers the child pid |
437 |
2) child execs the command requested |
438 |
diff -purN findutils-4.3.11.orig/find/tree.c findutils-4.3.11/find/tree.c |
439 |
--- findutils-4.3.11.orig/find/tree.c 2007-11-30 05:19:58.000000000 -0500 |
440 |
+++ findutils-4.3.11/find/tree.c 2007-12-18 11:17:19.192033154 -0500 |
441 |
@@ -1195,6 +1195,10 @@ build_expression_tree(int argc, char *ar |
442 |
const struct parser_table *entry_close, *entry_print, *entry_open; |
443 |
int i, oldi; |
444 |
|
445 |
+#ifdef WITH_SELINUX |
446 |
+ int is_selinux_enabled_flag = is_selinux_enabled()>0; |
447 |
+#endif /* WITH_SELINUX */ |
448 |
+ |
449 |
predicates = NULL; |
450 |
|
451 |
/* Find where in ARGV the predicates begin by skipping the list of |
452 |
@@ -1230,6 +1234,16 @@ build_expression_tree(int argc, char *ar |
453 |
} |
454 |
|
455 |
predicate_name = argv[i]; |
456 |
+ |
457 |
+#ifdef WITH_SELINUX |
458 |
+ if (! is_selinux_enabled_flag) { |
459 |
+ if ((strncmp(predicate_name,"-context",strlen("-context"))==0) || |
460 |
+ (strncmp(predicate_name,"--context",strlen("--context"))==0)) { |
461 |
+ error (1, 0,_("Error: invalid predicate %s: the kernel is not selinux-enabled.\n"),predicate_name); |
462 |
+ } |
463 |
+ } |
464 |
+#endif |
465 |
+ |
466 |
parse_entry = find_parser (predicate_name); |
467 |
if (parse_entry == NULL) |
468 |
{ |
469 |
@@ -1434,6 +1448,9 @@ get_new_pred (const struct parser_table |
470 |
last_pred->need_stat = true; |
471 |
last_pred->need_type = true; |
472 |
last_pred->args.str = NULL; |
473 |
+#ifdef WITH_SELINUX |
474 |
+ last_pred->args.scontext = NULL; |
475 |
+#endif |
476 |
last_pred->pred_next = NULL; |
477 |
last_pred->pred_left = NULL; |
478 |
last_pred->pred_right = NULL; |
479 |
|
480 |
|
481 |
|
482 |
-- |
483 |
gentoo-commits@g.o mailing list |