On 06/11/2012 02:13 PM, Peng Haitao wrote:

> setcap is not used in ltp, So AC_CHECK_PROG(SETCAP,setcap,setcap)
> should be deleted.
> 
> When HAVE_LIBCAP is not defined, the case should not be fail.


pushed V2, thanks all involved

Wanlong Gao

> 
> Signed-off-by: Peng Haitao <[email protected]>
> ---
>  include/mk/features.mk.default                      |    3 ---
>  include/mk/features.mk.in                           |    3 ---
>  m4/ltp-cap.m4                                       |    1 -
>  testcases/kernel/security/Makefile                  |    8 --------
>  testcases/kernel/security/cap_bound/cap_bounds_r.c  |    4 ++--
>  testcases/kernel/security/cap_bound/cap_bounds_rw.c |    8 +++++++-
>  6 files changed, 9 insertions(+), 18 deletions(-)
> 
> diff --git a/include/mk/features.mk.default b/include/mk/features.mk.default
> index 75a4c1d..86e4d4c 100644
> --- a/include/mk/features.mk.default
> +++ b/include/mk/features.mk.default
> @@ -20,9 +20,6 @@
>  # Garrett Cooper, October 2010
>  #
>  
> -# Path to setcap program
> -SETCAP                               :=
> -
>  # Tools enable knobs
>  WITH_EXPECT                  := no
>  
> diff --git a/include/mk/features.mk.in b/include/mk/features.mk.in
> index c9162e5..1fd28f8 100644
> --- a/include/mk/features.mk.in
> +++ b/include/mk/features.mk.in
> @@ -20,9 +20,6 @@
>  # Garrett Cooper, October 2010
>  #
>  
> -# Path to setcap program
> -SETCAP                               := @SETCAP@
> -
>  # Tools enable knobs
>  WITH_EXPECT                  := @WITH_EXPECT@
>  
> diff --git a/m4/ltp-cap.m4 b/m4/ltp-cap.m4
> index 953ea50..c646c8c 100644
> --- a/m4/ltp-cap.m4
> +++ b/m4/ltp-cap.m4
> @@ -29,7 +29,6 @@ AH_TEMPLATE(HAVE_LIBCAP,
>  AC_CHECK_HEADERS([sys/capability.h],[capability_header_prefix="sys"])
>  if test "x$capability_header_prefix" != x; then
>       AC_CHECK_LIB(cap,cap_compare,[cap_libs="-lcap"])
> -     AC_CHECK_PROG(SETCAP,setcap,setcap)
>  fi
>  if test "x$cap_libs" != x; then
>       AC_DEFINE(HAVE_LIBCAP)
> diff --git a/testcases/kernel/security/Makefile 
> b/testcases/kernel/security/Makefile
> index 9a7a2b2..0bb816f 100644
> --- a/testcases/kernel/security/Makefile
> +++ b/testcases/kernel/security/Makefile
> @@ -24,14 +24,6 @@ top_srcdir         ?= ../../..
>  
>  include      $(top_srcdir)/include/mk/env_pre.mk
>  
> -# For broken compilers and toolchains, like Montavista, that improperly 
> detect
> -# system headers when running autoconf -_-... bleh.
> -ifeq ($(strip $(CAP_LIBS)),)
> -FILTER_OUT_DIRS              := cap_bound filecaps securebits
> -endif
> -ifeq ($(strip $(SETCAP)),)
> -FILTER_OUT_DIRS              += filecaps
> -endif
>  ifneq ($(HAVE_SECUREBITS),yes)
>  FILTER_OUT_DIRS              += securebits
>  endif
> diff --git a/testcases/kernel/security/cap_bound/cap_bounds_r.c 
> b/testcases/kernel/security/cap_bound/cap_bounds_r.c
> index 006ab6a..0c09873 100644
> --- a/testcases/kernel/security/cap_bound/cap_bounds_r.c
> +++ b/testcases/kernel/security/cap_bound/cap_bounds_r.c
> @@ -37,7 +37,7 @@ int TST_TOTAL=1;
>  
>  int main(int argc, char *argv[])
>  {
> -#if HAVE_SYS_CAPABILITY_H
> +#ifdef HAVE_LIBCAP
>       int ret = 1;
>       int i;
>  
> @@ -88,4 +88,4 @@ int main(int argc, char *argv[])
>       tst_resm(TCONF, "System doesn't have POSIX capabilities.");
>  #endif
>       tst_exit();
> -}
> \ No newline at end of file
> +}
> diff --git a/testcases/kernel/security/cap_bound/cap_bounds_rw.c 
> b/testcases/kernel/security/cap_bound/cap_bounds_rw.c
> index eb69b4e..010ace6 100644
> --- a/testcases/kernel/security/cap_bound/cap_bounds_rw.c
> +++ b/testcases/kernel/security/cap_bound/cap_bounds_rw.c
> @@ -55,6 +55,7 @@ int check_remaining_caps(int lastdropped)
>                       return i;
>               }
>       }
> +#ifdef HAVE_LIBCAP
>       for (; i <= CAP_LAST_CAP; i++) {
>  #if HAVE_DECL_PR_CAPBSET_READ
>               ret = prctl(PR_CAPBSET_READ, i);
> @@ -71,6 +72,7 @@ int check_remaining_caps(int lastdropped)
>                       return -i;
>               }
>       }
> +#endif
>       return 0;
>  }
>  
> @@ -79,6 +81,7 @@ int main(int argc, char *argv[])
>       int ret = 1;
>       int i;
>  
> +#ifdef HAVE_LIBCAP
>  #if HAVE_DECL_PR_CAPBSET_DROP
>       ret = prctl(PR_CAPBSET_READ, -1);
>  #else
> @@ -131,5 +134,8 @@ int main(int argc, char *argv[])
>               }
>       }
>       tst_resm(TPASS, "PR_CAPBSET_DROP tests passed\n");
> +#else
> +     tst_resm(TCONF, "System doesn't have POSIX capabilities.");
> +#endif
>       tst_exit();
> -}
> \ No newline at end of file
> +}



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to