summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin Ouyang <Xin.Ouyang@windriver.com>2012-07-28 16:11:07 +0800
committerXin Ouyang <Xin.Ouyang@windriver.com>2012-07-28 16:25:25 +0800
commitc9a06873bd033c975e077c72e7a78bdba1a7eec8 (patch)
treee4da31fcb38a38f4c8b2c3d0073b121098abbdb0
parenta95119dbecf190d275e021bdff7ff89e08c5f104 (diff)
downloadmeta-selinux-c9a06873bd033c975e077c72e7a78bdba1a7eec8.tar.gz
findutils-4.4.2: fix build failure while no selinux disto_feature.
Current patches for selinux simply add selinux codes without conditional switches. And also, the gnulib patch is incomplete. These will cause build failures while we include selinux layers but do not specify selinux in DISTO_FEATURES. Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
-rw-r--r--recipes-extended/findutils/findutils-4.4.2/findutils-with-selinux-gnulib.patch (renamed from recipes-extended/findutils/findutils-4.4.2/findutils-selinux-gnulib.patch)208
-rw-r--r--recipes-extended/findutils/findutils-4.4.2/findutils-with-selinux.patch (renamed from recipes-extended/findutils/findutils-4.4.2/findutils-selinux.patch)218
-rw-r--r--recipes-extended/findutils/findutils_4.4.2.bbappend6
3 files changed, 278 insertions, 154 deletions
diff --git a/recipes-extended/findutils/findutils-4.4.2/findutils-selinux-gnulib.patch b/recipes-extended/findutils/findutils-4.4.2/findutils-with-selinux-gnulib.patch
index 85a1c3a..866ecdc 100644
--- a/recipes-extended/findutils/findutils-4.4.2/findutils-selinux-gnulib.patch
+++ b/recipes-extended/findutils/findutils-4.4.2/findutils-with-selinux-gnulib.patch
@@ -1,28 +1,31 @@
1From: Xin Ouyang <Xin.Ouyang@windriver.com> 1Subject: [PATCH] findutils: support selinux and gnulib
2Date: Tue, 26 Jun 2012 13:56:52 +0800
3Subject: [PATCH 2/2] findutils: support selinux and gnulib
4 2
5Upstream-Status: Inappropriate [configuration] 3Upstream-Status: Inappropriate [configuration]
6 4
7This is a F13 SRPM patch. 5This is modified from a F13 SRPM patch.
8 6
9Once the selinux-at module appears on the list within import-gnulib.config, 7Once the selinux-at module appears on the list within import-gnulib.config,
10this patch is no longer needed. 8this patch is no longer needed.
9
10Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
11--- 11---
12 aclocal.m4 | 2 + 12 aclocal.m4 | 2 +
13 gnulib/lib/Makefile.am | 43 ++++++ 13 gnulib/lib/Makefile.am | 44 +++++++
14 gnulib/lib/at-func.c | 98 ++++++++++---- 14 gnulib/lib/at-func.c | 98 ++++++++++----
15 gnulib/lib/getfilecon.c | 87 ++++++++++++ 15 gnulib/lib/getfilecon.c | 87 ++++++++++++
16 gnulib/lib/openat.c | 285 ++++++++++++++++++++-------------------- 16 gnulib/lib/openat.c | 285 ++++++++++++++++++++--------------------
17 gnulib/lib/openat.h | 88 ++++++------- 17 gnulib/lib/openat.h | 88 ++++++-------
18 gnulib/lib/se-selinux.in.h | 73 ++++++++++ 18 gnulib/lib/se-context.in.h | 34 +++++
19 gnulib/lib/se-selinux.in.h | 103 +++++++++++++++
19 gnulib/lib/selinux-at.c | 72 ++++++++++ 20 gnulib/lib/selinux-at.c | 72 ++++++++++
20 gnulib/lib/selinux-at.h | 52 ++++++++ 21 gnulib/lib/selinux-at.h | 52 ++++++++
21 gnulib/m4/gnulib-comp.m4 | 12 ++ 22 gnulib/m4/gnulib-comp.m4 | 12 ++
23 gnulib/m4/include_next.m4 | 29 +++-
22 gnulib/m4/selinux-context-h.m4 | 16 +++ 24 gnulib/m4/selinux-context-h.m4 | 16 +++
23 gnulib/m4/selinux-selinux-h.m4 | 57 ++++++++ 25 gnulib/m4/selinux-selinux-h.m4 | 57 ++++++++
24 12 files changed, 665 insertions(+), 220 deletions(-) 26 14 files changed, 753 insertions(+), 226 deletions(-)
25 create mode 100644 gnulib/lib/getfilecon.c 27 create mode 100644 gnulib/lib/getfilecon.c
28 create mode 100644 gnulib/lib/se-context.in.h
26 create mode 100644 gnulib/lib/se-selinux.in.h 29 create mode 100644 gnulib/lib/se-selinux.in.h
27 create mode 100644 gnulib/lib/selinux-at.c 30 create mode 100644 gnulib/lib/selinux-at.c
28 create mode 100644 gnulib/lib/selinux-at.h 31 create mode 100644 gnulib/lib/selinux-at.h
@@ -30,10 +33,10 @@ this patch is no longer needed.
30 create mode 100644 gnulib/m4/selinux-selinux-h.m4 33 create mode 100644 gnulib/m4/selinux-selinux-h.m4
31 34
32diff --git a/aclocal.m4 b/aclocal.m4 35diff --git a/aclocal.m4 b/aclocal.m4
33index 95ff111..0034170 100644 36index 1f97dda..61ad660 100644
34--- a/aclocal.m4 37--- a/aclocal.m4
35+++ b/aclocal.m4 38+++ b/aclocal.m4
36@@ -115,6 +115,8 @@ m4_include([gnulib/m4/rpmatch.m4]) 39@@ -1039,6 +1039,8 @@ m4_include([gnulib/m4/rpmatch.m4])
37 m4_include([gnulib/m4/same.m4]) 40 m4_include([gnulib/m4/same.m4])
38 m4_include([gnulib/m4/save-cwd.m4]) 41 m4_include([gnulib/m4/save-cwd.m4])
39 m4_include([gnulib/m4/savedir.m4]) 42 m4_include([gnulib/m4/savedir.m4])
@@ -43,10 +46,10 @@ index 95ff111..0034170 100644
43 m4_include([gnulib/m4/ssize_t.m4]) 46 m4_include([gnulib/m4/ssize_t.m4])
44 m4_include([gnulib/m4/st_dm_mode.m4]) 47 m4_include([gnulib/m4/st_dm_mode.m4])
45diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am 48diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am
46index 59ed5f2..b13e509 100644 49index 59ed5f2..7f105a9 100644
47--- a/gnulib/lib/Makefile.am 50--- a/gnulib/lib/Makefile.am
48+++ b/gnulib/lib/Makefile.am 51+++ b/gnulib/lib/Makefile.am
49@@ -1007,6 +1007,49 @@ EXTRA_libgnulib_a_SOURCES += savedir.c 52@@ -1007,6 +1007,50 @@ EXTRA_libgnulib_a_SOURCES += savedir.c
50 53
51 ## end gnulib module savedir 54 ## end gnulib module savedir
52 55
@@ -70,6 +73,7 @@ index 59ed5f2..b13e509 100644
70+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ 73+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
71+ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ 74+ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
72+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ 75+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
76+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
73+ -e 's|@''NEXT_SELINUX_SELINUX_H''@|$(NEXT_SELINUX_SELINUX_H)|g' \ 77+ -e 's|@''NEXT_SELINUX_SELINUX_H''@|$(NEXT_SELINUX_SELINUX_H)|g' \
74+ < $(srcdir)/se-selinux.in.h; \ 78+ < $(srcdir)/se-selinux.in.h; \
75+ } > $@-t && \ 79+ } > $@-t && \
@@ -825,18 +829,75 @@ index b5e4f11..433b998 100644
825+#endif 829+#endif
826+ 830+
827+#endif /* _GL_HEADER_OPENAT */ 831+#endif /* _GL_HEADER_OPENAT */
832diff --git a/gnulib/lib/se-context.in.h b/gnulib/lib/se-context.in.h
833new file mode 100644
834index 0000000..a34a7fb
835--- /dev/null
836+++ b/gnulib/lib/se-context.in.h
837@@ -0,0 +1,34 @@
838+#ifndef SELINUX_CONTEXT_H
839+# define SELINUX_CONTEXT_H
840+
841+# include <errno.h>
842+
843+#ifndef _GL_UNUSED_PARAMETER
844+# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
845+# define _GL_UNUSED_PARAMETER __attribute__ ((__unused__))
846+# else
847+# define _GL_UNUSED_PARAMETER
848+# endif
849+#endif
850+
851+typedef int context_t;
852+static inline context_t context_new (char const *s _GL_UNUSED_PARAMETER)
853+ { errno = ENOTSUP; return 0; }
854+static inline char *context_str (context_t con _GL_UNUSED_PARAMETER)
855+ { errno = ENOTSUP; return (void *) 0; }
856+static inline void context_free (context_t c _GL_UNUSED_PARAMETER) {}
857+
858+static inline int context_user_set (context_t sc _GL_UNUSED_PARAMETER,
859+ char const *s _GL_UNUSED_PARAMETER)
860+ { errno = ENOTSUP; return -1; }
861+static inline int context_role_set (context_t sc _GL_UNUSED_PARAMETER,
862+ char const *s _GL_UNUSED_PARAMETER)
863+ { errno = ENOTSUP; return -1; }
864+static inline int context_range_set (context_t sc _GL_UNUSED_PARAMETER,
865+ char const *s _GL_UNUSED_PARAMETER)
866+ { errno = ENOTSUP; return -1; }
867+static inline int context_type_set (context_t sc _GL_UNUSED_PARAMETER,
868+ char const *s _GL_UNUSED_PARAMETER)
869+ { errno = ENOTSUP; return -1; }
870+
871+#endif
828diff --git a/gnulib/lib/se-selinux.in.h b/gnulib/lib/se-selinux.in.h 872diff --git a/gnulib/lib/se-selinux.in.h b/gnulib/lib/se-selinux.in.h
829new file mode 100644 873new file mode 100644
830index 0000000..3f30a3c 874index 0000000..d683101
831--- /dev/null 875--- /dev/null
832+++ b/gnulib/lib/se-selinux.in.h 876+++ b/gnulib/lib/se-selinux.in.h
833@@ -0,0 +1,73 @@ 877@@ -0,0 +1,103 @@
878+/* Replacement <selinux/selinux.h> for platforms that lack it.
879+ Copyright (C) 2008-2011 Free Software Foundation, Inc.
880+
881+ This program is free software: you can redistribute it and/or modify
882+ it under the terms of the GNU General Public License as published by
883+ the Free Software Foundation; either version 3 of the License, or
884+ (at your option) any later version.
885+
886+ This program is distributed in the hope that it will be useful,
887+ but WITHOUT ANY WARRANTY; without even the implied warranty of
888+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
889+ GNU General Public License for more details.
890+
891+ You should have received a copy of the GNU General Public License
892+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
893+
834+#ifndef _GL_SELINUX_SELINUX_H 894+#ifndef _GL_SELINUX_SELINUX_H
835+# define _GL_SELINUX_SELINUX_H 895+# define _GL_SELINUX_SELINUX_H
836+ 896+
837+# if __GNUC__ >= 3 897+# if __GNUC__ >= 3
838+#pragma GCC system_header 898+@PRAGMA_SYSTEM_HEADER@
839+# endif 899+# endif
900+@PRAGMA_COLUMNS@
840+ 901+
841+# if HAVE_SELINUX_SELINUX_H 902+# if HAVE_SELINUX_SELINUX_H
842+ 903+
@@ -847,61 +908,74 @@ index 0000000..3f30a3c
847+# include <sys/types.h> 908+# include <sys/types.h>
848+# include <errno.h> 909+# include <errno.h>
849+ 910+
911+#ifndef _GL_UNUSED_PARAMETER
912+# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
913+# define _GL_UNUSED_PARAMETER __attribute__ ((__unused__))
914+# else
915+# define _GL_UNUSED_PARAMETER
916+# endif
917+#endif
918+
919+# if !GNULIB_defined_security_types
920+
850+typedef unsigned short security_class_t; 921+typedef unsigned short security_class_t;
851+# define security_context_t char* 922+# define security_context_t char*
852+# define is_selinux_enabled() 0 923+# define is_selinux_enabled() 0
853+ 924+
854+static inline int getcon (security_context_t *con _UNUSED_PARAMETER_) 925+static inline int getcon (security_context_t *con _GL_UNUSED_PARAMETER)
855+ { errno = ENOTSUP; return -1; } 926+ { errno = ENOTSUP; return -1; }
856+static inline void freecon (security_context_t con _UNUSED_PARAMETER_) {} 927+static inline void freecon (security_context_t con _GL_UNUSED_PARAMETER) {}
857+ 928+
858+ 929+
859+static inline int getfscreatecon (security_context_t *con _UNUSED_PARAMETER_) 930+static inline int getfscreatecon (security_context_t *con _GL_UNUSED_PARAMETER)
860+ { errno = ENOTSUP; return -1; } 931+ { errno = ENOTSUP; return -1; }
861+static inline int setfscreatecon (security_context_t con _UNUSED_PARAMETER_) 932+static inline int setfscreatecon (security_context_t con _GL_UNUSED_PARAMETER)
862+ { errno = ENOTSUP; return -1; } 933+ { errno = ENOTSUP; return -1; }
863+static inline int matchpathcon (char const *file _UNUSED_PARAMETER_, 934+static inline int matchpathcon (char const *file _GL_UNUSED_PARAMETER,
864+ mode_t m _UNUSED_PARAMETER_, 935+ mode_t m _GL_UNUSED_PARAMETER,
865+ security_context_t *con _UNUSED_PARAMETER_) 936+ security_context_t *con _GL_UNUSED_PARAMETER)
866+ { errno = ENOTSUP; return -1; } 937+ { errno = ENOTSUP; return -1; }
867+static inline int getfilecon (char const *file _UNUSED_PARAMETER_, 938+static inline int getfilecon (char const *file _GL_UNUSED_PARAMETER,
868+ security_context_t *con _UNUSED_PARAMETER_) 939+ security_context_t *con _GL_UNUSED_PARAMETER)
869+ { errno = ENOTSUP; return -1; } 940+ { errno = ENOTSUP; return -1; }
870+static inline int lgetfilecon (char const *file _UNUSED_PARAMETER_, 941+static inline int lgetfilecon (char const *file _GL_UNUSED_PARAMETER,
871+ security_context_t *con _UNUSED_PARAMETER_) 942+ security_context_t *con _GL_UNUSED_PARAMETER)
872+ { errno = ENOTSUP; return -1; } 943+ { errno = ENOTSUP; return -1; }
873+static inline int fgetfilecon (int fd, 944+static inline int fgetfilecon (int fd,
874+ security_context_t *con _UNUSED_PARAMETER_) 945+ security_context_t *con _GL_UNUSED_PARAMETER)
875+ { errno = ENOTSUP; return -1; } 946+ { errno = ENOTSUP; return -1; }
876+static inline int setfilecon (char const *file _UNUSED_PARAMETER_, 947+static inline int setfilecon (char const *file _GL_UNUSED_PARAMETER,
877+ security_context_t con _UNUSED_PARAMETER_) 948+ security_context_t con _GL_UNUSED_PARAMETER)
878+ { errno = ENOTSUP; return -1; } 949+ { errno = ENOTSUP; return -1; }
879+static inline int lsetfilecon (char const *file _UNUSED_PARAMETER_, 950+static inline int lsetfilecon (char const *file _GL_UNUSED_PARAMETER,
880+ security_context_t con _UNUSED_PARAMETER_) 951+ security_context_t con _GL_UNUSED_PARAMETER)
881+ { errno = ENOTSUP; return -1; } 952+ { errno = ENOTSUP; return -1; }
882+static inline int fsetfilecon (int fd _UNUSED_PARAMETER_, 953+static inline int fsetfilecon (int fd _GL_UNUSED_PARAMETER,
883+ security_context_t con _UNUSED_PARAMETER_) 954+ security_context_t con _GL_UNUSED_PARAMETER)
884+ { errno = ENOTSUP; return -1; } 955+ { errno = ENOTSUP; return -1; }
885+ 956+
886+static inline int security_check_context 957+static inline int security_check_context
887+ (security_context_t con _UNUSED_PARAMETER_) 958+ (security_context_t con _GL_UNUSED_PARAMETER)
888+ { errno = ENOTSUP; return -1; } 959+ { errno = ENOTSUP; return -1; }
889+static inline int security_check_context_raw 960+static inline int security_check_context_raw
890+ (security_context_t con _UNUSED_PARAMETER_) 961+ (security_context_t con _GL_UNUSED_PARAMETER)
891+ { errno = ENOTSUP; return -1; } 962+ { errno = ENOTSUP; return -1; }
892+static inline int setexeccon (security_context_t con _UNUSED_PARAMETER_) 963+static inline int setexeccon (security_context_t con _GL_UNUSED_PARAMETER)
893+ { errno = ENOTSUP; return -1; } 964+ { errno = ENOTSUP; return -1; }
894+static inline int security_compute_create 965+static inline int security_compute_create
895+ (security_context_t scon _UNUSED_PARAMETER_, 966+ (security_context_t scon _GL_UNUSED_PARAMETER,
896+ security_context_t tcon _UNUSED_PARAMETER_, 967+ security_context_t tcon _GL_UNUSED_PARAMETER,
897+ security_class_t tclass _UNUSED_PARAMETER_, 968+ security_class_t tclass _GL_UNUSED_PARAMETER,
898+ security_context_t *newcon _UNUSED_PARAMETER_) 969+ security_context_t *newcon _GL_UNUSED_PARAMETER)
899+ { errno = ENOTSUP; return -1; } 970+ { errno = ENOTSUP; return -1; }
900+static inline int matchpathcon_init_prefix 971+static inline int matchpathcon_init_prefix
901+ (char const *path _UNUSED_PARAMETER_, 972+ (char const *path _GL_UNUSED_PARAMETER,
902+ char const *prefix _UNUSED_PARAMETER_) 973+ char const *prefix _GL_UNUSED_PARAMETER)
903+ { errno = ENOTSUP; return -1; } 974+ { errno = ENOTSUP; return -1; }
904+ 975+
976+# define GNULIB_defined_security_types 1
977+# endif
978+
905+# endif 979+# endif
906+#endif /* _GL_SELINUX_SELINUX_H */ 980+#endif /* _GL_SELINUX_SELINUX_H */
907diff --git a/gnulib/lib/selinux-at.c b/gnulib/lib/selinux-at.c 981diff --git a/gnulib/lib/selinux-at.c b/gnulib/lib/selinux-at.c
@@ -1084,6 +1158,52 @@ index 1efe223..87f11dd 100644
1084 m4/setenv.m4 1158 m4/setenv.m4
1085 m4/size_max.m4 1159 m4/size_max.m4
1086 m4/ssize_t.m4 1160 m4/ssize_t.m4
1161diff --git a/gnulib/m4/include_next.m4 b/gnulib/m4/include_next.m4
1162index 7ce472b..79edd7c 100644
1163--- a/gnulib/m4/include_next.m4
1164+++ b/gnulib/m4/include_next.m4
1165@@ -36,18 +36,35 @@ EOF
1166 CPPFLAGS="$save_CPPFLAGS"
1167 rm -rf conftestd1 conftestd2
1168 ])
1169+ PRAGMA_SYSTEM_HEADER=
1170 if test $gl_cv_have_include_next = yes; then
1171-
1172- dnl FIXME: Remove HAVE_INCLUDE_NEXT and update everything that uses it
1173- dnl to use @INCLUDE_NEXT@ instead.
1174- AC_DEFINE([HAVE_INCLUDE_NEXT], 1,
1175- [Define if your compiler supports the #include_next directive.])
1176-
1177 INCLUDE_NEXT=include_next
1178+ if test -n "$GCC"; then
1179+ PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
1180+ fi
1181 else
1182 INCLUDE_NEXT=include
1183 fi
1184 AC_SUBST([INCLUDE_NEXT])
1185+ AC_SUBST([PRAGMA_SYSTEM_HEADER])
1186+ AC_CACHE_CHECK([whether system header files limit the line length],
1187+ [gl_cv_pragma_columns],
1188+ [dnl HP NonStop systems, which define __TANDEM, have this misfeature.
1189+ AC_EGREP_CPP([choke me],
1190+ [
1191+#ifdef __TANDEM
1192+choke me
1193+#endif
1194+ ],
1195+ [gl_cv_pragma_columns=yes],
1196+ [gl_cv_pragma_columns=no])
1197+ ])
1198+ if test $gl_cv_pragma_columns = yes; then
1199+ PRAGMA_COLUMNS="#pragma COLUMNS 10000"
1200+ else
1201+ PRAGMA_COLUMNS=
1202+ fi
1203+ AC_SUBST([PRAGMA_COLUMNS])
1204 ])
1205
1206 # gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
1087diff --git a/gnulib/m4/selinux-context-h.m4 b/gnulib/m4/selinux-context-h.m4 1207diff --git a/gnulib/m4/selinux-context-h.m4 b/gnulib/m4/selinux-context-h.m4
1088new file mode 100644 1208new file mode 100644
1089index 0000000..6b0bed1 1209index 0000000..6b0bed1
@@ -1170,5 +1290,5 @@ index 0000000..767c4f7
1170+ fi 1290+ fi
1171+]) 1291+])
1172-- 1292--
11731.7.5.4 12931.7.9.6
1174 1294
diff --git a/recipes-extended/findutils/findutils-4.4.2/findutils-selinux.patch b/recipes-extended/findutils/findutils-4.4.2/findutils-with-selinux.patch
index db0ab89..9597b09 100644
--- a/recipes-extended/findutils/findutils-4.4.2/findutils-selinux.patch
+++ b/recipes-extended/findutils/findutils-4.4.2/findutils-with-selinux.patch
@@ -1,87 +1,44 @@
1From: Xin Ouyang <Xin.Ouyang@windriver.com> 1Subject: [PATCH] findutils: support selinux
2Date: Tue, 26 Jun 2012 13:48:44 +0800
3Subject: [PATCH 1/2] findutils: support selinux
4 2
5Upstream-Status: Backport 3Upstream-Status: Backport
6 4
7This is modified from a F13'sx SRPM patch. 5This is modified from a F13'sx SRPM patch, with conditional
6selinux support.
8 7
9================================================================================ 8Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
10
11 Author: James Youngman <jay@gnu.org>
12 Date: Sat Jul 11 19:55:27 2009 +0100
13
14 Fix Savannah bug #27017: find -D opt / -fstype ext3 -print , -quit coredump.
15
16 Fix Savannah bug #27017: find -D opt / -fstype ext3 -print , -quit
17 coredumps.
18 * find/tree.c (set_new_parent): Initialise struct
19 predicate->arg_text to NULL (instead of leaving it uninitialised).
20 (get_new_pred_noarg): Likewise.
21 (get_new_pred): Initialise predicate->arg_text to
22 "ThisShouldBeSetToSomethingElse" to make it easier to notice
23 bugs.
24 (get_new_pred_chk_op): Use get_new_pred_noarg.
25 (print_predicate): Use an if statement instead of
26 two ternary operators.
27 * find/util.c (insert_primary_withpred): Accept new argument, arg,
28 being the argument (if any) of this predicate. Pass it to
29 get_new_pred_chk_op.
30 (insert_primary): Likewise (pass arg to insert_primary_withpred).
31 (insert_primary_noarg): New function; calls insert_primary with
32 arg=NULL.
33 * find/parser.c (collect_arg_stat_info): Add an output parameter;
34 the filename from which we collected the stat information.
35 (parse_closeparen, parse_delete, parse_and, parse_or,
36 parse_comma): Use get_new_pred_noarg.
37 (parse_cnewer, parse_newer, parse_anewer): Use new
38 collect_arg_stat_info and insert_primary interface.
39 (parse_print, parse_prune, parse_nouser, parse_empty): Use
40 insert_primary_noarg.
41 (parse_accesscheck, parse_false): Use insert_primary_noarg.
42 (parse_used, parse_iname, parse_fprint, insert_fprint,
43 parse_fstype, parse_ilname): Use new collect_arg and
44 insert_primary interfaces.
45 (parse_ipath, parse_lname, do_parse_xmin, parse_name, parse_path,
46 parse_perm, parse_size, parse_user, parse_time): Use new
47 collect_arg and insert_primary_withpred interface.
48 (parse_negate, parse_openparen): Use new get_new_pred_chk_op interface.
49 (parse_newerXY, parse_nogroup): Use new insert_primary interface.
50 (insert_regex, parse_samefile): Use new insert_primary_withpred
51 interface.
52 (insert_type, insert_fprintf, new_insert_exec_ok, insert_num): Use
53 new insert_primary_withpred interface.
54 * find/defs.h (struct predicate.arg_text): make const.
55 Add declarations for new function get_new_pred_noarg and
56 insert_primary_noarg. Add 'arg' parameter to get_new_pred_chk_op
57 and insert_primary_withpred.
58--- 9---
59 NEWS | 6 +++ 10 configure.ac | 11 ++++
60 doc/find.texi | 18 +++++++- 11 doc/find.texi | 18 ++++++-
61 find/Makefile.am | 2 +- 12 find/Makefile.am | 2 +-
62 find/defs.h | 6 +++ 13 find/defs.h | 14 +++++
63 find/find.1 | 4 ++ 14 find/find.1 | 4 ++
64 find/parser.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 15 find/parser.c | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
65 find/pred.c | 47 ++++++++++++++++++++ 16 find/pred.c | 54 +++++++++++++++++++
66 find/tree.c | 2 + 17 find/tree.c | 6 +++
67 8 files changed, 209 insertions(+), 4 deletions(-) 18 8 files changed, 261 insertions(+), 3 deletions(-)
68 19
69diff --git a/NEWS b/NEWS 20diff --git a/configure.ac b/configure.ac
70index 342a3d3..df0681c 100644 21index f4849b3..2dd3b13 100644
71--- a/NEWS 22--- a/configure.ac
72+++ b/NEWS 23+++ b/configure.ac
73@@ -1,5 +1,11 @@ 24@@ -114,6 +114,17 @@ AC_CHECK_LIB([m],[fabs],[FINDLIBS="-lm $FINDLIBS"]
74 GNU findutils NEWS - User visible changes. -*- outline -*- (allout) 25 AC_DEFINE_UNQUOTED(HAVE_FABS_IN_LIBM,1,[fabs is defined in -lm]))
75 26 AC_SUBST([FINDLIBS])
76+* Major changes in release 4.4.2, 2009-11-26 27
77+ 28+AC_ARG_WITH([selinux],
78+** Functional Enhancements to find 29+ AS_HELP_STRING([--without-selinux], [disable SELinux support]),
30+ [:],
31+ [AC_CHECK_LIB([selinux], [is_selinux_enabled], [with_selinux=yes], [with_selinux=no])])
32+if test x$with_selinux = xyes; then
33+ AC_DEFINE([WITH_SELINUX], [1], [Define to support SELinux])
34+ AC_SUBST([LIBSELINUX], [-lselinux])
35+else
36+ AC_SUBST([LIBSELINUX], [ ])
37+fi
79+ 38+
80+patch #4848: Patch - Support for SELinux 39 dnl Checks for header files.
81+ 40 AC_HEADER_STDC
82 * Major changes in release 4.4.2, 2009-05-16 41 dnl Assume unistd.h is present - coreutils does too.
83
84 ** Bug Fixes
85diff --git a/doc/find.texi b/doc/find.texi 42diff --git a/doc/find.texi b/doc/find.texi
86index 391ffa0..f599bbc 100644 43index 391ffa0..f599bbc 100644
87--- a/doc/find.texi 44--- a/doc/find.texi
@@ -141,44 +98,52 @@ index b001509..6fc7df3 100644
141 EXTRA_DIST = defs.h $(man_MANS) 98 EXTRA_DIST = defs.h $(man_MANS)
142 INCLUDES = -I../gnulib/lib -I$(top_srcdir)/lib -I$(top_srcdir)/gnulib/lib -I../intl -DLOCALEDIR=\"$(localedir)\" 99 INCLUDES = -I../gnulib/lib -I$(top_srcdir)/lib -I$(top_srcdir)/gnulib/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
143-LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@ @LIB_CLOCK_GETTIME@ @FINDLIBS@ 100-LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@ @LIB_CLOCK_GETTIME@ @FINDLIBS@
144+LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@ @LIB_CLOCK_GETTIME@ @FINDLIBS@ @LIB_SELINUX@ 101+LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@ @LIB_CLOCK_GETTIME@ @FINDLIBS@ @LIBSELINUX@
145 man_MANS = find.1 102 man_MANS = find.1
146 SUBDIRS = . testsuite 103 SUBDIRS = . testsuite
147 104
148diff --git a/find/defs.h b/find/defs.h 105diff --git a/find/defs.h b/find/defs.h
149index 4539fd9..e7e3a69 100644 106index 4539fd9..4f3b168 100644
150--- a/find/defs.h 107--- a/find/defs.h
151+++ b/find/defs.h 108+++ b/find/defs.h
152@@ -48,6 +48,7 @@ Please stop compiling the program now 109@@ -48,6 +48,9 @@ Please stop compiling the program now
153 #include <stdbool.h> /* for bool/boolean */ 110 #include <stdbool.h> /* for bool/boolean */
154 #include <stdint.h> /* for uintmax_t */ 111 #include <stdint.h> /* for uintmax_t */
155 #include <sys/stat.h> /* S_ISUID etc. */ 112 #include <sys/stat.h> /* S_ISUID etc. */
113+#ifdef WITH_SELINUX
156+#include <selinux/selinux.h> 114+#include <selinux/selinux.h>
115+#endif
157 116
158 117
159 118
160@@ -315,6 +316,7 @@ struct predicate 119@@ -315,6 +318,9 @@ struct predicate
161 struct samefile_file_id samefileid; /* samefile */ 120 struct samefile_file_id samefileid; /* samefile */
162 mode_t type; /* type */ 121 mode_t type; /* type */
163 struct format_val printf_vec; /* printf fprintf fprint ls fls print0 fprint0 print */ 122 struct format_val printf_vec; /* printf fprintf fprint ls fls print0 fprint0 print */
123+#ifdef WITH_SELINUX
164+ security_context_t scontext; /* security context */ 124+ security_context_t scontext; /* security context */
125+#endif
165 } args; 126 } args;
166 127
167 /* The next predicate in the user input sequence, 128 /* The next predicate in the user input sequence,
168@@ -459,6 +461,7 @@ PREDICATEFUNCTION pred_used; 129@@ -459,6 +465,9 @@ PREDICATEFUNCTION pred_used;
169 PREDICATEFUNCTION pred_user; 130 PREDICATEFUNCTION pred_user;
170 PREDICATEFUNCTION pred_writable; 131 PREDICATEFUNCTION pred_writable;
171 PREDICATEFUNCTION pred_xtype; 132 PREDICATEFUNCTION pred_xtype;
133+#ifdef WITH_SELINUX
172+PREDICATEFUNCTION pred_context; 134+PREDICATEFUNCTION pred_context;
135+#endif
173 136
174 137
175 138
176@@ -604,6 +607,9 @@ struct options 139@@ -604,6 +613,11 @@ struct options
177 */ 140 */
178 int regex_options; 141 int regex_options;
179 142
143+#ifdef WITH_SELINUX
180+ /* function used to get file context */ 144+ /* function used to get file context */
181+ int (*x_getfilecon) (int, const char *, security_context_t *); 145+ int (*x_getfilecon) (int, const char *, security_context_t *);
146+#endif
182+ 147+
183 /* Optimisation level. One is the default. 148 /* Optimisation level. One is the default.
184 */ 149 */
@@ -206,38 +171,45 @@ index 8b67ae3..1d23b17 100644
206 A `%' character followed by any other character is discarded, but the 171 A `%' character followed by any other character is discarded, but the
207 other character is printed (don't rely on this, as further format 172 other character is printed (don't rely on this, as further format
208diff --git a/find/parser.c b/find/parser.c 173diff --git a/find/parser.c b/find/parser.c
209index 08758ee..d7fc9ce 100644 174index 08758ee..02f9067 100644
210--- a/find/parser.c 175--- a/find/parser.c
211+++ b/find/parser.c 176+++ b/find/parser.c
212@@ -53,6 +53,8 @@ 177@@ -53,6 +53,10 @@
213 #include <unistd.h> 178 #include <unistd.h>
214 #include <sys/stat.h> 179 #include <sys/stat.h>
215 180
181+#ifdef WITH_SELINUX
216+#include "selinux-at.h" 182+#include "selinux-at.h"
183+#endif
217+ 184+
218 #if ENABLE_NLS 185 #if ENABLE_NLS
219 # include <libintl.h> 186 # include <libintl.h>
220 # define _(Text) gettext (Text) 187 # define _(Text) gettext (Text)
221@@ -155,6 +157,7 @@ static boolean parse_noignore_race PARAMS((const struct parser_table*, char *arg 188@@ -155,6 +159,9 @@ static boolean parse_noignore_race PARAMS((const struct parser_table*, char *arg
222 static boolean parse_warn PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); 189 static boolean parse_warn PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
223 static boolean parse_xtype PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); 190 static boolean parse_xtype PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
224 static boolean parse_quit PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); 191 static boolean parse_quit PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
192+#ifdef WITH_SELINUX
225+static boolean parse_context PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); 193+static boolean parse_context PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
194+#endif
226 195
227 boolean parse_print PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); 196 boolean parse_print PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
228 197
229@@ -251,6 +254,7 @@ static struct parser_table const parse_table[] = 198@@ -251,6 +258,9 @@ static struct parser_table const parse_table[] =
230 PARSE_TEST ("cmin", cmin), /* GNU */ 199 PARSE_TEST ("cmin", cmin), /* GNU */
231 PARSE_TEST ("cnewer", cnewer), /* GNU */ 200 PARSE_TEST ("cnewer", cnewer), /* GNU */
232 {ARG_TEST, "ctime", parse_time, pred_ctime}, /* POSIX */ 201 {ARG_TEST, "ctime", parse_time, pred_ctime}, /* POSIX */
202+#ifdef WITH_SELINUX
233+ PARSE_TEST ("context", context), /* GNU */ 203+ PARSE_TEST ("context", context), /* GNU */
204+#endif
234 PARSE_POSOPT ("daystart", daystart), /* GNU */ 205 PARSE_POSOPT ("daystart", daystart), /* GNU */
235 PARSE_ACTION ("delete", delete), /* GNU, Mac OS, FreeBSD */ 206 PARSE_ACTION ("delete", delete), /* GNU, Mac OS, FreeBSD */
236 PARSE_OPTION ("d", d), /* Mac OS X, FreeBSD, NetBSD, OpenBSD, but deprecated in favour of -depth */ 207 PARSE_OPTION ("d", d), /* Mac OS X, FreeBSD, NetBSD, OpenBSD, but deprecated in favour of -depth */
237@@ -347,6 +351,86 @@ static struct parser_table const parse_table[] = 208@@ -347,6 +357,89 @@ static struct parser_table const parse_table[] =
238 static const char *first_nonoption_arg = NULL; 209 static const char *first_nonoption_arg = NULL;
239 static const struct parser_table *noop = NULL; 210 static const struct parser_table *noop = NULL;
240 211
212+#ifdef WITH_SELINUX
241+static int 213+static int
242+fallback_getfilecon (int fd, const char *name, security_context_t *p, 214+fallback_getfilecon (int fd, const char *name, security_context_t *p,
243+ int prev_rv) 215+ int prev_rv)
@@ -318,59 +290,75 @@ index 08758ee..d7fc9ce 100644
318+{ 290+{
319+ return lgetfileconat (fd, name, p); 291+ return lgetfileconat (fd, name, p);
320+} 292+}
293+
294+#endif
321 295
322 void 296 void
323 check_option_combinations(const struct predicate *p) 297 check_option_combinations(const struct predicate *p)
324@@ -450,11 +534,13 @@ set_follow_state(enum SymlinkOption opt) 298@@ -450,11 +543,17 @@ set_follow_state(enum SymlinkOption opt)
325 { 299 {
326 case SYMLINK_ALWAYS_DEREF: /* -L */ 300 case SYMLINK_ALWAYS_DEREF: /* -L */
327 options.xstat = optionl_stat; 301 options.xstat = optionl_stat;
302+#ifdef WITH_SELINUX
328+ options.x_getfilecon = optionl_getfilecon; 303+ options.x_getfilecon = optionl_getfilecon;
304+#endif
329 options.no_leaf_check = true; 305 options.no_leaf_check = true;
330 break; 306 break;
331 307
332 case SYMLINK_NEVER_DEREF: /* -P (default) */ 308 case SYMLINK_NEVER_DEREF: /* -P (default) */
333 options.xstat = optionp_stat; 309 options.xstat = optionp_stat;
310+#ifdef WITH_SELINUX
334+ options.x_getfilecon = optionp_getfilecon; 311+ options.x_getfilecon = optionp_getfilecon;
312+#endif
335 /* Can't turn no_leaf_check off because the user might have specified 313 /* Can't turn no_leaf_check off because the user might have specified
336 * -noleaf anyway 314 * -noleaf anyway
337 */ 315 */
338@@ -462,6 +548,7 @@ set_follow_state(enum SymlinkOption opt) 316@@ -462,6 +561,9 @@ set_follow_state(enum SymlinkOption opt)
339 317
340 case SYMLINK_DEREF_ARGSONLY: /* -H */ 318 case SYMLINK_DEREF_ARGSONLY: /* -H */
341 options.xstat = optionh_stat; 319 options.xstat = optionh_stat;
320+#ifdef WITH_SELINUX
342+ options.x_getfilecon = optionh_getfilecon; 321+ options.x_getfilecon = optionh_getfilecon;
322+#endif
343 options.no_leaf_check = true; 323 options.no_leaf_check = true;
344 } 324 }
345 } 325 }
346@@ -1146,8 +1233,10 @@ tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N\n\ 326@@ -1146,8 +1248,14 @@ tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N\n\
347 -nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN\n\ 327 -nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN\n\
348 -readable -writable -executable\n\ 328 -readable -writable -executable\n\
349 -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N\n\ 329 -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N\n\
350- -used N -user NAME -xtype [bcdpfls]\n")); 330- -used N -user NAME -xtype [bcdpfls]\n"));
351+ -used N -user NAME -xtype [bcdpfls]")); 331+ -used N -user NAME -xtype [bcdpfls]"));
332+#ifdef WITH_SELINUX
352 puts (_("\ 333 puts (_("\
353+ -context CONTEXT\n")); 334+ -context CONTEXT\n"));
335+#else
336+ puts (_("\n"));
337+#endif
354+ puts (_("\n\ 338+ puts (_("\n\
355 actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print \n\ 339 actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print \n\
356 -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit\n\ 340 -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit\n\
357 -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;\n\ 341 -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;\n\
358@@ -2574,6 +2663,11 @@ parse_version (const struct parser_table* entry, char **argv, int *arg_ptr) 342@@ -2574,6 +2682,13 @@ parse_version (const struct parser_table* entry, char **argv, int *arg_ptr)
359 printf("LEAF_OPTIMISATION "); 343 printf("LEAF_OPTIMISATION ");
360 ++features; 344 ++features;
361 #endif 345 #endif
346+#ifdef WITH_SELINUX
362+ if (0 < is_selinux_enabled ()) 347+ if (0 < is_selinux_enabled ())
363+ { 348+ {
364+ printf ("SELINUX "); 349+ printf ("SELINUX ");
365+ ++features; 350+ ++features;
366+ } 351+ }
352+#endif
367 353
368 flags = 0; 354 flags = 0;
369 if (is_fts_enabled(&flags)) 355 if (is_fts_enabled(&flags))
370@@ -2609,6 +2703,31 @@ parse_version (const struct parser_table* entry, char **argv, int *arg_ptr) 356@@ -2608,6 +2723,33 @@ parse_version (const struct parser_table* entry, char **argv, int *arg_ptr)
357 exit (0);
371 } 358 }
372 359
373 static boolean 360+#ifdef WITH_SELINUX
361+static boolean
374+parse_context (const struct parser_table* entry, char **argv, int *arg_ptr) 362+parse_context (const struct parser_table* entry, char **argv, int *arg_ptr)
375+{ 363+{
376+ struct predicate *our_pred; 364+ struct predicate *our_pred;
@@ -394,58 +382,68 @@ index 08758ee..d7fc9ce 100644
394+ (*arg_ptr)++; 382+ (*arg_ptr)++;
395+ return true; 383+ return true;
396+} 384+}
385+#endif
397+ 386+
398+static boolean 387 static boolean
399 parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr) 388 parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
400 { 389 {
401 options.stay_on_filesystem = true; 390@@ -2861,7 +3003,11 @@ insert_fprintf (struct format_val *vec,
402@@ -2861,7 +2980,7 @@ insert_fprintf (struct format_val *vec,
403 if (*scan2 == '.') 391 if (*scan2 == '.')
404 for (scan2++; ISDIGIT (*scan2); scan2++) 392 for (scan2++; ISDIGIT (*scan2); scan2++)
405 /* Do nothing. */ ; 393 /* Do nothing. */ ;
406- if (strchr ("abcdDfFgGhHiklmMnpPsStuUyY", *scan2)) 394+#ifdef WITH_SELINUX
407+ if (strchr ("abcdDfFgGhHiklmMnpPsStuUyYZ", *scan2)) 395+ if (strchr ("abcdDfFgGhHiklmMnpPsStuUyYZ", *scan2))
396+#else
397 if (strchr ("abcdDfFgGhHiklmMnpPsStuUyY", *scan2))
398+#endif
408 { 399 {
409 segmentp = make_segment (segmentp, format, scan2 - format, 400 segmentp = make_segment (segmentp, format, scan2 - format,
410 KIND_FORMAT, *scan2, 0, 401 KIND_FORMAT, *scan2, 0,
411@@ -2991,6 +3110,11 @@ make_segment (struct segment **segment, 402@@ -2991,6 +3137,13 @@ make_segment (struct segment **segment,
412 *fmt++ = 's'; 403 *fmt++ = 's';
413 break; 404 break;
414 405
406+#ifdef WITH_SELINUX
415+ case 'Z': /* SELinux security context */ 407+ case 'Z': /* SELinux security context */
416+ mycost = NeedsAccessInfo; 408+ mycost = NeedsAccessInfo;
417+ *fmt++ = 's'; 409+ *fmt++ = 's';
418+ break; 410+ break;
411+#endif
419+ 412+
420 case 'H': /* ARGV element file was found under */ 413 case 'H': /* ARGV element file was found under */
421 *fmt++ = 's'; 414 *fmt++ = 's';
422 break; 415 break;
423diff --git a/find/pred.c b/find/pred.c 416diff --git a/find/pred.c b/find/pred.c
424index b1f48a0..7c34119 100644 417index b1f48a0..43cfd19 100644
425--- a/find/pred.c 418--- a/find/pred.c
426+++ b/find/pred.c 419+++ b/find/pred.c
427@@ -48,6 +48,8 @@ 420@@ -48,6 +48,10 @@
428 #include "error.h" 421 #include "error.h"
429 #include "verify.h" 422 #include "verify.h"
430 423
424+#ifdef WITH_SELINUX
431+#include <selinux/selinux.h> 425+#include <selinux/selinux.h>
426+#endif
432+ 427+
433 #if ENABLE_NLS 428 #if ENABLE_NLS
434 # include <libintl.h> 429 # include <libintl.h>
435 # define _(Text) gettext (Text) 430 # define _(Text) gettext (Text)
436@@ -230,6 +232,7 @@ struct pred_assoc pred_table[] = 431@@ -230,6 +234,9 @@ struct pred_assoc pred_table[] =
437 {pred_user, "user "}, 432 {pred_user, "user "},
438 {pred_writable, "writable "}, 433 {pred_writable, "writable "},
439 {pred_xtype, "xtype "}, 434 {pred_xtype, "xtype "},
435+#ifdef WITH_SELINUX
440+ {pred_context, "context"}, 436+ {pred_context, "context"},
437+#endif
441 {0, "none "} 438 {0, "none "}
442 }; 439 };
443 #endif 440 #endif
444@@ -1054,6 +1057,30 @@ do_fprintf(struct format_val *dest, 441@@ -1054,6 +1061,32 @@ do_fprintf(struct format_val *dest,
445 mode_to_filetype(stat_buf->st_mode & S_IFMT)); 442 mode_to_filetype(stat_buf->st_mode & S_IFMT));
446 } 443 }
447 break; 444 break;
448+ 445+
446+#ifdef WITH_SELINUX
449+ case 'Z': /* SELinux security context */ 447+ case 'Z': /* SELinux security context */
450+ { 448+ {
451+ security_context_t scontext; 449+ security_context_t scontext;
@@ -469,15 +467,16 @@ index b1f48a0..7c34119 100644
469+ } 467+ }
470+ } 468+ }
471+ break; 469+ break;
470+#endif
472 } 471 }
473 /* end of KIND_FORMAT case */ 472 /* end of KIND_FORMAT case */
474 break; 473 break;
475@@ -1844,6 +1871,26 @@ pred_xtype (const char *pathname, struct stat *stat_buf, struct predicate *pred_ 474@@ -1844,6 +1877,27 @@ pred_xtype (const char *pathname, struct stat *stat_buf, struct predicate *pred_
476 */ 475 */
477 return (pred_type (pathname, &sbuf, pred_ptr)); 476 return (pred_type (pathname, &sbuf, pred_ptr));
478 } 477 }
479+ 478+
480+ 479+#ifdef WITH_SELINUX
481+boolean 480+boolean
482+pred_context (const char *pathname, struct stat *stat_buf, 481+pred_context (const char *pathname, struct stat *stat_buf,
483+ struct predicate *pred_ptr) 482+ struct predicate *pred_ptr)
@@ -495,30 +494,35 @@ index b1f48a0..7c34119 100644
495+ freecon (scontext); 494+ freecon (scontext);
496+ return rv; 495+ return rv;
497+} 496+}
497+#endif
498+ 498+
499 499
500 /* 1) fork to get a child; parent remembers the child pid 500 /* 1) fork to get a child; parent remembers the child pid
501 2) child execs the command requested 501 2) child execs the command requested
502diff --git a/find/tree.c b/find/tree.c 502diff --git a/find/tree.c b/find/tree.c
503index 60a0601..63100fb 100644 503index 60a0601..6d48c09 100644
504--- a/find/tree.c 504--- a/find/tree.c
505+++ b/find/tree.c 505+++ b/find/tree.c
506@@ -909,6 +909,7 @@ static struct pred_cost_lookup costlookup[] = 506@@ -909,6 +909,9 @@ static struct pred_cost_lookup costlookup[] =
507 { pred_cmin , NeedsStatInfo, }, 507 { pred_cmin , NeedsStatInfo, },
508 { pred_cnewer , NeedsStatInfo, }, 508 { pred_cnewer , NeedsStatInfo, },
509 { pred_comma , NeedsNothing, }, 509 { pred_comma , NeedsNothing, },
510+#ifdef WITH_SELINUX
510+ { pred_context , NeedsAccessInfo }, 511+ { pred_context , NeedsAccessInfo },
512+#endif
511 { pred_ctime , NeedsStatInfo, }, 513 { pred_ctime , NeedsStatInfo, },
512 { pred_delete , NeedsSyncDiskHit }, 514 { pred_delete , NeedsSyncDiskHit },
513 { pred_empty , NeedsStatInfo }, 515 { pred_empty , NeedsStatInfo },
514@@ -1453,6 +1454,7 @@ get_new_pred (const struct parser_table *entry) 516@@ -1453,6 +1456,9 @@ get_new_pred (const struct parser_table *entry)
515 last_pred->p_cost = NeedsUnknown; 517 last_pred->p_cost = NeedsUnknown;
516 last_pred->arg_text = "ThisShouldBeSetToSomethingElse"; 518 last_pred->arg_text = "ThisShouldBeSetToSomethingElse";
517 last_pred->args.str = NULL; 519 last_pred->args.str = NULL;
520+#ifdef WITH_SELINUX
518+ last_pred->args.scontext = NULL; 521+ last_pred->args.scontext = NULL;
522+#endif
519 last_pred->pred_next = NULL; 523 last_pred->pred_next = NULL;
520 last_pred->pred_left = NULL; 524 last_pred->pred_left = NULL;
521 last_pred->pred_right = NULL; 525 last_pred->pred_right = NULL;
522-- 526--
5231.7.5.4 5271.7.9.6
524 528
diff --git a/recipes-extended/findutils/findutils_4.4.2.bbappend b/recipes-extended/findutils/findutils_4.4.2.bbappend
index a3922d8..eb94cfa 100644
--- a/recipes-extended/findutils/findutils_4.4.2.bbappend
+++ b/recipes-extended/findutils/findutils_4.4.2.bbappend
@@ -1,9 +1,9 @@
1PR .= ".1" 1PR .= ".2"
2 2
3FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:" 3FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
4 4
5SRC_URI += "file://findutils-selinux.patch" 5SRC_URI += "file://findutils-with-selinux.patch"
6SRC_URI += "file://findutils-selinux-gnulib.patch" 6SRC_URI += "file://findutils-with-selinux-gnulib.patch"
7 7
8DEPENDS += "${@base_contains('DISTRO_FEATURES', 'selinux', 'libselinux', '', d)}" 8DEPENDS += "${@base_contains('DISTRO_FEATURES', 'selinux', 'libselinux', '', d)}"
9 9