Skip to content

Commit

Permalink
filecapstest.sh: fix a bug of fail in RHEL5
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Peng Haitao <[email protected]>
Signed-off-by: Wanlong Gao <[email protected]>
  • Loading branch information
Peng Haitao authored and gaowanlong committed Jun 12, 2012
1 parent fc47348 commit 66ad27e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 18 deletions.
3 changes: 0 additions & 3 deletions include/mk/features.mk.default
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
# Garrett Cooper, October 2010
#

# Path to setcap program
SETCAP :=

# Tools enable knobs
WITH_EXPECT := no

Expand Down
3 changes: 0 additions & 3 deletions include/mk/features.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
# Garrett Cooper, October 2010
#

# Path to setcap program
SETCAP := @SETCAP@

# Tools enable knobs
WITH_EXPECT := @WITH_EXPECT@

Expand Down
1 change: 0 additions & 1 deletion m4/ltp-cap.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 0 additions & 8 deletions testcases/kernel/security/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions testcases/kernel/security/cap_bound/cap_bounds_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -88,4 +88,4 @@ int main(int argc, char *argv[])
tst_resm(TCONF, "System doesn't have POSIX capabilities.");
#endif
tst_exit();
}
}
8 changes: 7 additions & 1 deletion testcases/kernel/security/cap_bound/cap_bounds_rw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -71,6 +72,7 @@ int check_remaining_caps(int lastdropped)
return -i;
}
}
#endif
return 0;
}

Expand All @@ -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
Expand Down Expand Up @@ -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();
}
}

0 comments on commit 66ad27e

Please sign in to comment.