Blame tests/cert-tests/othername-test

Packit 549fdc
#!/bin/sh
Packit 549fdc
Packit 549fdc
# Copyright (C) 2015 Red Hat, Inc.
Packit 549fdc
#
Packit 549fdc
# This file is part of GnuTLS.
Packit 549fdc
#
Packit 549fdc
# GnuTLS is free software; you can redistribute it and/or modify it
Packit 549fdc
# under the terms of the GNU General Public License as published by the
Packit 549fdc
# Free Software Foundation; either version 3 of the License, or (at
Packit 549fdc
# your option) any later version.
Packit 549fdc
#
Packit 549fdc
# GnuTLS is distributed in the hope that it will be useful, but
Packit 549fdc
# WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 549fdc
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 549fdc
# General Public License for more details.
Packit 549fdc
#
Packit 549fdc
# You should have received a copy of the GNU General Public License
Packit 549fdc
# along with GnuTLS; if not, write to the Free Software Foundation,
Packit 549fdc
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Packit 549fdc
Packit 549fdc
#set -e
Packit 549fdc
Packit 549fdc
srcdir="${srcdir:-.}"
Packit 549fdc
CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
Packit 549fdc
DIFF="${DIFF:-diff}"
Packit 549fdc
OUTFILE=tmp-othername.pem
Packit 549fdc
Packit 549fdc
if ! test -x "${CERTTOOL}"; then
Packit 549fdc
	exit 77
Packit 549fdc
fi
Packit 549fdc
Packit 549fdc
export TZ="UTC"
Packit 549fdc
Packit 549fdc
. ${srcdir}/../scripts/common.sh
Packit 549fdc
Packit 549fdc
check_for_datefudge
Packit 549fdc
Packit 549fdc
# Note that in rare cases this test may fail because the
Packit 549fdc
# time set using datefudge could have changed since the generation
Packit 549fdc
# (if example the system was busy)
Packit 549fdc
Packit 549fdc
datefudge -s "2007-04-22" \
Packit 549fdc
	"${CERTTOOL}" --generate-self-signed \
Packit 549fdc
		--load-privkey "${srcdir}/data/template-test.key" \
Packit 549fdc
		--template "${srcdir}/templates/template-othername.tmpl" \
Packit 549fdc
		--outfile ${OUTFILE} 2>/dev/null
Packit 549fdc
Packit 549fdc
${DIFF} "${srcdir}/data/template-othername.pem" ${OUTFILE} >/dev/null 2>&1
Packit 549fdc
rc=$?
Packit 549fdc
Packit 549fdc
# We're done.
Packit 549fdc
if test "${rc}" != "0"; then
Packit 549fdc
	echo "Test 1 (othername) failed"
Packit 549fdc
	exit ${rc}
Packit 549fdc
fi
Packit 549fdc
Packit 549fdc
datefudge -s "2007-04-22" \
Packit 549fdc
	"${CERTTOOL}" --generate-self-signed \
Packit 549fdc
		--load-privkey "${srcdir}/data/template-test.key" \
Packit 549fdc
		--template "${srcdir}/templates/template-othername-xmpp.tmpl" \
Packit 549fdc
		--outfile ${OUTFILE} 2>/dev/null
Packit 549fdc
Packit 549fdc
${DIFF} "${srcdir}/data/template-othername-xmpp.pem" ${OUTFILE} >/dev/null 2>&1
Packit 549fdc
rc=$?
Packit 549fdc
Packit 549fdc
# We're done.
Packit 549fdc
if test "${rc}" != "0"; then
Packit 549fdc
	echo "Test 1 (xmpp) failed"
Packit 549fdc
	exit ${rc}
Packit 549fdc
fi
Packit 549fdc
Packit 549fdc
Packit 549fdc
Packit 549fdc
rm -f ${OUTFILE}
Packit 549fdc
Packit 549fdc
exit 0