tests: Skip secret key import check in SELinux mode

* configure.ac (ENABLE_SELINUX_HACKS): New am_conditional.
* checks/Makefile.am (prepared.stamp): Replace by defs-config.inc.
(defs-config.inc): Create and set enable_selinux_hacks variable.
* checks/defs.inc: Include defs-config.inc.

* checks/armor.test: Do not run the last test in selinux mode.

GnuPG-bug-id: 1390
This commit is contained in:
Werner Koch 2012-11-08 17:16:40 +01:00
parent e3e5406049
commit 95347cf950
4 changed files with 29 additions and 12 deletions

View File

@ -6,12 +6,12 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
#
# GnuPG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
# Process this file with automake to create Makefile.in
@ -39,22 +39,29 @@ DATA_FILES = data-500 data-9000 data-32000 data-80000 plain-large
EXTRA_DIST = defs.inc $(TESTS) $(TEST_FILES) \
mkdemodirs signdemokey
CLEANFILES = prepared.stamp x y yy z out err $(DATA_FILES) \
CLEANFILES = defs-config.inc x y yy z out err $(DATA_FILES) \
plain-1 plain-2 plain-3 trustdb.gpg *.lock .\#lk* \
*.test.log gpg_dearmor gpg.conf \
pubring.gpg secring.gpg pubring.pkr secring.skr
DISTCLEANFILES = pubring.gpg~ random_seed
all-local: prepared.stamp
all-local: defs-config.inc
distclean-local:
$(srcdir)/mkdemodirs --clean
prepared.stamp: ./pubring.gpg ./secring.gpg ./plain-1 ./plain-2 ./plain-3 \
defs-config.inc: ./pubring.gpg ./secring.gpg ./plain-1 ./plain-2 ./plain-3 \
./pubring.pkr ./secring.skr ./gpg_dearmor $(DATA_FILES)
$(GPG_IMPORT) $(srcdir)/pubdemo.asc
echo timestamp >./prepared.stamp
$(GPG_IMPORT) $(srcdir)/pubdemo.asc
echo '# Do not edit - created by the Makefile. -*- sh -*-' \
> defs-config.inc
if ENABLE_SELINUX_HACKS
echo enable_selinux_hacks=yes >> defs-config.inc
else
echo enable_selinux_hacks=no >> defs-config.inc
endif
./gpg_dearmor:
echo '#!/bin/sh' >./gpg_dearmor

View File

@ -739,9 +739,14 @@ wg7Md81a5RI3F2FG8747t9gX
# armor filter gpg swalled the CRC line and passed the '-----END...'
# line on to the decryption layer.
# Can only perform this test if we have Twofish
# Can only perform this test if we have Twofish. We also can't use it
# if we have SELinux support, because that will fail on secret key
# import.
if $GPG --with-colons --list-config ciphername | grep TWOFISH > /dev/null 2>/dev/null ; then
if test x$enable_selinux_hacks = xyes ; then
echo "SELinux support is enabled: skipping secret key import check"
else
if $GPG --with-colons --list-config ciphername | grep TWOFISH > /dev/null 2>/dev/null ; then
i=alpha_seckey
info "importing: $i"
eval "(IFS=; echo \"\$$i\")" >x
@ -755,4 +760,5 @@ if $GPG --with-colons --list-config ciphername | grep TWOFISH > /dev/null 2>/dev
else
error "bug#1179 is back in town"
fi
fi
fi

View File

@ -1,9 +1,12 @@
# definitions for the check scripts
# definitions for the check scripts -*- sh -*-
#--------------------------------
#------ constants ---------------
#--------------------------------
# First the Makefile generated constants
. ./defs-config.inc || exit 3
# Note that usrpass1 is also used in Makefile.am
usrname1="one"
usrpass1="def"
@ -50,7 +53,7 @@ error () {
defs_error_seen=yes
echo "$pgmname:" $* >&5
if [ x$defs_stop_on_error != xyes ]; then
exit 1
exit 1
fi
}
@ -115,7 +118,7 @@ echo_n () {
# Special function for zOS.
my_chtag () {
#FIXME: Is there an envvar to test for the OS or do we
#FIXME: Is there an envvar to test for the OS or do we
# need to resort to a configure test
#if test "$FOO" = "bar"; then
# chtag -tc ISO8859-1 $1

View File

@ -920,6 +920,7 @@ fi
AM_CONDITIONAL(ENABLE_CARD_SUPPORT, test "$card_support" = yes)
AM_CONDITIONAL(ENABLE_AGENT_SUPPORT, test "$agent_support" = yes)
AM_CONDITIONAL(ENABLE_SELINUX_HACKS, test "$selinux_support" = yes)
dnl Checks for header files.
AC_HEADER_STDC