Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 315759 | Differences between
and this patch

Collapse All | Expand All

(-)findutils-4.4.2.orig/find/Makefile.am (-1 / +2 lines)
Lines 2-7 AUTOMAKE_OPTIONS = std-options Link Here
2
localedir = $(datadir)/locale
2
localedir = $(datadir)/locale
3
# noinst_PROGRAMS = regexprops
3
# noinst_PROGRAMS = regexprops
4
# regexprops_SOURCES = regexprops.c
4
# regexprops_SOURCES = regexprops.c
5
DEFS = @DEFS@ -I. -I$(srcdir) -I.. -DWITH_SELINUX
5
6
6
noinst_LIBRARIES = libfindtools.a
7
noinst_LIBRARIES = libfindtools.a
7
libfindtools_a_SOURCES = finddata.c fstype.c parser.c pred.c tree.c util.c
8
libfindtools_a_SOURCES = finddata.c fstype.c parser.c pred.c tree.c util.c
Lines 26-32 endif Link Here
26
27
27
EXTRA_DIST = defs.h $(man_MANS)
28
EXTRA_DIST = defs.h $(man_MANS)
28
INCLUDES = -I../gnulib/lib -I$(top_srcdir)/lib -I$(top_srcdir)/gnulib/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
29
INCLUDES = -I../gnulib/lib -I$(top_srcdir)/lib -I$(top_srcdir)/gnulib/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
29
LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@ @LIB_CLOCK_GETTIME@ @FINDLIBS@
30
LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@ @LIB_CLOCK_GETTIME@ @FINDLIBS@ -lselinux
30
man_MANS = find.1
31
man_MANS = find.1
31
SUBDIRS = . testsuite
32
SUBDIRS = . testsuite
32
33
(-)findutils-4.4.2.orig/find/Makefile.in (-2 / +2 lines)
Lines 275-281 CPP = @CPP@ Link Here
275
CPPFLAGS = @CPPFLAGS@
275
CPPFLAGS = @CPPFLAGS@
276
CYGPATH_W = @CYGPATH_W@
276
CYGPATH_W = @CYGPATH_W@
277
DEFAULT_ARG_SIZE = @DEFAULT_ARG_SIZE@
277
DEFAULT_ARG_SIZE = @DEFAULT_ARG_SIZE@
278
DEFS = @DEFS@
278
DEFS = @DEFS@ -I. -I$(srcdir) -I.. -DWITH_SELINUX
279
DEPDIR = @DEPDIR@
279
DEPDIR = @DEPDIR@
280
DIRENT_H = @DIRENT_H@
280
DIRENT_H = @DIRENT_H@
281
ECHO_C = @ECHO_C@
281
ECHO_C = @ECHO_C@
Lines 607-613 libfindtools_a_SOURCES = finddata.c fsty Link Here
607
@WITH_FTS_TRUE@oldfind_SOURCES = find.c
607
@WITH_FTS_TRUE@oldfind_SOURCES = find.c
608
@WITH_FTS_FALSE@ftsfind_SOURCES = ftsfind.c
608
@WITH_FTS_FALSE@ftsfind_SOURCES = ftsfind.c
609
EXTRA_DIST = defs.h $(man_MANS)
609
EXTRA_DIST = defs.h $(man_MANS)
610
LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@ @LIB_CLOCK_GETTIME@ @FINDLIBS@
610
LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@ @LIB_CLOCK_GETTIME@ @FINDLIBS@ -lselinux
611
man_MANS = find.1
611
man_MANS = find.1
612
SUBDIRS = . testsuite
612
SUBDIRS = . testsuite
613
all: all-recursive
613
all: all-recursive
(-)findutils-4.4.2.orig/find/defs.h (-2 / +13 lines)
Lines 91-96 int get_statinfo PARAMS((const char *pat Link Here
91
#define MODE_RWX	(S_IXUSR | S_IXGRP | S_IXOTH | MODE_RW)
91
#define MODE_RWX	(S_IXUSR | S_IXGRP | S_IXOTH | MODE_RW)
92
#define MODE_ALL	(S_ISUID | S_ISGID | S_ISVTX | MODE_RWX)
92
#define MODE_ALL	(S_ISUID | S_ISGID | S_ISVTX | MODE_RWX)
93
93
94
#ifdef WITH_SELINUX
95
#include <selinux/selinux.h>
96
#endif /*WITH_SELINUX*/
94
97
95
struct predicate;
98
struct predicate;
96
struct options;
99
struct options;
Lines 315-320 struct predicate Link Here
315
    struct samefile_file_id samefileid; /* samefile */
318
    struct samefile_file_id samefileid; /* samefile */
316
    mode_t type;		/* type */
319
    mode_t type;		/* type */
317
    struct format_val printf_vec; /* printf fprintf fprint ls fls print0 fprint0 print */
320
    struct format_val printf_vec; /* printf fprintf fprint ls fls print0 fprint0 print */
321
#ifdef WITH_SELINUX
322
    security_context_t scontext; /* scontext */
323
#endif /*WITH_SELINUX*/
318
  } args;
324
  } args;
319
325
320
  /* The next predicate in the user input sequence,
326
  /* The next predicate in the user input sequence,
Lines 459-465 PREDICATEFUNCTION pred_used; Link Here
459
PREDICATEFUNCTION pred_user;
465
PREDICATEFUNCTION pred_user;
460
PREDICATEFUNCTION pred_writable;
466
PREDICATEFUNCTION pred_writable;
461
PREDICATEFUNCTION pred_xtype;
467
PREDICATEFUNCTION pred_xtype;
462
468
#ifdef WITH_SELINUX
469
PREDICATEFUNCTION pred_scontext;
470
#endif /* WITH_SELINUX */
463
471
464
472
465
int launch PARAMS((const struct buildcmd_control *ctl,
473
int launch PARAMS((const struct buildcmd_control *ctl,
Lines 605-614 struct options Link Here
605
   */
613
   */
606
  unsigned short optimisation_level;
614
  unsigned short optimisation_level;
607
615
608
609
  /* How should we quote filenames in error messages and so forth?
616
  /* How should we quote filenames in error messages and so forth?
610
   */
617
   */
611
  enum quoting_style err_quoting_style;
618
  enum quoting_style err_quoting_style;
619
620
#ifdef WITH_SELINUX
621
  int (*x_getfilecon)();
622
#endif /* WITH_SELINUX */
612
};
623
};
613
extern struct options options;
624
extern struct options options;
614
625
(-)findutils-4.4.2.orig/find/find.1 (+6 lines)
Lines 934-939 checks the type of the file that Link Here
934
.B \-type
934
.B \-type
935
does not check.
935
does not check.
936
936
937
.IP "\-context \fIscontext\fR"
938
.IP "\--context \fIscontext\fR"
939
(SELinux only) File has the security context \fIscontext\fR.
940
937
.SS ACTIONS
941
.SS ACTIONS
938
.IP "\-delete\fR"
942
.IP "\-delete\fR"
939
Delete files; true if removal succeeded.  If the removal failed, an
943
Delete files; true if removal succeeded.  If the removal failed, an
Lines 1354-1359 File's type (like in Link Here
1354
U=unknown type (shouldn't happen)
1358
U=unknown type (shouldn't happen)
1355
.IP %Y
1359
.IP %Y
1356
File's type (like %y), plus follow symlinks: L=loop, N=nonexistent
1360
File's type (like %y), plus follow symlinks: L=loop, N=nonexistent
1361
.IP %Z
1362
(SELinux only) file's security context.
1357
.PP
1363
.PP
1358
A `%' character followed by any other character is discarded, but the
1364
A `%' character followed by any other character is discarded, but the
1359
other character is printed (don't rely on this, as further format
1365
other character is printed (don't rely on this, as further format
(-)findutils-4.4.2.orig/find/find.c (-1 / +1 lines)
Lines 1270-1276 process_path (char *pathname, char *name Link Here
1270
static void
1270
static void
1271
process_dir (char *pathname, char *name, int pathlen, const struct stat *statp, char *parent)
1271
process_dir (char *pathname, char *name, int pathlen, const struct stat *statp, char *parent)
1272
{
1272
{
1273
  int subdirs_left;		/* Number of unexamined subdirs in PATHNAME. */
1273
  int subdirs_left=0;		/* Number of unexamined subdirs in PATHNAME. */
1274
  boolean subdirs_unreliable;	/* if true, cannot use dir link count as subdir limif (if false, it may STILL be unreliable) */
1274
  boolean subdirs_unreliable;	/* if true, cannot use dir link count as subdir limif (if false, it may STILL be unreliable) */
1275
  unsigned int idx;		/* Which entry are we on? */
1275
  unsigned int idx;		/* Which entry are we on? */
1276
  struct stat stat_buf;
1276
  struct stat stat_buf;
(-)findutils-4.4.2.orig/find/parser.c (+140 lines)
Lines 53-58 Link Here
53
#include <unistd.h>
53
#include <unistd.h>
54
#include <sys/stat.h>
54
#include <sys/stat.h>
55
55
56
#ifdef WITH_SELINUX
57
#include <selinux/selinux.h>
58
int optionh_getfilecon(const char *name, security_context_t *p);
59
int optionl_getfilecon(const char *name, security_context_t *p);
60
int optionp_getfilecon(const char *name, security_context_t *p);
61
#endif /*WITH_SELINUX*/
62
56
#if ENABLE_NLS
63
#if ENABLE_NLS
57
# include <libintl.h>
64
# include <libintl.h>
58
# define _(Text) gettext (Text)
65
# define _(Text) gettext (Text)
Lines 155-160 static boolean parse_noignore_race PARAM Link Here
155
static boolean parse_warn          PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
162
static boolean parse_warn          PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
156
static boolean parse_xtype         PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
163
static boolean parse_xtype         PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
157
static boolean parse_quit          PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
164
static boolean parse_quit          PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
165
#ifdef WITH_SELINUX
166
static boolean parse_scontext      PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
167
#endif /*WITH_SELINUX*/
158
168
159
boolean parse_print             PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
169
boolean parse_print             PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
160
170
Lines 340-345 static struct parser_table const parse_t Link Here
340
  {ARG_TEST, "-help",                 parse_help,    NULL},       /* GNU */
350
  {ARG_TEST, "-help",                 parse_help,    NULL},       /* GNU */
341
  {ARG_TEST, "version",               parse_version, NULL},	  /* GNU */
351
  {ARG_TEST, "version",               parse_version, NULL},	  /* GNU */
342
  {ARG_TEST, "-version",              parse_version, NULL},	  /* GNU */
352
  {ARG_TEST, "-version",              parse_version, NULL},	  /* GNU */
353
  {ARG_TEST, "context",               parse_scontext, pred_scontext},	/* SELinux */
354
  {ARG_TEST, "-context",              parse_scontext, pred_scontext},	/* SELinux */
343
  {0, 0, 0, 0}
355
  {0, 0, 0, 0}
344
};
356
};
345
357
Lines 451-460 set_follow_state(enum SymlinkOption opt) Link Here
451
	case SYMLINK_ALWAYS_DEREF:  /* -L */
463
	case SYMLINK_ALWAYS_DEREF:  /* -L */
452
	  options.xstat = optionl_stat;
464
	  options.xstat = optionl_stat;
453
	  options.no_leaf_check = true;
465
	  options.no_leaf_check = true;
466
#ifdef WITH_SELINUX
467
	  options.x_getfilecon = optionl_getfilecon;
468
#endif /* WITH_SELINUX */
454
	  break;
469
	  break;
455
470
456
	case SYMLINK_NEVER_DEREF:	/* -P (default) */
471
	case SYMLINK_NEVER_DEREF:	/* -P (default) */
457
	  options.xstat = optionp_stat;
472
	  options.xstat = optionp_stat;
473
#ifdef WITH_SELINUX
474
	  options.x_getfilecon = optionp_getfilecon;
475
#endif /* WITH_SELINUX */
458
	  /* Can't turn no_leaf_check off because the user might have specified
476
	  /* Can't turn no_leaf_check off because the user might have specified
459
	   * -noleaf anyway
477
	   * -noleaf anyway
460
	   */
478
	   */
Lines 463-468 set_follow_state(enum SymlinkOption opt) Link Here
463
	case SYMLINK_DEREF_ARGSONLY: /* -H */
481
	case SYMLINK_DEREF_ARGSONLY: /* -H */
464
	  options.xstat = optionh_stat;
482
	  options.xstat = optionh_stat;
465
	  options.no_leaf_check = true;
483
	  options.no_leaf_check = true;
484
#ifdef WITH_SELINUX
485
	  options.x_getfilecon = optionh_getfilecon;
486
#endif /* WITH_SELINUX */
466
	}
487
	}
467
    }
488
    }
468
  options.symlink_handling = opt;
489
  options.symlink_handling = opt;
Lines 670-675 collect_arg_stat_info(char **argv, int * Link Here
670
691
671
   The predicate structure is updated with the new information. */
692
   The predicate structure is updated with the new information. */
672
693
694
#ifdef WITH_SELINUX
695
696
static int
697
fallback_getfilecon(const char *name, security_context_t *p, int prev_rv)
698
{
699
  /* Our original getfilecon() call failed.  Perhaps we can't follow a
700
   * symbolic link.  If that might be the problem, lgetfilecon() the link. 
701
   * Otherwise, admit defeat. 
702
   */
703
  switch (errno)
704
    {
705
    case ENOENT:
706
    case ENOTDIR:
707
#ifdef DEBUG_STAT
708
      fprintf(stderr, "fallback_getfilecon(): getfilecon(%s) failed; falling back on lgetfilecon()\n", name);
709
#endif
710
      return lgetfilecon(name, p);
711
712
    case EACCES:
713
    case EIO:
714
    case ELOOP:
715
    case ENAMETOOLONG:
716
#ifdef EOVERFLOW
717
    case EOVERFLOW:	    /* EOVERFLOW is not #defined on UNICOS. */
718
#endif
719
    default:
720
      return prev_rv;	       
721
    }
722
}
723
724
725
/* optionh_getfilecon() implements the getfilecon operation when the
726
 * -H option is in effect.
727
 * 
728
 * If the item to be examined is a command-line argument, we follow
729
 * symbolic links.  If the getfilecon() call fails on the command-line
730
 * item, we fall back on the properties of the symbolic link.
731
 *
732
 * If the item to be examined is not a command-line argument, we
733
 * examine the link itself.
734
 */
735
int 
736
optionh_getfilecon(const char *name, security_context_t *p)
737
{
738
  if (0 == state.curdepth) 
739
    {
740
      /* This file is from the command line; deference the link (if it
741
       * is a link).  
742
       */
743
      int rv = getfilecon(name, p);
744
      if (0 == rv)
745
	return 0;		/* success */
746
      else
747
	return fallback_getfilecon(name, p, rv);
748
    }
749
  else
750
    {
751
      /* Not a file on the command line; do not derefernce the link.
752
       */
753
      return lgetfilecon(name, p);
754
    }
755
}
756
757
/* optionl_getfilecon() implements the getfilecon operation when the
758
 * -L option is in effect.  That option makes us examine the thing the
759
 * symbolic link points to, not the symbolic link itself.
760
 */
761
int 
762
optionl_getfilecon(const char *name, security_context_t *p)
763
{
764
  int rv = getfilecon(name, p);
765
  if (0 == rv)
766
    return 0;			/* normal case. */
767
  else
768
    return fallback_getfilecon(name, p, rv);
769
}
770
771
/* optionp_getfilecon() implements the stat operation when the -P
772
 * option is in effect (this is also the default).  That option makes
773
 * us examine the symbolic link itself, not the thing it points to.
774
 */
775
int 
776
optionp_getfilecon(const char *name, security_context_t *p)
777
{
778
  return lgetfilecon(name, p);
779
}
780
#endif /* WITH_SELINUX */
781
673
782
674
static boolean
783
static boolean
675
parse_and (const struct parser_table* entry, char **argv, int *arg_ptr)
784
parse_and (const struct parser_table* entry, char **argv, int *arg_ptr)
Lines 1128-1133 tests (N can be +N or -N or N): -amin N Link Here
1128
      -readable -writable -executable\n\
1237
      -readable -writable -executable\n\
1129
      -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N\n\
1238
      -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N\n\
1130
      -used N -user NAME -xtype [bcdpfls]\n"));
1239
      -used N -user NAME -xtype [bcdpfls]\n"));
1240
#ifdef WITH_SELINUX
1241
  puts (_("\
1242
      -context CONTEXT\n"));
1243
#endif /*WITH_SELINUX*/
1131
  puts (_("\
1244
  puts (_("\
1132
actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print \n\
1245
actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print \n\
1133
      -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit\n\
1246
      -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit\n\
Lines 2552-2557 parse_version (const struct parser_table Link Here
2552
  exit (0);
2665
  exit (0);
2553
}
2666
}
2554
2667
2668
#ifdef WITH_SELINUX
2669
2670
static boolean
2671
parse_scontext ( const struct parser_table* entry, char **argv, int *arg_ptr)
2672
{
2673
  struct predicate *our_pred;
2674
2675
  if ( (argv == NULL) || (argv[*arg_ptr] == NULL) )
2676
    return( false );
2677
2678
  our_pred = insert_primary(entry);
2679
  our_pred->need_stat = false;
2680
#ifdef DEBUG
2681
  our_pred->p_name = find_pred_name (pred_scontext);
2682
#endif /*DEBUG*/
2683
  our_pred->args.scontext = argv[*arg_ptr];;
2684
2685
  (*arg_ptr)++;
2686
  return( true );
2687
}
2688
2689
#endif /*WITH_SELINUX*/
2690
2555
static boolean
2691
static boolean
2556
parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
2692
parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
2557
{
2693
{
Lines 2803-2809 insert_fprintf (struct format_val *vec, Link Here
2803
	  if (*scan2 == '.')
2939
	  if (*scan2 == '.')
2804
	    for (scan2++; ISDIGIT (*scan2); scan2++)
2940
	    for (scan2++; ISDIGIT (*scan2); scan2++)
2805
	      /* Do nothing. */ ;
2941
	      /* Do nothing. */ ;
2942
#ifdef WITH_SELINUX
2943
	  if (strchr ("abcdDfFgGhHiklmMnpPsStuUyYZ", *scan2))
2944
#else
2806
	  if (strchr ("abcdDfFgGhHiklmMnpPsStuUyY", *scan2))
2945
	  if (strchr ("abcdDfFgGhHiklmMnpPsStuUyY", *scan2))
2946
#endif
2807
	    {
2947
	    {
2808
	      segmentp = make_segment (segmentp, format, scan2 - format,
2948
	      segmentp = make_segment (segmentp, format, scan2 - format,
2809
				       KIND_FORMAT, *scan2, 0,
2949
				       KIND_FORMAT, *scan2, 0,
(-)findutils-4.4.2.orig/find/pred.c (+56 lines)
Lines 48-53 Link Here
48
#include "error.h"
48
#include "error.h"
49
#include "verify.h"
49
#include "verify.h"
50
50
51
#ifdef WITH_SELINUX
52
#include <selinux/selinux.h>
53
#endif /*WITH_SELINUX*/
54
55
#ifndef FNM_CASEFOLD
56
#define FNM_CASEFOLD (1<<4)
57
#endif  /*FNM_CASEFOLD*/
58
51
#if ENABLE_NLS
59
#if ENABLE_NLS
52
# include <libintl.h>
60
# include <libintl.h>
53
# define _(Text) gettext (Text)
61
# define _(Text) gettext (Text)
Lines 230-235 struct pred_assoc pred_table[] = Link Here
230
  {pred_user, "user    "},
238
  {pred_user, "user    "},
231
  {pred_writable, "writable "},
239
  {pred_writable, "writable "},
232
  {pred_xtype, "xtype   "},
240
  {pred_xtype, "xtype   "},
241
#ifdef WITH_SELINUX
242
  {pred_scontext, "context"},
243
#endif /*WITH_SELINUX*/
233
  {0, "none    "}
244
  {0, "none    "}
234
};
245
};
235
#endif
246
#endif
Lines 1054-1059 do_fprintf(struct format_val *dest, Link Here
1054
			     mode_to_filetype(stat_buf->st_mode & S_IFMT));
1065
			     mode_to_filetype(stat_buf->st_mode & S_IFMT));
1055
	  }
1066
	  }
1056
	  break;
1067
	  break;
1068
#ifdef WITH_SELINUX
1069
      case 'Z':               /* SELinux security context */
1070
        {
1071
          security_context_t scontext;
1072
          int rv;
1073
          rv = (*options.x_getfilecon)(state.rel_pathname, &scontext);
1074
1075
          if ( rv < 0 ) {
1076
            fprintf(stderr, "getfileconf(%s): %s",
1077
                           pathname, strerror(errno));
1078
            fflush(stderr);
1079
          }
1080
          else {
1081
	      segment->text[segment->text_len] = 's';
1082
	      checked_fprintf (dest, segment->text, scontext);
1083
	      freecon(scontext);
1084
          }
1085
        }
1086
        break ;
1087
#endif /* WITH_SELINUX */
1057
	}
1088
	}
1058
      /* end of KIND_FORMAT case */
1089
      /* end of KIND_FORMAT case */
1059
      break;
1090
      break;
Lines 1844-1849 pred_xtype (const char *pathname, struct Link Here
1844
   */
1875
   */
1845
  return (pred_type (pathname, &sbuf, pred_ptr));
1876
  return (pred_type (pathname, &sbuf, pred_ptr));
1846
}
1877
}
1878
  
1879
1880
#ifdef WITH_SELINUX
1881
1882
boolean
1883
pred_scontext (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
1884
{
1885
  int rv;
1886
  security_context_t scontext;
1887
1888
  rv = (* options.x_getfilecon)(state.rel_pathname, &scontext);
1889
1890
  if ( rv < 0 ) {
1891
    (void) fprintf(stderr, "getfilecon(%s): %s\n", pathname, strerror(errno));
1892
    (void) fflush(stderr);
1893
    return ( false );
1894
  }
1895
1896
  rv = (fnmatch(pred_ptr->args.scontext, scontext,0)==0);
1897
  freecon(scontext);
1898
  return rv;
1899
}
1900
1901
#endif /*WITH_SELINUX*/
1902
1847
1903
1848
/*  1) fork to get a child; parent remembers the child pid
1904
/*  1) fork to get a child; parent remembers the child pid
1849
    2) child execs the command requested
1905
    2) child execs the command requested
(-)findutils-4.4.2.orig/find/tree.c (+17 lines)
Lines 1195-1200 build_expression_tree(int argc, char *ar Link Here
1195
  const struct parser_table *entry_close, *entry_print, *entry_open;
1195
  const struct parser_table *entry_close, *entry_print, *entry_open;
1196
  int i, oldi;
1196
  int i, oldi;
1197
1197
1198
#ifdef WITH_SELINUX
1199
  int is_selinux_enabled_flag = is_selinux_enabled()>0;
1200
#endif /* WITH_SELINUX */
1201
1198
  predicates = NULL;
1202
  predicates = NULL;
1199
  
1203
  
1200
  /* Find where in ARGV the predicates begin by skipping the list of
1204
  /* Find where in ARGV the predicates begin by skipping the list of
Lines 1230-1235 build_expression_tree(int argc, char *ar Link Here
1230
	}
1234
	}
1231
1235
1232
      predicate_name = argv[i];
1236
      predicate_name = argv[i];
1237
1238
#ifdef WITH_SELINUX
1239
      if (! is_selinux_enabled_flag) {
1240
	if ((strncmp(predicate_name,"-context",strlen("-context"))==0) ||
1241
	    (strncmp(predicate_name,"--context",strlen("--context"))==0)) {
1242
	  error (1, 0,_("Error: invalid predicate %s: the kernel is not selinux-enabled.\n"),predicate_name);
1243
	}
1244
      }
1245
#endif
1246
1233
      parse_entry = find_parser (predicate_name);
1247
      parse_entry = find_parser (predicate_name);
1234
      if (parse_entry == NULL)
1248
      if (parse_entry == NULL)
1235
	{
1249
	{
Lines 1434-1439 get_new_pred (const struct parser_table Link Here
1434
  last_pred->need_stat = true;
1448
  last_pred->need_stat = true;
1435
  last_pred->need_type = true;
1449
  last_pred->need_type = true;
1436
  last_pred->args.str = NULL;
1450
  last_pred->args.str = NULL;
1451
#ifdef WITH_SELINUX
1452
  last_pred->args.scontext = NULL;
1453
#endif
1437
  last_pred->pred_next = NULL;
1454
  last_pred->pred_next = NULL;
1438
  last_pred->pred_left = NULL;
1455
  last_pred->pred_left = NULL;
1439
  last_pred->pred_right = NULL;
1456
  last_pred->pred_right = NULL;

Return to bug 315759