opendnssec-1.4.3/ 0000775 0001750 0001750 00000000000 12247571202 010665 5 0000000 0000000 opendnssec-1.4.3/config.guess 0000755 0001750 0001750 00000127432 12247571136 013142 0000000 0000000 #! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
timestamp='2012-02-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 .
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Per Bothner. Please send patches (context
# diff format) to and include a ChangeLog
# entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to ."
version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help" >&2
exit 1 ;;
* )
break ;;
esac
done
if test $# != 0; then
echo "$me: too many arguments$help" >&2
exit 1
fi
trap 'exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team.
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac ; set_cc_for_build= ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the
# object file format.
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE_ARCH}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
os=netbsd
else
os=netbsdelf
fi
;;
*)
os=netbsd
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case "${UNAME_VERSION}" in
Debian*)
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
*:SolidBSD:*:*)
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
exit ;;
macppc:MirBSD:*:*)
echo powerpc-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE="alpha" ;;
"EV4.5 (21064)")
UNAME_MACHINE="alpha" ;;
"LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;;
"EV5 (21164)")
UNAME_MACHINE="alphaev5" ;;
"EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;;
"EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;;
"EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;;
"EV6 (21264)")
UNAME_MACHINE="alphaev6" ;;
"EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;;
"EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;;
"EV7 (21364)")
UNAME_MACHINE="alphaev7" ;;
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
exit $exitcode ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
exit ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit ;;
*:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos
exit ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit ;;
*:z/VM:*:*)
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
arm:riscos:*:*|arm:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
exit ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux${UNAME_RELEASE}
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
;;
sun4)
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
exit ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
#include /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c &&
dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
SYSTEM_NAME=`$dummy $dummyarg` &&
{ echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos${UNAME_RELEASE}
exit ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
exit ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
exit ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
echo powerpc-harris-powermax
exit ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
[ ${TARGET_BINARY_INTERFACE}x = x ]
then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
exit ;;
ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
exit ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
then
echo "$SYSTEM_NAME"
else
echo rs6000-ibm-aix3.2.5
fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit ;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
esac ;;
esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include
#include
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
eval $set_cc_for_build
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
# generating 64-bit code. GNU and HP use different nomenclature:
#
# $ CC_FOR_BUILD=cc ./config.guess
# => hppa2.0w-hp-hpux11.23
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
HP_ARCH="hppa64"
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit ;;
ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ia64-hp-hpux${HPUX_REV}
exit ;;
3050*:HI-UX:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
exit ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
exit ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
*:UNICOS/mp:*:*)
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
*:Interix*:*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-gnu ;;
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
esac
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit ;;
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
paragon:*:*:*)
echo i860-intel-osf1
exit ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
exit ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
exit ;;
M68*:*:R3V[5678]*:*)
test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit ;;
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
exit ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says
echo i586-unisys-sysv4
exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes .
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit ;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
echo ${UNAME_MACHINE}-stratus-vos
exit ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
exit ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
exit ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit ;;
SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE}
exit ;;
SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE}
exit ;;
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
exit ;;
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-?:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
exit ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
exit ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "$cputype" = "386"; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
exit ;;
*:TENEX:*:*)
echo pdp10-unknown-tenex
exit ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
echo pdp10-dec-tops20
exit ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
echo pdp10-xkl-tops20
exit ;;
*:TOPS-20:*:*)
echo pdp10-unknown-tops20
exit ;;
*:ITS:*:*)
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
V*) echo vax-dec-vms ; exit ;;
esac ;;
*:XENIX:*:SysV)
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
eval $set_cc_for_build
cat >$dummy.c <
# include
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
c34*)
echo c34-convex-bsd
exit ;;
c38*)
echo c38-convex-bsd
exit ;;
c4*)
echo c4-convex-bsd
exit ;;
esac
fi
cat >&2 < in order to provide the needed
information to handle your system.
config.guess timestamp = $timestamp
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
hostinfo = `(hostinfo) 2>/dev/null`
/bin/universe = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF
exit 1
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
opendnssec-1.4.3/tools/ 0000775 0001750 0001750 00000000000 12247571206 012031 5 0000000 0000000 opendnssec-1.4.3/tools/solaris/ 0000775 0001750 0001750 00000000000 12247571206 013505 5 0000000 0000000 opendnssec-1.4.3/tools/solaris/ods-signerd.init.in 0000664 0001750 0001750 00000005067 11341330411 017126 0000000 0000000 #!/bin/sh
#
# $Id: ods-signerd.init.in 2892 2010-02-24 23:06:49Z jakob $
#
# Copyright (c) 2009 Nominet UK. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# export SOFTHSM_CONF=/etc/softhsm.conf
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:@OPENDNSSEC_LIB_DIR@
signer_bin_file="@OPENDNSSEC_SBIN_DIR@/ods-signerd"
signer_cli_file="@OPENDNSSEC_SBIN_DIR@/ods-signer"
signer_pid_file="@OPENDNSSEC_PID_DIR@/signerd.pid"
case "$1" in
'start')
# Check program is not running
ps -ef | grep '\' | grep -v grep
if [ $? -eq 0 ]
then
echo "signer_engine is already running"
exit 0
fi
# Start program up
if [ -x $signer_bin_file ]
then
echo "Starting signer engine"
$signer_bin_file &
fi
;;
'stop')
# Stop program
if [ -x $signer_cli_file ]
then
echo "Stopping signer engine"
$signer_cli_file stop
else
if [ -x $signer_pid_file ]
then
echo "Stopping signer engine via pid_file"
kill -TERM `cat $signer_pid_file`
else
echo "Stopping signer engine via pid"
PID=`ps -ef | grep '\' | grep -v grep | awk '{ print $2 }'`
if [ ! -z "$PID" ]
then
kill $PID
fi
fi
fi
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0
opendnssec-1.4.3/tools/solaris/Makefile.in 0000664 0001750 0001750 00000033637 12247571140 015503 0000000 0000000 # Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# $Id: Makefile.am 2233 2009-10-15 12:19:44Z jakob $
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = tools/solaris
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/ods-enforcerd.init.in $(srcdir)/ods-signerd.init.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_broken_setres.m4 \
$(top_srcdir)/m4/acx_check_strptime.m4 \
$(top_srcdir)/m4/acx_cunit.m4 \
$(top_srcdir)/m4/acx_database_backend.m4 \
$(top_srcdir)/m4/acx_dbparams.m4 \
$(top_srcdir)/m4/acx_dlopen.m4 $(top_srcdir)/m4/acx_ldns.m4 \
$(top_srcdir)/m4/acx_libc.m4 $(top_srcdir)/m4/acx_libxml2.m4 \
$(top_srcdir)/m4/acx_mysql.m4 $(top_srcdir)/m4/acx_pedantic.m4 \
$(top_srcdir)/m4/acx_pkcs11_modules.m4 \
$(top_srcdir)/m4/acx_prefixhack.m4 \
$(top_srcdir)/m4/acx_rpath.m4 $(top_srcdir)/m4/acx_rt.m4 \
$(top_srcdir)/m4/acx_sqlite3.m4 $(top_srcdir)/m4/acx_ssl.m4 \
$(top_srcdir)/m4/acx_strict.m4 \
$(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/check_compiler_flag.m4 \
$(top_srcdir)/m4/check_compiler_flag_needed.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/opendnssec_common.m4 $(top_srcdir)/version.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/common/config.h
CONFIG_CLEAN_FILES = ods-enforcerd.init ods-signerd.init
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CUCUMBER = @CUCUMBER@
CUNIT_INCLUDES = @CUNIT_INCLUDES@
CUNIT_LIBS = @CUNIT_LIBS@
CYGPATH_W = @CYGPATH_W@
C_LIBS = @C_LIBS@
DB_HOST = @DB_HOST@
DB_INCLUDES = @DB_INCLUDES@
DB_LIBS = @DB_LIBS@
DB_NAME = @DB_NAME@
DB_PASS = @DB_PASS@
DB_PORT = @DB_PORT@
DB_TYPE = @DB_TYPE@
DB_USER = @DB_USER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_SSL = @HAVE_SSL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVA = @JAVA@
LD = @LD@
LDFLAGS = @LDFLAGS@
LDNS_CONFIG = @LDNS_CONFIG@
LDNS_INCLUDES = @LDNS_INCLUDES@
LDNS_LIBS = @LDNS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MYSQL = @MYSQL@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_INCLUDES = @MYSQL_INCLUDES@
MYSQL_LIBS = @MYSQL_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENDNSSEC_BIN_DIR = @OPENDNSSEC_BIN_DIR@
OPENDNSSEC_CONFIG_DIR = @OPENDNSSEC_CONFIG_DIR@
OPENDNSSEC_CONFIG_FILE = @OPENDNSSEC_CONFIG_FILE@
OPENDNSSEC_DATA_DIR = @OPENDNSSEC_DATA_DIR@
OPENDNSSEC_ENFORCER_PIDFILE = @OPENDNSSEC_ENFORCER_PIDFILE@
OPENDNSSEC_FETCH_PIDFILE = @OPENDNSSEC_FETCH_PIDFILE@
OPENDNSSEC_LIBEXEC_DIR = @OPENDNSSEC_LIBEXEC_DIR@
OPENDNSSEC_LIB_DIR = @OPENDNSSEC_LIB_DIR@
OPENDNSSEC_LOCALSTATE_DIR = @OPENDNSSEC_LOCALSTATE_DIR@
OPENDNSSEC_PID_DIR = @OPENDNSSEC_PID_DIR@
OPENDNSSEC_SBIN_DIR = @OPENDNSSEC_SBIN_DIR@
OPENDNSSEC_SCHEMA_DIR = @OPENDNSSEC_SCHEMA_DIR@
OPENDNSSEC_SIGNER_CLI = @OPENDNSSEC_SIGNER_CLI@
OPENDNSSEC_SIGNER_ENGINE = @OPENDNSSEC_SIGNER_ENGINE@
OPENDNSSEC_SIGNER_PIDFILE = @OPENDNSSEC_SIGNER_PIDFILE@
OPENDNSSEC_SIGNER_SOCKET = @OPENDNSSEC_SIGNER_SOCKET@
OPENDNSSEC_STATE_DIR = @OPENDNSSEC_STATE_DIR@
OPENDNSSEC_SYSCONF_DIR = @OPENDNSSEC_SYSCONF_DIR@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SQLITE3 = @SQLITE3@
SQLITE3_INCLUDES = @SQLITE3_INCLUDES@
SQLITE3_LIBS = @SQLITE3_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
XML2_CONFIG = @XML2_CONFIG@
XML2_INCLUDES = @XML2_INCLUDES@
XML2_LIBS = @XML2_LIBS@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkcs11_aepkeyper_module = @pkcs11_aepkeyper_module@
pkcs11_etoken_module = @pkcs11_etoken_module@
pkcs11_ncipher_module = @pkcs11_ncipher_module@
pkcs11_opensc_module = @pkcs11_opensc_module@
pkcs11_sca6000_module = @pkcs11_sca6000_module@
pkcs11_softhsm_module = @pkcs11_softhsm_module@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = \
config.log config.status \
$(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(srcdir)/config.h.in~ \
$(srcdir)/configure \
$(srcdir)/install-sh $(srcdir)/ltmain.sh $(srcdir)/missing \
$(srcdir)/depcomp $(srcdir)/aclocal.m4 $(srcdir)/compile \
$(srcdir)/config.guess $(srcdir)/config.sub
EXTRA_DIST = \
README \
ods-enforcerd-smf.xml \
ods-signerd-smf.xml \
ods-enforcerd.init.in \
ods-signerd.init.in
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/solaris/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign tools/solaris/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
ods-enforcerd.init: $(top_builddir)/config.status $(srcdir)/ods-enforcerd.init.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
ods-signerd.init: $(top_builddir)/config.status $(srcdir)/ods-signerd.init.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
opendnssec-1.4.3/tools/solaris/ods-signerd-smf.xml 0000664 0001750 0001750 00000003724 11267542336 017161 0000000 0000000
OpenDNSSEC
opendnssec-1.4.3/tools/solaris/ods-enforcerd.init.in 0000664 0001750 0001750 00000004537 11341330411 017443 0000000 0000000 #!/bin/sh
#
# $Id: ods-enforcerd.init.in 2892 2010-02-24 23:06:49Z jakob $
#
# Copyright (c) 2009 Nominet UK. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# export SOFTHSM_CONF=/etc/softhsm.conf
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:@OPENDNSSEC_LIB_DIR@
enforcer_bin_file="@OPENDNSSEC_SBIN_DIR@/ods-enforcerd"
enforcer_pid_file="@OPENDNSSEC_PID_DIR@/enforcerd.pid"
case "$1" in
'start')
# Check program is not running
ps -ef | grep '$enforcer_bin_file' | grep -v grep
if [ $? -eq 0 ]
then
echo "ods-enforcerd is already running"
exit 0
fi
# Start program up
if [ -x $enforcer_bin_file ]
then
echo "Starting enforcer"
$enforcer_bin_file &
fi
;;
'stop')
# Stop programs
if [ -x $enforcer_pid_file ]
then
echo "Stopping ods-enforcerd via pid_file"
kill -TERM `cat $enforcer_pid_file`
else
PID=`ps -ef | grep '$enforcer_bin_file' | grep -v grep | awk '{ print $2 }'`
if [ ! -z "$PID" ]
then
echo "Stopping ods-enforcerd via pid"
kill $PID
fi
fi
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0
opendnssec-1.4.3/tools/solaris/ods-enforcerd-smf.xml 0000664 0001750 0001750 00000003734 11267542336 017476 0000000 0000000
OpenDNSSEC
opendnssec-1.4.3/tools/solaris/README 0000664 0001750 0001750 00000002313 11267542336 014307 0000000 0000000 # $Id: README 2288 2009-10-21 08:22:54Z sion $
Solaris scripts to control OpenDNSSEC processes:
Any package for solaris should probably include something like the following:
In the prototype:
...
i preremove
i postinstall
d none /lib/svc/method/opendnssec 0755 root root
d none /var/svc/manifest/site/opendnssec 0755 root root
d none /lib/svc/method/opendnssec/ods-signerd.init=ods-signerd.init 0555 root root
d none /lib/svc/method/opendnssec/ods-enforcerd.init=ods-enforcerd.init 0555 root root
f none /var/svc/manifest/site/opendnssec/ods-signerd-smf.xml=ods-signerd-smf.xml 0555 root root
f none /var/svc/manifest/site/opendnssec/ods-enforcerd-smf.xml=ods-enforcerd-smf.xml 0555 root root
...
In the preremove
...
/usr/sbin/svcadm disable enforcer
/usr/sbin/svccfg -v delete svc:/site/opendnssec/enforcer:default
/usr/sbin/svcadm disable signer
/usr/sbin/svccfg -v delete svc:/site/opendnssec/signer:default
...
In the postinstall
...
/usr/sbin/svccfg -v import /var/svc/manifest/site/opendnssec/ods-signerd-smf.xml
/usr/sbin/svccfg -v import /var/svc/manifest/site/opendnssec/ods-enforcerd-smf.xml
...
Then you can use:
svcadm [enable|disable] signer
svcadm [enable|disable] enforcer
to control the processes
opendnssec-1.4.3/tools/solaris/Makefile.am 0000664 0001750 0001750 00000000752 11265611540 015460 0000000 0000000 # $Id: Makefile.am 2233 2009-10-15 12:19:44Z jakob $
MAINTAINERCLEANFILES = \
config.log config.status \
$(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(srcdir)/config.h.in~ \
$(srcdir)/configure \
$(srcdir)/install-sh $(srcdir)/ltmain.sh $(srcdir)/missing \
$(srcdir)/depcomp $(srcdir)/aclocal.m4 $(srcdir)/compile \
$(srcdir)/config.guess $(srcdir)/config.sub
EXTRA_DIST = \
README \
ods-enforcerd-smf.xml \
ods-signerd-smf.xml \
ods-enforcerd.init.in \
ods-signerd.init.in
opendnssec-1.4.3/tools/ods-control.in 0000664 0001750 0001750 00000007305 11750466637 014562 0000000 0000000 #!/bin/sh
#
# $Id: ods-control.in 6300 2012-05-03 11:35:59Z jerry $
#
# Copyright (c) 2009 .SE (The Internet Infrastructure Foundation)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
progname="ods-control"
bindir="@OPENDNSSEC_BIN_DIR@"
sbindir="@OPENDNSSEC_SBIN_DIR@"
enforcer_pid_file="@OPENDNSSEC_ENFORCER_PIDFILE@"
signer_pid_file="@OPENDNSSEC_SIGNER_PIDFILE@"
signer_socket_file="@OPENDNSSEC_SIGNER_SOCKET@"
case "$1" in
'ksm')
shift
"$bindir/ods-ksmutil" $@
;;
'hsm')
shift
"$bindir/ods-hsmutil" $@
;;
'signer')
case "$2" in
'start')
echo "Starting signer engine..."
"$sbindir/ods-signer" start
RETVAL=$?
if [ $RETVAL = 0 ]; then
i=0
while [ ! -r "$signer_pid_file" ]; do
sleep 1
i=`expr $i + 1`
if [ $i -ge 5 ]; then
RETVAL=1
echo "Could not start signer"
exit $RETVAL
fi
done
i=0
while [ ! -r "$signer_socket_file" ]; do
sleep 1
i=`expr $i + 1`
if [ $i -ge 5 ]; then
RETVAL=1
echo "Could not start signer"
exit $RETVAL
fi
done
sleep 1
"$sbindir/ods-signer" running
RETVAL=$?
fi
exit $RETVAL
;;
*)
shift
"$sbindir/ods-signer" "$@"
;;
esac
;;
'enforcer')
case "$2" in
'start')
echo "Starting enforcer..."
"$sbindir/ods-enforcerd"
RETVAL=$?
if [ $RETVAL = 0 ]; then
i=0
while [ ! -r "$enforcer_pid_file" ]; do
sleep 1
i=`expr $i + 1`
if [ $i -ge 5 ]; then
RETVAL=1
echo "Could not start enforcer"
break
fi
done
fi
exit $RETVAL
;;
'stop')
echo "Stopping enforcer..."
if [ -r "$enforcer_pid_file" ]; then
kill -TERM `cat "$enforcer_pid_file"`
RETVAL=$?
if [ $RETVAL = 0 ]; then
i=0
while [ -r "$enforcer_pid_file" ]; do
sleep 1
i=`expr $i + 1`
if [ $i -ge 5 ]; then
RETVAL=1
echo "Could not stop enforcer"
break
fi
done
fi
else
echo "Cannot find PID file"
RETVAL=1
fi
exit $RETVAL
;;
'notify')
echo "Notifying enforcer of new database..."
if [ -r "$enforcer_pid_file" ]; then
kill -HUP `cat "$enforcer_pid_file"`
RETVAL=$?
else
echo "Cannot find PID file"
RETVAL=1
fi
exit $RETVAL
;;
*)
echo "usage: $progname enforcer start|stop|notify"
;;
esac
;;
'start')
"$0" enforcer start
RETVAL=$?
if [ $RETVAL != 0 ]
then
exit $RETVAL
fi
"$0" signer start
RETVAL=$?
exit $RETVAL
;;
'stop')
"$0" enforcer stop
echo "Stopping signer engine..."
"$sbindir/ods-signer" stop
;;
*)
echo "usage: $progname ksm|hsm|signer|enforcer|start|stop ..."
;;
esac
opendnssec-1.4.3/tools/Makefile.in 0000664 0001750 0001750 00000074730 12247571140 014026 0000000 0000000 # Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# $Id: Makefile.am 1971 2009-10-01 06:37:51Z jakob $
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = tools
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/ods-control.8.in $(srcdir)/ods-control.in \
$(srcdir)/ods-kasp2html.in $(srcdir)/ods-timing.5.in \
$(srcdir)/opendnssec.7.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_broken_setres.m4 \
$(top_srcdir)/m4/acx_check_strptime.m4 \
$(top_srcdir)/m4/acx_cunit.m4 \
$(top_srcdir)/m4/acx_database_backend.m4 \
$(top_srcdir)/m4/acx_dbparams.m4 \
$(top_srcdir)/m4/acx_dlopen.m4 $(top_srcdir)/m4/acx_ldns.m4 \
$(top_srcdir)/m4/acx_libc.m4 $(top_srcdir)/m4/acx_libxml2.m4 \
$(top_srcdir)/m4/acx_mysql.m4 $(top_srcdir)/m4/acx_pedantic.m4 \
$(top_srcdir)/m4/acx_pkcs11_modules.m4 \
$(top_srcdir)/m4/acx_prefixhack.m4 \
$(top_srcdir)/m4/acx_rpath.m4 $(top_srcdir)/m4/acx_rt.m4 \
$(top_srcdir)/m4/acx_sqlite3.m4 $(top_srcdir)/m4/acx_ssl.m4 \
$(top_srcdir)/m4/acx_strict.m4 \
$(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/check_compiler_flag.m4 \
$(top_srcdir)/m4/check_compiler_flag_needed.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/opendnssec_common.m4 $(top_srcdir)/version.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/common/config.h
CONFIG_CLEAN_FILES = ods-control ods-timing.5 opendnssec.7 \
ods-control.8 ods-kasp2html
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \
"$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man7dir)" \
"$(DESTDIR)$(man8dir)"
SCRIPTS = $(bin_SCRIPTS) $(sbin_SCRIPTS)
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
man5dir = $(mandir)/man5
man7dir = $(mandir)/man7
man8dir = $(mandir)/man8
NROFF = nroff
MANS = $(man5_MANS) $(man7_MANS) $(man8_MANS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CUCUMBER = @CUCUMBER@
CUNIT_INCLUDES = @CUNIT_INCLUDES@
CUNIT_LIBS = @CUNIT_LIBS@
CYGPATH_W = @CYGPATH_W@
C_LIBS = @C_LIBS@
DB_HOST = @DB_HOST@
DB_INCLUDES = @DB_INCLUDES@
DB_LIBS = @DB_LIBS@
DB_NAME = @DB_NAME@
DB_PASS = @DB_PASS@
DB_PORT = @DB_PORT@
DB_TYPE = @DB_TYPE@
DB_USER = @DB_USER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_SSL = @HAVE_SSL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVA = @JAVA@
LD = @LD@
LDFLAGS = @LDFLAGS@
LDNS_CONFIG = @LDNS_CONFIG@
LDNS_INCLUDES = @LDNS_INCLUDES@
LDNS_LIBS = @LDNS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MYSQL = @MYSQL@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_INCLUDES = @MYSQL_INCLUDES@
MYSQL_LIBS = @MYSQL_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENDNSSEC_BIN_DIR = @OPENDNSSEC_BIN_DIR@
OPENDNSSEC_CONFIG_DIR = @OPENDNSSEC_CONFIG_DIR@
OPENDNSSEC_CONFIG_FILE = @OPENDNSSEC_CONFIG_FILE@
OPENDNSSEC_DATA_DIR = @OPENDNSSEC_DATA_DIR@
OPENDNSSEC_ENFORCER_PIDFILE = @OPENDNSSEC_ENFORCER_PIDFILE@
OPENDNSSEC_FETCH_PIDFILE = @OPENDNSSEC_FETCH_PIDFILE@
OPENDNSSEC_LIBEXEC_DIR = @OPENDNSSEC_LIBEXEC_DIR@
OPENDNSSEC_LIB_DIR = @OPENDNSSEC_LIB_DIR@
OPENDNSSEC_LOCALSTATE_DIR = @OPENDNSSEC_LOCALSTATE_DIR@
OPENDNSSEC_PID_DIR = @OPENDNSSEC_PID_DIR@
OPENDNSSEC_SBIN_DIR = @OPENDNSSEC_SBIN_DIR@
OPENDNSSEC_SCHEMA_DIR = @OPENDNSSEC_SCHEMA_DIR@
OPENDNSSEC_SIGNER_CLI = @OPENDNSSEC_SIGNER_CLI@
OPENDNSSEC_SIGNER_ENGINE = @OPENDNSSEC_SIGNER_ENGINE@
OPENDNSSEC_SIGNER_PIDFILE = @OPENDNSSEC_SIGNER_PIDFILE@
OPENDNSSEC_SIGNER_SOCKET = @OPENDNSSEC_SIGNER_SOCKET@
OPENDNSSEC_STATE_DIR = @OPENDNSSEC_STATE_DIR@
OPENDNSSEC_SYSCONF_DIR = @OPENDNSSEC_SYSCONF_DIR@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SQLITE3 = @SQLITE3@
SQLITE3_INCLUDES = @SQLITE3_INCLUDES@
SQLITE3_LIBS = @SQLITE3_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
XML2_CONFIG = @XML2_CONFIG@
XML2_INCLUDES = @XML2_INCLUDES@
XML2_LIBS = @XML2_LIBS@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkcs11_aepkeyper_module = @pkcs11_aepkeyper_module@
pkcs11_etoken_module = @pkcs11_etoken_module@
pkcs11_ncipher_module = @pkcs11_ncipher_module@
pkcs11_opensc_module = @pkcs11_opensc_module@
pkcs11_sca6000_module = @pkcs11_sca6000_module@
pkcs11_softhsm_module = @pkcs11_softhsm_module@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
SUBDIRS = solaris
sbin_SCRIPTS = ods-control
bin_SCRIPTS = ods-kasp2html
man5_MANS = ods-timing.5
man7_MANS = opendnssec.7
man8_MANS = ods-control.8
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign tools/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
ods-control: $(top_builddir)/config.status $(srcdir)/ods-control.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
ods-timing.5: $(top_builddir)/config.status $(srcdir)/ods-timing.5.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
opendnssec.7: $(top_builddir)/config.status $(srcdir)/opendnssec.7.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
ods-control.8: $(top_builddir)/config.status $(srcdir)/ods-control.8.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
ods-kasp2html: $(top_builddir)/config.status $(srcdir)/ods-kasp2html.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n' \
-e 'h;s|.*|.|' \
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
if (++n[d] == $(am__install_max)) { \
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
else { print "f", d "/" $$4, $$1 } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-binSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
install-sbinSCRIPTS: $(sbin_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
@list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n' \
-e 'h;s|.*|.|' \
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
if (++n[d] == $(am__install_max)) { \
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
else { print "f", d "/" $$4, $$1 } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
} \
; done
uninstall-sbinSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir)
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-man5: $(man5_MANS)
@$(NORMAL_INSTALL)
test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
@list='$(man5_MANS)'; test -n "$(man5dir)" || exit 0; \
{ for i in $$list; do echo "$$i"; done; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \
done; }
uninstall-man5:
@$(NORMAL_UNINSTALL)
@list='$(man5_MANS)'; test -n "$(man5dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir)
install-man7: $(man7_MANS)
@$(NORMAL_INSTALL)
test -z "$(man7dir)" || $(MKDIR_P) "$(DESTDIR)$(man7dir)"
@list='$(man7_MANS)'; test -n "$(man7dir)" || exit 0; \
{ for i in $$list; do echo "$$i"; done; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^7][0-9a-z]*$$,7,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man7dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man7dir)" || exit $$?; }; \
done; }
uninstall-man7:
@$(NORMAL_UNINSTALL)
@list='$(man7_MANS)'; test -n "$(man7dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^7][0-9a-z]*$$,7,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man7dir)'; $(am__uninstall_files_from_dir)
install-man8: $(man8_MANS)
@$(NORMAL_INSTALL)
test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
@list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \
{ for i in $$list; do echo "$$i"; done; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
done; }
uninstall-man8:
@$(NORMAL_UNINSTALL)
@list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir)
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@list='$(MANS)'; if test -n "$$list"; then \
list=`for p in $$list; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
if test -n "$$list" && \
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
echo " typically \`make maintainer-clean' will remove them" >&2; \
exit 1; \
else :; fi; \
else :; fi
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile $(SCRIPTS) $(MANS)
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(man8dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am: install-man
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am: install-binSCRIPTS install-sbinSCRIPTS
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man: install-man5 install-man7 install-man8
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-binSCRIPTS uninstall-man uninstall-sbinSCRIPTS
uninstall-man: uninstall-man5 uninstall-man7 uninstall-man8
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic clean-libtool \
ctags ctags-recursive distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-binSCRIPTS \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-man5 \
install-man7 install-man8 install-pdf install-pdf-am \
install-ps install-ps-am install-sbinSCRIPTS install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am \
uninstall-binSCRIPTS uninstall-man uninstall-man5 \
uninstall-man7 uninstall-man8 uninstall-sbinSCRIPTS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
opendnssec-1.4.3/tools/ods-control.8.in 0000664 0001750 0001750 00000003423 11701067442 014710 0000000 0000000 .TH "ods-control" "8" "February 2010" "OpenDNSSEC" "OpenDNSSEC ods-control"
.\" $Id: ods-control.8.in 6011 2012-01-04 15:24:18Z jakob $
.SH "NAME"
.LP
.B ods\-control
\- OpenDNSSEC control utility
.SH "SYNOPSIS"
.LP
.B ods\-control ksm ...
.br
.B ods\-control hsm ...
.br
.B ods\-control signer ...
.br
.B ods\-control start
.br
.B ods\-control stop
.br
.B ods\-control enforcer start
.br
.B ods\-control enforcer stop
.br
.B ods\-control enforcer notify
.SH "DESCRIPTION"
.LP
ods\-control is a helper utility which gives a combined interface for different
command utilities within OpenDNSSEC. It can also start and stop OpenDNSSEC by
controlling the two daemons.
.SH "OPTIONS"
.LP
.TP
\fBksm\fR
The remainder of the command line will be sent to the ods\-ksmutil utility
.TP
\fBhsm\fR
The remainder of the command line will be sent to the ods\-hsmutil utility
.TP
\fBsigner\fR
The remainder of the command line will be sent to the ods\-signer utility
.TP
\fBstart\fR
Will start the two daemons of OpenDNSSEC, ods\-enforcerd and ods\-signerd
.TP
\fBstop\fR
Will stop the two daemons of OpenDNSSEC, ods\-enforcerd and ods\-signerd
.TP
\fBenforcer start\fR
Start the ods\-enforcerd daemon without touching the ods\-signerd and
return non-zero on problems
.TP
\fBenforcer stop\fR
Stop the ods\-enforcerd daemon without touching the ods\-signerd and
return non-zero on problems
.TP
\fBenforcer notify\fR
Notify the enforcer that its database has been updated and may need
further processing by the KASP Enforcer.
.SH "SEE ALSO"
.LP
ods\-enforcerd(8), ods\-hsmspeed(1),
ods\-hsmutil(1), ods\-kaspcheck(1), ods\-ksmutil(1), ods\-signer(8),
ods\-signerd(8), ods\-timing(5), opendnssec(7),
.B http://www.opendnssec.org/
.SH "AUTHORS"
.LP
.B ods\-control
was written by Jakob Schlyter as part of the OpenDNSSEC project.
opendnssec-1.4.3/tools/ods-timing.5.in 0000664 0001750 0001750 00000005573 11701067442 014524 0000000 0000000 .TH "ods-timing" "5" "February 2010" OpenDNSSEC "OpenDNSSEC timinig"
.\" $Id: ods-timing.5.in 6011 2012-01-04 15:24:18Z jakob $
.SH "NAME"
.LP
.B ods-timing
\- OpenDNSSEC timing specification
.SH "SYNOPSIS"
.LP
.B @OPENDNSSEC_CONFIG_DIR@/conf.xml
.br
.B @OPENDNSSEC_CONFIG_DIR@/kasp.xml
.br
.B @OPENDNSSEC_CONFIG_DIR@/zonelist.xml
.SH "DESCRIPTION"
.LP
The configuration files of OpenDNSSEC need to have timing descriptions,
notably for periods. These descriptions follow ISO 8601 with exceptions
for the duration of a month and a year, as these periods would be allowed
to vary if ISO 8601 were strictly adhered to.
.PP
Durations are represented by the format \fBP[n]Y[n]M[n]DT[n]H[n]M[n]S\fR.
In these representations, the \fB[n]\fR is replaced by the value for each
of the date and time elements that follow the \fB[n]\fR. Leading zeros are
not required. The capital letters \fBP\fR, \fBY\fR, \fBM\fR, \fBW\fR,
\fBD\fR, \fBT\fR, \fBH\fR, \fBM\fR and \fBS\fR are designators for each of
the date and time elements and are not replaced
.TP
.B P
is the duration designator (historically called "period") placed at the start of the duration representation.
.TP
.B Y
is the year designator that follows the value for the number of years.
.TP
.B M
is the month designator that follows the value for the number of months.
.TP
.B W
is the week designator that follows the value for the number of weeks.
.TP
.B D
is the day designator that follows the value for the number of days.
.TP
.B T
is the time designator that precedes the time components of the representation.
.TP
.B H
is the hour designator that follows the value for the number of hours.
.TP
.B M
is the minute designator that follows the value for the number of minutes.
.TP
.B S
is the second designator that follows the value for the number of seconds.
.PP
For example,
.B P3Y6M4DT12H30M5S
represents a duration of "three years, six months, four days, twelve hours, thirty minutes, and five seconds". Date and time elements including their designator may be omitted if their value is zero, and lower order elements may also be omitted for reduced precision. For example,
.B P23DT23H
and
.B P4Y
are both acceptable duration representations.
.SH "EXCEPTION"
.LP
A year or month vary in duration depending on the current date. For OpenDNSSEC, we assume fixed values
.TP
.B One month
is assumed to be 31 days.
.TP
.B One year
is assumed to be 365 days.
.PP
This exception may or may not change in future releases of OpenDNSSEC.
The reason for making this exception is to avoid complicating this
software in a way that may not meet any practical need.
.SH "SEE ALSO"
.LP
ods\-control(8), ods\-enforcerd(8), ods\-hsmspeed(1),
ods\-hsmutil(1), ods\-kaspcheck(1), ods\-ksmutil(1), ods\-signer(8),
ods\-signerd(8), opendnssec(7),
ISO 8601,
.B http://www.opendnssec.org/
.SH "AUTHORS"
.LP
.B OpenDNSSEC
was made by the OpenDNSSEC project, to be found on
.B http://www.opendnssec.org/
opendnssec-1.4.3/tools/opendnssec.7.in 0000664 0001750 0001750 00000007614 11701067442 014613 0000000 0000000 .TH "opendnssec" "7" "February 2010" "OpenDNSSEC" "OpenDNSSEC overview"
.\" $Id: opendnssec.7.in 6011 2012-01-04 15:24:18Z jakob $
.SH "NAME"
.LP
.B OpenDNSSEC
\- making DNSSEC easy for DNS administrators
.SH "SYNOPSIS"
.LP
.B ods-control start
.LP
.B ods-control stop
.LP
.B ods-ksmutil
.RB \fIsubcommand...\fB
.LP
.B ods-signer
.RB [\fIsubcommand...\fB]
.SH "DESCRIPTION"
.LP
OpenDNSSEC is a complete DNSSEC zone signing system which maintains stability and security of signed domains. DNSSEC adds many cryptographic concerns to DNS; OpenDNSSEC automates those to allow current DNS administrators to adopt DNSSEC.
.PP
Domain signing is done by placing OpenDNSSEC between the place where the
zone files are edited and where they are published. The current version
of OpenDNSSEC supports files and AXFR to communicate the zone data;
effectively, OpenDNSSEC acts as a "bump in the wire" between editing and
publishing a zone.
.PP
OpenDNSSEC has two daemons, which are unitedly started and stopped through
the
.I ods\-control(8)
command.
The two daemons in turn invoke other programs to get their work done.
.PP
One of the daemons is the KASP Enforcer, which enforces policies that define
security and timing requirements for each individual zone. Operators tend
to interact with the KASP Enforcer a lot, through the
.I ods\-ksmutil(1)
command.
.PP
The other daemon is the Signer Engine, which in turn signs the zone content.
It retrieves that content from a file or through AXFR, and publishes a signed
version of the zone into a file or through AXFR. Direct interaction with the
Signer Engine, although not normally necessary, is possible through the
.I ods\-signer(8)
command.
.PP
The keys that sign the zones are managed by an independent repository, which
is accessed over a PKCS #11 interface. The principle idea of this interface
being to unleash access to cryptographic hardware, there are implementations
in software. Also, implementations range from open to commercial, and from
very simple to highly secure. By default, OpenDNSSEC is configured to run on
top of a SoftHSM, but a few other commands exist to test any
Hardware Security Module that may sit under the PKCS #11 API.
.SH "OPERATIONAL PRACTICES"
The approach used by OpenDNSSEC follows the best current practice of
two kinds of key per zone:
.TP
.B KSK\fR or \fBKey Signing Key
This key belongs in the apex of a zone, and is referenced in the parent
zone (quite possibly a registry) in the form of DS records alongside
NS records. These parent references function as trust delegations.
The KSK is usually a longer key, and it could harm the efficiency of
secure resolvers if all individual resource records were signed with it.
This is why it is advisable to use the KSK only to sign the ZSK.
In DNS records, the KSK can usually be recognised by having its SEP
(Secure Entry Point) flag set.
.TP
.B ZSK\fR or \fBZone Signing Key
This key also belongs in the apex of a zone, and
is actually used to sign the resource records in a zone.
It is a shorter key for reasons of efficiency, that is rolled over
on a fairly regular basis. To detach these rollovers from the parent,
the ZSK is not directly trusted by the parent zone, but instead its
trust is established by way of a signature by the KSK on the ZSK.
.PP
OpenDNSSEC is mindful about the period of validity of each key, and will
rollover in time to keep the domain signed, with new keys, without any
downtime for the secure domain. The only thing that is not standardised,
and thus cannot be automated at the moment is the interface between a zone
and its parent, so this has to be done manually, or scripted around
OpenDNSSEC.
.SH "SEE ALSO"
.LP
ods\-control(8), ods\-enforcerd(8), ods\-hsmspeed(1),
ods\-hsmutil(1), ods\-kaspcheck(1), ods\-ksmutil(1), ods\-signer(8),
ods\-signerd(8), ods\-timing(5),
.B http://www.opendnssec.org/
.SH "AUTHORS"
.LP
.B OpenDNSSEC
was made by the OpenDNSSEC project, to be found on
.B http://www.opendnssec.org/
opendnssec-1.4.3/tools/Makefile.am 0000664 0001750 0001750 00000000373 11410413030 013765 0000000 0000000 # $Id: Makefile.am 1971 2009-10-01 06:37:51Z jakob $
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
SUBDIRS = solaris
sbin_SCRIPTS = ods-control
bin_SCRIPTS = ods-kasp2html
man5_MANS = ods-timing.5
man7_MANS = opendnssec.7
man8_MANS = ods-control.8
opendnssec-1.4.3/tools/ods-kasp2html.in 0000664 0001750 0001750 00000003521 11346414504 014766 0000000 0000000 #!/bin/sh
#
# $Id: ods-kasp2html.in 3035 2010-03-12 10:36:52Z jakob $
#
# Copyright (c) 2010 Kirei AB. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
XMLLINT=@XMLLINT@
XSLTPROC=@XSLTPROC@
KASP_SCHEMA=@OPENDNSSEC_DATA_DIR@/kasp.rng
KASP_XSL=@OPENDNSSEC_DATA_DIR@/kasp2html.xsl
KASP_XML=$1
if [ ! -x "$XMLLINT" ]; then
echo "error: xmllint required, but not found"
exit 1
fi
if [ ! -x "$XSLTPROC" ]; then
echo "error: xsltproc required, but not found"
exit 1
fi
if [ -f "$KASP_XML" ]; then
$XMLLINT --noout --relaxng $KASP_SCHEMA $KASP_XML && \
$XSLTPROC $KASP_XSL $KASP_XML
else
echo "usage: $0 [kasp.xml]"
fi
opendnssec-1.4.3/configure.ac 0000664 0001750 0001750 00000020055 12167227357 013107 0000000 0000000 # $Id: configure.ac 7187 2013-07-10 09:52:47Z matthijs $
m4_sinclude([version.m4])
AC_PREREQ(2.61)
AC_INIT([opendnssec], OPENDNSSEC_VERSION, [http://bugs.opendnssec.org/])
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(foreign)
ACX_PREFIXHACK
OPENDNSSEC_COMMON
# extensions
AC_USE_SYSTEM_EXTENSIONS
# standard programs
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_RANLIB
# additional programs
AC_PATH_PROG(XMLLINT, xmllint)
AC_PATH_PROG(XSLTPROC, xsltproc)
AC_PATH_PROG(JAVA, java)
AC_PATH_PROG(CP, cp)
AC_DEFINE_UNQUOTED(CP_COMMAND, "$CP", [System cp(3) command])
# building
ACX_ARG_RPATH
ACX_RUNTIME_PATH_ADD
ACX_PEDANTIC
ACX_STRICT
# compiler flags
CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"])
CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"])
CHECK_COMPILER_FLAG_NEEDED($C99FLAG, [#include ], [CFLAGS="$CFLAGS $C99FLAG"])
CHECK_COMPILER_FLAG_NEEDED(-D__EXTENSIONS__,
[
#include "confdefs.h"
#include
#include
int test() {
int a;
char **opts = NULL;
a = getopt(2, opts, "a");
return a;
}
], [CFLAGS="-D__EXTENSIONS__ $CFLAGS"])
# checks for header files
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_HEADER_TIME
AC_CHECK_HEADERS([fcntl.h inttypes.h stdio.h stdlib.h string.h syslog.h unistd.h])
AC_CHECK_HEADERS(getopt.h,, [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([errno.h getopt.h pthread.h signal.h stdarg.h stdint.h strings.h])
AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/stat.h sys/time.h sys/types.h sys/wait.h])
AC_CHECK_HEADERS([libxml/parser.h libxml/relaxng.h libxml/xmlreader.h libxml/xpath.h])
# checks for typedefs, structures, and compiler characteristics
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_TYPE_UINT16_T
AC_MSG_CHECKING(for union semun)
AC_TRY_COMPILE([#include
#include
#include ],
[union semun arg;],
[have_union_semun=1],
[have_union_semun=0]
)
if test $have_union_semun = 1; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_UNION_SEMUN, 1, [union semun is defined])
else
AC_MSG_RESULT(no)
fi
# pthread
ACX_PTHREAD
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
# checks for library functions
AC_CHECK_FUNCS([arc4random arc4random_uniform])
AC_CHECK_FUNCS([dup2 endpwent select strerror strtol])
AC_CHECK_FUNCS([getpass getpassphrase memset])
AC_CHECK_FUNCS([localtime_r memset strdup strerror strstr strtol strtoul])
AC_CHECK_FUNCS([setregid setreuid])
AC_CHECK_FUNCS([chown stat exit time atoi getpid waitpid sigfillset])
AC_CHECK_FUNCS([malloc calloc realloc free])
AC_CHECK_FUNCS([strlen strncmp strncat strncpy strerror strncasecmp strdup])
AC_CHECK_FUNCS([fgetc fopen fclose ferror fprintf vsnprintf snprintf fflush])
AC_CHECK_FUNCS([openlog closelog syslog])
AC_CHECK_FUNCS([openlog_r closelog_r syslog_r vsyslog_r])
AC_CHECK_FUNCS([chroot getgroups setgroups initgroups])
AC_CHECK_FUNCS([close unlink fcntl socket listen bzero])
AC_CHECK_FUNCS([va_start va_end])
AC_CHECK_FUNCS([xmlInitParser xmlCleanupParser xmlCleanupThreads])
AC_CHECK_FUNCS([pthread_mutex_init pthread_mutex_destroy pthread_mutex_lock pthread_mutex_unlock])
AC_CHECK_FUNCS([pthread_cond_init pthread_cond_signal pthread_cond_destroy pthread_cond_wait pthread_cond_timedwait])
AC_CHECK_FUNCS([pthread_create pthread_detach pthread_self pthread_join pthread_sigmask])
AC_FUNC_CHOWN
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_VPRINTF
AC_REPLACE_FUNCS(strlcat)
AC_REPLACE_FUNCS(strlcpy)
AC_REPLACE_FUNCS(b64_pton)
AC_REPLACE_FUNCS(b64_ntop)
ACX_BROKEN_SETRES
AC_CHECK_STRPTIME
# check for some target-specific stuff
case "$host" in
*-*-darwin*)
AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
[Define if your platform breaks doing a seteuid before a setuid])
AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
;;
esac
# check for the sockaddr_un.sun_len member
AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
[AC_DEFINE(HAVE_SOCKADDR_SUN_LEN,1,[Have the sockaddr_un.sun_len member.])],
[],
[ #include
#include
])
# timeshift
AC_ARG_ENABLE(timeshift,
AC_HELP_STRING([--enable-timeshift], [Enable timeshift debug]),
[enable_timeshift="${enableval}"],
[enable_timeshift="no"])
AC_MSG_CHECKING(if we should enable timeshift debugging)
if test "x${enable_timeshift}" = "xyes"; then
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(ENFORCER_TIMESHIFT, 1, [timeshift debug])
else
AC_MSG_RESULT(no)
fi
# common dependencies
ACX_LIBXML2
ACX_LDNS(1,6,12)
ACX_LDNS_NOT(1,6,14, [binary incompatibility, see http://open.nlnetlabs.nl/pipermail/ldns-users/2012-October/000564.html])
ACX_LDNS_NOT(1,6,15, [fail to create NSEC3 bitmap for empty non-terminals, see http://www.nlnetlabs.nl/pipermail/ldns-users/2012-November/000565.html])
ACX_PKCS11_MODULES
ACX_RT
ACX_LIBC
ACX_SSL
# libhsm
ACX_DLOPEN
AC_DEFINE_UNQUOTED([HSM_DEFAULT_CONFIG],["$OPENDNSSEC_CONFIG_FILE"],[Default configuration file.])
# enforcer
AC_PATH_PROG(PERL, perl)
if test -z "$PERL"; then
AC_MSG_ERROR([perl not found])
fi
ACX_DBPARAMS
ACX_DATABASE_BACKEND
ACX_CUNIT
AC_DEFINE_UNQUOTED(SIGNER_CLI_UPDATE, "$OPENDNSSEC_SIGNER_CLI update", [Path to the OpenDNSSEC signer engine cli])
AM_CONDITIONAL([ENABLE_ENFORCER], [test "${enable_signer}" = "yes"])
# cunit
AM_CONDITIONAL([WITH_CUNIT], [test "${with_cunit}" != "no" -a -n "$CUNIT_LIBS"])
# signer
AC_ARG_ENABLE(signer,
AC_HELP_STRING([--disable-signer],
[Disable signer build (default enabled)]),
[enable_signer="${enableval}"],
[enable_signer="yes"])
AH_BOTTOM([
/* define before includes as it specifies what standard to use. */
#if (defined(HAVE_PSELECT) && !defined (HAVE_PSELECT_PROTO)) \
|| !defined (HAVE_CTIME_R_PROTO) \
|| defined (STRPTIME_NEEDS_DEFINES)
# ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 600
# endif
# ifndef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200112
# endif
# ifndef _BSD_SOURCE
# define _BSD_SOURCE 1
# endif
# ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
# endif
# ifndef _STDC_C99
# define _STDC_C99 1
# endif
# ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
# endif
#endif
])
AM_CONDITIONAL([ENABLE_SIGNER], [test "${enable_signer}" = "yes"])
# check for a green cucumber (but only if we can shift time)
if test "x${enable_timeshift}" = "xyes"; then
AC_PATH_PROG(CUCUMBER, cucumber)
fi
AM_CONDITIONAL([WITH_CUCUMBER], [test -x "${CUCUMBER}"])
# doxygen
DX_PDF_FEATURE(OFF)
DX_PS_FEATURE(OFF)
DX_INIT_DOXYGEN(${PACKAGE_NAME}, [Doxyfile], [doxygen-doc])
AC_CONFIG_HEADER([common/config.h])
AC_CONFIG_FILES([
Makefile
Doxyfile
common/Makefile
conf/Makefile
conf/addns.xml
conf/conf.xml
conf/enforcerstate.xml
conf/kasp.xml
conf/signconf.xml
conf/zonelist.xml
enforcer/Makefile
enforcer/common/Makefile
enforcer/enforcerd/Makefile
enforcer/enforcerd/ods-enforcerd.8
enforcer/ksm/Makefile
enforcer/ksm/include/Makefile
enforcer/ksm/include/ksm/Makefile
enforcer/test/Makefile
enforcer/test/cucumber/Makefile
enforcer/test/cucumber/c_conf.xml
enforcer/test/cucumber/c_kasp.xml
enforcer/test/cucumber/c_zonelist.base.xml
enforcer/test/cunit/Makefile
enforcer/test/cunit/database_setup_mysql.sh
enforcer/test/cunit/database_setup_sqlite3.sh
enforcer/utils/Makefile
enforcer/utils/ods-kaspcheck.1
enforcer/utils/ods-ksmutil.1
libhsm/Makefile
libhsm/src/Makefile
libhsm/src/bin/Makefile
libhsm/src/bin/ods-hsmspeed.1
libhsm/src/bin/ods-hsmutil.1
libhsm/src/lib/Makefile
libhsm/checks/Makefile
libhsm/checks/conf-softhsm.xml
libhsm/checks/conf-sca6000.xml
libhsm/checks/conf-etoken.xml
libhsm/checks/conf-multi.xml
libhsm/checks/conf-opensc.xml
libhsm/checks/conf-ncipher.xml
libhsm/checks/conf-aepkeyper.xml
signer/Makefile
signer/man/Makefile
signer/man/ods-signer.8
signer/man/ods-signerd.8
signer/src/Makefile
tools/Makefile
tools/ods-control
tools/solaris/Makefile
tools/solaris/ods-enforcerd.init
tools/solaris/ods-signerd.init
tools/ods-timing.5
tools/opendnssec.7
tools/ods-control.8
tools/ods-kasp2html
])
AC_OUTPUT
opendnssec-1.4.3/m4/ 0000775 0001750 0001750 00000000000 12247571201 011204 5 0000000 0000000 opendnssec-1.4.3/m4/acx_rt.m4 0000664 0001750 0001750 00000000764 11423547701 012660 0000000 0000000 # $Id: acx_rt.m4 3626 2010-07-27 12:23:29Z rb $
AC_DEFUN([ACX_RT],[
RT_LIBS="-lrt"
tmp_LIBS=$LIBS
LIBS="$LIBS $RT_LIBS"
AC_CHECK_LIB(
[rt],
[clock_gettime],
[AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime])],
[RT_LIBS=""]
)
LIBS=$tmp_LIBS
AC_SUBST(RT_LIBS)
AC_CHECK_HEADERS(sys/time.h time.h)
if test "x$RT_LIBS" = "x" ; then
AC_CHECK_FUNC(
[gettimeofday],
[],
[AC_MSG_ERROR(Could not find the function clock_gettime or gettimeofday)]
)
fi
])
opendnssec-1.4.3/m4/acx_ssl.m4 0000664 0001750 0001750 00000003432 11665367032 013034 0000000 0000000 # Check for SSL, original taken from
# http://www.gnu.org/software/ac-archive/htmldoc/check_ssl.html and
# modified for OpenDNSSEC.
AC_DEFUN([ACX_SSL], [
AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname],
[enable SSL (will check /usr/local/ssl
/usr/lib/ssl /usr/ssl /usr/pkg /usr/sfw /usr/local /usr)]),[
],[
withval="yes"
])
if test x_$withval != x_no; then
AC_MSG_CHECKING(for SSL)
if test x_$withval = x_ -o x_$withval = x_yes; then
withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/sfw /usr/local /usr"
fi
for dir in $withval; do
ssldir="$dir"
if test -f "$dir/include/openssl/ssl.h"; then
found_ssl="yes";
AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.])
if test x_$ssldir != x_/usr; then
SSL_INCLUDES="$SSL_INCLUDES -I$ssldir/include";
fi
break;
fi
done
if test x_$found_ssl != x_yes; then
AC_MSG_ERROR(Cannot find the SSL libraries in $withval)
else
AC_MSG_RESULT(found in $ssldir)
HAVE_SSL=yes
if test x_$ssldir != x_/usr; then
SSL_LIBS="$SSL_LIBS -L$ssldir/lib";
fi
if test x_$ssldir = x_/usr/sfw; then
SSL_LIBS="$SSL_LIBS -R$ssldir/lib";
fi
AC_CHECK_LIB(crypto, HMAC_CTX_init,, [
AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required])
])
AC_CHECK_FUNCS([EVP_sha1 EVP_sha256])
fi
AC_SUBST(HAVE_SSL)
AC_SUBST(SSL_INCLUDES)
AC_SUBST(SSL_LIBS)
fi
])dnl
opendnssec-1.4.3/m4/acx_pkcs11_modules.m4 0000664 0001750 0001750 00000003610 11663453334 015062 0000000 0000000 # $Id: acx_pkcs11_modules.m4 5910 2011-11-24 14:38:20Z rb $
AC_DEFUN([ACX_PKCS11_MODULES],[
AC_ARG_WITH(pkcs11-softhsm,
AS_HELP_STRING([--with-pkcs11-softhsm=PATH],[specify path of SoftHSM PKCS#11 library (default PREFIX/lib/softhsm/libsofthsm.so)]),
[ pkcs11_softhsm_module="$withval" ],
[ pkcs11_softhsm_module="$full_libdir/softhsm/libsofthsm.so" ]
)
AC_ARG_WITH(pkcs11-sca6000,
AS_HELP_STRING([--with-pkcs11-sca6000=PATH],[specify path of SCA/6000 PKCS#11 library (default /usr/lib/libpkcs11.so)]),
[ pkcs11_sca6000_module="$withval" ],
[ pkcs11_sca6000_module="/usr/lib/libpkcs11.so" ]
)
AC_ARG_WITH(pkcs11-etoken,
AS_HELP_STRING([--with-pkcs11-etoken=PATH],[specify path of Aladdin eToken PKCS#11 library (default /usr/local/lib/libeTPkcs11.so)]),
[ pkcs11_etoken_module="$withval" ],
[ pkcs11_etoken_module="/usr/local/lib/libeTPkcs11.so" ]
)
AC_ARG_WITH(pkcs11-opensc,
AS_HELP_STRING([--with-pkcs11-opensc=PATH],[specify path of OpenSC PKCS#11 library (default /usr/lib/pkcs11/opensc-pkcs11.so)]),
[ pkcs11_opensc_module="$withval" ],
[ pkcs11_opensc_module="/usr/lib/pkcs11/opensc-pkcs11.so" ]
)
AC_ARG_WITH(pkcs11-ncipher,
AS_HELP_STRING([--with-pkcs11-ncipher=PATH],[specify path of nCipher PKCS#11 library (default /opt/nfast/toolkits/pkcs11/libcknfast.so)]),
[ pkcs11_ncipher_module="$withval" ],
[ pkcs11_ncipher_module="/opt/nfast/toolkits/pkcs11/libcknfast.so" ]
)
AC_ARG_WITH(pkcs11-aepkeyper,
AS_HELP_STRING([--with-pkcs11-aepkeyper=PATH],[specify path of AEP Keyper PKCS#11 library (default /opt/Keyper/PKCS11Provider/pkcs11.so)]),
[ pkcs11_aepkeyper_module="$withval" ],
[ pkcs11_aepkeyper_module="/opt/Keyper/PKCS11Provider/pkcs11.so" ]
)
AC_SUBST(pkcs11_softhsm_module)
AC_SUBST(pkcs11_sca6000_module)
AC_SUBST(pkcs11_etoken_module)
AC_SUBST(pkcs11_opensc_module)
AC_SUBST(pkcs11_ncipher_module)
AC_SUBST(pkcs11_aepkeyper_module)
])
opendnssec-1.4.3/m4/acx_ldns.m4 0000664 0001750 0001750 00000005736 12052653653 013202 0000000 0000000 # $Id: acx_ldns.m4 6847 2012-11-20 10:12:59Z sara $
AC_DEFUN([ACX_LDNS],[
AC_ARG_WITH(ldns,
[AC_HELP_STRING([--with-ldns=PATH],[specify prefix of path of ldns library to use])],
[
LDNS_PATH="$withval"
AC_PATH_PROGS(LDNS_CONFIG, ldns-config, ldns-config, $LDNS_PATH/bin)
],[
LDNS_PATH="/usr/local"
AC_PATH_PROGS(LDNS_CONFIG, ldns-config, ldns-config, $PATH)
])
if test -x "$LDNS_CONFIG"
then
AC_MSG_CHECKING(what are the ldns includes)
LDNS_INCLUDES="`$LDNS_CONFIG --cflags`"
AC_MSG_RESULT($LDNS_INCLUDES)
AC_MSG_CHECKING(what are the ldns libs)
LDNS_LIBS="`$LDNS_CONFIG --libs`"
AC_MSG_RESULT($LDNS_LIBS)
else
AC_MSG_CHECKING(what are the ldns includes)
LDNS_INCLUDES="-I$LDNS_PATH/include"
AC_MSG_RESULT($LDNS_INCLUDES)
AC_MSG_CHECKING(what are the ldns libs)
LDNS_LIBS="-L$LDNS_PATH/lib -lldns"
AC_MSG_RESULT($LDNS_LIBS)
fi
tmp_CPPFLAGS=$CPPFLAGS
tmp_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LDNS_INCLUDES"
LIBS="$LIBS $LDNS_LIBS"
AC_CHECK_LIB(ldns, ldns_rr_new,,[AC_MSG_ERROR([Can't find ldns library])])
LIBS=$tmp_LIBS
AC_MSG_CHECKING([for ldns version])
CHECK_LDNS_VERSION=m4_format(0x%02x%02x%02x, $1, $2, $3)
AC_LANG_PUSH([C])
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
#include
int main()
{
#ifdef LDNS_REVISION
if (LDNS_REVISION >= $CHECK_LDNS_VERSION)
return 0;
#endif
return 1;
}
]])
],[
AC_MSG_RESULT([>= $1.$2.$3])
],[
AC_MSG_RESULT([< $1.$2.$3])
AC_MSG_ERROR([ldns library too old ($1.$2.$3 or later required)])
],[])
AC_LANG_POP([C])
CPPFLAGS=$tmp_CPPFLAGS
AC_SUBST(LDNS_INCLUDES)
AC_SUBST(LDNS_LIBS)
])
AC_DEFUN([ACX_LDNS_NOT],[
AC_ARG_WITH(ldns,
[AC_HELP_STRING([--with-ldns=PATH],[specify prefix of path of ldns library to use])],
[
LDNS_PATH="$withval"
AC_PATH_PROGS(LDNS_CONFIG, ldns-config, ldns-config, $LDNS_PATH/bin)
],[
LDNS_PATH="/usr/local"
AC_PATH_PROGS(LDNS_CONFIG, ldns-config, ldns-config, $PATH)
])
if test -x "$LDNS_CONFIG"
then
AC_MSG_CHECKING(what are the ldns includes)
LDNS_INCLUDES="`$LDNS_CONFIG --cflags`"
AC_MSG_RESULT($LDNS_INCLUDES)
AC_MSG_CHECKING(what are the ldns libs)
LDNS_LIBS="`$LDNS_CONFIG --libs`"
AC_MSG_RESULT($LDNS_LIBS)
else
AC_MSG_CHECKING(what are the ldns includes)
LDNS_INCLUDES="-I$LDNS_PATH/include"
AC_MSG_RESULT($LDNS_INCLUDES)
AC_MSG_CHECKING(what are the ldns libs)
LDNS_LIBS="-L$LDNS_PATH/lib -lldns"
AC_MSG_RESULT($LDNS_LIBS)
fi
tmp_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $LDNS_INCLUDES"
AC_MSG_CHECKING([for ldns version not $1.$2.$3])
CHECK_LDNS_VERSION=m4_format(0x%02x%02x%02x, $1, $2, $3)
AC_LANG_PUSH([C])
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
#include
int main()
{
#ifdef LDNS_REVISION
if (LDNS_REVISION != $CHECK_LDNS_VERSION)
return 0;
#endif
return 1;
}
]])
],[
AC_MSG_RESULT([ok])
],[
AC_MSG_RESULT([no])
AC_MSG_ERROR([ldns version $1.$2.$3 is not compatible due to $4])
],[])
AC_LANG_POP([C])
CPPFLAGS=$tmp_CPPFLAGS
])
opendnssec-1.4.3/m4/check_compiler_flag_needed.m4 0000664 0001750 0001750 00000001674 11410424713 016636 0000000 0000000 # $Id: check_compiler_flag_needed.m4 3541 2010-06-23 15:35:39Z jakob $
# if the given code compiles without the flag, execute argument 4
# if the given code only compiles with the flag, execute argument 3
# otherwise fail
AC_DEFUN([CHECK_COMPILER_FLAG_NEEDED],[
AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(whether we need $1 as a flag for $CC)
cache=`echo $1 | sed 'y% .=/+-%____p_%'`
AC_CACHE_VAL(cv_prog_cc_flag_needed_$cache,
[
echo '$2' > conftest.c
echo 'void f(){}' >>conftest.c
if test -z "`$CC $CFLAGS -Werror -Wall -c conftest.c 2>&1`"; then
eval "cv_prog_cc_flag_needed_$cache=no"
else
[
if test -z "`$CC $CFLAGS $1 -Werror -Wall -c conftest.c 2>&1`"; then
eval "cv_prog_cc_flag_needed_$cache=yes"
else
echo 'Test with flag fails too'
fi
]
fi
rm -f conftest*
])
if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
AC_MSG_RESULT(yes)
:
$3
else
AC_MSG_RESULT(no)
:
$4
fi
])
opendnssec-1.4.3/m4/check_compiler_flag.m4 0000664 0001750 0001750 00000001154 11410424713 015323 0000000 0000000 # $Id: check_compiler_flag.m4 3541 2010-06-23 15:35:39Z jakob $
# routine to help check for compiler flags.
AC_DEFUN([CHECK_COMPILER_FLAG],[
AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(whether $CC supports -$1)
cache=`echo $1 | sed 'y% .=/+-%____p_%'`
AC_CACHE_VAL(cv_prog_cc_flag_$cache,
[
echo 'void f(){}' >conftest.c
if test -z "`$CC -$1 -c conftest.c 2>&1`"; then
eval "cv_prog_cc_flag_$cache=yes"
else
eval "cv_prog_cc_flag_$cache=no"
fi
rm -f conftest*
])
if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
AC_MSG_RESULT(yes)
:
$2
else
AC_MSG_RESULT(no)
:
$3
fi
])
opendnssec-1.4.3/m4/acx_libxml2.m4 0000664 0001750 0001750 00000001746 11327553071 013605 0000000 0000000 # $Id: acx_libxml2.m4 2718 2010-01-26 11:47:05Z jakob $
AC_DEFUN([ACX_LIBXML2],[
AC_ARG_WITH(libxml2,
[AS_HELP_STRING([--with-libxml2=DIR],[look for libxml2 in this dir])],
[
XML2_PATH="$withval"
AC_PATH_PROGS(XML2_CONFIG, xml2-config, xml2-config, $XML2_PATH/bin)
],[
XML2_PATH="/usr/local"
AC_PATH_PROGS(XML2_CONFIG, xml2-config, xml2-config, $PATH)
])
if test -x "$XML2_CONFIG"
then
AC_MSG_CHECKING(what are the xml2 includes)
XML2_INCLUDES="`$XML2_CONFIG --cflags`"
AC_MSG_RESULT($XML2_INCLUDES)
AC_MSG_CHECKING(what are the xml2 libs)
XML2_LIBS="`$XML2_CONFIG --libs`"
AC_MSG_RESULT($XML2_LIBS)
tmp_CPPFLAGS=$CPPFLAGS
tmp_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $XML2_INCLUDES"
LIBS="$LIBS $XML2_LIBS"
AC_CHECK_LIB(xml2, xmlDocGetRootElement,,[AC_MSG_ERROR([Can't find libxml2 library])])
CPPFLAGS=$tmp_CPPFLAGS
LIBS=$tmp_LIBS
else
AC_MSG_ERROR([libxml2 required, but not found.])
fi
AC_SUBST(XML2_INCLUDES)
AC_SUBST(XML2_LIBS)
])
opendnssec-1.4.3/m4/ax_pthread.m4 0000664 0001750 0001750 00000030366 11750712623 013520 0000000 0000000 # ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads. It
# sets the PTHREAD_LIBS output variable to the threads library and linker
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC to any special C compiler that is needed for
# multi-threaded programs (defaults to the value of CC otherwise). (This
# is necessary on AIX to use the special cc_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also link it with them as well. e.g. you should link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threads programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
# will define HAVE_PTHREAD.
#
# Please let the authors know if this macro fails on any platform, or if
# you have any other suggestions or comments. This macro was based on work
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
# grateful for the helpful feedback of numerous users.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson
# Copyright (c) 2011 Daniel Richard G.
#
# This program is free software: you can redistribute it and/or modify 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.
#
# This program 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 .
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 18
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
AC_MSG_RESULT($ax_pthread_ok)
if test x"$ax_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# ... -mt is also the pthreads flag for HP/aCC
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case ${host_os} in
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
;;
esac
if test x"$ax_pthread_ok" = xno; then
for flag in $ax_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
pthread-config)
AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
if test x"$ax_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($ax_pthread_ok)
if test "x$ax_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$ax_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ],
[int attr = $attr; return attr /* ; */])],
[attr_name=$attr; break],
[])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case ${host_os} in
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
osf* | hpux*) flag="-D_REENTRANT";;
solaris*)
if test "$GCC" = "yes"; then
flag="-D_REENTRANT"
else
flag="-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
ax_cv_PTHREAD_PRIO_INHERIT, [
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include ]], [[int i = PTHREAD_PRIO_INHERIT;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with xlc_r or cc_r
if test x"$GCC" != xyes; then
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
else
PTHREAD_CC=$CC
fi
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$ax_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
ax_pthread_ok=no
$2
fi
AC_LANG_POP
])dnl AX_PTHREAD
opendnssec-1.4.3/m4/acx_database_backend.m4 0000664 0001750 0001750 00000002364 11410424713 015435 0000000 0000000 # $Id: acx_database_backend.m4 3541 2010-06-23 15:35:39Z jakob $
AC_DEFUN([ACX_DATABASE_BACKEND],[
AC_ARG_WITH(database-backend,
AC_HELP_STRING([--with-database-backend],
[Select database backend (sqlite3|mysql)]),
[database_backend="${withval}"],
[database_backend="sqlite3"])
AC_MSG_CHECKING(for database backend)
if test "x${database_backend}" = "xsqlite3"; then
AC_MSG_RESULT(SQLite3)
ACX_SQLITE3
DB_TYPE=sqlite3
DB_INCLUDES=$SQLITE3_INCLUDES
DB_LIBS=$SQLITE3_LIBS
AC_DEFINE_UNQUOTED(SQL_BIN, "$SQLITE3", [database binary])
AC_DEFINE_UNQUOTED(SQL_SETUP, "$OPENDNSSEC_DATA_DIR/database_create.sqlite3", [database setup script])
elif test "x${database_backend}" = "xmysql"; then
AC_MSG_RESULT(MySQL)
ACX_MYSQL
DB_TYPE=mysql
DB_INCLUDES=$MYSQL_INCLUDES
DB_LIBS=$MYSQL_LIBS
AC_DEFINE_UNQUOTED(SQL_BIN, "$MYSQL", [database binary])
AC_DEFINE_UNQUOTED(SQL_SETUP, "$OPENDNSSEC_DATA_DIR/database_create.mysql", [database setup script])
else
AC_MSG_RESULT(Unknown)
AC_MSG_ERROR([Database backend ${database_backend} not supported.])
fi
AC_SUBST(DB_TYPE)
AC_SUBST(DB_INCLUDES)
AC_SUBST(DB_LIBS)
AM_CONDITIONAL([USE_MYSQL], [test "x${database_backend}" = "xmysql"])
])
opendnssec-1.4.3/m4/ltversion.m4 0000644 0001750 0001750 00000001262 12247571127 013421 0000000 0000000 # ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# @configure_input@
# serial 3337 ltversion.m4
# This file is part of GNU Libtool
m4_define([LT_PACKAGE_VERSION], [2.4.2])
m4_define([LT_PACKAGE_REVISION], [1.3337])
AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.2'
macro_revision='1.3337'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])
opendnssec-1.4.3/m4/acx_broken_setres.m4 0000664 0001750 0001750 00000001755 11410424713 015072 0000000 0000000 # $Id: acx_broken_setres.m4 3541 2010-06-23 15:35:39Z jakob $
AC_DEFUN([ACX_BROKEN_SETRES],[
AC_CHECK_FUNCS(setresuid, [
AC_MSG_CHECKING(if setresuid seems to work)
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include
#include
int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
]])],
[AC_MSG_RESULT(yes)],
[AC_DEFINE(BROKEN_SETRESUID, 1,
[Define if your setresuid() is broken])
AC_MSG_RESULT(not implemented)],
[AC_MSG_WARN([cross compiling: not checking setresuid])]
)
])
AC_CHECK_FUNCS(setresgid, [
AC_MSG_CHECKING(if setresgid seems to work)
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include
#include
int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
]])],
[AC_MSG_RESULT(yes)],
[AC_DEFINE(BROKEN_SETRESGID, 1,
[Define if your setresgid() is broken])
AC_MSG_RESULT(not implemented)],
[AC_MSG_WARN([cross compiling: not checking setresuid])]
)
])
])
opendnssec-1.4.3/m4/acx_dbparams.m4 0000664 0001750 0001750 00000001443 11542650315 014015 0000000 0000000 # $Id: acx_dbparams.m4 4642 2011-03-24 14:10:21Z rb $
AC_DEFUN([ACX_DBPARAMS],[
AC_ARG_WITH(dbname,
[AS_HELP_STRING([--with-dbname=DB_NAME],[Database name/schema for unit tests])],
DB_NAME="$withval"
)
AC_SUBST(DB_NAME)
AC_ARG_WITH(dbhost,
[AS_HELP_STRING([--with-dbhost=DB_HOST],[Database host for unit tests])],
DB_HOST="$withval"
)
AC_SUBST(DB_HOST)
AC_ARG_WITH(dbport,
[AS_HELP_STRING([--with-dbport=DB_PORT],[Database port for unit tests])],
DB_PORT="$withval"
)
AC_SUBST(DB_PORT)
AC_ARG_WITH(dbuser,
[AS_HELP_STRING([--with-dbuser=DB_USER],[Database user for unit tests])],
DB_USER="$withval"
)
AC_SUBST(DB_USER)
AC_ARG_WITH(dbpass,
[AS_HELP_STRING([--with-dbpass=DB_PASS],[Database password for unit tests])],
DB_PASS="$withval"
)
AC_SUBST(DB_PASS)
])
opendnssec-1.4.3/m4/acx_pedantic.m4 0000664 0001750 0001750 00000000524 11410415234 014003 0000000 0000000 # $Id: acx_pedantic.m4 3535 2010-06-23 14:30:52Z jakob $
AC_DEFUN([ACX_PEDANTIC],[
AC_ARG_ENABLE(
[pedantic],
[AS_HELP_STRING([--enable-pedantic],[enable pedantic compile mode @<:@enabled@:>@])],
,
[enable_pedantic="yes"]
)
if test "${enable_pedantic}" = "yes"; then
enable_strict="yes";
CFLAGS="${CFLAGS} -pedantic"
fi
])
opendnssec-1.4.3/m4/acx_sqlite3.m4 0000664 0001750 0001750 00000002103 11466404264 013607 0000000 0000000 # $Id: acx_sqlite3.m4 4176 2010-11-10 02:51:32Z rb $
AC_DEFUN([ACX_SQLITE3],[
AC_ARG_WITH(sqlite3,
AC_HELP_STRING([--with-sqlite3=PATH],[Specify prefix of path of SQLite3]),
[
SQLITE3_PATH="$withval"
AC_PATH_PROGS(SQLITE3, sqlite3, sqlite3, $withval/bin)
],[
SQLITE3_PATH="/usr/local"
AC_PATH_PROGS(SQLITE3, sqlite3, sqlite3, $PATH)
])
if ! test -x "$SQLITE3"; then
AC_MSG_ERROR([sqlite3 command not found])
fi
AC_MSG_CHECKING(what are the SQLite3 includes)
SQLITE3_INCLUDES="-I$SQLITE3_PATH/include"
AC_MSG_RESULT($SQLITE3_INCLUDES)
AC_MSG_CHECKING(what are the SQLite3 libs)
SQLITE3_LIBS="-L$SQLITE3_PATH/lib -lsqlite3"
AC_MSG_RESULT($SQLITE3_LIBS)
tmp_CPPFLAGS=$CPPFLAGS
tmp_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $SQLITE3_INCLUDES"
LIBS="$LIBS $SQLITE3_LIBS"
AC_CHECK_HEADERS(sqlite3.h,,[AC_MSG_ERROR([Can't find SQLite3 headers])])
AC_CHECK_LIB(sqlite3, sqlite3_prepare_v2, [], [AC_MSG_ERROR([Missing SQLite3 library v3.3.9 or greater])])
CPPFLAGS=$tmp_CPPFLAGS
LIBS=$tmp_LIBS
AC_SUBST(SQLITE3_INCLUDES)
AC_SUBST(SQLITE3_LIBS)
])
opendnssec-1.4.3/m4/acx_dlopen.m4 0000664 0001750 0001750 00000001423 11605030455 013500 0000000 0000000 # $Id: acx_dlopen.m4 5294 2011-07-06 09:55:57Z rb $
AC_DEFUN([ACX_DLOPEN],[
tmp_SUCCESS="no"
# Unix
AC_CHECK_FUNC(
[dlopen],
[
AC_DEFINE(HAVE_DLOPEN, 1, [Define if you have dlopen])
tmp_SUCCESS="yes"
],
[
AC_CHECK_LIB(
[dl],
[dlopen],
[
AC_DEFINE(HAVE_DLOPEN, 1, [Define if you have dlopen])
LIBS="$LIBS -ldl"
tmp_SUCCESS="yes"
]
)
]
)
# Windows
if test "$tmp_SUCCESS" = "no"
then
AC_MSG_CHECKING([for LoadLibrary])
AC_TRY_LINK(
[#include ],
[LoadLibrary(NULL);],
[
AC_DEFINE(HAVE_LOADLIBRARY, 1, [Define if you have LoadLibrary])
tmp_SUCCESS="yes"
]
)
AC_MSG_RESULT([$tmp_SUCCESS])
fi
if test "$tmp_SUCCESS" = "no"
then
AC_MSG_ERROR([No dynamic library loading support])
fi
])
opendnssec-1.4.3/m4/acx_rpath.m4 0000664 0001750 0001750 00000001711 11410415234 013331 0000000 0000000 # $Id: acx_rpath.m4 3535 2010-06-23 14:30:52Z jakob $
dnl Add option to disable the evil rpath. Check whether to use rpath or not.
dnl Adds the --disable-rpath option. Uses trick to edit the ./libtool.
AC_DEFUN([ACX_ARG_RPATH],
[
AC_ARG_ENABLE(rpath,
[AS_HELP_STRING([--disable-rpath],
[disable hardcoded rpath (default=enabled)])],
[enable_rpath=$enableval],
[enable_rpath=yes])
if test "x$enable_rpath" = xno; then
AC_MSG_RESULT([Fixing libtool for -rpath problems.])
sed < libtool > libtool-2 \
's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/'
mv libtool-2 libtool
chmod 755 libtool
libtool="./libtool"
fi
])
dnl Add a -R to the RUNTIME_PATH. Only if rpath is enabled and it is
dnl an absolute path.
dnl $1: the pathname to add.
AC_DEFUN([ACX_RUNTIME_PATH_ADD], [
if test "x$enable_rpath" = xyes; then
if echo "$1" | grep "^/" >/dev/null; then
RUNTIME_PATH="$RUNTIME_PATH -R$1"
fi
fi
])
opendnssec-1.4.3/m4/ax_prog_doxygen.m4 0000664 0001750 0001750 00000042663 11427746256 014612 0000000 0000000 # $Id$
#
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html
# ===========================================================================
#
# SYNOPSIS
#
# DX_INIT_DOXYGEN(PROJECT-NAME, DOXYFILE-PATH, [OUTPUT-DIR])
# DX_DOXYGEN_FEATURE(ON|OFF)
# DX_DOT_FEATURE(ON|OFF)
# DX_HTML_FEATURE(ON|OFF)
# DX_CHM_FEATURE(ON|OFF)
# DX_CHI_FEATURE(ON|OFF)
# DX_MAN_FEATURE(ON|OFF)
# DX_RTF_FEATURE(ON|OFF)
# DX_XML_FEATURE(ON|OFF)
# DX_PDF_FEATURE(ON|OFF)
# DX_PS_FEATURE(ON|OFF)
#
# DESCRIPTION
#
# The DX_*_FEATURE macros control the default setting for the given
# Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for
# generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML
# help (for MS users), 'CHI' for generating a seperate .chi file by the
# .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate
# output formats. The environment variable DOXYGEN_PAPER_SIZE may be
# specified to override the default 'a4wide' paper size.
#
# By default, HTML, PDF and PS documentation is generated as this seems to
# be the most popular and portable combination. MAN pages created by
# Doxygen are usually problematic, though by picking an appropriate subset
# and doing some massaging they might be better than nothing. CHM and RTF
# are specific for MS (note that you can't generate both HTML and CHM at
# the same time). The XML is rather useless unless you apply specialized
# post-processing to it.
#
# The macros mainly control the default state of the feature. The use can
# override the default by specifying --enable or --disable. The macros
# ensure that contradictory flags are not given (e.g.,
# --enable-doxygen-html and --enable-doxygen-chm,
# --enable-doxygen-anything with --disable-doxygen, etc.) Finally, each
# feature will be automatically disabled (with a warning) if the required
# programs are missing.
#
# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN
# with the following parameters: a one-word name for the project for use
# as a filename base etc., an optional configuration file name (the
# default is 'Doxyfile', the same as Doxygen's default), and an optional
# output directory name (the default is 'doxygen-doc').
#
# Automake Support
#
# The following is a template aminclude.am file for use with Automake.
# Make targets and variables values are controlled by the various
# DX_COND_* conditionals set by autoconf.
#
# The provided targets are:
#
# doxygen-doc: Generate all doxygen documentation.
#
# doxygen-run: Run doxygen, which will generate some of the
# documentation (HTML, CHM, CHI, MAN, RTF, XML)
# but will not do the post processing required
# for the rest of it (PS, PDF, and some MAN).
#
# doxygen-man: Rename some doxygen generated man pages.
#
# doxygen-ps: Generate doxygen PostScript documentation.
#
# doxygen-pdf: Generate doxygen PDF documentation.
#
# Note that by default these are not integrated into the automake targets.
# If doxygen is used to generate man pages, you can achieve this
# integration by setting man3_MANS to the list of man pages generated and
# then adding the dependency:
#
# $(man3_MANS): doxygen-doc
#
# This will cause make to run doxygen and generate all the documentation.
#
# The following variable is intended for use in Makefile.am:
#
# DX_CLEANFILES = everything to clean.
#
# Then add this variable to MOSTLYCLEANFILES.
#
# ----- begin aminclude.am -------------------------------------
#
# ## --------------------------------- ##
# ## Format-independent Doxygen rules. ##
# ## --------------------------------- ##
#
# if DX_COND_doc
#
# ## ------------------------------- ##
# ## Rules specific for HTML output. ##
# ## ------------------------------- ##
#
# if DX_COND_html
#
# DX_CLEAN_HTML = @DX_DOCDIR@/html
#
# endif DX_COND_html
#
# ## ------------------------------ ##
# ## Rules specific for CHM output. ##
# ## ------------------------------ ##
#
# if DX_COND_chm
#
# DX_CLEAN_CHM = @DX_DOCDIR@/chm
#
# if DX_COND_chi
#
# DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
#
# endif DX_COND_chi
#
# endif DX_COND_chm
#
# ## ------------------------------ ##
# ## Rules specific for MAN output. ##
# ## ------------------------------ ##
#
# if DX_COND_man
#
# DX_CLEAN_MAN = @DX_DOCDIR@/man
#
# endif DX_COND_man
#
# ## ------------------------------ ##
# ## Rules specific for RTF output. ##
# ## ------------------------------ ##
#
# if DX_COND_rtf
#
# DX_CLEAN_RTF = @DX_DOCDIR@/rtf
#
# endif DX_COND_rtf
#
# ## ------------------------------ ##
# ## Rules specific for XML output. ##
# ## ------------------------------ ##
#
# if DX_COND_xml
#
# DX_CLEAN_XML = @DX_DOCDIR@/xml
#
# endif DX_COND_xml
#
# ## ----------------------------- ##
# ## Rules specific for PS output. ##
# ## ----------------------------- ##
#
# if DX_COND_ps
#
# DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
#
# DX_PS_GOAL = doxygen-ps
#
# doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
#
# @DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
# cd @DX_DOCDIR@/latex; \
# rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
# $(DX_LATEX) refman.tex; \
# $(MAKEINDEX_PATH) refman.idx; \
# $(DX_LATEX) refman.tex; \
# countdown=5; \
# while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
# refman.log > /dev/null 2>&1 \
# && test $$countdown -gt 0; do \
# $(DX_LATEX) refman.tex; \
# countdown=`expr $$countdown - 1`; \
# done; \
# $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
#
# endif DX_COND_ps
#
# ## ------------------------------ ##
# ## Rules specific for PDF output. ##
# ## ------------------------------ ##
#
# if DX_COND_pdf
#
# DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
#
# DX_PDF_GOAL = doxygen-pdf
#
# doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
#
# @DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
# cd @DX_DOCDIR@/latex; \
# rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
# $(DX_PDFLATEX) refman.tex; \
# $(DX_MAKEINDEX) refman.idx; \
# $(DX_PDFLATEX) refman.tex; \
# countdown=5; \
# while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
# refman.log > /dev/null 2>&1 \
# && test $$countdown -gt 0; do \
# $(DX_PDFLATEX) refman.tex; \
# countdown=`expr $$countdown - 1`; \
# done; \
# mv refman.pdf ../@PACKAGE@.pdf
#
# endif DX_COND_pdf
#
# ## ------------------------------------------------- ##
# ## Rules specific for LaTeX (shared for PS and PDF). ##
# ## ------------------------------------------------- ##
#
# if DX_COND_latex
#
# DX_CLEAN_LATEX = @DX_DOCDIR@/latex
#
# endif DX_COND_latex
#
# .PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
#
# .INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
#
# doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
#
# doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
#
# @DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
# rm -rf @DX_DOCDIR@
# $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
#
# DX_CLEANFILES = \
# @DX_DOCDIR@/@PACKAGE@.tag \
# -r \
# $(DX_CLEAN_HTML) \
# $(DX_CLEAN_CHM) \
# $(DX_CLEAN_CHI) \
# $(DX_CLEAN_MAN) \
# $(DX_CLEAN_RTF) \
# $(DX_CLEAN_XML) \
# $(DX_CLEAN_PS) \
# $(DX_CLEAN_PDF) \
# $(DX_CLEAN_LATEX)
#
# endif DX_COND_doc
#
# ----- end aminclude.am ---------------------------------------
#
# LICENSE
#
# Copyright (c) 2009 Oren Ben-Kiki
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 10
## ----------##
## Defaults. ##
## ----------##
DX_ENV=""
AC_DEFUN([DX_FEATURE_doc], ON)
AC_DEFUN([DX_FEATURE_dot], ON)
AC_DEFUN([DX_FEATURE_man], OFF)
AC_DEFUN([DX_FEATURE_html], ON)
AC_DEFUN([DX_FEATURE_chm], OFF)
AC_DEFUN([DX_FEATURE_chi], OFF)
AC_DEFUN([DX_FEATURE_rtf], OFF)
AC_DEFUN([DX_FEATURE_xml], OFF)
AC_DEFUN([DX_FEATURE_pdf], ON)
AC_DEFUN([DX_FEATURE_ps], ON)
## --------------- ##
## Private macros. ##
## --------------- ##
# DX_ENV_APPEND(VARIABLE, VALUE)
# ------------------------------
# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen.
AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])])
# DX_DIRNAME_EXPR
# ---------------
# Expand into a shell expression prints the directory part of a path.
AC_DEFUN([DX_DIRNAME_EXPR],
[[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
# -------------------------------------
# Expands according to the M4 (static) status of the feature.
AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
# DX_REQUIRE_PROG(VARIABLE, PROGRAM)
# ----------------------------------
# Require the specified program to be found for the DX_CURRENT_FEATURE to work.
AC_DEFUN([DX_REQUIRE_PROG], [
AC_PATH_TOOL([$1], [$2])
if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
fi
])
# DX_TEST_FEATURE(FEATURE)
# ------------------------
# Expand to a shell expression testing whether the feature is active.
AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
# -------------------------------------------------
# Verify that a required features has the right state before trying to turn on
# the DX_CURRENT_FEATURE.
AC_DEFUN([DX_CHECK_DEPEND], [
test "$DX_FLAG_$1" = "$2" \
|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
requires, contradicts) doxygen-DX_CURRENT_FEATURE])
])
# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
# ----------------------------------------------------------
# Turn off the DX_CURRENT_FEATURE if the required feature is off.
AC_DEFUN([DX_CLEAR_DEPEND], [
test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
])
# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
# CHECK_DEPEND, CLEAR_DEPEND,
# REQUIRE, DO-IF-ON, DO-IF-OFF)
# --------------------------------------------
# Parse the command-line option controlling a feature. CHECK_DEPEND is called
# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
# otherwise CLEAR_DEPEND is called to turn off the default state if a required
# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
AC_DEFUN([DX_ARG_ABLE], [
AC_DEFUN([DX_CURRENT_FEATURE], [$1])
AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
AC_ARG_ENABLE(doxygen-$1,
[AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
[--enable-doxygen-$1]),
DX_IF_FEATURE([$1], [don't $2], [$2]))],
[
case "$enableval" in
#(
y|Y|yes|Yes|YES)
AC_SUBST([DX_FLAG_$1], 1)
$3
;; #(
n|N|no|No|NO)
AC_SUBST([DX_FLAG_$1], 0)
;; #(
*)
AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
;;
esac
], [
AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
$4
])
if DX_TEST_FEATURE([$1]); then
$5
:
fi
if DX_TEST_FEATURE([$1]); then
AM_CONDITIONAL(DX_COND_$1, :)
$6
:
else
AM_CONDITIONAL(DX_COND_$1, false)
$7
:
fi
])
## -------------- ##
## Public macros. ##
## -------------- ##
# DX_XXX_FEATURE(DEFAULT_STATE)
# -----------------------------
AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])])
AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])])
AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])])
AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])])
AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])])
AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])])
AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])])
AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])])
# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR])
# ---------------------------------------------------------
# PROJECT also serves as the base name for the documentation files.
# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc".
AC_DEFUN([DX_INIT_DOXYGEN], [
# Files:
AC_SUBST([DX_PROJECT], [$1])
AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])])
AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
# Environment variables used inside doxygen.cfg:
DX_ENV_APPEND(SRCDIR, $srcdir)
DX_ENV_APPEND(PROJECT, $DX_PROJECT)
DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
# Doxygen itself:
DX_ARG_ABLE(doc, [generate any doxygen documentation],
[],
[],
[DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
DX_REQUIRE_PROG([DX_PERL], perl)],
[DX_ENV_APPEND(PERL_PATH, $DX_PERL)])
# Dot for graphics:
DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[DX_REQUIRE_PROG([DX_DOT], dot)],
[DX_ENV_APPEND(HAVE_DOT, YES)
DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
[DX_ENV_APPEND(HAVE_DOT, NO)])
# Man pages generation:
DX_ARG_ABLE(man, [generate doxygen manual pages],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[],
[DX_ENV_APPEND(GENERATE_MAN, YES)],
[DX_ENV_APPEND(GENERATE_MAN, NO)])
# RTF file generation:
DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[],
[DX_ENV_APPEND(GENERATE_RTF, YES)],
[DX_ENV_APPEND(GENERATE_RTF, NO)])
# XML file generation:
DX_ARG_ABLE(xml, [generate doxygen XML documentation],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[],
[DX_ENV_APPEND(GENERATE_XML, YES)],
[DX_ENV_APPEND(GENERATE_XML, NO)])
# (Compressed) HTML help generation:
DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[DX_REQUIRE_PROG([DX_HHC], hhc)],
[DX_ENV_APPEND(HHC_PATH, $DX_HHC)
DX_ENV_APPEND(GENERATE_HTML, YES)
DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
[DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
# Seperate CHI file generation.
DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file],
[DX_CHECK_DEPEND(chm, 1)],
[DX_CLEAR_DEPEND(chm, 1)],
[],
[DX_ENV_APPEND(GENERATE_CHI, YES)],
[DX_ENV_APPEND(GENERATE_CHI, NO)])
# Plain HTML pages generation:
DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
[DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
[DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
[],
[DX_ENV_APPEND(GENERATE_HTML, YES)],
[DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
# PostScript file generation:
DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[DX_REQUIRE_PROG([DX_LATEX], latex)
DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
DX_REQUIRE_PROG([DX_DVIPS], dvips)
DX_REQUIRE_PROG([DX_EGREP], egrep)])
# PDF file generation:
DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
DX_REQUIRE_PROG([DX_EGREP], egrep)])
# LaTeX generation for PS and/or PDF:
if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
AM_CONDITIONAL(DX_COND_latex, :)
DX_ENV_APPEND(GENERATE_LATEX, YES)
else
AM_CONDITIONAL(DX_COND_latex, false)
DX_ENV_APPEND(GENERATE_LATEX, NO)
fi
# Paper size for PS and/or PDF:
AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
[a4wide (default), a4, letter, legal or executive])
case "$DOXYGEN_PAPER_SIZE" in
#(
"")
AC_SUBST(DOXYGEN_PAPER_SIZE, "")
;; #(
a4wide|a4|letter|legal|executive)
DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
;; #(
*)
AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
;;
esac
#For debugging:
#echo DX_FLAG_doc=$DX_FLAG_doc
#echo DX_FLAG_dot=$DX_FLAG_dot
#echo DX_FLAG_man=$DX_FLAG_man
#echo DX_FLAG_html=$DX_FLAG_html
#echo DX_FLAG_chm=$DX_FLAG_chm
#echo DX_FLAG_chi=$DX_FLAG_chi
#echo DX_FLAG_rtf=$DX_FLAG_rtf
#echo DX_FLAG_xml=$DX_FLAG_xml
#echo DX_FLAG_pdf=$DX_FLAG_pdf
#echo DX_FLAG_ps=$DX_FLAG_ps
#echo DX_ENV=$DX_ENV
])
opendnssec-1.4.3/m4/acx_check_strptime.m4 0000664 0001750 0001750 00000001333 11423100516 015215 0000000 0000000 # $Id: acx_check_strptime.m4 3596 2010-07-25 18:24:14Z jakob $
AC_DEFUN([AC_CHECK_STRPTIME],[
AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(whether strptime needs defines)
AC_CACHE_VAL(ac_cv_c_strptime_needs_defs,[
cat >conftest.c <
void testing (void) { struct tm t; char *timestr; strptime(timestr, "%Y%m", &t); }
EOF
if test -z "`$CC -Wall -Werror -c conftest.c 2>&1`"; then
eval "ac_cv_c_strptime_needs_defs=no"
else
eval "ac_cv_c_strptime_needs_defs=yes"
fi
rm -f conftest*
])
AC_MSG_RESULT($ac_cv_c_strptime_needs_defs)
if test $ac_cv_c_strptime_needs_defs = yes; then
AC_DEFINE_UNQUOTED([STRPTIME_NEEDS_DEFINES], 1, [strptime is available from time.h with some defines.])
fi
])
opendnssec-1.4.3/m4/opendnssec_common.m4 0000664 0001750 0001750 00000014473 12104210117 015074 0000000 0000000 # $Id: opendnssec_common.m4 7018 2013-02-05 13:59:43Z sion $
AC_DEFUN([OPENDNSSEC_COMMON],[
AC_MSG_NOTICE(Detecting common OpenDNSSEC settings)
full_bindir=`eval eval eval eval eval echo "${bindir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
full_sbindir=`eval eval eval eval eval echo "${sbindir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
full_libdir=`eval eval eval eval eval echo "${libdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
full_libexecdir=`eval eval eval eval eval echo "${libexecdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
full_datadir=`eval eval eval eval eval echo "${datadir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
full_sysconfdir=`eval eval eval eval eval echo "${sysconfdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
full_localstatedir=`eval eval eval eval eval echo "${localstatedir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
OPENDNSSEC_BIN_DIR=$full_bindir
OPENDNSSEC_SBIN_DIR=$full_sbindir
OPENDNSSEC_LIB_DIR=$full_libdir/opendnssec
OPENDNSSEC_LIBEXEC_DIR=$full_libexecdir/opendnssec
OPENDNSSEC_DATA_DIR=$full_datadir/opendnssec
OPENDNSSEC_SYSCONF_DIR=$full_sysconfdir/opendnssec
OPENDNSSEC_LOCALSTATE_DIR="$full_localstatedir/opendnssec"
OPENDNSSEC_PID_DIR="$full_localstatedir/run/opendnssec"
AC_SUBST([OPENDNSSEC_BIN_DIR])
AC_SUBST([OPENDNSSEC_SBIN_DIR])
AC_SUBST([OPENDNSSEC_LIB_DIR])
AC_SUBST([OPENDNSSEC_LIBEXEC_DIR])
AC_SUBST([OPENDNSSEC_DATA_DIR])
AC_SUBST([OPENDNSSEC_SYSCONF_DIR])
AC_SUBST([OPENDNSSEC_LOCALSTATE_DIR])
AC_SUBST([OPENDNSSEC_PID_DIR])
OPENDNSSEC_CONFIG_DIR=$OPENDNSSEC_SYSCONF_DIR
OPENDNSSEC_CONFIG_FILE=$OPENDNSSEC_SYSCONF_DIR/conf.xml
OPENDNSSEC_SCHEMA_DIR=$OPENDNSSEC_DATA_DIR
OPENDNSSEC_STATE_DIR=$OPENDNSSEC_LOCALSTATE_DIR
AC_SUBST([OPENDNSSEC_CONFIG_DIR])
AC_SUBST([OPENDNSSEC_CONFIG_FILE])
AC_SUBST([OPENDNSSEC_SCHEMA_DIR])
AC_SUBST([OPENDNSSEC_STATE_DIR])
AC_DEFINE_UNQUOTED(OPENDNSSEC_CONFIG_DIR, "$OPENDNSSEC_CONFIG_DIR", [Path to the OpenDNSSEC configuration files])
AC_DEFINE_UNQUOTED(OPENDNSSEC_CONFIG_FILE, "$OPENDNSSEC_CONFIG_FILE", [Path to the main OpenDNSSEC configuration file])
AC_DEFINE_UNQUOTED(OPENDNSSEC_SCHEMA_DIR, "$OPENDNSSEC_SCHEMA_DIR", [Path to the OpenDNSSEC data files])
AC_DEFINE_UNQUOTED(OPENDNSSEC_STATE_DIR, "$OPENDNSSEC_STATE_DIR", [Path to the OpenDNSSEC var directory])
OPENDNSSEC_SIGNER_PIDFILE=$OPENDNSSEC_PID_DIR/signerd.pid
OPENDNSSEC_ENFORCER_PIDFILE=$OPENDNSSEC_PID_DIR/enforcerd.pid
OPENDNSSEC_FETCH_PIDFILE=$OPENDNSSEC_PID_DIR/zone_fetcher.pid
AC_SUBST([OPENDNSSEC_SIGNER_PIDFILE])
AC_SUBST([OPENDNSSEC_ENFORCER_PIDFILE])
AC_SUBST([OPENDNSSEC_FETCH_PIDFILE])
AC_DEFINE_UNQUOTED(OPENDNSSEC_SIGNER_PIDFILE, "$OPENDNSSEC_SIGNER_PIDFILE", [Path to the OpenDNSSEC signer pid file])
AC_DEFINE_UNQUOTED(OPENDNSSEC_ENFORCER_PIDFILE, "$OPENDNSSEC_ENFORCER_PIDFILE", [Path to the OpenDNSSEC enforcer pid file])
AC_DEFINE_UNQUOTED(OPENDNSSEC_FETCH_PIDFILE, "$OPENDNSSEC_FETCH_PIDFILE", [Path to the OpenDNSSEC zone fetcher pid file])
# signer specific
OPENDNSSEC_SIGNER_SOCKET=$OPENDNSSEC_PID_DIR/engine.sock
OPENDNSSEC_SIGNER_ENGINE=$OPENDNSSEC_SBIN_DIR/ods-signerd
OPENDNSSEC_SIGNER_CLI=$OPENDNSSEC_SBIN_DIR/ods-signer
OPENDNSSEC_SIGNER_WORKINGDIR=$OPENDNSSEC_STATE_DIR/tmp
AC_SUBST([OPENDNSSEC_SIGNER_SOCKET])
AC_SUBST([OPENDNSSEC_SIGNER_ENGINE])
AC_SUBST([OPENDNSSEC_SIGNER_CLI])
AC_DEFINE_UNQUOTED(OPENDNSSEC_SIGNER_SOCKET, "$OPENDNSSEC_SIGNER_SOCKET", [Path to the OpenDNSSEC signer socket])
AC_DEFINE_UNQUOTED(OPENDNSSEC_SIGNER_ENGINE, "$OPENDNSSEC_SIGNER_ENGINE", [Path to the OpenDNSSEC signer engine])
AC_DEFINE_UNQUOTED(OPENDNSSEC_SIGNER_CLI, "$OPENDNSSEC_SIGNER_CLI", [Path to the OpenDNSSEC signer cli])
AC_DEFINE_UNQUOTED(ODS_SE_PIDFILE, ["$OPENDNSSEC_SIGNER_PIDFILE"], [Path to the OpenDNSSEC signer engine pid file])
AC_DEFINE_UNQUOTED(ODS_ZF_PIDFILE, ["$OPENDNSSEC_FETCH_PIDFILE"], [Path to the OpenDNSSEC signer engine pid file])
AC_DEFINE_UNQUOTED(ODS_SE_SOCKFILE, ["$OPENDNSSEC_SIGNER_SOCKET"], [Path to the OpenDNSSEC signer engine socket file])
AC_DEFINE_UNQUOTED(ODS_SE_WORKDIR, ["$OPENDNSSEC_SIGNER_WORKINGDIR"], [Path to the OpenDNSSEC signer engine working directory])
AC_DEFINE_UNQUOTED(ODS_SE_CFGFILE, ["$OPENDNSSEC_CONFIG_FILE"], [Path to the OpenDNSSEC config file])
AC_DEFINE_UNQUOTED(ODS_SE_RNGDIR, ["$OPENDNSSEC_SCHEMA_DIR"], [Path to the OpenDNSSEC data files])
AC_DEFINE_UNQUOTED(ODS_SE_ENGINE, ["$OPENDNSSEC_SIGNER_ENGINE"], [Path to the OpenDNSSEC signer engine binary])
AC_DEFINE_UNQUOTED(ODS_SE_CLI, ["$OPENDNSSEC_SIGNER_CLI"], [Path to the OpenDNSSEC signer client binary])
AC_DEFINE_UNQUOTED(ODS_SE_MAXLINE, [1024], [Maximum line length that the OpenDNSSEC signer client can handle])
AC_DEFINE_UNQUOTED(ODS_SE_MAX_BACKOFF, [3600], [Number of seconds the OpenDNSSEC signer engine should backoff when a task failed])
AC_DEFINE_UNQUOTED(ODS_SE_WORKERTHREADS, [4], [Default number of worker threads for the OpenDNSSEC signer engine])
AC_DEFINE_UNQUOTED(ODS_SE_STOP_RESPONSE, ["Engine shut down."], [Shutdown message for the OpenDNSSEC signer client])
AC_DEFINE_UNQUOTED(ODS_SE_FILE_MAGIC_V3, [";OpenDNSSEC-backup-v3"], [File magic for storing backups from the OpenDNSSEC signer engine])
AC_DEFINE_UNQUOTED(ODS_SE_FILE_MAGIC_V2, [";ODSSE2"], [File magic for storing backups from the OpenDNSSEC signer engine])
AC_DEFINE_UNQUOTED(ODS_SE_FILE_MAGIC_V1, [";ODSSE1"], [File magic for storing backups from the OpenDNSSEC signer engine])
AC_DEFINE_UNQUOTED(ODS_SE_VERBOSITY, [3], [Default verbosity])
# enforcer specific
OPENDNSSEC_ENFORCER_CONTROL=$OPENDNSSEC_SBIN_DIR/ods-control
OPENDNSSEC_ENFORCER_KASPCHECK=$OPENDNSSEC_BIN_DIR/ods-kaspcheck
AC_DEFINE_UNQUOTED(ODS_EN_CONTROL, ["$OPENDNSSEC_ENFORCER_CONTROL enforcer "], [Path to the OpenDNSSEC ods-control binary])
AC_DEFINE_UNQUOTED(ODS_EN_NOTIFY, ["$OPENDNSSEC_ENFORCER_CONTROL enforcer notify"], [Command to send a SIGHUP to the ods-enforcerd process])
AC_DEFINE_UNQUOTED(ODS_EN_KASPCHECK, ["$OPENDNSSEC_ENFORCER_KASPCHECK"], [Path to the OpenDNSSEC kaspcheck binary])
])
opendnssec-1.4.3/m4/ltsugar.m4 0000644 0001750 0001750 00000010424 12247571127 013055 0000000 0000000 # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
#
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 6 ltsugar.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
# lt_join(SEP, ARG1, [ARG2...])
# -----------------------------
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
# associated separator.
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
# versions in m4sugar had bugs.
m4_define([lt_join],
[m4_if([$#], [1], [],
[$#], [2], [[$2]],
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
m4_define([_lt_join],
[m4_if([$#$2], [2], [],
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
# lt_car(LIST)
# lt_cdr(LIST)
# ------------
# Manipulate m4 lists.
# These macros are necessary as long as will still need to support
# Autoconf-2.59 which quotes differently.
m4_define([lt_car], [[$1]])
m4_define([lt_cdr],
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
[$#], 1, [],
[m4_dquote(m4_shift($@))])])
m4_define([lt_unquote], $1)
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
# ------------------------------------------
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
# Note that neither SEPARATOR nor STRING are expanded; they are appended
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
# than defined and empty).
#
# This macro is needed until we can rely on Autoconf 2.62, since earlier
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
m4_define([lt_append],
[m4_define([$1],
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
# ----------------------------------------------------------
# Produce a SEP delimited list of all paired combinations of elements of
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
# has the form PREFIXmINFIXSUFFIXn.
# Needed until we can rely on m4_combine added in Autoconf 2.62.
m4_define([lt_combine],
[m4_if(m4_eval([$# > 3]), [1],
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
[[m4_foreach([_Lt_prefix], [$2],
[m4_foreach([_Lt_suffix],
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
# -----------------------------------------------------------------------
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
m4_define([lt_if_append_uniq],
[m4_ifdef([$1],
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
[lt_append([$1], [$2], [$3])$4],
[$5])],
[lt_append([$1], [$2], [$3])$4])])
# lt_dict_add(DICT, KEY, VALUE)
# -----------------------------
m4_define([lt_dict_add],
[m4_define([$1($2)], [$3])])
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
# --------------------------------------------
m4_define([lt_dict_add_subkey],
[m4_define([$1($2:$3)], [$4])])
# lt_dict_fetch(DICT, KEY, [SUBKEY])
# ----------------------------------
m4_define([lt_dict_fetch],
[m4_ifval([$3],
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
# -----------------------------------------------------------------
m4_define([lt_if_dict_fetch],
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
[$5],
[$6])])
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
# --------------------------------------------------------------
m4_define([lt_dict_filter],
[m4_if([$5], [], [],
[lt_join(m4_quote(m4_default([$4], [[, ]])),
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
])
opendnssec-1.4.3/m4/acx_mysql.m4 0000664 0001750 0001750 00000002616 11560775060 013401 0000000 0000000 # $Id: acx_mysql.m4 5071 2011-05-06 13:40:00Z rb $
AC_DEFUN([ACX_MYSQL],[
AC_ARG_WITH(mysql,
AC_HELP_STRING([--with-mysql=DIR],[Specify prefix of path of MySQL]),
[
MYSQL_PATH="$withval"
AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $MYSQL_PATH/bin)
AC_PATH_PROGS(MYSQL, mysql, mysql, $MYSQL_PATH/bin)
],[
MYSQL_PATH="/usr/local"
AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $PATH)
AC_PATH_PROGS(MYSQL, mysql, mysql)
])
if test -x "$MYSQL_CONFIG"; then
AC_MSG_CHECKING(mysql version)
MYSQL_VERSION="`$MYSQL_CONFIG --version`"
MYSQL_VERSION_MAJOR=`echo "$MYSQL_VERSION" | sed -e 's/\..*//'`
AC_MSG_RESULT($MYSQL_VERSION)
if test ${MYSQL_VERSION_MAJOR} -le 4 ; then
AC_MSG_ERROR([mysql must be newer than 5.0.0])
fi
AC_MSG_CHECKING(what are the MySQL includes)
MYSQL_INCLUDES="`$MYSQL_CONFIG --include` -DBIG_JOINS=1 -DUSE_MYSQL -Wno-long-long"
AC_MSG_RESULT($MYSQL_INCLUDES)
AC_MSG_CHECKING(what are the MySQL libs)
MYSQL_LIBS="`$MYSQL_CONFIG --libs_r`"
AC_MSG_RESULT($MYSQL_LIBS)
fi
if ! test -x "$MYSQL"; then
AC_MSG_ERROR([mysql command not found])
fi
tmp_CPPFLAGS=$CPPFLAGS
tmp_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDES"
LIBS="$LIBS $MYSQL_LIBS"
AC_CHECK_HEADERS(mysql.h,,[AC_MSG_ERROR([Can't find MySQL headers])])
CPPFLAGS=$tmp_CPPFLAGS
LIBS=$tmp_LIBS
AC_SUBST(MYSQL_INCLUDES)
AC_SUBST(MYSQL_LIBS)
])
opendnssec-1.4.3/m4/acx_cunit.m4 0000664 0001750 0001750 00000001606 11564423744 013357 0000000 0000000 # $Id: acx_cunit.m4 5122 2011-05-17 07:46:44Z rb $
AC_DEFUN([ACX_CUNIT],[
AC_ARG_WITH(cunit,
[AC_HELP_STRING([--with-cunit=DIR],[Look for cunit in this dir])],
[
CUNIT_PATH="$withval"
],[
CUNIT_PATH="/usr/local"
])
AS_IF([test "x$with_cunit" != xno],[
AC_MSG_CHECKING(what are the cunit includes)
CUNIT_INCLUDES="-I$CUNIT_PATH/include"
AC_MSG_RESULT($CUNIT_INCLUDES)
AC_MSG_CHECKING(what are the cunit libs)
CUNIT_LIBS="-L$CUNIT_PATH/lib -lcunit"
AC_MSG_RESULT($CUNIT_LIBS)
tmp_CPPFLAGS=$CPPFLAGS
tmp_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $CUNIT_INCLUDES"
LIBS="$LIBS $CUNIT_LIBS"
AC_CHECK_LIB(cunit, CU_run_test, [],[
AC_MSG_NOTICE([Can't find cunit library])
CUNIT_INCLUDES=
CUNIT_LIBS=
])
CPPFLAGS=$tmp_CPPFLAGS
LIBS=$tmp_LIBS
],[
AC_MSG_NOTICE([cunit disabled])
CUNIT_INCLUDES=
CUNIT_LIBS=
])
AC_SUBST(CUNIT_INCLUDES)
AC_SUBST(CUNIT_LIBS)
])
opendnssec-1.4.3/m4/libtool.m4 0000644 0001750 0001750 00001060434 12247571126 013046 0000000 0000000 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
#
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# Written by Gordon Matzigkeit, 1996
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
m4_define([_LT_COPYING], [dnl
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# Written by Gordon Matzigkeit, 1996
#
# This file is part of GNU Libtool.
#
# GNU Libtool is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# As a special exception to the GNU General Public License,
# if you distribute this file as part of a program or library that
# is built using GNU Libtool, you may include this file under the
# same distribution terms that you use for the rest of that program.
#
# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
# obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
])
# serial 57 LT_INIT
# LT_PREREQ(VERSION)
# ------------------
# Complain and exit if this libtool version is less that VERSION.
m4_defun([LT_PREREQ],
[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
[m4_default([$3],
[m4_fatal([Libtool version $1 or higher is required],
63)])],
[$2])])
# _LT_CHECK_BUILDDIR
# ------------------
# Complain if the absolute build directory name contains unusual characters
m4_defun([_LT_CHECK_BUILDDIR],
[case `pwd` in
*\ * | *\ *)
AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
esac
])
# LT_INIT([OPTIONS])
# ------------------
AC_DEFUN([LT_INIT],
[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
AC_BEFORE([$0], [LT_LANG])dnl
AC_BEFORE([$0], [LT_OUTPUT])dnl
AC_BEFORE([$0], [LTDL_INIT])dnl
m4_require([_LT_CHECK_BUILDDIR])dnl
dnl Autoconf doesn't catch unexpanded LT_ macros by default:
m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
dnl unless we require an AC_DEFUNed macro:
AC_REQUIRE([LTOPTIONS_VERSION])dnl
AC_REQUIRE([LTSUGAR_VERSION])dnl
AC_REQUIRE([LTVERSION_VERSION])dnl
AC_REQUIRE([LTOBSOLETE_VERSION])dnl
m4_require([_LT_PROG_LTMAIN])dnl
_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
dnl Parse OPTIONS
_LT_SET_OPTIONS([$0], [$1])
# This can be used to rebuild libtool when needed
LIBTOOL_DEPS="$ltmain"
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
_LT_SETUP
# Only expand once:
m4_define([LT_INIT])
])# LT_INIT
# Old names:
AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
# _LT_CC_BASENAME(CC)
# -------------------
# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
m4_defun([_LT_CC_BASENAME],
[for cc_temp in $1""; do
case $cc_temp in
compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
\-*) ;;
*) break;;
esac
done
cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
])
# _LT_FILEUTILS_DEFAULTS
# ----------------------
# It is okay to use these file commands and assume they have been set
# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
m4_defun([_LT_FILEUTILS_DEFAULTS],
[: ${CP="cp -f"}
: ${MV="mv -f"}
: ${RM="rm -f"}
])# _LT_FILEUTILS_DEFAULTS
# _LT_SETUP
# ---------
m4_defun([_LT_SETUP],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
dnl
_LT_DECL([], [host_alias], [0], [The host system])dnl
_LT_DECL([], [host], [0])dnl
_LT_DECL([], [host_os], [0])dnl
dnl
_LT_DECL([], [build_alias], [0], [The build system])dnl
_LT_DECL([], [build], [0])dnl
_LT_DECL([], [build_os], [0])dnl
dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([LT_PATH_LD])dnl
AC_REQUIRE([LT_PATH_NM])dnl
dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
test -z "$LN_S" && LN_S="ln -s"
_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
dnl
AC_REQUIRE([LT_CMD_MAX_LEN])dnl
_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_CHECK_SHELL_FEATURES])dnl
m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
m4_require([_LT_CMD_RELOAD])dnl
m4_require([_LT_CHECK_MAGIC_METHOD])dnl
m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
m4_require([_LT_CMD_OLD_ARCHIVE])dnl
m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
m4_require([_LT_WITH_SYSROOT])dnl
_LT_CONFIG_LIBTOOL_INIT([
# See if we are running on zsh, and set the options which allow our
# commands through without removal of \ escapes INIT.
if test -n "\${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
fi
])
if test -n "${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
fi
_LT_CHECK_OBJDIR
m4_require([_LT_TAG_COMPILER])dnl
case $host_os in
aix3*)
# AIX sometimes has problems with the GCC collect2 program. For some
# reason, if we set the COLLECT_NAMES environment variable, the problems
# vanish in a puff of smoke.
if test "X${COLLECT_NAMES+set}" != Xset; then
COLLECT_NAMES=
export COLLECT_NAMES
fi
;;
esac
# Global variables:
ofile=libtool
can_build_shared=yes
# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
with_gnu_ld="$lt_cv_prog_gnu_ld"
old_CC="$CC"
old_CFLAGS="$CFLAGS"
# Set sane defaults for various variables
test -z "$CC" && CC=cc
test -z "$LTCC" && LTCC=$CC
test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
test -z "$LD" && LD=ld
test -z "$ac_objext" && ac_objext=o
_LT_CC_BASENAME([$compiler])
# Only perform the check for file, if the check method requires it
test -z "$MAGIC_CMD" && MAGIC_CMD=file
case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
_LT_PATH_MAGIC
fi
;;
esac
# Use C for the default configuration in the libtool script
LT_SUPPORTED_TAG([CC])
_LT_LANG_C_CONFIG
_LT_LANG_DEFAULT_CONFIG
_LT_CONFIG_COMMANDS
])# _LT_SETUP
# _LT_PREPARE_SED_QUOTE_VARS
# --------------------------
# Define a few sed substitution that help us do robust quoting.
m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
[# Backslashify metacharacters that are still active within
# double-quoted strings.
sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
# Same as above, but do not quote variable references.
double_quote_subst='s/\([["`\\]]\)/\\\1/g'
# Sed substitution to delay expansion of an escaped shell variable in a
# double_quote_subst'ed string.
delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
# Sed substitution to delay expansion of an escaped single quote.
delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
# Sed substitution to avoid accidental globbing in evaled expressions
no_glob_subst='s/\*/\\\*/g'
])
# _LT_PROG_LTMAIN
# ---------------
# Note that this code is called both from `configure', and `config.status'
# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
# `config.status' has no value for ac_aux_dir unless we are using Automake,
# so we pass a copy along to make sure it has a sensible value anyway.
m4_defun([_LT_PROG_LTMAIN],
[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
ltmain="$ac_aux_dir/ltmain.sh"
])# _LT_PROG_LTMAIN
## ------------------------------------- ##
## Accumulate code for creating libtool. ##
## ------------------------------------- ##
# So that we can recreate a full libtool script including additional
# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
# in macros and then make a single call at the end using the `libtool'
# label.
# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
# ----------------------------------------
# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
m4_define([_LT_CONFIG_LIBTOOL_INIT],
[m4_ifval([$1],
[m4_append([_LT_OUTPUT_LIBTOOL_INIT],
[$1
])])])
# Initialize.
m4_define([_LT_OUTPUT_LIBTOOL_INIT])
# _LT_CONFIG_LIBTOOL([COMMANDS])
# ------------------------------
# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
m4_define([_LT_CONFIG_LIBTOOL],
[m4_ifval([$1],
[m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
[$1
])])])
# Initialize.
m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
# -----------------------------------------------------
m4_defun([_LT_CONFIG_SAVE_COMMANDS],
[_LT_CONFIG_LIBTOOL([$1])
_LT_CONFIG_LIBTOOL_INIT([$2])
])
# _LT_FORMAT_COMMENT([COMMENT])
# -----------------------------
# Add leading comment marks to the start of each line, and a trailing
# full-stop to the whole comment if one is not present already.
m4_define([_LT_FORMAT_COMMENT],
[m4_ifval([$1], [
m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
[['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
)])
## ------------------------ ##
## FIXME: Eliminate VARNAME ##
## ------------------------ ##
# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
# -------------------------------------------------------------------
# CONFIGNAME is the name given to the value in the libtool script.
# VARNAME is the (base) name used in the configure script.
# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
# VARNAME. Any other value will be used directly.
m4_define([_LT_DECL],
[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
[lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
[m4_ifval([$1], [$1], [$2])])
lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
m4_ifval([$4],
[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
lt_dict_add_subkey([lt_decl_dict], [$2],
[tagged?], [m4_ifval([$5], [yes], [no])])])
])
# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
# --------------------------------------------------------
m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
# ------------------------------------------------
m4_define([lt_decl_tag_varnames],
[_lt_decl_filter([tagged?], [yes], $@)])
# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
# ---------------------------------------------------------
m4_define([_lt_decl_filter],
[m4_case([$#],
[0], [m4_fatal([$0: too few arguments: $#])],
[1], [m4_fatal([$0: too few arguments: $#: $1])],
[2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
[3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
[lt_dict_filter([lt_decl_dict], $@)])[]dnl
])
# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
# --------------------------------------------------
m4_define([lt_decl_quote_varnames],
[_lt_decl_filter([value], [1], $@)])
# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
# ---------------------------------------------------
m4_define([lt_decl_dquote_varnames],
[_lt_decl_filter([value], [2], $@)])
# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
# ---------------------------------------------------
m4_define([lt_decl_varnames_tagged],
[m4_assert([$# <= 2])dnl
_$0(m4_quote(m4_default([$1], [[, ]])),
m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
m4_define([_lt_decl_varnames_tagged],
[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
# ------------------------------------------------
m4_define([lt_decl_all_varnames],
[_$0(m4_quote(m4_default([$1], [[, ]])),
m4_if([$2], [],
m4_quote(lt_decl_varnames),
m4_quote(m4_shift($@))))[]dnl
])
m4_define([_lt_decl_all_varnames],
[lt_join($@, lt_decl_varnames_tagged([$1],
lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
])
# _LT_CONFIG_STATUS_DECLARE([VARNAME])
# ------------------------------------
# Quote a variable value, and forward it to `config.status' so that its
# declaration there will have the same value as in `configure'. VARNAME
# must have a single quote delimited value for this to work.
m4_define([_LT_CONFIG_STATUS_DECLARE],
[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
# _LT_CONFIG_STATUS_DECLARATIONS
# ------------------------------
# We delimit libtool config variables with single quotes, so when
# we write them to config.status, we have to be sure to quote all
# embedded single quotes properly. In configure, this macro expands
# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
#
# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`'
m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
[m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
# _LT_LIBTOOL_TAGS
# ----------------
# Output comment and list of tags supported by the script
m4_defun([_LT_LIBTOOL_TAGS],
[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
available_tags="_LT_TAGS"dnl
])
# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
# -----------------------------------
# Extract the dictionary values for VARNAME (optionally with TAG) and
# expand to a commented shell variable setting:
#
# # Some comment about what VAR is for.
# visible_name=$lt_internal_name
m4_define([_LT_LIBTOOL_DECLARE],
[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
[description])))[]dnl
m4_pushdef([_libtool_name],
m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
[0], [_libtool_name=[$]$1],
[1], [_libtool_name=$lt_[]$1],
[2], [_libtool_name=$lt_[]$1],
[_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
])
# _LT_LIBTOOL_CONFIG_VARS
# -----------------------
# Produce commented declarations of non-tagged libtool config variables
# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
# script. Tagged libtool config variables (even for the LIBTOOL CONFIG
# section) are produced by _LT_LIBTOOL_TAG_VARS.
m4_defun([_LT_LIBTOOL_CONFIG_VARS],
[m4_foreach([_lt_var],
m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
[m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
# _LT_LIBTOOL_TAG_VARS(TAG)
# -------------------------
m4_define([_LT_LIBTOOL_TAG_VARS],
[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
[m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
# _LT_TAGVAR(VARNAME, [TAGNAME])
# ------------------------------
m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
# _LT_CONFIG_COMMANDS
# -------------------
# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
# variables for single and double quote escaping we saved from calls
# to _LT_DECL, we can put quote escaped variables declarations
# into `config.status', and then the shell code to quote escape them in
# for loops in `config.status'. Finally, any additional code accumulated
# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
m4_defun([_LT_CONFIG_COMMANDS],
[AC_PROVIDE_IFELSE([LT_OUTPUT],
dnl If the libtool generation code has been placed in $CONFIG_LT,
dnl instead of duplicating it all over again into config.status,
dnl then we will have config.status run $CONFIG_LT later, so it
dnl needs to know what name is stored there:
[AC_CONFIG_COMMANDS([libtool],
[$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
dnl If the libtool generation code is destined for config.status,
dnl expand the accumulated commands and init code now:
[AC_CONFIG_COMMANDS([libtool],
[_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
])#_LT_CONFIG_COMMANDS
# Initialize.
m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
[
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
sed_quote_subst='$sed_quote_subst'
double_quote_subst='$double_quote_subst'
delay_variable_subst='$delay_variable_subst'
_LT_CONFIG_STATUS_DECLARATIONS
LTCC='$LTCC'
LTCFLAGS='$LTCFLAGS'
compiler='$compiler_DEFAULT'
# A function that is used when there is no print builtin or printf.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
\$[]1
_LTECHO_EOF'
}
# Quote evaled strings.
for var in lt_decl_all_varnames([[ \
]], lt_decl_quote_varnames); do
case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
*[[\\\\\\\`\\"\\\$]]*)
eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
;;
*)
eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
;;
esac
done
# Double-quote double-evaled strings.
for var in lt_decl_all_varnames([[ \
]], lt_decl_dquote_varnames); do
case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
*[[\\\\\\\`\\"\\\$]]*)
eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
;;
*)
eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
;;
esac
done
_LT_OUTPUT_LIBTOOL_INIT
])
# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
# ------------------------------------
# Generate a child script FILE with all initialization necessary to
# reuse the environment learned by the parent script, and make the
# file executable. If COMMENT is supplied, it is inserted after the
# `#!' sequence but before initialization text begins. After this
# macro, additional text can be appended to FILE to form the body of
# the child script. The macro ends with non-zero status if the
# file could not be fully written (such as if the disk is full).
m4_ifdef([AS_INIT_GENERATED],
[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
[m4_defun([_LT_GENERATED_FILE_INIT],
[m4_require([AS_PREPARE])]dnl
[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
[lt_write_fail=0
cat >$1 <<_ASEOF || lt_write_fail=1
#! $SHELL
# Generated by $as_me.
$2
SHELL=\${CONFIG_SHELL-$SHELL}
export SHELL
_ASEOF
cat >>$1 <<\_ASEOF || lt_write_fail=1
AS_SHELL_SANITIZE
_AS_PREPARE
exec AS_MESSAGE_FD>&1
_ASEOF
test $lt_write_fail = 0 && chmod +x $1[]dnl
m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
# LT_OUTPUT
# ---------
# This macro allows early generation of the libtool script (before
# AC_OUTPUT is called), incase it is used in configure for compilation
# tests.
AC_DEFUN([LT_OUTPUT],
[: ${CONFIG_LT=./config.lt}
AC_MSG_NOTICE([creating $CONFIG_LT])
_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
[# Run this file to recreate a libtool stub with the current configuration.])
cat >>"$CONFIG_LT" <<\_LTEOF
lt_cl_silent=false
exec AS_MESSAGE_LOG_FD>>config.log
{
echo
AS_BOX([Running $as_me.])
} >&AS_MESSAGE_LOG_FD
lt_cl_help="\
\`$as_me' creates a local libtool stub from the current configuration,
for use in further configure time tests before the real libtool is
generated.
Usage: $[0] [[OPTIONS]]
-h, --help print this help, then exit
-V, --version print version number, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
Report bugs to ."
lt_cl_version="\
m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
configured by $[0], generated by m4_PACKAGE_STRING.
Copyright (C) 2011 Free Software Foundation, Inc.
This config.lt script is free software; the Free Software Foundation
gives unlimited permision to copy, distribute and modify it."
while test $[#] != 0
do
case $[1] in
--version | --v* | -V )
echo "$lt_cl_version"; exit 0 ;;
--help | --h* | -h )
echo "$lt_cl_help"; exit 0 ;;
--debug | --d* | -d )
debug=: ;;
--quiet | --q* | --silent | --s* | -q )
lt_cl_silent=: ;;
-*) AC_MSG_ERROR([unrecognized option: $[1]
Try \`$[0] --help' for more information.]) ;;
*) AC_MSG_ERROR([unrecognized argument: $[1]
Try \`$[0] --help' for more information.]) ;;
esac
shift
done
if $lt_cl_silent; then
exec AS_MESSAGE_FD>/dev/null
fi
_LTEOF
cat >>"$CONFIG_LT" <<_LTEOF
_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
_LTEOF
cat >>"$CONFIG_LT" <<\_LTEOF
AC_MSG_NOTICE([creating $ofile])
_LT_OUTPUT_LIBTOOL_COMMANDS
AS_EXIT(0)
_LTEOF
chmod +x "$CONFIG_LT"
# configure is writing to config.log, but config.lt does its own redirection,
# appending to config.log, which fails on DOS, as config.log is still kept
# open by configure. Here we exec the FD to /dev/null, effectively closing
# config.log, so it can be properly (re)opened and appended to by config.lt.
lt_cl_success=:
test "$silent" = yes &&
lt_config_lt_args="$lt_config_lt_args --quiet"
exec AS_MESSAGE_LOG_FD>/dev/null
$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
exec AS_MESSAGE_LOG_FD>>config.log
$lt_cl_success || AS_EXIT(1)
])# LT_OUTPUT
# _LT_CONFIG(TAG)
# ---------------
# If TAG is the built-in tag, create an initial libtool script with a
# default configuration from the untagged config vars. Otherwise add code
# to config.status for appending the configuration named by TAG from the
# matching tagged config vars.
m4_defun([_LT_CONFIG],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
_LT_CONFIG_SAVE_COMMANDS([
m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
m4_if(_LT_TAG, [C], [
# See if we are running on zsh, and set the options which allow our
# commands through without removal of \ escapes.
if test -n "${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
fi
cfgfile="${ofile}T"
trap "$RM \"$cfgfile\"; exit 1" 1 2 15
$RM "$cfgfile"
cat <<_LT_EOF >> "$cfgfile"
#! $SHELL
# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
#
_LT_COPYING
_LT_LIBTOOL_TAGS
# ### BEGIN LIBTOOL CONFIG
_LT_LIBTOOL_CONFIG_VARS
_LT_LIBTOOL_TAG_VARS
# ### END LIBTOOL CONFIG
_LT_EOF
case $host_os in
aix3*)
cat <<\_LT_EOF >> "$cfgfile"
# AIX sometimes has problems with the GCC collect2 program. For some
# reason, if we set the COLLECT_NAMES environment variable, the problems
# vanish in a puff of smoke.
if test "X${COLLECT_NAMES+set}" != Xset; then
COLLECT_NAMES=
export COLLECT_NAMES
fi
_LT_EOF
;;
esac
_LT_PROG_LTMAIN
# We use sed instead of cat because bash on DJGPP gets confused if
# if finds mixed CR/LF and LF-only lines. Since sed operates in
# text mode, it properly converts lines to CR/LF. This bash problem
# is reportedly fixed, but why not run on old versions too?
sed '$q' "$ltmain" >> "$cfgfile" \
|| (rm -f "$cfgfile"; exit 1)
_LT_PROG_REPLACE_SHELLFNS
mv -f "$cfgfile" "$ofile" ||
(rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
chmod +x "$ofile"
],
[cat <<_LT_EOF >> "$ofile"
dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
dnl in a comment (ie after a #).
# ### BEGIN LIBTOOL TAG CONFIG: $1
_LT_LIBTOOL_TAG_VARS(_LT_TAG)
# ### END LIBTOOL TAG CONFIG: $1
_LT_EOF
])dnl /m4_if
],
[m4_if([$1], [], [
PACKAGE='$PACKAGE'
VERSION='$VERSION'
TIMESTAMP='$TIMESTAMP'
RM='$RM'
ofile='$ofile'], [])
])dnl /_LT_CONFIG_SAVE_COMMANDS
])# _LT_CONFIG
# LT_SUPPORTED_TAG(TAG)
# ---------------------
# Trace this macro to discover what tags are supported by the libtool
# --tag option, using:
# autoconf --trace 'LT_SUPPORTED_TAG:$1'
AC_DEFUN([LT_SUPPORTED_TAG], [])
# C support is built-in for now
m4_define([_LT_LANG_C_enabled], [])
m4_define([_LT_TAGS], [])
# LT_LANG(LANG)
# -------------
# Enable libtool support for the given language if not already enabled.
AC_DEFUN([LT_LANG],
[AC_BEFORE([$0], [LT_OUTPUT])dnl
m4_case([$1],
[C], [_LT_LANG(C)],
[C++], [_LT_LANG(CXX)],
[Go], [_LT_LANG(GO)],
[Java], [_LT_LANG(GCJ)],
[Fortran 77], [_LT_LANG(F77)],
[Fortran], [_LT_LANG(FC)],
[Windows Resource], [_LT_LANG(RC)],
[m4_ifdef([_LT_LANG_]$1[_CONFIG],
[_LT_LANG($1)],
[m4_fatal([$0: unsupported language: "$1"])])])dnl
])# LT_LANG
# _LT_LANG(LANGNAME)
# ------------------
m4_defun([_LT_LANG],
[m4_ifdef([_LT_LANG_]$1[_enabled], [],
[LT_SUPPORTED_TAG([$1])dnl
m4_append([_LT_TAGS], [$1 ])dnl
m4_define([_LT_LANG_]$1[_enabled], [])dnl
_LT_LANG_$1_CONFIG($1)])dnl
])# _LT_LANG
m4_ifndef([AC_PROG_GO], [
############################################################
# NOTE: This macro has been submitted for inclusion into #
# GNU Autoconf as AC_PROG_GO. When it is available in #
# a released version of Autoconf we should remove this #
# macro and use it instead. #
############################################################
m4_defun([AC_PROG_GO],
[AC_LANG_PUSH(Go)dnl
AC_ARG_VAR([GOC], [Go compiler command])dnl
AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
_AC_ARG_VAR_LDFLAGS()dnl
AC_CHECK_TOOL(GOC, gccgo)
if test -z "$GOC"; then
if test -n "$ac_tool_prefix"; then
AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
fi
fi
if test -z "$GOC"; then
AC_CHECK_PROG(GOC, gccgo, gccgo, false)
fi
])#m4_defun
])#m4_ifndef
# _LT_LANG_DEFAULT_CONFIG
# -----------------------
m4_defun([_LT_LANG_DEFAULT_CONFIG],
[AC_PROVIDE_IFELSE([AC_PROG_CXX],
[LT_LANG(CXX)],
[m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
AC_PROVIDE_IFELSE([AC_PROG_F77],
[LT_LANG(F77)],
[m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
AC_PROVIDE_IFELSE([AC_PROG_FC],
[LT_LANG(FC)],
[m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
dnl pulling things in needlessly.
AC_PROVIDE_IFELSE([AC_PROG_GCJ],
[LT_LANG(GCJ)],
[AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
[LT_LANG(GCJ)],
[AC_PROVIDE_IFELSE([LT_PROG_GCJ],
[LT_LANG(GCJ)],
[m4_ifdef([AC_PROG_GCJ],
[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
m4_ifdef([A][M_PROG_GCJ],
[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
m4_ifdef([LT_PROG_GCJ],
[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
AC_PROVIDE_IFELSE([AC_PROG_GO],
[LT_LANG(GO)],
[m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
AC_PROVIDE_IFELSE([LT_PROG_RC],
[LT_LANG(RC)],
[m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
])# _LT_LANG_DEFAULT_CONFIG
# Obsolete macros:
AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
dnl AC_DEFUN([AC_LIBTOOL_F77], [])
dnl AC_DEFUN([AC_LIBTOOL_FC], [])
dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
dnl AC_DEFUN([AC_LIBTOOL_RC], [])
# _LT_TAG_COMPILER
# ----------------
m4_defun([_LT_TAG_COMPILER],
[AC_REQUIRE([AC_PROG_CC])dnl
_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
# If no C compiler was specified, use CC.
LTCC=${LTCC-"$CC"}
# If no C compiler flags were specified, use CFLAGS.
LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
# Allow CC to be a program name with arguments.
compiler=$CC
])# _LT_TAG_COMPILER
# _LT_COMPILER_BOILERPLATE
# ------------------------
# Check for compiler boilerplate output or warnings with
# the simple compiler test code.
m4_defun([_LT_COMPILER_BOILERPLATE],
[m4_require([_LT_DECL_SED])dnl
ac_outfile=conftest.$ac_objext
echo "$lt_simple_compile_test_code" >conftest.$ac_ext
eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
_lt_compiler_boilerplate=`cat conftest.err`
$RM conftest*
])# _LT_COMPILER_BOILERPLATE
# _LT_LINKER_BOILERPLATE
# ----------------------
# Check for linker boilerplate output or warnings with
# the simple link test code.
m4_defun([_LT_LINKER_BOILERPLATE],
[m4_require([_LT_DECL_SED])dnl
ac_outfile=conftest.$ac_objext
echo "$lt_simple_link_test_code" >conftest.$ac_ext
eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
_lt_linker_boilerplate=`cat conftest.err`
$RM -r conftest*
])# _LT_LINKER_BOILERPLATE
# _LT_REQUIRED_DARWIN_CHECKS
# -------------------------
m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
case $host_os in
rhapsody* | darwin*)
AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
AC_CHECK_TOOL([LIPO], [lipo], [:])
AC_CHECK_TOOL([OTOOL], [otool], [:])
AC_CHECK_TOOL([OTOOL64], [otool64], [:])
_LT_DECL([], [DSYMUTIL], [1],
[Tool to manipulate archived DWARF debug symbol files on Mac OS X])
_LT_DECL([], [NMEDIT], [1],
[Tool to change global to local symbols on Mac OS X])
_LT_DECL([], [LIPO], [1],
[Tool to manipulate fat objects and archives on Mac OS X])
_LT_DECL([], [OTOOL], [1],
[ldd/readelf like tool for Mach-O binaries on Mac OS X])
_LT_DECL([], [OTOOL64], [1],
[ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
[lt_cv_apple_cc_single_mod=no
if test -z "${LT_MULTI_MODULE}"; then
# By default we will add the -single_module flag. You can override
# by either setting the environment variable LT_MULTI_MODULE
# non-empty at configure time, or by adding -multi_module to the
# link flags.
rm -rf libconftest.dylib*
echo "int foo(void){return 1;}" > conftest.c
echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-dynamiclib -Wl,-single_module conftest.c 2>conftest.err
_lt_result=$?
# If there is a non-empty error log, and "single_module"
# appears in it, assume the flag caused a linker warning
if test -s conftest.err && $GREP single_module conftest.err; then
cat conftest.err >&AS_MESSAGE_LOG_FD
# Otherwise, if the output was created with a 0 exit code from
# the compiler, it worked.
elif test -f libconftest.dylib && test $_lt_result -eq 0; then
lt_cv_apple_cc_single_mod=yes
else
cat conftest.err >&AS_MESSAGE_LOG_FD
fi
rm -rf libconftest.dylib*
rm -f conftest.*
fi])
AC_CACHE_CHECK([for -exported_symbols_list linker flag],
[lt_cv_ld_exported_symbols_list],
[lt_cv_ld_exported_symbols_list=no
save_LDFLAGS=$LDFLAGS
echo "_main" > conftest.sym
LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[lt_cv_ld_exported_symbols_list=yes],
[lt_cv_ld_exported_symbols_list=no])
LDFLAGS="$save_LDFLAGS"
])
AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
[lt_cv_ld_force_load=no
cat > conftest.c << _LT_EOF
int forced_loaded() { return 2;}
_LT_EOF
echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
$LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
$AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
$RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
cat > conftest.c << _LT_EOF
int main() { return 0;}
_LT_EOF
echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
_lt_result=$?
if test -s conftest.err && $GREP force_load conftest.err; then
cat conftest.err >&AS_MESSAGE_LOG_FD
elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
lt_cv_ld_force_load=yes
else
cat conftest.err >&AS_MESSAGE_LOG_FD
fi
rm -f conftest.err libconftest.a conftest conftest.c
rm -rf conftest.dSYM
])
case $host_os in
rhapsody* | darwin1.[[012]])
_lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
darwin1.*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
darwin*) # darwin 5.x on
# if running on 10.5 or later, the deployment target defaults
# to the OS version, if on x86, and 10.4, the deployment
# target defaults to 10.4. Don't you love it?
case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
10.[[012]]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
10.*)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
esac
;;
esac
if test "$lt_cv_apple_cc_single_mod" = "yes"; then
_lt_dar_single_mod='$single_module'
fi
if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
_lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
else
_lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
fi
if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
_lt_dsymutil='~$DSYMUTIL $lib || :'
else
_lt_dsymutil=
fi
;;
esac
])
# _LT_DARWIN_LINKER_FEATURES([TAG])
# ---------------------------------
# Checks for linker and compiler features on darwin
m4_defun([_LT_DARWIN_LINKER_FEATURES],
[
m4_require([_LT_REQUIRED_DARWIN_CHECKS])
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
if test "$lt_cv_ld_force_load" = "yes"; then
_LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
[FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes])
else
_LT_TAGVAR(whole_archive_flag_spec, $1)=''
fi
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
case $cc_basename in
ifort*) _lt_dar_can_shared=yes ;;
*) _lt_dar_can_shared=$GCC ;;
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
_LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
_LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
_LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
_LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
m4_if([$1], [CXX],
[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
_LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
_LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
],[])
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
])
# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
# ----------------------------------
# Links a minimal program and checks the executable
# for the system default hardcoded library path. In most cases,
# this is /usr/lib:/lib, but when the MPI compilers are used
# the location of the communication and MPI libs are included too.
# If we don't find anything, use the default library path according
# to the aix ld manual.
# Store the results from the different compilers for each TAGNAME.
# Allow to override them for all tags through lt_cv_aix_libpath.
m4_defun([_LT_SYS_MODULE_PATH_AIX],
[m4_require([_LT_DECL_SED])dnl
if test "${lt_cv_aix_libpath+set}" = set; then
aix_libpath=$lt_cv_aix_libpath
else
AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
[AC_LINK_IFELSE([AC_LANG_PROGRAM],[
lt_aix_libpath_sed='[
/Import File Strings/,/^$/ {
/^0/ {
s/^0 *\([^ ]*\) *$/\1/
p
}
}]'
_LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
# Check for a 64-bit object if we didn't find anything.
if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
_LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
fi],[])
if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
_LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
fi
])
aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
fi
])# _LT_SYS_MODULE_PATH_AIX
# _LT_SHELL_INIT(ARG)
# -------------------
m4_define([_LT_SHELL_INIT],
[m4_divert_text([M4SH-INIT], [$1
])])# _LT_SHELL_INIT
# _LT_PROG_ECHO_BACKSLASH
# -----------------------
# Find how we can fake an echo command that does not interpret backslash.
# In particular, with Autoconf 2.60 or later we add some code to the start
# of the generated configure script which will find a shell with a builtin
# printf (which we can use as an echo command).
m4_defun([_LT_PROG_ECHO_BACKSLASH],
[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
AC_MSG_CHECKING([how to print strings])
# Test print first, because it will be a builtin if present.
if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
ECHO='print -r --'
elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
ECHO='printf %s\n'
else
# Use this function as a fallback that always works.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
$[]1
_LTECHO_EOF'
}
ECHO='func_fallback_echo'
fi
# func_echo_all arg...
# Invoke $ECHO with all args, space-separated.
func_echo_all ()
{
$ECHO "$*"
}
case "$ECHO" in
printf*) AC_MSG_RESULT([printf]) ;;
print*) AC_MSG_RESULT([print -r]) ;;
*) AC_MSG_RESULT([cat]) ;;
esac
m4_ifdef([_AS_DETECT_SUGGESTED],
[_AS_DETECT_SUGGESTED([
test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
PATH=/empty FPATH=/empty; export PATH FPATH
test "X`printf %s $ECHO`" = "X$ECHO" \
|| test "X`print -r -- $ECHO`" = "X$ECHO" )])])
_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
])# _LT_PROG_ECHO_BACKSLASH
# _LT_WITH_SYSROOT
# ----------------
AC_DEFUN([_LT_WITH_SYSROOT],
[AC_MSG_CHECKING([for sysroot])
AC_ARG_WITH([sysroot],
[ --with-sysroot[=DIR] Search for dependent libraries within DIR
(or the compiler's sysroot if not specified).],
[], [with_sysroot=no])
dnl lt_sysroot will always be passed unquoted. We quote it here
dnl in case the user passed a directory name.
lt_sysroot=
case ${with_sysroot} in #(
yes)
if test "$GCC" = yes; then
lt_sysroot=`$CC --print-sysroot 2>/dev/null`
fi
;; #(
/*)
lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
;; #(
no|'')
;; #(
*)
AC_MSG_RESULT([${with_sysroot}])
AC_MSG_ERROR([The sysroot must be an absolute path.])
;;
esac
AC_MSG_RESULT([${lt_sysroot:-no}])
_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
[dependent libraries, and in which our libraries should be installed.])])
# _LT_ENABLE_LOCK
# ---------------
m4_defun([_LT_ENABLE_LOCK],
[AC_ARG_ENABLE([libtool-lock],
[AS_HELP_STRING([--disable-libtool-lock],
[avoid locking (might break parallel builds)])])
test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
*ELF-32*)
HPUX_IA64_MODE="32"
;;
*ELF-64*)
HPUX_IA64_MODE="64"
;;
esac
fi
rm -rf conftest*
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
if test "$lt_cv_prog_gnu_ld" = yes; then
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -melf32bsmip"
;;
*N32*)
LD="${LD-ld} -melf32bmipn32"
;;
*64-bit*)
LD="${LD-ld} -melf64bmip"
;;
esac
else
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
;;
*N32*)
LD="${LD-ld} -n32"
;;
*64-bit*)
LD="${LD-ld} -64"
;;
esac
fi
fi
rm -rf conftest*
;;
x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.o` in
*32-bit*)
case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
ppc64-*linux*|powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
LD="${LD-ld} -m elf_s390"
;;
sparc64-*linux*)
LD="${LD-ld} -m elf32_sparc"
;;
esac
;;
*64-bit*)
case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
ppc*-*linux*|powerpc*-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
LD="${LD-ld} -m elf64_s390"
;;
sparc*-*linux*)
LD="${LD-ld} -m elf64_sparc"
;;
esac
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
[AC_LANG_PUSH(C)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
AC_LANG_POP])
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
fi
;;
*-*solaris*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.o` in
*64-bit*)
case $lt_cv_prog_gnu_ld in
yes*)
case $host in
i?86-*-solaris*)
LD="${LD-ld} -m elf_x86_64"
;;
sparc*-*-solaris*)
LD="${LD-ld} -m elf64_sparc"
;;
esac
# GNU ld 2.21 introduced _sol2 emulations. Use them if available.
if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
LD="${LD-ld}_sol2"
fi
;;
*)
if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
LD="${LD-ld} -64"
fi
;;
esac
;;
esac
fi
rm -rf conftest*
;;
esac
need_locks="$enable_libtool_lock"
])# _LT_ENABLE_LOCK
# _LT_PROG_AR
# -----------
m4_defun([_LT_PROG_AR],
[AC_CHECK_TOOLS(AR, [ar], false)
: ${AR=ar}
: ${AR_FLAGS=cru}
_LT_DECL([], [AR], [1], [The archiver])
_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
[lt_cv_ar_at_file=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
[echo conftest.$ac_objext > conftest.lst
lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
AC_TRY_EVAL([lt_ar_try])
if test "$ac_status" -eq 0; then
# Ensure the archiver fails upon bogus file names.
rm -f conftest.$ac_objext libconftest.a
AC_TRY_EVAL([lt_ar_try])
if test "$ac_status" -ne 0; then
lt_cv_ar_at_file=@
fi
fi
rm -f conftest.* libconftest.a
])
])
if test "x$lt_cv_ar_at_file" = xno; then
archiver_list_spec=
else
archiver_list_spec=$lt_cv_ar_at_file
fi
_LT_DECL([], [archiver_list_spec], [1],
[How to feed a file listing to the archiver])
])# _LT_PROG_AR
# _LT_CMD_OLD_ARCHIVE
# -------------------
m4_defun([_LT_CMD_OLD_ARCHIVE],
[_LT_PROG_AR
AC_CHECK_TOOL(STRIP, strip, :)
test -z "$STRIP" && STRIP=:
_LT_DECL([], [STRIP], [1], [A symbol stripping program])
AC_CHECK_TOOL(RANLIB, ranlib, :)
test -z "$RANLIB" && RANLIB=:
_LT_DECL([], [RANLIB], [1],
[Commands used to install an old-style archive])
# Determine commands to create old-style static archives.
old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
old_postinstall_cmds='chmod 644 $oldlib'
old_postuninstall_cmds=
if test -n "$RANLIB"; then
case $host_os in
openbsd*)
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
;;
*)
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
;;
esac
old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
fi
case $host_os in
darwin*)
lock_old_archive_extraction=yes ;;
*)
lock_old_archive_extraction=no ;;
esac
_LT_DECL([], [old_postinstall_cmds], [2])
_LT_DECL([], [old_postuninstall_cmds], [2])
_LT_TAGDECL([], [old_archive_cmds], [2],
[Commands used to build an old-style archive])
_LT_DECL([], [lock_old_archive_extraction], [0],
[Whether to use a lock for old archive extraction])
])# _LT_CMD_OLD_ARCHIVE
# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
# ----------------------------------------------------------------
# Check whether the given compiler option works
AC_DEFUN([_LT_COMPILER_OPTION],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_SED])dnl
AC_CACHE_CHECK([$1], [$2],
[$2=no
m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="$3"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
# Note that $ac_compile itself does not contain backslashes and begins
# with a dollar sign (not a hyphen), so the echo should work correctly.
# The option is referenced via a variable to avoid confusing sed.
lt_compile=`echo "$ac_compile" | $SED \
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&AS_MESSAGE_LOG_FD
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
$ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
$2=yes
fi
fi
$RM conftest*
])
if test x"[$]$2" = xyes; then
m4_if([$5], , :, [$5])
else
m4_if([$6], , :, [$6])
fi
])# _LT_COMPILER_OPTION
# Old name:
AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
# [ACTION-SUCCESS], [ACTION-FAILURE])
# ----------------------------------------------------
# Check whether the given linker option works
AC_DEFUN([_LT_LINKER_OPTION],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_SED])dnl
AC_CACHE_CHECK([$1], [$2],
[$2=no
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $3"
echo "$lt_simple_link_test_code" > conftest.$ac_ext
if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
# The linker can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s conftest.err; then
# Append any errors to the config.log.
cat conftest.err 1>&AS_MESSAGE_LOG_FD
$ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if diff conftest.exp conftest.er2 >/dev/null; then
$2=yes
fi
else
$2=yes
fi
fi
$RM -r conftest*
LDFLAGS="$save_LDFLAGS"
])
if test x"[$]$2" = xyes; then
m4_if([$4], , :, [$4])
else
m4_if([$5], , :, [$5])
fi
])# _LT_LINKER_OPTION
# Old name:
AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
# LT_CMD_MAX_LEN
#---------------
AC_DEFUN([LT_CMD_MAX_LEN],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
# find the maximum length of command line arguments
AC_MSG_CHECKING([the maximum length of command line arguments])
AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
i=0
teststring="ABCD"
case $build_os in
msdosdjgpp*)
# On DJGPP, this test can blow up pretty badly due to problems in libc
# (any single argument exceeding 2000 bytes causes a buffer overrun
# during glob expansion). Even if it were fixed, the result of this
# check would be larger than it should be.
lt_cv_sys_max_cmd_len=12288; # 12K is about right
;;
gnu*)
# Under GNU Hurd, this test is not required because there is
# no limit to the length of command line arguments.
# Libtool will interpret -1 as no limit whatsoever
lt_cv_sys_max_cmd_len=-1;
;;
cygwin* | mingw* | cegcc*)
# On Win9x/ME, this test blows up -- it succeeds, but takes
# about 5 minutes as the teststring grows exponentially.
# Worse, since 9x/ME are not pre-emptively multitasking,
# you end up with a "frozen" computer, even though with patience
# the test eventually succeeds (with a max line length of 256k).
# Instead, let's just punt: use the minimum linelength reported by
# all of the supported platforms: 8192 (on NT/2K/XP).
lt_cv_sys_max_cmd_len=8192;
;;
mint*)
# On MiNT this can take a long time and run out of memory.
lt_cv_sys_max_cmd_len=8192;
;;
amigaos*)
# On AmigaOS with pdksh, this test takes hours, literally.
# So we just punt and use a minimum line length of 8192.
lt_cv_sys_max_cmd_len=8192;
;;
netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
# This has been around since 386BSD, at least. Likely further.
if test -x /sbin/sysctl; then
lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
elif test -x /usr/sbin/sysctl; then
lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
else
lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
fi
# And add a safety zone
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
;;
interix*)
# We know the value 262144 and hardcode it with a safety zone (like BSD)
lt_cv_sys_max_cmd_len=196608
;;
os2*)
# The test takes a long time on OS/2.
lt_cv_sys_max_cmd_len=8192
;;
osf*)
# Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
# due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
# nice to cause kernel panics so lets avoid the loop below.
# First set a reasonable default.
lt_cv_sys_max_cmd_len=16384
#
if test -x /sbin/sysconfig; then
case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
*1*) lt_cv_sys_max_cmd_len=-1 ;;
esac
fi
;;
sco3.2v5*)
lt_cv_sys_max_cmd_len=102400
;;
sysv5* | sco5v6* | sysv4.2uw2*)
kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
if test -n "$kargmax"; then
lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
else
lt_cv_sys_max_cmd_len=32768
fi
;;
*)
lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
if test -n "$lt_cv_sys_max_cmd_len"; then
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
else
# Make teststring a little bigger before we do anything with it.
# a 1K string should be a reasonable start.
for i in 1 2 3 4 5 6 7 8 ; do
teststring=$teststring$teststring
done
SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
# If test is not a shell built-in, we'll probably end up computing a
# maximum length that is only half of the actual maximum length, but
# we can't tell.
while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
= "X$teststring$teststring"; } >/dev/null 2>&1 &&
test $i != 17 # 1/2 MB should be enough
do
i=`expr $i + 1`
teststring=$teststring$teststring
done
# Only check the string length outside the loop.
lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
teststring=
# Add a significant safety factor because C++ compilers can tack on
# massive amounts of additional arguments before passing them to the
# linker. It appears as though 1/2 is a usable value.
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
fi
;;
esac
])
if test -n $lt_cv_sys_max_cmd_len ; then
AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
else
AC_MSG_RESULT(none)
fi
max_cmd_len=$lt_cv_sys_max_cmd_len
_LT_DECL([], [max_cmd_len], [0],
[What is the maximum length of a command?])
])# LT_CMD_MAX_LEN
# Old name:
AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
# _LT_HEADER_DLFCN
# ----------------
m4_defun([_LT_HEADER_DLFCN],
[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
])# _LT_HEADER_DLFCN
# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
# ----------------------------------------------------------------
m4_defun([_LT_TRY_DLOPEN_SELF],
[m4_require([_LT_HEADER_DLFCN])dnl
if test "$cross_compiling" = yes; then :
[$4]
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
[#line $LINENO "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
#include
#endif
#include
#ifdef RTLD_GLOBAL
# define LT_DLGLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LT_DLGLOBAL DL_GLOBAL
# else
# define LT_DLGLOBAL 0
# endif
#endif
/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
find out it does not work in some platform. */
#ifndef LT_DLLAZY_OR_NOW
# ifdef RTLD_LAZY
# define LT_DLLAZY_OR_NOW RTLD_LAZY
# else
# ifdef DL_LAZY
# define LT_DLLAZY_OR_NOW DL_LAZY
# else
# ifdef RTLD_NOW
# define LT_DLLAZY_OR_NOW RTLD_NOW
# else
# ifdef DL_NOW
# define LT_DLLAZY_OR_NOW DL_NOW
# else
# define LT_DLLAZY_OR_NOW 0
# endif
# endif
# endif
# endif
#endif
/* When -fvisbility=hidden is used, assume the code has been annotated
correspondingly for the symbols needed. */
#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
int fnord () __attribute__((visibility("default")));
#endif
int fnord () { return 42; }
int main ()
{
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
int status = $lt_dlunknown;
if (self)
{
if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
else
{
if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
else puts (dlerror ());
}
/* dlclose (self); */
}
else
puts (dlerror ());
return status;
}]
_LT_EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
(./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
lt_status=$?
case x$lt_status in
x$lt_dlno_uscore) $1 ;;
x$lt_dlneed_uscore) $2 ;;
x$lt_dlunknown|x*) $3 ;;
esac
else :
# compilation failed
$3
fi
fi
rm -fr conftest*
])# _LT_TRY_DLOPEN_SELF
# LT_SYS_DLOPEN_SELF
# ------------------
AC_DEFUN([LT_SYS_DLOPEN_SELF],
[m4_require([_LT_HEADER_DLFCN])dnl
if test "x$enable_dlopen" != xyes; then
enable_dlopen=unknown
enable_dlopen_self=unknown
enable_dlopen_self_static=unknown
else
lt_cv_dlopen=no
lt_cv_dlopen_libs=
case $host_os in
beos*)
lt_cv_dlopen="load_add_on"
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
;;
mingw* | pw32* | cegcc*)
lt_cv_dlopen="LoadLibrary"
lt_cv_dlopen_libs=
;;
cygwin*)
lt_cv_dlopen="dlopen"
lt_cv_dlopen_libs=
;;
darwin*)
# if libdl is installed we need to link against it
AC_CHECK_LIB([dl], [dlopen],
[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
lt_cv_dlopen="dyld"
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
])
;;
*)
AC_CHECK_FUNC([shl_load],
[lt_cv_dlopen="shl_load"],
[AC_CHECK_LIB([dld], [shl_load],
[lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
[AC_CHECK_FUNC([dlopen],
[lt_cv_dlopen="dlopen"],
[AC_CHECK_LIB([dl], [dlopen],
[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
[AC_CHECK_LIB([svld], [dlopen],
[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
[AC_CHECK_LIB([dld], [dld_link],
[lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
])
])
])
])
])
;;
esac
if test "x$lt_cv_dlopen" != xno; then
enable_dlopen=yes
else
enable_dlopen=no
fi
case $lt_cv_dlopen in
dlopen)
save_CPPFLAGS="$CPPFLAGS"
test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
save_LDFLAGS="$LDFLAGS"
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
save_LIBS="$LIBS"
LIBS="$lt_cv_dlopen_libs $LIBS"
AC_CACHE_CHECK([whether a program can dlopen itself],
lt_cv_dlopen_self, [dnl
_LT_TRY_DLOPEN_SELF(
lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
])
if test "x$lt_cv_dlopen_self" = xyes; then
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
lt_cv_dlopen_self_static, [dnl
_LT_TRY_DLOPEN_SELF(
lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
])
fi
CPPFLAGS="$save_CPPFLAGS"
LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS"
;;
esac
case $lt_cv_dlopen_self in
yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
*) enable_dlopen_self=unknown ;;
esac
case $lt_cv_dlopen_self_static in
yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
*) enable_dlopen_self_static=unknown ;;
esac
fi
_LT_DECL([dlopen_support], [enable_dlopen], [0],
[Whether dlopen is supported])
_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
[Whether dlopen of programs is supported])
_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
[Whether dlopen of statically linked programs is supported])
])# LT_SYS_DLOPEN_SELF
# Old name:
AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
# _LT_COMPILER_C_O([TAGNAME])
# ---------------------------
# Check to see if options -c and -o are simultaneously supported by compiler.
# This macro does not hard code the compiler like AC_PROG_CC_C_O.
m4_defun([_LT_COMPILER_C_O],
[m4_require([_LT_DECL_SED])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_TAG_COMPILER])dnl
AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
[_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
[_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
$RM -r conftest 2>/dev/null
mkdir conftest
cd conftest
mkdir out
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="-o out/conftest2.$ac_objext"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
# Note that $ac_compile itself does not contain backslashes and begins
# with a dollar sign (not a hyphen), so the echo should work correctly.
lt_compile=`echo "$ac_compile" | $SED \
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&AS_MESSAGE_LOG_FD
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
$ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
$SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
fi
fi
chmod u+w . 2>&AS_MESSAGE_LOG_FD
$RM conftest*
# SGI C++ compiler will create directory out/ii_files/ for
# template instantiation
test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
$RM out/* && rmdir out
cd ..
$RM -r conftest
$RM conftest*
])
_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
[Does compiler simultaneously support -c and -o options?])
])# _LT_COMPILER_C_O
# _LT_COMPILER_FILE_LOCKS([TAGNAME])
# ----------------------------------
# Check to see if we can do hard links to lock some files if needed
m4_defun([_LT_COMPILER_FILE_LOCKS],
[m4_require([_LT_ENABLE_LOCK])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
_LT_COMPILER_C_O([$1])
hard_links="nottested"
if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
AC_MSG_CHECKING([if we can lock with hard links])
hard_links=yes
$RM conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
touch conftest.a
ln conftest.a conftest.b 2>&5 || hard_links=no
ln conftest.a conftest.b 2>/dev/null && hard_links=no
AC_MSG_RESULT([$hard_links])
if test "$hard_links" = no; then
AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
need_locks=warn
fi
else
need_locks=no
fi
_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
])# _LT_COMPILER_FILE_LOCKS
# _LT_CHECK_OBJDIR
# ----------------
m4_defun([_LT_CHECK_OBJDIR],
[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
[rm -f .libs 2>/dev/null
mkdir .libs 2>/dev/null
if test -d .libs; then
lt_cv_objdir=.libs
else
# MS-DOS does not allow filenames that begin with a dot.
lt_cv_objdir=_libs
fi
rmdir .libs 2>/dev/null])
objdir=$lt_cv_objdir
_LT_DECL([], [objdir], [0],
[The name of the directory that contains temporary libtool files])dnl
m4_pattern_allow([LT_OBJDIR])dnl
AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
[Define to the sub-directory in which libtool stores uninstalled libraries.])
])# _LT_CHECK_OBJDIR
# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
# --------------------------------------
# Check hardcoding attributes.
m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
[AC_MSG_CHECKING([how to hardcode library paths into programs])
_LT_TAGVAR(hardcode_action, $1)=
if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
test -n "$_LT_TAGVAR(runpath_var, $1)" ||
test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
# We can hardcode non-existent directories.
if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
# If the only mechanism to avoid hardcoding is shlibpath_var, we
# have to relink, otherwise we might link with an installed library
# when we should be linking with a yet-to-be-installed one
## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
# Linking always hardcodes the temporary library directory.
_LT_TAGVAR(hardcode_action, $1)=relink
else
# We can link without hardcoding, and we can hardcode nonexisting dirs.
_LT_TAGVAR(hardcode_action, $1)=immediate
fi
else
# We cannot hardcode anything, or else we can only hardcode existing
# directories.
_LT_TAGVAR(hardcode_action, $1)=unsupported
fi
AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
# Fast installation is not supported
enable_fast_install=no
elif test "$shlibpath_overrides_runpath" = yes ||
test "$enable_shared" = no; then
# Fast installation is not necessary
enable_fast_install=needless
fi
_LT_TAGDECL([], [hardcode_action], [0],
[How to hardcode a shared library path into an executable])
])# _LT_LINKER_HARDCODE_LIBPATH
# _LT_CMD_STRIPLIB
# ----------------
m4_defun([_LT_CMD_STRIPLIB],
[m4_require([_LT_DECL_EGREP])
striplib=
old_striplib=
AC_MSG_CHECKING([whether stripping libraries is possible])
if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
test -z "$striplib" && striplib="$STRIP --strip-unneeded"
AC_MSG_RESULT([yes])
else
# FIXME - insert some real tests, host_os isn't really good enough
case $host_os in
darwin*)
if test -n "$STRIP" ; then
striplib="$STRIP -x"
old_striplib="$STRIP -S"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
;;
*)
AC_MSG_RESULT([no])
;;
esac
fi
_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
_LT_DECL([], [striplib], [1])
])# _LT_CMD_STRIPLIB
# _LT_SYS_DYNAMIC_LINKER([TAG])
# -----------------------------
# PORTME Fill in your ld.so characteristics
m4_defun([_LT_SYS_DYNAMIC_LINKER],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_OBJDUMP])dnl
m4_require([_LT_DECL_SED])dnl
m4_require([_LT_CHECK_SHELL_FEATURES])dnl
AC_MSG_CHECKING([dynamic linker characteristics])
m4_if([$1],
[], [
if test "$GCC" = yes; then
case $host_os in
darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
*) lt_awk_arg="/^libraries:/" ;;
esac
case $host_os in
mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
*) lt_sed_strip_eq="s,=/,/,g" ;;
esac
lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
case $lt_search_path_spec in
*\;*)
# if the path contains ";" then we assume it to be the separator
# otherwise default to the standard path separator (i.e. ":") - it is
# assumed that no part of a normal pathname contains ";" but that should
# okay in the real world where ";" in dirpaths is itself problematic.
lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
;;
*)
lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
;;
esac
# Ok, now we have the path, separated by spaces, we can step through it
# and add multilib dir if necessary.
lt_tmp_lt_search_path_spec=
lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
for lt_sys_path in $lt_search_path_spec; do
if test -d "$lt_sys_path/$lt_multi_os_dir"; then
lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
else
test -d "$lt_sys_path" && \
lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
fi
done
lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
BEGIN {RS=" "; FS="/|\n";} {
lt_foo="";
lt_count=0;
for (lt_i = NF; lt_i > 0; lt_i--) {
if ($lt_i != "" && $lt_i != ".") {
if ($lt_i == "..") {
lt_count++;
} else {
if (lt_count == 0) {
lt_foo="/" $lt_i lt_foo;
} else {
lt_count--;
}
}
}
}
if (lt_foo != "") { lt_freq[[lt_foo]]++; }
if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
}'`
# AWK program above erroneously prepends '/' to C:/dos/paths
# for these hosts.
case $host_os in
mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
$SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
esac
sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
else
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
fi])
library_names_spec=
libname_spec='lib$name'
soname_spec=
shrext_cmds=".so"
postinstall_cmds=
postuninstall_cmds=
finish_cmds=
finish_eval=
shlibpath_var=
shlibpath_overrides_runpath=unknown
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_dlsearch_path_spec="/lib /usr/lib"
need_lib_prefix=unknown
hardcode_into_libs=no
# when you set need_version to no, make sure it does not cause -set_version
# flags to be left without arguments
need_version=unknown
case $host_os in
aix3*)
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
shlibpath_var=LIBPATH
# AIX 3 has no versioning support, so we append a major version to the name.
soname_spec='${libname}${release}${shared_ext}$major'
;;
aix[[4-9]]*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
hardcode_into_libs=yes
if test "$host_cpu" = ia64; then
# AIX 5 supports IA64
library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
else
# With GCC up to 2.95.x, collect2 would create an import file
# for dependence libraries. The import file would start with
# the line `#! .'. This would cause the generated library to
# depend on `.', always an invalid library. This was fixed in
# development snapshots of GCC prior to 3.0.
case $host_os in
aix4 | aix4.[[01]] | aix4.[[01]].*)
if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
echo ' yes '
echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
:
else
can_build_shared=no
fi
;;
esac
# AIX (on Power*) has no versioning support, so currently we can not hardcode correct
# soname into executable. Probably we can add versioning support to
# collect2, so additional links can be useful in future.
if test "$aix_use_runtimelinking" = yes; then
# If using run time linking (on AIX 4.2 or later) use lib.so
# instead of lib.a to let people know that these are not
# typical AIX shared libraries.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
else
# We preserve .a as extension for shared libraries through AIX4.2
# and later when we are not doing run time linking.
library_names_spec='${libname}${release}.a $libname.a'
soname_spec='${libname}${release}${shared_ext}$major'
fi
shlibpath_var=LIBPATH
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# Since July 2007 AmigaOS4 officially supports .so libraries.
# When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
;;
m68k)
library_names_spec='$libname.ixlibrary $libname.a'
# Create ${libname}_ixlibrary.a entries in /sys/libs.
finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
;;
esac
;;
beos*)
library_names_spec='${libname}${shared_ext}'
dynamic_linker="$host_os ld.so"
shlibpath_var=LIBRARY_PATH
;;
bsdi[[45]]*)
version_type=linux # correct to gnu/linux during the next big refactor
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
# the default ld.so.conf also contains /usr/contrib/lib and
# /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
# libtool to hard-code these into programs
;;
cygwin* | mingw* | pw32* | cegcc*)
version_type=windows
shrext_cmds=".dll"
need_version=no
need_lib_prefix=no
case $GCC,$cc_basename in
yes,*)
# gcc
library_names_spec='$libname.dll.a'
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \${file}`~
dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
dldir=$destdir/`dirname \$dlpath`~
test -d \$dldir || mkdir -p \$dldir~
$install_prog $dir/$dlname \$dldir/$dlname~
chmod a+x \$dldir/$dlname~
if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
fi'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
dlpath=$dir/\$dldll~
$RM \$dlpath'
shlibpath_overrides_runpath=yes
case $host_os in
cygwin*)
# Cygwin DLLs use 'cyg' prefix rather than 'lib'
soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
m4_if([$1], [],[
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
;;
mingw* | cegcc*)
# MinGW DLLs use traditional 'lib' prefix
soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
;;
pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib'
library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
;;
esac
dynamic_linker='Win32 ld.exe'
;;
*,cl*)
# Native MSVC
libname_spec='$name'
soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
library_names_spec='${libname}.dll.lib'
case $build_os in
mingw*)
sys_lib_search_path_spec=
lt_save_ifs=$IFS
IFS=';'
for lt_path in $LIB
do
IFS=$lt_save_ifs
# Let DOS variable expansion print the short 8.3 style file name.
lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
done
IFS=$lt_save_ifs
# Convert to MSYS style.
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
;;
cygwin*)
# Convert to unix form, then to dos form, then back to unix form
# but this time dos style (no spaces!) so that the unix form looks
# like /cygdrive/c/PROGRA~1:/cygdr...
sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
;;
*)
sys_lib_search_path_spec="$LIB"
if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
# It is most probably a Windows format PATH.
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
else
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
fi
# FIXME: find the short name or the path components, as spaces are
# common. (e.g. "Program Files" -> "PROGRA~1")
;;
esac
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \${file}`~
dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
dldir=$destdir/`dirname \$dlpath`~
test -d \$dldir || mkdir -p \$dldir~
$install_prog $dir/$dlname \$dldir/$dlname'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
dlpath=$dir/\$dldll~
$RM \$dlpath'
shlibpath_overrides_runpath=yes
dynamic_linker='Win32 link.exe'
;;
*)
# Assume MSVC wrapper
library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
dynamic_linker='Win32 ld.exe'
;;
esac
# FIXME: first we should search . and the directory the executable is in
shlibpath_var=PATH
;;
darwin* | rhapsody*)
dynamic_linker="$host_os dyld"
version_type=darwin
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
soname_spec='${libname}${release}${major}$shared_ext'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
m4_if([$1], [],[
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
;;
dgux*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
;;
freebsd* | dragonfly*)
# DragonFly does not have aout. When/if they implement a new
# versioning mechanism, adjust this.
if test -x /usr/bin/objformat; then
objformat=`/usr/bin/objformat`
else
case $host_os in
freebsd[[23]].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
version_type=freebsd-$objformat
case $version_type in
freebsd-elf*)
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
need_version=no
need_lib_prefix=no
;;
freebsd-*)
library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
need_version=yes
;;
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[[01]]* | freebsdelf3.[[01]]*)
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
*) # from 4.6 on, and DragonFly
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
esac
;;
gnu*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
haiku*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
dynamic_linker="$host_os runtime_loader"
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LIBRARY_PATH
shlibpath_overrides_runpath=yes
sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
hardcode_into_libs=yes
;;
hpux9* | hpux10* | hpux11*)
# Give a soname corresponding to the major version so that dld.sl refuses to
# link against other versions.
version_type=sunos
need_lib_prefix=no
need_version=no
case $host_cpu in
ia64*)
shrext_cmds='.so'
hardcode_into_libs=yes
dynamic_linker="$host_os dld.so"
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
if test "X$HPUX_IA64_MODE" = X32; then
sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
else
sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
fi
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
;;
hppa*64*)
shrext_cmds='.sl'
hardcode_into_libs=yes
dynamic_linker="$host_os dld.sl"
shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
;;
*)
shrext_cmds='.sl'
dynamic_linker="$host_os dld.sl"
shlibpath_var=SHLIB_PATH
shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
;;
esac
# HP-UX runs *really* slowly unless shared libraries are mode 555, ...
postinstall_cmds='chmod 555 $lib'
# or fails outright, so override atomically:
install_override_mode=555
;;
interix[[3-9]]*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
irix5* | irix6* | nonstopux*)
case $host_os in
nonstopux*) version_type=nonstopux ;;
*)
if test "$lt_cv_prog_gnu_ld" = yes; then
version_type=linux # correct to gnu/linux during the next big refactor
else
version_type=irix
fi ;;
esac
need_lib_prefix=no
need_version=no
soname_spec='${libname}${release}${shared_ext}$major'
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
case $host_os in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in # libtool.m4 will add one of these switches to LD
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
libsuff= shlibsuff= libmagic=32-bit;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
libsuff=32 shlibsuff=N32 libmagic=N32;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
libsuff=64 shlibsuff=64 libmagic=64-bit;;
*) libsuff= shlibsuff= libmagic=never-match;;
esac
;;
esac
shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
shlibpath_overrides_runpath=no
sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
hardcode_into_libs=yes
;;
# No shared lib support for Linux oldld, aout, or coff.
linux*oldld* | linux*aout* | linux*coff*)
dynamic_linker=no
;;
# This must be glibc/ELF.
linux* | k*bsd*-gnu | kopensolaris*-gnu)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
# Some binutils ld are patched to set DT_RUNPATH
AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
[lt_cv_shlibpath_overrides_runpath=no
save_LDFLAGS=$LDFLAGS
save_libdir=$libdir
eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
[lt_cv_shlibpath_overrides_runpath=yes])])
LDFLAGS=$save_LDFLAGS
libdir=$save_libdir
])
shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
# This implies no fast_install, which is unacceptable.
# Some rework will be needed to allow for fast_install
# before this can be enabled.
hardcode_into_libs=yes
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
# powerpc, because MkLinux only supported shared libraries with the
# GNU dynamic linker. Since this was broken with cross compilers,
# most powerpc-linux boxes support dynamic linking these days and
# people can always --disable-shared, the test was removed, and we
# assume the GNU/Linux dynamic linker is in use.
dynamic_linker='GNU/Linux ld.so'
;;
netbsdelf*-gnu)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
dynamic_linker='NetBSD ld.elf_so'
;;
netbsd*)
version_type=sunos
need_lib_prefix=no
need_version=no
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
dynamic_linker='NetBSD ld.elf_so'
fi
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
newsos6)
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
;;
*nto* | *qnx*)
version_type=qnx
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
dynamic_linker='ldqnx.so'
;;
openbsd*)
version_type=sunos
sys_lib_dlsearch_path_spec="/usr/lib"
need_lib_prefix=no
# Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
case $host_os in
openbsd3.3 | openbsd3.3.*) need_version=yes ;;
*) need_version=no ;;
esac
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
case $host_os in
openbsd2.[[89]] | openbsd2.[[89]].*)
shlibpath_overrides_runpath=no
;;
*)
shlibpath_overrides_runpath=yes
;;
esac
else
shlibpath_overrides_runpath=yes
fi
;;
os2*)
libname_spec='$name'
shrext_cmds=".dll"
need_lib_prefix=no
library_names_spec='$libname${shared_ext} $libname.a'
dynamic_linker='OS/2 ld.exe'
shlibpath_var=LIBPATH
;;
osf3* | osf4* | osf5*)
version_type=osf
need_lib_prefix=no
need_version=no
soname_spec='${libname}${release}${shared_ext}$major'
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
;;
rdos*)
dynamic_linker=no
;;
solaris*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
# ldd complains unless libraries are executable
postinstall_cmds='chmod +x $lib'
;;
sunos4*)
version_type=sunos
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
if test "$with_gnu_ld" = yes; then
need_lib_prefix=no
fi
need_version=yes
;;
sysv4 | sysv4.3*)
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
case $host_vendor in
sni)
shlibpath_overrides_runpath=no
need_lib_prefix=no
runpath_var=LD_RUN_PATH
;;
siemens)
need_lib_prefix=no
;;
motorola)
need_lib_prefix=no
need_version=no
shlibpath_overrides_runpath=no
sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
;;
esac
;;
sysv4*MP*)
if test -d /usr/nec ;then
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
soname_spec='$libname${shared_ext}.$major'
shlibpath_var=LD_LIBRARY_PATH
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
version_type=freebsd-elf
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
if test "$with_gnu_ld" = yes; then
sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
else
sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
case $host_os in
sco3.2v5*)
sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
;;
esac
fi
sys_lib_dlsearch_path_spec='/usr/lib'
;;
tpf*)
# TPF is a cross-target only. Preferred cross-host = GNU/Linux.
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
uts4*)
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
;;
*)
dynamic_linker=no
;;
esac
AC_MSG_RESULT([$dynamic_linker])
test "$dynamic_linker" = no && can_build_shared=no
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
if test "$GCC" = yes; then
variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
fi
if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
fi
if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
fi
_LT_DECL([], [variables_saved_for_relink], [1],
[Variables whose values should be saved in libtool wrapper scripts and
restored at link time])
_LT_DECL([], [need_lib_prefix], [0],
[Do we need the "lib" prefix for modules?])
_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
_LT_DECL([], [version_type], [0], [Library versioning type])
_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
_LT_DECL([], [shlibpath_overrides_runpath], [0],
[Is shlibpath searched before the hard-coded library search path?])
_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
_LT_DECL([], [library_names_spec], [1],
[[List of archive names. First name is the real one, the rest are links.
The last name is the one that the linker finds with -lNAME]])
_LT_DECL([], [soname_spec], [1],
[[The coded name of the library, if different from the real name]])
_LT_DECL([], [install_override_mode], [1],
[Permission mode override for installation of shared libraries])
_LT_DECL([], [postinstall_cmds], [2],
[Command to use after installation of a shared archive])
_LT_DECL([], [postuninstall_cmds], [2],
[Command to use after uninstallation of a shared archive])
_LT_DECL([], [finish_cmds], [2],
[Commands used to finish a libtool library installation in a directory])
_LT_DECL([], [finish_eval], [1],
[[As "finish_cmds", except a single script fragment to be evaled but
not shown]])
_LT_DECL([], [hardcode_into_libs], [0],
[Whether we should hardcode library paths into libraries])
_LT_DECL([], [sys_lib_search_path_spec], [2],
[Compile-time system search path for libraries])
_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
[Run-time system search path for libraries])
])# _LT_SYS_DYNAMIC_LINKER
# _LT_PATH_TOOL_PREFIX(TOOL)
# --------------------------
# find a file program which can recognize shared library
AC_DEFUN([_LT_PATH_TOOL_PREFIX],
[m4_require([_LT_DECL_EGREP])dnl
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
[case $MAGIC_CMD in
[[\\/*] | ?:[\\/]*])
lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
;;
*)
lt_save_MAGIC_CMD="$MAGIC_CMD"
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
dnl $ac_dummy forces splitting on constant user-supplied paths.
dnl POSIX.2 word splitting is done only on the output of word expansions,
dnl not every word. This closes a longstanding sh security hole.
ac_dummy="m4_if([$2], , $PATH, [$2])"
for ac_dir in $ac_dummy; do
IFS="$lt_save_ifs"
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$1; then
lt_cv_path_MAGIC_CMD="$ac_dir/$1"
if test -n "$file_magic_test_file"; then
case $deplibs_check_method in
"file_magic "*)
file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
$EGREP "$file_magic_regex" > /dev/null; then
:
else
cat <<_LT_EOF 1>&2
*** Warning: the command libtool uses to detect shared libraries,
*** $file_magic_cmd, produces output that libtool cannot recognize.
*** The result is that libtool may fail to recognize shared libraries
*** as such. This will affect the creation of libtool libraries that
*** depend on shared libraries, but programs linked with such libtool
*** libraries will work regardless of this problem. Nevertheless, you
*** may want to report the problem to your system manager and/or to
*** bug-libtool@gnu.org
_LT_EOF
fi ;;
esac
fi
break
fi
done
IFS="$lt_save_ifs"
MAGIC_CMD="$lt_save_MAGIC_CMD"
;;
esac])
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if test -n "$MAGIC_CMD"; then
AC_MSG_RESULT($MAGIC_CMD)
else
AC_MSG_RESULT(no)
fi
_LT_DECL([], [MAGIC_CMD], [0],
[Used to examine libraries when file_magic_cmd begins with "file"])dnl
])# _LT_PATH_TOOL_PREFIX
# Old name:
AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
# _LT_PATH_MAGIC
# --------------
# find a file program which can recognize a shared library
m4_defun([_LT_PATH_MAGIC],
[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
_LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
else
MAGIC_CMD=:
fi
fi
])# _LT_PATH_MAGIC
# LT_PATH_LD
# ----------
# find the pathname to the GNU or non-GNU linker
AC_DEFUN([LT_PATH_LD],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
m4_require([_LT_DECL_SED])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
AC_ARG_WITH([gnu-ld],
[AS_HELP_STRING([--with-gnu-ld],
[assume the C compiler uses GNU ld @<:@default=no@:>@])],
[test "$withval" = no || with_gnu_ld=yes],
[with_gnu_ld=no])dnl
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by $CC])
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
*)
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
esac
case $ac_prog in
# Accept absolute paths.
[[\\/]]* | ?:[[\\/]]*)
re_direlt='/[[^/]][[^/]]*/\.\./'
# Canonicalize the pathname of ld
ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(lt_cv_path_LD,
[if test -z "$LD"; then
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
for ac_dir in $PATH; do
IFS="$lt_save_ifs"
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
lt_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some variants of GNU ld only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
else
# Keep this pattern in sync with the one in func_win32_libid.
lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
lt_cv_file_magic_cmd='$OBJDUMP -f'
fi
;;
cegcc*)
# use the weaker test based on 'objdump'. See mingw*.
lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
lt_cv_file_magic_cmd='$OBJDUMP -f'
;;
darwin* | rhapsody*)
lt_cv_deplibs_check_method=pass_all
;;
freebsd* | dragonfly*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
case $host_cpu in
i*86 )
# Not sure whether the presence of OpenBSD here was a mistake.
# Let's accept both of them until this is cleared up.
lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
;;
esac
else
lt_cv_deplibs_check_method=pass_all
fi
;;
gnu*)
lt_cv_deplibs_check_method=pass_all
;;
haiku*)
lt_cv_deplibs_check_method=pass_all
;;
hpux10.20* | hpux11*)
lt_cv_file_magic_cmd=/usr/bin/file
case $host_cpu in
ia64*)
lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
;;
hppa*64*)
[lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
;;
*)
lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
lt_cv_file_magic_test_file=/usr/lib/libc.sl
;;
esac
;;
interix[[3-9]]*)
# PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
;;
irix5* | irix6* | nonstopux*)
case $LD in
*-32|*"-32 ") libmagic=32-bit;;
*-n32|*"-n32 ") libmagic=N32;;
*-64|*"-64 ") libmagic=64-bit;;
*) libmagic=never-match;;
esac
lt_cv_deplibs_check_method=pass_all
;;
# This must be glibc/ELF.
linux* | k*bsd*-gnu | kopensolaris*-gnu)
lt_cv_deplibs_check_method=pass_all
;;
netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
else
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
fi
;;
newos6*)
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_test_file=/usr/lib/libnls.so
;;
*nto* | *qnx*)
lt_cv_deplibs_check_method=pass_all
;;
openbsd*)
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
else
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
fi
;;
osf3* | osf4* | osf5*)
lt_cv_deplibs_check_method=pass_all
;;
rdos*)
lt_cv_deplibs_check_method=pass_all
;;
solaris*)
lt_cv_deplibs_check_method=pass_all
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
lt_cv_deplibs_check_method=pass_all
;;
sysv4 | sysv4.3*)
case $host_vendor in
motorola)
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
;;
ncr)
lt_cv_deplibs_check_method=pass_all
;;
sequent)
lt_cv_file_magic_cmd='/bin/file'
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
;;
sni)
lt_cv_file_magic_cmd='/bin/file'
lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
lt_cv_file_magic_test_file=/lib/libc.so
;;
siemens)
lt_cv_deplibs_check_method=pass_all
;;
pc)
lt_cv_deplibs_check_method=pass_all
;;
esac
;;
tpf*)
lt_cv_deplibs_check_method=pass_all
;;
esac
])
file_magic_glob=
want_nocaseglob=no
if test "$build" = "$host"; then
case $host_os in
mingw* | pw32*)
if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
want_nocaseglob=yes
else
file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
fi
;;
esac
fi
file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
test -z "$deplibs_check_method" && deplibs_check_method=unknown
_LT_DECL([], [deplibs_check_method], [1],
[Method to check whether dependent libraries are shared objects])
_LT_DECL([], [file_magic_cmd], [1],
[Command to use when deplibs_check_method = "file_magic"])
_LT_DECL([], [file_magic_glob], [1],
[How to find potential files when deplibs_check_method = "file_magic"])
_LT_DECL([], [want_nocaseglob], [1],
[Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
])# _LT_CHECK_MAGIC_METHOD
# LT_PATH_NM
# ----------
# find the pathname to a BSD- or MS-compatible name lister
AC_DEFUN([LT_PATH_NM],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
[if test -n "$NM"; then
# Let the user override the test.
lt_cv_path_NM="$NM"
else
lt_nm_to_check="${ac_tool_prefix}nm"
if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
lt_nm_to_check="$lt_nm_to_check nm"
fi
for lt_tmp_nm in $lt_nm_to_check; do
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
IFS="$lt_save_ifs"
test -z "$ac_dir" && ac_dir=.
tmp_nm="$ac_dir/$lt_tmp_nm"
if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
# Tru64's nm complains that /dev/null is an invalid object file
case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
*/dev/null* | *'Invalid file or object type'*)
lt_cv_path_NM="$tmp_nm -B"
break
;;
*)
case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
*/dev/null*)
lt_cv_path_NM="$tmp_nm -p"
break
;;
*)
lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
;;
esac
;;
esac
fi
done
IFS="$lt_save_ifs"
done
: ${lt_cv_path_NM=no}
fi])
if test "$lt_cv_path_NM" != "no"; then
NM="$lt_cv_path_NM"
else
# Didn't find any BSD compatible name lister, look for dumpbin.
if test -n "$DUMPBIN"; then :
# Let the user override the test.
else
AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
*COFF*)
DUMPBIN="$DUMPBIN -symbols"
;;
*)
DUMPBIN=:
;;
esac
fi
AC_SUBST([DUMPBIN])
if test "$DUMPBIN" != ":"; then
NM="$DUMPBIN"
fi
fi
test -z "$NM" && NM=nm
AC_SUBST([NM])
_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
[lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&AS_MESSAGE_LOG_FD
(eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&AS_MESSAGE_LOG_FD
(eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
cat conftest.out >&AS_MESSAGE_LOG_FD
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
fi
rm -f conftest*])
])# LT_PATH_NM
# Old names:
AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_PROG_NM], [])
dnl AC_DEFUN([AC_PROG_NM], [])
# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
# --------------------------------
# how to determine the name of the shared library
# associated with a specific link library.
# -- PORTME fill in with the dynamic library characteristics
m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
[m4_require([_LT_DECL_EGREP])
m4_require([_LT_DECL_OBJDUMP])
m4_require([_LT_DECL_DLLTOOL])
AC_CACHE_CHECK([how to associate runtime and link libraries],
lt_cv_sharedlib_from_linklib_cmd,
[lt_cv_sharedlib_from_linklib_cmd='unknown'
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
# two different shell functions defined in ltmain.sh
# decide which to use based on capabilities of $DLLTOOL
case `$DLLTOOL --help 2>&1` in
*--identify-strict*)
lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
;;
*)
lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
;;
esac
;;
*)
# fallback: assume linklib IS sharedlib
lt_cv_sharedlib_from_linklib_cmd="$ECHO"
;;
esac
])
sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
[Command to associate shared and link libraries])
])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
# _LT_PATH_MANIFEST_TOOL
# ----------------------
# locate the manifest tool
m4_defun([_LT_PATH_MANIFEST_TOOL],
[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
[lt_cv_path_mainfest_tool=no
echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
$MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
cat conftest.err >&AS_MESSAGE_LOG_FD
if $GREP 'Manifest Tool' conftest.out > /dev/null; then
lt_cv_path_mainfest_tool=yes
fi
rm -f conftest*])
if test "x$lt_cv_path_mainfest_tool" != xyes; then
MANIFEST_TOOL=:
fi
_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
])# _LT_PATH_MANIFEST_TOOL
# LT_LIB_M
# --------
# check for math library
AC_DEFUN([LT_LIB_M],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
LIBM=
case $host in
*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
# These system don't have libm, or don't need it
;;
*-ncr-sysv4.3*)
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
;;
*)
AC_CHECK_LIB(m, cos, LIBM="-lm")
;;
esac
AC_SUBST([LIBM])
])# LT_LIB_M
# Old name:
AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_CHECK_LIBM], [])
# _LT_COMPILER_NO_RTTI([TAGNAME])
# -------------------------------
m4_defun([_LT_COMPILER_NO_RTTI],
[m4_require([_LT_TAG_COMPILER])dnl
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
if test "$GCC" = yes; then
case $cc_basename in
nvcc*)
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
*)
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
esac
_LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
lt_cv_prog_compiler_rtti_exceptions,
[-fno-rtti -fno-exceptions], [],
[_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
fi
_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
[Compiler flag to turn off builtin functions])
])# _LT_COMPILER_NO_RTTI
# _LT_CMD_GLOBAL_SYMBOLS
# ----------------------
m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([LT_PATH_NM])dnl
AC_REQUIRE([LT_PATH_LD])dnl
m4_require([_LT_DECL_SED])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_TAG_COMPILER])dnl
# Check for command to grab the raw symbol name followed by C symbol from nm.
AC_MSG_CHECKING([command to parse $NM output from $compiler object])
AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
[
# These are sane defaults that work on at least a few old systems.
# [They come from Ultrix. What could be older than Ultrix?!! ;)]
# Character class describing NM global symbol codes.
symcode='[[BCDEGRST]]'
# Regexp to match symbols that can be accessed directly from C.
sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
# Define system-specific variables.
case $host_os in
aix*)
symcode='[[BCDT]]'
;;
cygwin* | mingw* | pw32* | cegcc*)
symcode='[[ABCDGISTW]]'
;;
hpux*)
if test "$host_cpu" = ia64; then
symcode='[[ABCDEGRST]]'
fi
;;
irix* | nonstopux*)
symcode='[[BCDEGRST]]'
;;
osf*)
symcode='[[BCDEGQRST]]'
;;
solaris*)
symcode='[[BDRT]]'
;;
sco3.2v5*)
symcode='[[DT]]'
;;
sysv4.2uw2*)
symcode='[[DT]]'
;;
sysv5* | sco5v6* | unixware* | OpenUNIX*)
symcode='[[ABDT]]'
;;
sysv4)
symcode='[[DFNSTU]]'
;;
esac
# If we're using GNU nm, then use its standard symbol codes.
case `$NM -V 2>&1` in
*GNU* | *'with BFD'*)
symcode='[[ABCDGIRSTW]]' ;;
esac
# Transform an extracted symbol line into a proper C declaration.
# Some systems (esp. on ia64) link data and code symbols differently,
# so use this general approach.
lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
# Transform an extracted symbol line into symbol name and symbol address
lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
# Handle CRLF in mingw tool chain
opt_cr=
case $build_os in
mingw*)
opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
;;
esac
# Try without a prefix underscore, then with it.
for ac_symprfx in "" "_"; do
# Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
symxfrm="\\1 $ac_symprfx\\2 \\2"
# Write the raw and C identifiers.
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
# Fake it for dumpbin and say T for any non-static function
# and D for any global variable.
# Also find C++ and __fastcall symbols from MSVC++,
# which start with @ or ?.
lt_cv_sys_global_symbol_pipe="$AWK ['"\
" {last_section=section; section=\$ 3};"\
" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
" \$ 0!~/External *\|/{next};"\
" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
" {if(hide[section]) next};"\
" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
" s[1]~/^[@?]/{print s[1], s[1]; next};"\
" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
" ' prfx=^$ac_symprfx]"
else
lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
fi
lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
# Check to see that the pipe works correctly.
pipe_works=no
rm -f conftest*
cat > conftest.$ac_ext <<_LT_EOF
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(void);
void nm_test_func(void){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func();return(0);}
_LT_EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
else
rm -f "$nlist"T
fi
# Make sure that we snagged all the symbols we need.
if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
cat <<_LT_EOF > conftest.$ac_ext
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
/* DATA imports from DLLs on WIN32 con't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs. */
# define LT@&t@_DLSYM_CONST
#elif defined(__osf__)
/* This system does not cope well with relocations in const data. */
# define LT@&t@_DLSYM_CONST
#else
# define LT@&t@_DLSYM_CONST const
#endif
#ifdef __cplusplus
extern "C" {
#endif
_LT_EOF
# Now generate the symbol file.
eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
cat <<_LT_EOF >> conftest.$ac_ext
/* The mapping between symbol names and symbols. */
LT@&t@_DLSYM_CONST struct {
const char *name;
void *address;
}
lt__PROGRAM__LTX_preloaded_symbols[[]] =
{
{ "@PROGRAM@", (void *) 0 },
_LT_EOF
$SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
cat <<\_LT_EOF >> conftest.$ac_ext
{0, (void *) 0}
};
/* This works around a problem in FreeBSD linker */
#ifdef FREEBSD_WORKAROUND
static const void *lt_preloaded_setup() {
return lt__PROGRAM__LTX_preloaded_symbols;
}
#endif
#ifdef __cplusplus
}
#endif
_LT_EOF
# Now try linking the two files.
mv conftest.$ac_objext conftstm.$ac_objext
lt_globsym_save_LIBS=$LIBS
lt_globsym_save_CFLAGS=$CFLAGS
LIBS="conftstm.$ac_objext"
CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
pipe_works=yes
fi
LIBS=$lt_globsym_save_LIBS
CFLAGS=$lt_globsym_save_CFLAGS
else
echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
fi
else
echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
fi
else
echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
fi
else
echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
cat conftest.$ac_ext >&5
fi
rm -rf conftest* conftst*
# Do not use the global_symbol_pipe unless it works.
if test "$pipe_works" = yes; then
break
else
lt_cv_sys_global_symbol_pipe=
fi
done
])
if test -z "$lt_cv_sys_global_symbol_pipe"; then
lt_cv_sys_global_symbol_to_cdecl=
fi
if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
AC_MSG_RESULT(failed)
else
AC_MSG_RESULT(ok)
fi
# Response file support.
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
nm_file_list_spec='@'
elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
nm_file_list_spec='@'
fi
_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
[Take the output of nm and produce a listing of raw symbols and C names])
_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
[Transform the output of nm in a proper C declaration])
_LT_DECL([global_symbol_to_c_name_address],
[lt_cv_sys_global_symbol_to_c_name_address], [1],
[Transform the output of nm in a C name address pair])
_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
[lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
[Transform the output of nm in a C name address pair when lib prefix is needed])
_LT_DECL([], [nm_file_list_spec], [1],
[Specify filename containing input files for $NM])
]) # _LT_CMD_GLOBAL_SYMBOLS
# _LT_COMPILER_PIC([TAGNAME])
# ---------------------------
m4_defun([_LT_COMPILER_PIC],
[m4_require([_LT_TAG_COMPILER])dnl
_LT_TAGVAR(lt_prog_compiler_wl, $1)=
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_TAGVAR(lt_prog_compiler_static, $1)=
m4_if([$1], [CXX], [
# C++ specific cases for pic, static, wl, etc.
if test "$GXX" = yes; then
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
case $host_os in
aix*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
m68k)
# FIXME: we need at least 68020 code to build shared libraries, but
# adding the `-m68020' flag to GCC prevents building anything better,
# like `-m68040'.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
;;
esac
;;
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
mingw* | cygwin* | os2* | pw32* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
# (--disable-auto-import) libraries
m4_if([$1], [GCJ], [],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
;;
darwin* | rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
;;
*djgpp*)
# DJGPP does not support shared libraries at all
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
;;
haiku*)
# PIC is the default for Haiku.
# The "-static" flag exists, but is broken.
_LT_TAGVAR(lt_prog_compiler_static, $1)=
;;
interix[[3-9]]*)
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
# Instead, we relocate shared libraries at runtime.
;;
sysv4*MP*)
if test -d /usr/nec; then
_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
fi
;;
hpux*)
# PIC is the default for 64-bit PA HP-UX, but not for 32-bit
# PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
# sets the default TLS model and affects inlining.
case $host_cpu in
hppa*64*)
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
;;
*qnx* | *nto*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
else
case $host_os in
aix[[4-9]]*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
else
_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
fi
;;
chorus*)
case $cc_basename in
cxch68*)
# Green Hills C++ Compiler
# _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
;;
esac
;;
mingw* | cygwin* | os2* | pw32* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
m4_if([$1], [GCJ], [],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
;;
dgux*)
case $cc_basename in
ec++*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
;;
ghcx*)
# Green Hills C++ Compiler
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
*)
;;
esac
;;
freebsd* | dragonfly*)
# FreeBSD uses GNU C++
;;
hpux9* | hpux10* | hpux11*)
case $cc_basename in
CC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
if test "$host_cpu" != ia64; then
_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
fi
;;
aCC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
case $host_cpu in
hppa*64*|ia64*)
# +Z the default
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
;;
esac
;;
*)
;;
esac
;;
interix*)
# This is c89, which is MS Visual C++ (no shared libs)
# Anyone wants to do a port?
;;
irix5* | irix6* | nonstopux*)
case $cc_basename in
CC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
# CC pic flag -KPIC is the default.
;;
*)
;;
esac
;;
linux* | k*bsd*-gnu | kopensolaris*-gnu)
case $cc_basename in
KCC*)
# KAI C++ Compiler
_LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
ecpc* )
# old Intel C++ for x86_64 which still supported -KPIC.
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
icpc* )
# Intel C++, used to be incompatible with GCC.
# ICC 10 doesn't accept -KPIC any more.
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
pgCC* | pgcpp*)
# Portland Group C++ compiler
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
cxx*)
# Compaq C++
# Make sure the PIC flag is empty. It appears that all Alpha
# Linux and Compaq Tru64 Unix objects are PIC.
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
# IBM XL 8.0, 9.0 on PPC and BlueGene
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
# Sun C++ 5.9
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
;;
esac
;;
esac
;;
lynxos*)
;;
m88k*)
;;
mvs*)
case $cc_basename in
cxx*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
;;
*)
;;
esac
;;
netbsd* | netbsdelf*-gnu)
;;
*qnx* | *nto*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
;;
osf3* | osf4* | osf5*)
case $cc_basename in
KCC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
;;
RCC*)
# Rational C++ 2.4.1
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
cxx*)
# Digital/Compaq C++
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# Make sure the PIC flag is empty. It appears that all Alpha
# Linux and Compaq Tru64 Unix objects are PIC.
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
*)
;;
esac
;;
psos*)
;;
solaris*)
case $cc_basename in
CC* | sunCC*)
# Sun C++ 4.2, 5.x and Centerline C++
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
;;
gcx*)
# Green Hills C++ Compiler
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
;;
*)
;;
esac
;;
sunos4*)
case $cc_basename in
CC*)
# Sun C++ 4.x
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
lcc*)
# Lucid
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
*)
;;
esac
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
case $cc_basename in
CC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
esac
;;
tandem*)
case $cc_basename in
NCC*)
# NonStop-UX NCC 3.20
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
;;
*)
;;
esac
;;
vxworks*)
;;
*)
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
;;
esac
fi
],
[
if test "$GCC" = yes; then
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
case $host_os in
aix*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
m68k)
# FIXME: we need at least 68020 code to build shared libraries, but
# adding the `-m68020' flag to GCC prevents building anything better,
# like `-m68040'.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
;;
esac
;;
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
# (--disable-auto-import) libraries
m4_if([$1], [GCJ], [],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
;;
darwin* | rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
;;
haiku*)
# PIC is the default for Haiku.
# The "-static" flag exists, but is broken.
_LT_TAGVAR(lt_prog_compiler_static, $1)=
;;
hpux*)
# PIC is the default for 64-bit PA HP-UX, but not for 32-bit
# PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
# sets the default TLS model and affects inlining.
case $host_cpu in
hppa*64*)
# +Z the default
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
;;
interix[[3-9]]*)
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
# Instead, we relocate shared libraries at runtime.
;;
msdosdjgpp*)
# Just because we use GCC doesn't mean we suddenly get shared libraries
# on systems that don't support them.
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
enable_shared=no
;;
*nto* | *qnx*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
;;
sysv4*MP*)
if test -d /usr/nec; then
_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
fi
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
case $cc_basename in
nvcc*) # Cuda Compiler Driver 2.2
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
_LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
fi
;;
esac
else
# PORTME Check for flag to pass linker flags through the system compiler.
case $host_os in
aix*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
else
_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
fi
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
m4_if([$1], [GCJ], [],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
;;
hpux9* | hpux10* | hpux11*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
# not for PA HP-UX.
case $host_cpu in
hppa*64*|ia64*)
# +Z the default
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
;;
esac
# Is there a better lt_prog_compiler_static that works with the bundled CC?
_LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
;;
irix5* | irix6* | nonstopux*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# PIC (with -KPIC) is the default.
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
linux* | k*bsd*-gnu | kopensolaris*-gnu)
case $cc_basename in
# old Intel for x86_64 which still supported -KPIC.
ecc*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
# icc used to be incompatible with GCC.
# ICC 10 doesn't accept -KPIC any more.
icc* | ifort*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
# Lahey Fortran 8.1.
lf95*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
;;
nagfor*)
# NAG Fortran compiler
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
# Portland Group compilers (*not* the Pentium gcc compiler,
# which looks to be a dead project)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
ccc*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# All Alpha code is PIC.
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
xl* | bgxl* | bgf* | mpixl*)
# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
# Sun Fortran 8.3 passes all unrecognized flags to the linker
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)=''
;;
*Sun\ F* | *Sun*Fortran*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
;;
*Sun\ C*)
# Sun C 5.9
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
;;
*Intel*\ [[CF]]*Compiler*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
*Portland\ Group*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
esac
;;
esac
;;
newsos6)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
*nto* | *qnx*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
;;
osf3* | osf4* | osf5*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# All OSF/1 code is PIC.
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
rdos*)
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
solaris*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
case $cc_basename in
f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
esac
;;
sunos4*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
sysv4 | sysv4.2uw2* | sysv4.3*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
sysv4*MP*)
if test -d /usr/nec ;then
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
fi
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
unicos*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
;;
uts4*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
*)
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
;;
esac
fi
])
case $host_os in
# For platforms which do not support PIC, -DPIC is meaningless:
*djgpp*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
;;
esac
AC_CACHE_CHECK([for $compiler option to produce PIC],
[_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
[_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
#
# Check to make sure the PIC flag actually works.
#
if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
_LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
[_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
[$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
[case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
"" | " "*) ;;
*) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
esac],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
fi
_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
[Additional compiler flags for building library objects])
_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
[How to pass a linker flag through the compiler])
#
# Check to make sure the static flag actually works.
#
wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
_LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
$lt_tmp_static_flag,
[],
[_LT_TAGVAR(lt_prog_compiler_static, $1)=])
_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
[Compiler flag to prevent dynamic linking])
])# _LT_COMPILER_PIC
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
# See if the linker supports building shared libraries.
m4_defun([_LT_LINKER_SHLIBS],
[AC_REQUIRE([LT_PATH_LD])dnl
AC_REQUIRE([LT_PATH_NM])dnl
m4_require([_LT_PATH_MANIFEST_TOOL])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_DECL_SED])dnl
m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
m4_require([_LT_TAG_COMPILER])dnl
AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
m4_if([$1], [CXX], [
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
_LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
case $host_os in
aix[[4-9]]*)
# If we're using GNU nm, then we don't want the "-C" option.
# -C means demangle to AIX nm, but means don't demangle with GNU nm
# Also, AIX nm treats weak defined symbols like other global defined
# symbols, whereas GNU nm marks them as "W".
if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
_LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
else
_LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
fi
;;
pw32*)
_LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
;;
cygwin* | mingw* | cegcc*)
case $cc_basename in
cl*)
_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
;;
*)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
_LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
;;
esac
;;
linux* | k*bsd*-gnu | gnu*)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
*)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
;;
esac
], [
runpath_var=
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(archive_cmds, $1)=
_LT_TAGVAR(archive_expsym_cmds, $1)=
_LT_TAGVAR(compiler_needs_object, $1)=no
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
_LT_TAGVAR(inherit_rpath, $1)=no
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(old_archive_from_new_cmds, $1)=
_LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
_LT_TAGVAR(thread_safe_flag_spec, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
_LT_TAGVAR(include_expsyms, $1)=
# exclude_expsyms can be an extended regexp of symbols to exclude
# it will be wrapped by ` (' and `)$', so one must not match beginning or
# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
# as well as any symbol that contains `d'.
_LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
# platforms (ab)use it in PIC code, but their linkers get confused if
# the symbol is explicitly referenced. Since portable code cannot
# rely on this symbol name, it's probably fine to never include it in
# preloaded symbol tables.
# Exclude shared library initialization/finalization symbols.
dnl Note also adjust exclude_expsyms for C++ above.
extract_expsyms_cmds=
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
with_gnu_ld=yes
;;
openbsd*)
with_gnu_ld=no
;;
linux* | k*bsd*-gnu | gnu*)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
esac
_LT_TAGVAR(ld_shlibs, $1)=yes
# On some targets, GNU ld is compatible enough with the native linker
# that we're better off using the native interface for both.
lt_use_gnu_ld_interface=no
if test "$with_gnu_ld" = yes; then
case $host_os in
aix*)
# The AIX port of GNU ld has always aspired to compatibility
# with the native linker. However, as the warning in the GNU ld
# block says, versions before 2.19.5* couldn't really create working
# shared libraries, regardless of the interface used.
case `$LD -v 2>&1` in
*\ \(GNU\ Binutils\)\ 2.19.5*) ;;
*\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
*\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
*)
lt_use_gnu_ld_interface=yes
;;
esac
;;
*)
lt_use_gnu_ld_interface=yes
;;
esac
fi
if test "$lt_use_gnu_ld_interface" = yes; then
# If archive_cmds runs LD, not CC, wlarc should be empty
wlarc='${wl}'
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
runpath_var=LD_RUN_PATH
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
# ancient GNU ld didn't support --whole-archive et. al.
if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
_LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
else
_LT_TAGVAR(whole_archive_flag_spec, $1)=
fi
supports_anon_versioning=no
case `$LD -v 2>&1` in
*GNU\ gold*) supports_anon_versioning=yes ;;
*\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
*\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
*\ 2.11.*) ;; # other 2.11 versions
*) supports_anon_versioning=yes ;;
esac
# See if GNU ld supports shared libraries.
case $host_os in
aix[[3-9]]*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
_LT_TAGVAR(ld_shlibs, $1)=no
cat <<_LT_EOF 1>&2
*** Warning: the GNU linker, at least up to release 2.19, is reported
*** to be unable to reliably create shared libraries on AIX.
*** Therefore, libtool is disabling shared libraries support. If you
*** really care for shared libraries, you may want to install binutils
*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
*** You will then need to restart the configuration process.
_LT_EOF
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)=''
;;
m68k)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
;;
esac
;;
beos*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
# Joseph Beckenbach says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
cygwin* | mingw* | pw32* | cegcc*)
# _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
_LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file (1st line
# is EXPORTS), use it as is; otherwise, prepend...
_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
cat $export_symbols >> $output_objdir/$soname.def;
fi~
$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
haiku*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
interix[[3-9]]*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
# Instead, shared libraries are loaded at an image base (0x10000000 by
# default) and relocated if they conflict, which is a slow very memory
# consuming and fragmenting process. To avoid this, we pick a random,
# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
# time. Moving up from 0x10000000 also allows more sbrk(2) space.
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
;;
gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
tmp_diet=no
if test "$host_os" = linux-dietlibc; then
case $cc_basename in
diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
esac
fi
if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
&& test "$tmp_diet" = no
then
tmp_addflag=' $pic_flag'
tmp_sharedflag='-shared'
case $cc_basename,$host_cpu in
pgcc*) # Portland Group C compiler
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag'
;;
pgf77* | pgf90* | pgf95* | pgfortran*)
# Portland Group f77 and f90 compilers
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag -Mnomain' ;;
ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
tmp_addflag=' -i_dynamic' ;;
efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
tmp_addflag=' -i_dynamic -nofor_main' ;;
ifc* | ifort*) # Intel Fortran compiler
tmp_addflag=' -nofor_main' ;;
lf95*) # Lahey Fortran 8.1
_LT_TAGVAR(whole_archive_flag_spec, $1)=
tmp_sharedflag='--shared' ;;
xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
tmp_sharedflag='-qmkshrobj'
tmp_addflag= ;;
nvcc*) # Cuda Compiler Driver 2.2
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
_LT_TAGVAR(compiler_needs_object, $1)=yes
;;
esac
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*) # Sun C 5.9
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
_LT_TAGVAR(compiler_needs_object, $1)=yes
tmp_sharedflag='-G' ;;
*Sun\ F*) # Sun Fortran 8.3
tmp_sharedflag='-G' ;;
esac
_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
if test "x$supports_anon_versioning" = xyes; then
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
fi
case $cc_basename in
xlf* | bgf* | bgxlf* | mpixlf*)
# IBM XL Fortran 10.1 on PPC cannot create shared libs itself
_LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
if test "x$supports_anon_versioning" = xyes; then
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
fi
;;
esac
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
else
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
fi
;;
solaris*)
if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
_LT_TAGVAR(ld_shlibs, $1)=no
cat <<_LT_EOF 1>&2
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
*** create shared libraries on Solaris systems. Therefore, libtool
*** is disabling shared libraries support. We urge you to upgrade GNU
*** binutils to release 2.9.1 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
_LT_EOF
elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
_LT_TAGVAR(ld_shlibs, $1)=no
cat <<_LT_EOF 1>&2
*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
*** reliably create shared libraries on SCO systems. Therefore, libtool
*** is disabling shared libraries support. We urge you to upgrade GNU
*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
_LT_EOF
;;
*)
# For security reasons, it is highly recommended that you always
# use absolute paths for naming shared libraries, and exclude the
# DT_RUNPATH tag from executables and libraries. But doing so
# requires that you compile everything twice, which is a pain.
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
sunos4*)
_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
wlarc=
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
runpath_var=
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
fi
else
# PORTME fill in a description of your system's linker (not GNU ld)
case $host_os in
aix3*)
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=yes
_LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
_LT_TAGVAR(hardcode_minus_L, $1)=yes
if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
_LT_TAGVAR(hardcode_direct, $1)=unsupported
fi
;;
aix[[4-9]]*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
exp_sym_flag='-Bexport'
no_entry_flag=""
else
# If we're using GNU nm, then we don't want the "-C" option.
# -C means demangle to AIX nm, but means don't demangle with GNU nm
# Also, AIX nm treats weak defined symbols like other global
# defined symbols, whereas GNU nm marks them as "W".
if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
_LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
else
_LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
fi
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
;;
esac
exp_sym_flag='-bexport'
no_entry_flag='-bnoentry'
fi
# When large executables or shared objects are built, AIX ld can
# have problems creating the table of contents. If linking a library
# or program results in "error TOC overflow" add -mminimal-toc to
# CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
# enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
_LT_TAGVAR(archive_cmds, $1)=''
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
if test "$GCC" = yes; then
case $host_os in aix4.[[012]]|aix4.[[012]].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" &&
strings "$collect2name" | $GREP resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
_LT_TAGVAR(hardcode_direct, $1)=unsupported
# It fails to find uninstalled libraries when the uninstalled
# path is not listed in the libpath. Setting hardcode_minus_L
# to unsupported forces relinking
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=
fi
;;
esac
shared_flag='-shared'
if test "$aix_use_runtimelinking" = yes; then
shared_flag="$shared_flag "'${wl}-G'
fi
_LT_TAGVAR(link_all_deplibs, $1)=no
else
# not using gcc
if test "$host_cpu" = ia64; then
# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
# chokes on -Wl,-G. The following line is correct:
shared_flag='-G'
else
if test "$aix_use_runtimelinking" = yes; then
shared_flag='${wl}-G'
else
shared_flag='${wl}-bM:SRE'
fi
fi
fi
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
# It seems that -bexpall does not export symbols beginning with
# underscore (_), so it is better to generate a list of symbols to export.
_LT_TAGVAR(always_export_symbols, $1)=yes
if test "$aix_use_runtimelinking" = yes; then
# Warning - without using the other runtime loading flags (-brtl),
# -berok will link without error, but may produce a broken library.
_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
# Determine the default libpath from the value encoded in an
# empty executable.
_LT_SYS_MODULE_PATH_AIX([$1])
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
else
if test "$host_cpu" = ia64; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
_LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
_LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
else
# Determine the default libpath from the value encoded in an
# empty executable.
_LT_SYS_MODULE_PATH_AIX([$1])
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
# Warning - without using the other run time loading flags,
# -berok will link without error, but may produce a broken library.
_LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
if test "$with_gnu_ld" = yes; then
# We only use this code for GNU lds that support --whole-archive.
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
else
# Exported symbols can be pulled into shared objects from archives
_LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
# This is similar to how AIX traditionally builds its shared libraries.
_LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
fi
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)=''
;;
m68k)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
;;
esac
;;
bsdi[[45]]*)
_LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
;;
cygwin* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
case $cc_basename in
cl*)
# Native MSVC
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='@'
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=".dll"
# FIXME: Setting linknames here is a bad hack.
_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
else
sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
fi~
$CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
linknames='
# The linker will not automatically build a static lib if we build a DLL.
# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
# Don't use ranlib
_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
lt_tool_outputfile="@TOOL_OUTPUT@"~
case $lt_outputfile in
*.exe|*.EXE) ;;
*)
lt_outputfile="$lt_outputfile.exe"
lt_tool_outputfile="$lt_tool_outputfile.exe"
;;
esac~
if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
$MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
$RM "$lt_outputfile.manifest";
fi'
;;
*)
# Assume MSVC wrapper
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=".dll"
# FIXME: Setting linknames here is a bad hack.
_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
# The linker will automatically build a .lib file if we build a DLL.
_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
# FIXME: Should let the user specify the lib program.
_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
;;
esac
;;
darwin* | rhapsody*)
_LT_DARWIN_LINKER_FEATURES($1)
;;
dgux*)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
# support. Future versions do this automatically, but an explicit c++rt0.o
# does not break anything, and helps significantly (at the cost of a little
# extra space).
freebsd2.2*)
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
freebsd2.*)
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
freebsd* | dragonfly*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
hpux9*)
if test "$GCC" = yes; then
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
else
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(hardcode_direct, $1)=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
;;
hpux10*)
if test "$GCC" = yes && test "$with_gnu_ld" = no; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
else
_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
fi
if test "$with_gnu_ld" = no; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
_LT_TAGVAR(hardcode_minus_L, $1)=yes
fi
;;
hpux11*)
if test "$GCC" = yes && test "$with_gnu_ld" = no; then
case $host_cpu in
hppa*64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
else
case $host_cpu in
hppa*64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
m4_if($1, [], [
# Older versions of the 11.00 compiler do not understand -b yet
# (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
_LT_LINKER_OPTION([if $CC understands -b],
_LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
[_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
[_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
[_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
;;
esac
fi
if test "$with_gnu_ld" = no; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
case $host_cpu in
hppa*64*|ia64*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
_LT_TAGVAR(hardcode_minus_L, $1)=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
if test "$GCC" = yes; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
# Try to use the -exported_symbol ld option, if it does not
# work, assume that -exports_file does not work either and
# implicitly export all symbols.
# This should be the same for all languages, so no per-tag cache variable.
AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
[lt_cv_irix_exported_symbol],
[save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
AC_LINK_IFELSE(
[AC_LANG_SOURCE(
[AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
[C++], [[int foo (void) { return 0; }]],
[Fortran 77], [[
subroutine foo
end]],
[Fortran], [[
subroutine foo
end]])])],
[lt_cv_irix_exported_symbol=yes],
[lt_cv_irix_exported_symbol=no])
LDFLAGS="$save_LDFLAGS"])
if test "$lt_cv_irix_exported_symbol" = yes; then
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
fi
else
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)='no'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(inherit_rpath, $1)=yes
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
newsos6)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*nto* | *qnx*)
;;
openbsd*)
if test -f /usr/libexec/ld.so; then
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
else
case $host_os in
openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
;;
esac
fi
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
os2*)
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
_LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
;;
osf3*)
if test "$GCC" = yes; then
_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
else
_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)='no'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
;;
osf4* | osf5*) # as osf3* with the addition of -msym flag
if test "$GCC" = yes; then
_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
else
_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
# Both c and cxx compiler support -rpath directly
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)='no'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
;;
solaris*)
_LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
if test "$GCC" = yes; then
wlarc='${wl}'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
else
case `$CC -V 2>&1` in
*"Compilers 5.0"*)
wlarc=''
_LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
;;
*)
wlarc='${wl}'
_LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
;;
esac
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
case $host_os in
solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
*)
# The compiler driver will combine and reorder linker options,
# but understands `-z linker_flag'. GCC discards it without `$wl',
# but is careful enough not to reorder.
# Supported since Solaris 2.6 (maybe 2.5.1?)
if test "$GCC" = yes; then
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
else
_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
fi
;;
esac
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
sunos4*)
if test "x$host_vendor" = xsequent; then
# Use $CC to link under sequent, because it throws in some extra .o
# files that make .init and .fini sections work.
_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
else
_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
sysv4)
case $host_vendor in
sni)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
;;
siemens)
## LD is ld it makes a PLAMLIB
## CC just makes a GrossModule.
_LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
_LT_TAGVAR(hardcode_direct, $1)=no
;;
motorola)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
;;
esac
runpath_var='LD_RUN_PATH'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
sysv4.3*)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
;;
sysv4*MP*)
if test -d /usr/nec; then
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
runpath_var=LD_RUN_PATH
hardcode_runpath_var=yes
_LT_TAGVAR(ld_shlibs, $1)=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
runpath_var='LD_RUN_PATH'
if test "$GCC" = yes; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
sysv5* | sco3.2v5* | sco5v6*)
# Note: We can NOT use -z defs as we might desire, because we do not
# link with -lc, and that would cause any symbols used from libc to
# always be unresolved, which means just about no library would
# ever link correctly. If we're not using GNU ld we use -z text
# though, which does catch some bad symbols but isn't as heavy-handed
# as -z defs.
_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
runpath_var='LD_RUN_PATH'
if test "$GCC" = yes; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
uts4*)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
if test x$host_vendor = xsni; then
case $host in
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
;;
esac
fi
fi
])
AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
_LT_DECL([], [extract_expsyms_cmds], [2],
[The commands to extract the exported symbol list from a shared archive])
#
# Do we need to explicitly link libc?
#
case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
x|xyes)
# Assume -lc should be added
_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
if test "$enable_shared" = yes && test "$GCC" = yes; then
case $_LT_TAGVAR(archive_cmds, $1) in
*'~'*)
# FIXME: we may have to deal with multi-command sequences.
;;
'$CC '*)
# Test whether the compiler implicitly links with -lc since on some
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
AC_CACHE_CHECK([whether -lc should be explicitly linked in],
[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
[$RM conftest*
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
soname=conftest
lib=conftest
libobjs=conftest.$ac_objext
deplibs=
wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
compiler_flags=-v
linker_flags=-v
verstring=
output_objdir=.
libname=conftest
lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
_LT_TAGVAR(allow_undefined_flag, $1)=
if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
then
lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
else
lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
fi
_LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
else
cat conftest.err 1>&5
fi
$RM conftest*
])
_LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
;;
esac
fi
;;
esac
_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
[Whether or not to add -lc for building shared libraries])
_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
[enable_shared_with_static_runtimes], [0],
[Whether or not to disallow shared libs when runtime libs are static])
_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
[Compiler flag to allow reflexive dlopens])
_LT_TAGDECL([], [whole_archive_flag_spec], [1],
[Compiler flag to generate shared objects directly from archives])
_LT_TAGDECL([], [compiler_needs_object], [1],
[Whether the compiler copes with passing no objects directly])
_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
[Create an old-style archive from a shared archive])
_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
[Create a temporary old-style archive to link instead of a shared archive])
_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
_LT_TAGDECL([], [archive_expsym_cmds], [2])
_LT_TAGDECL([], [module_cmds], [2],
[Commands used to build a loadable module if different from building
a shared archive.])
_LT_TAGDECL([], [module_expsym_cmds], [2])
_LT_TAGDECL([], [with_gnu_ld], [1],
[Whether we are building with GNU ld or not])
_LT_TAGDECL([], [allow_undefined_flag], [1],
[Flag that allows shared libraries with undefined symbols to be built])
_LT_TAGDECL([], [no_undefined_flag], [1],
[Flag that enforces no undefined symbols])
_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
[Flag to hardcode $libdir into a binary during linking.
This must work even if $libdir does not exist])
_LT_TAGDECL([], [hardcode_libdir_separator], [1],
[Whether we need a single "-rpath" flag with a separated argument])
_LT_TAGDECL([], [hardcode_direct], [0],
[Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
DIR into the resulting binary])
_LT_TAGDECL([], [hardcode_direct_absolute], [0],
[Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
DIR into the resulting binary and the resulting library dependency is
"absolute", i.e impossible to change by setting ${shlibpath_var} if the
library is relocated])
_LT_TAGDECL([], [hardcode_minus_L], [0],
[Set to "yes" if using the -LDIR flag during linking hardcodes DIR
into the resulting binary])
_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
[Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
into the resulting binary])
_LT_TAGDECL([], [hardcode_automatic], [0],
[Set to "yes" if building a shared library automatically hardcodes DIR
into the library and all subsequent libraries and executables linked
against it])
_LT_TAGDECL([], [inherit_rpath], [0],
[Set to yes if linker adds runtime paths of dependent libraries
to runtime path list])
_LT_TAGDECL([], [link_all_deplibs], [0],
[Whether libtool must link a program against all its dependency libraries])
_LT_TAGDECL([], [always_export_symbols], [0],
[Set to "yes" if exported symbols are required])
_LT_TAGDECL([], [export_symbols_cmds], [2],
[The commands to list exported symbols])
_LT_TAGDECL([], [exclude_expsyms], [1],
[Symbols that should not be listed in the preloaded symbols])
_LT_TAGDECL([], [include_expsyms], [1],
[Symbols that must always be exported])
_LT_TAGDECL([], [prelink_cmds], [2],
[Commands necessary for linking programs (against libraries) with templates])
_LT_TAGDECL([], [postlink_cmds], [2],
[Commands necessary for finishing linking programs])
_LT_TAGDECL([], [file_list_spec], [1],
[Specify filename containing input files])
dnl FIXME: Not yet implemented
dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
dnl [Compiler flag to generate thread safe objects])
])# _LT_LINKER_SHLIBS
# _LT_LANG_C_CONFIG([TAG])
# ------------------------
# Ensure that the configuration variables for a C compiler are suitably
# defined. These variables are subsequently used by _LT_CONFIG to write
# the compiler configuration to `libtool'.
m4_defun([_LT_LANG_C_CONFIG],
[m4_require([_LT_DECL_EGREP])dnl
lt_save_CC="$CC"
AC_LANG_PUSH(C)
# Source file extension for C test sources.
ac_ext=c
# Object file extension for compiled C test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests
lt_simple_link_test_code='int main(){return(0);}'
_LT_TAG_COMPILER
# Save the default compiler, since it gets overwritten when the other
# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
compiler_DEFAULT=$CC
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
if test -n "$compiler"; then
_LT_COMPILER_NO_RTTI($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_SYS_DYNAMIC_LINKER($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
LT_SYS_DLOPEN_SELF
_LT_CMD_STRIPLIB
# Report which library types will actually be built
AC_MSG_CHECKING([if libtool supports shared libraries])
AC_MSG_RESULT([$can_build_shared])
AC_MSG_CHECKING([whether to build shared libraries])
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
case $host_os in
aix3*)
test "$enable_shared" = yes && enable_static=no
if test -n "$RANLIB"; then
archive_cmds="$archive_cmds~\$RANLIB \$lib"
postinstall_cmds='$RANLIB $lib'
fi
;;
aix[[4-9]]*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
;;
esac
AC_MSG_RESULT([$enable_shared])
AC_MSG_CHECKING([whether to build static libraries])
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
AC_MSG_RESULT([$enable_static])
_LT_CONFIG($1)
fi
AC_LANG_POP
CC="$lt_save_CC"
])# _LT_LANG_C_CONFIG
# _LT_LANG_CXX_CONFIG([TAG])
# --------------------------
# Ensure that the configuration variables for a C++ compiler are suitably
# defined. These variables are subsequently used by _LT_CONFIG to write
# the compiler configuration to `libtool'.
m4_defun([_LT_LANG_CXX_CONFIG],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_PATH_MANIFEST_TOOL])dnl
if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
(test "X$CXX" != "Xg++"))) ; then
AC_PROG_CXXCPP
else
_lt_caught_CXX_error=yes
fi
AC_LANG_PUSH(C++)
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(archive_expsym_cmds, $1)=
_LT_TAGVAR(compiler_needs_object, $1)=no
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(inherit_rpath, $1)=no
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
_LT_TAGVAR(reload_flag, $1)=$reload_flag
_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
_LT_TAGVAR(no_undefined_flag, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
# Source file extension for C++ test sources.
ac_ext=cpp
# Object file extension for compiled C++ test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# No sense in running all these tests if we already determined that
# the CXX compiler isn't working. Some variables (like enable_shared)
# are currently assumed to apply to all compilers on this platform,
# and will be corrupted by setting them based on a non-working compiler.
if test "$_lt_caught_CXX_error" != yes; then
# Code to be used in simple compile tests
lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests
lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC=$CC
lt_save_CFLAGS=$CFLAGS
lt_save_LD=$LD
lt_save_GCC=$GCC
GCC=$GXX
lt_save_with_gnu_ld=$with_gnu_ld
lt_save_path_LD=$lt_cv_path_LD
if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
else
$as_unset lt_cv_prog_gnu_ld
fi
if test -n "${lt_cv_path_LDCXX+set}"; then
lt_cv_path_LD=$lt_cv_path_LDCXX
else
$as_unset lt_cv_path_LD
fi
test -z "${LDCXX+set}" || LD=$LDCXX
CC=${CXX-"c++"}
CFLAGS=$CXXFLAGS
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_CC_BASENAME([$compiler])
if test -n "$compiler"; then
# We don't want -fno-exception when compiling C++ code, so set the
# no_builtin_flag separately
if test "$GXX" = yes; then
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
else
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
fi
if test "$GXX" = yes; then
# Set up default GNU C++ configuration
LT_PATH_LD
# Check if GNU C++ uses GNU ld as the underlying linker, since the
# archiving commands below assume that GNU ld is being used.
if test "$with_gnu_ld" = yes; then
_LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
# If archive_cmds runs LD, not CC, wlarc should be empty
# XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
# investigate it a little bit more. (MM)
wlarc='${wl}'
# ancient GNU ld didn't support --whole-archive et. al.
if eval "`$CC -print-prog-name=ld` --help 2>&1" |
$GREP 'no-whole-archive' > /dev/null; then
_LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
else
_LT_TAGVAR(whole_archive_flag_spec, $1)=
fi
else
with_gnu_ld=no
wlarc=
# A generic and very simple default shared library creation
# command for GNU C++ for the case where it uses the native
# linker, instead of GNU ld. If possible, this setting should
# overridden to take advantage of the native linker features on
# the platform it is being used on.
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
fi
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
else
GXX=no
with_gnu_ld=no
wlarc=
fi
# PORTME: fill in a description of your system's C++ link characteristics
AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
_LT_TAGVAR(ld_shlibs, $1)=yes
case $host_os in
aix3*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
aix[[4-9]]*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
exp_sym_flag='-Bexport'
no_entry_flag=""
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
for ld_flag in $LDFLAGS; do
case $ld_flag in
*-brtl*)
aix_use_runtimelinking=yes
break
;;
esac
done
;;
esac
exp_sym_flag='-bexport'
no_entry_flag='-bnoentry'
fi
# When large executables or shared objects are built, AIX ld can
# have problems creating the table of contents. If linking a library
# or program results in "error TOC overflow" add -mminimal-toc to
# CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
# enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
_LT_TAGVAR(archive_cmds, $1)=''
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
if test "$GXX" = yes; then
case $host_os in aix4.[[012]]|aix4.[[012]].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" &&
strings "$collect2name" | $GREP resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
_LT_TAGVAR(hardcode_direct, $1)=unsupported
# It fails to find uninstalled libraries when the uninstalled
# path is not listed in the libpath. Setting hardcode_minus_L
# to unsupported forces relinking
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=
fi
esac
shared_flag='-shared'
if test "$aix_use_runtimelinking" = yes; then
shared_flag="$shared_flag "'${wl}-G'
fi
else
# not using gcc
if test "$host_cpu" = ia64; then
# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
# chokes on -Wl,-G. The following line is correct:
shared_flag='-G'
else
if test "$aix_use_runtimelinking" = yes; then
shared_flag='${wl}-G'
else
shared_flag='${wl}-bM:SRE'
fi
fi
fi
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
# It seems that -bexpall does not export symbols beginning with
# underscore (_), so it is better to generate a list of symbols to
# export.
_LT_TAGVAR(always_export_symbols, $1)=yes
if test "$aix_use_runtimelinking" = yes; then
# Warning - without using the other runtime loading flags (-brtl),
# -berok will link without error, but may produce a broken library.
_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
# Determine the default libpath from the value encoded in an empty
# executable.
_LT_SYS_MODULE_PATH_AIX([$1])
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
else
if test "$host_cpu" = ia64; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
_LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
_LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
else
# Determine the default libpath from the value encoded in an
# empty executable.
_LT_SYS_MODULE_PATH_AIX([$1])
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
# Warning - without using the other run time loading flags,
# -berok will link without error, but may produce a broken library.
_LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
if test "$with_gnu_ld" = yes; then
# We only use this code for GNU lds that support --whole-archive.
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
else
# Exported symbols can be pulled into shared objects from archives
_LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
# This is similar to how AIX traditionally builds its shared
# libraries.
_LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
fi
fi
;;
beos*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
# Joseph Beckenbach says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
chorus*)
case $cc_basename in
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
cygwin* | mingw* | pw32* | cegcc*)
case $GXX,$cc_basename in
,cl* | no,cl*)
# Native MSVC
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='@'
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=".dll"
# FIXME: Setting linknames here is a bad hack.
_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
$SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
else
$SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
fi~
$CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
linknames='
# The linker will not automatically build a static lib if we build a DLL.
# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
# Don't use ranlib
_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
lt_tool_outputfile="@TOOL_OUTPUT@"~
case $lt_outputfile in
*.exe|*.EXE) ;;
*)
lt_outputfile="$lt_outputfile.exe"
lt_tool_outputfile="$lt_tool_outputfile.exe"
;;
esac~
func_to_tool_file "$lt_outputfile"~
if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
$MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
$RM "$lt_outputfile.manifest";
fi'
;;
*)
# g++
# _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file (1st line
# is EXPORTS), use it as is; otherwise, prepend...
_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
cat $export_symbols >> $output_objdir/$soname.def;
fi~
$CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
darwin* | rhapsody*)
_LT_DARWIN_LINKER_FEATURES($1)
;;
dgux*)
case $cc_basename in
ec++*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
ghcx*)
# Green Hills C++ Compiler
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
freebsd2.*)
# C++ shared libraries reported to be fairly broken before
# switch to ELF
_LT_TAGVAR(ld_shlibs, $1)=no
;;
freebsd-elf*)
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
;;
freebsd* | dragonfly*)
# FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
# conventions
_LT_TAGVAR(ld_shlibs, $1)=yes
;;
gnu*)
;;
haiku*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
hpux9*)
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
# but as the default
# location of the library.
case $cc_basename in
CC*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
aCC*)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;;
*)
if test "$GXX" = yes; then
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
else
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
hpux10*|hpux11*)
if test $with_gnu_ld = no; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
case $host_cpu in
hppa*64*|ia64*)
;;
*)
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
;;
esac
fi
case $host_cpu in
hppa*64*|ia64*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
# but as the default
# location of the library.
;;
esac
case $cc_basename in
CC*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
aCC*)
case $host_cpu in
hppa*64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
ia64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
esac
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;;
*)
if test "$GXX" = yes; then
if test $with_gnu_ld = no; then
case $host_cpu in
hppa*64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
ia64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
esac
fi
else
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
interix[[3-9]]*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
# Instead, shared libraries are loaded at an image base (0x10000000 by
# default) and relocated if they conflict, which is a slow very memory
# consuming and fragmenting process. To avoid this, we pick a random,
# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
# time. Moving up from 0x10000000 also allows more sbrk(2) space.
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
;;
irix5* | irix6*)
case $cc_basename in
CC*)
# SGI C++
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
# Archives containing C++ object files must be created using
# "CC -ar", where "CC" is the IRIX C++ compiler. This is
# necessary to make sure instantiated templates are included
# in the archive.
_LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
;;
*)
if test "$GXX" = yes; then
if test "$with_gnu_ld" = no; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
else
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
fi
fi
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
esac
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(inherit_rpath, $1)=yes
;;
linux* | k*bsd*-gnu | kopensolaris*-gnu)
case $cc_basename in
KCC*)
# Kuck and Associates, Inc. (KAI) C++ Compiler
# KCC will only create a shared library if the output file
# ends with ".so" (or ".sl" for HP-UX), so rename the library
# to its proper name (with version) after linking.
_LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
# Archives containing C++ object files must be created using
# "CC -Bstatic", where "CC" is the KAI C++ compiler.
_LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
;;
icpc* | ecpc* )
# Intel C++
with_gnu_ld=yes
# version 8.0 and above of icpc choke on multiply defined symbols
# if we add $predep_objects and $postdep_objects, however 7.1 and
# earlier do not add the objects themselves.
case `$CC -V 2>&1` in
*"Version 7."*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
;;
*) # Version 8.0 or newer
tmp_idyn=
case $host_cpu in
ia64*) tmp_idyn=' -i_dynamic';;
esac
_LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
;;
esac
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
;;
pgCC* | pgcpp*)
# Portland Group C++ compiler
case `$CC -V` in
*pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
_LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
_LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
$RANLIB $oldlib'
_LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
;;
*) # Version 6 and above use weak symbols
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
;;
esac
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
;;
cxx*)
# Compaq C++
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
runpath_var=LD_RUN_PATH
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
;;
xl* | mpixl* | bgxl*)
# IBM XL 8.0 on PPC, with GNU ld
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
_LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
if test "x$supports_anon_versioning" = xyes; then
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
fi
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
# Sun C++ 5.9
_LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
_LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
_LT_TAGVAR(compiler_needs_object, $1)=yes
# Not sure whether something based on
# $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
# would be better.
output_verbose_link_cmd='func_echo_all'
# Archives containing C++ object files must be created using
# "CC -xar", where "CC" is the Sun C++ compiler. This is
# necessary to make sure instantiated templates are included
# in the archive.
_LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
;;
esac
;;
esac
;;
lynxos*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
m88k*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
mvs*)
case $cc_basename in
cxx*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
wlarc=
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
fi
# Workaround some broken pre-1.5 toolchains
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
;;
*nto* | *qnx*)
_LT_TAGVAR(ld_shlibs, $1)=yes
;;
openbsd2*)
# C++ shared libraries are fairly broken
_LT_TAGVAR(ld_shlibs, $1)=no
;;
openbsd*)
if test -f /usr/libexec/ld.so; then
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
_LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
fi
output_verbose_link_cmd=func_echo_all
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
osf3* | osf4* | osf5*)
case $cc_basename in
KCC*)
# Kuck and Associates, Inc. (KAI) C++ Compiler
# KCC will only create a shared library if the output file
# ends with ".so" (or ".sl" for HP-UX), so rename the library
# to its proper name (with version) after linking.
_LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
# Archives containing C++ object files must be created using
# the KAI C++ compiler.
case $host in
osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
esac
;;
RCC*)
# Rational C++ 2.4.1
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
cxx*)
case $host in
osf3*)
_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
;;
*)
_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
echo "-hidden">> $lib.exp~
$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
$RM $lib.exp'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
;;
esac
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;;
*)
if test "$GXX" = yes && test "$with_gnu_ld" = no; then
_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
case $host in
osf3*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
;;
esac
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
else
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
psos*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
sunos4*)
case $cc_basename in
CC*)
# Sun C++ 4.x
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
lcc*)
# Lucid
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
solaris*)
case $cc_basename in
CC* | sunCC*)
# Sun C++ 4.2, 5.x and Centerline C++
_LT_TAGVAR(archive_cmds_need_lc,$1)=yes
_LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
_LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
case $host_os in
solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
*)
# The compiler driver will combine and reorder linker options,
# but understands `-z linker_flag'.
# Supported since Solaris 2.6 (maybe 2.5.1?)
_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
;;
esac
_LT_TAGVAR(link_all_deplibs, $1)=yes
output_verbose_link_cmd='func_echo_all'
# Archives containing C++ object files must be created using
# "CC -xar", where "CC" is the Sun C++ compiler. This is
# necessary to make sure instantiated templates are included
# in the archive.
_LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
;;
gcx*)
# Green Hills C++ Compiler
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
# The C++ compiler must be used to create the archive.
_LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
;;
*)
# GNU C++ compiler with Solaris linker
if test "$GXX" = yes && test "$with_gnu_ld" = no; then
_LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
if $CC --version | $GREP -v '^2\.7' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
else
# g++ 2.7 appears to require `-G' NOT `-shared' on this
# platform.
_LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
case $host_os in
solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
*)
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
;;
esac
fi
;;
esac
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
runpath_var='LD_RUN_PATH'
case $cc_basename in
CC*)
_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
;;
sysv5* | sco3.2v5* | sco5v6*)
# Note: We can NOT use -z defs as we might desire, because we do not
# link with -lc, and that would cause any symbols used from libc to
# always be unresolved, which means just about no library would
# ever link correctly. If we're not using GNU ld we use -z text
# though, which does catch some bad symbols but isn't as heavy-handed
# as -z defs.
_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
runpath_var='LD_RUN_PATH'
case $cc_basename in
CC*)
_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
'"$_LT_TAGVAR(old_archive_cmds, $1)"
_LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
'"$_LT_TAGVAR(reload_cmds, $1)"
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
;;
tandem*)
case $cc_basename in
NCC*)
# NonStop-UX NCC 3.20
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
vxworks*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
_LT_TAGVAR(GCC, $1)="$GXX"
_LT_TAGVAR(LD, $1)="$LD"
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
_LT_SYS_HIDDEN_LIBDEPS($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_SYS_DYNAMIC_LINKER($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi # test -n "$compiler"
CC=$lt_save_CC
CFLAGS=$lt_save_CFLAGS
LDCXX=$LD
LD=$lt_save_LD
GCC=$lt_save_GCC
with_gnu_ld=$lt_save_with_gnu_ld
lt_cv_path_LDCXX=$lt_cv_path_LD
lt_cv_path_LD=$lt_save_path_LD
lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
fi # test "$_lt_caught_CXX_error" != yes
AC_LANG_POP
])# _LT_LANG_CXX_CONFIG
# _LT_FUNC_STRIPNAME_CNF
# ----------------------
# func_stripname_cnf prefix suffix name
# strip PREFIX and SUFFIX off of NAME.
# PREFIX and SUFFIX must not contain globbing or regex special
# characters, hashes, percent signs, but SUFFIX may contain a leading
# dot (in which case that matches only a dot).
#
# This function is identical to the (non-XSI) version of func_stripname,
# except this one can be used by m4 code that may be executed by configure,
# rather than the libtool script.
m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
AC_REQUIRE([_LT_DECL_SED])
AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
func_stripname_cnf ()
{
case ${2} in
.*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
esac
} # func_stripname_cnf
])# _LT_FUNC_STRIPNAME_CNF
# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
# ---------------------------------
# Figure out "hidden" library dependencies from verbose
# compiler output when linking a shared library.
# Parse the compiler output and extract the necessary
# objects, libraries and library flags.
m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
# Dependencies to place before and after the object being linked:
_LT_TAGVAR(predep_objects, $1)=
_LT_TAGVAR(postdep_objects, $1)=
_LT_TAGVAR(predeps, $1)=
_LT_TAGVAR(postdeps, $1)=
_LT_TAGVAR(compiler_lib_search_path, $1)=
dnl we can't use the lt_simple_compile_test_code here,
dnl because it contains code intended for an executable,
dnl not a library. It's possible we should let each
dnl tag define a new lt_????_link_test_code variable,
dnl but it's only used here...
m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
int a;
void foo (void) { a = 0; }
_LT_EOF
], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
class Foo
{
public:
Foo (void) { a = 0; }
private:
int a;
};
_LT_EOF
], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
subroutine foo
implicit none
integer*4 a
a=0
return
end
_LT_EOF
], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
subroutine foo
implicit none
integer a
a=0
return
end
_LT_EOF
], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
public class foo {
private int a;
public void bar (void) {
a = 0;
}
};
_LT_EOF
], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
package foo
func foo() {
}
_LT_EOF
])
_lt_libdeps_save_CFLAGS=$CFLAGS
case "$CC $CFLAGS " in #(
*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
esac
dnl Parse the compiler output and extract the necessary
dnl objects, libraries and library flags.
if AC_TRY_EVAL(ac_compile); then
# Parse the compiler output and extract the necessary
# objects, libraries and library flags.
# Sentinel used to keep track of whether or not we are before
# the conftest object file.
pre_test_object_deps_done=no
for p in `eval "$output_verbose_link_cmd"`; do
case ${prev}${p} in
-L* | -R* | -l*)
# Some compilers place space between "-{L,R}" and the path.
# Remove the space.
if test $p = "-L" ||
test $p = "-R"; then
prev=$p
continue
fi
# Expand the sysroot to ease extracting the directories later.
if test -z "$prev"; then
case $p in
-L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
-R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
-l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
esac
fi
case $p in
=*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
esac
if test "$pre_test_object_deps_done" = no; then
case ${prev} in
-L | -R)
# Internal compiler library paths should come after those
# provided the user. The postdeps already come after the
# user supplied libs so there is no need to process them.
if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
_LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
else
_LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
fi
;;
# The "-l" case would never come before the object being
# linked, so don't bother handling this case.
esac
else
if test -z "$_LT_TAGVAR(postdeps, $1)"; then
_LT_TAGVAR(postdeps, $1)="${prev}${p}"
else
_LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
fi
fi
prev=
;;
*.lto.$objext) ;; # Ignore GCC LTO objects
*.$objext)
# This assumes that the test object file only shows up
# once in the compiler output.
if test "$p" = "conftest.$objext"; then
pre_test_object_deps_done=yes
continue
fi
if test "$pre_test_object_deps_done" = no; then
if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
_LT_TAGVAR(predep_objects, $1)="$p"
else
_LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
fi
else
if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
_LT_TAGVAR(postdep_objects, $1)="$p"
else
_LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
fi
fi
;;
*) ;; # Ignore the rest.
esac
done
# Clean up.
rm -f a.out a.exe
else
echo "libtool.m4: error: problem compiling $1 test program"
fi
$RM -f confest.$objext
CFLAGS=$_lt_libdeps_save_CFLAGS
# PORTME: override above test on systems where it is broken
m4_if([$1], [CXX],
[case $host_os in
interix[[3-9]]*)
# Interix 3.5 installs completely hosed .la files for C++, so rather than
# hack all around it, let's just trust "g++" to DTRT.
_LT_TAGVAR(predep_objects,$1)=
_LT_TAGVAR(postdep_objects,$1)=
_LT_TAGVAR(postdeps,$1)=
;;
linux*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
# Sun C++ 5.9
# The more standards-conforming stlport4 library is
# incompatible with the Cstd library. Avoid specifying
# it if it's in CXXFLAGS. Ignore libCrun as
# -library=stlport4 depends on it.
case " $CXX $CXXFLAGS " in
*" -library=stlport4 "*)
solaris_use_stlport4=yes
;;
esac
if test "$solaris_use_stlport4" != yes; then
_LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
fi
;;
esac
;;
solaris*)
case $cc_basename in
CC* | sunCC*)
# The more standards-conforming stlport4 library is
# incompatible with the Cstd library. Avoid specifying
# it if it's in CXXFLAGS. Ignore libCrun as
# -library=stlport4 depends on it.
case " $CXX $CXXFLAGS " in
*" -library=stlport4 "*)
solaris_use_stlport4=yes
;;
esac
# Adding this requires a known-good setup of shared libraries for
# Sun compiler versions before 5.6, else PIC objects from an old
# archive will be linked into the output, leading to subtle bugs.
if test "$solaris_use_stlport4" != yes; then
_LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
fi
;;
esac
;;
esac
])
case " $_LT_TAGVAR(postdeps, $1) " in
*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
esac
_LT_TAGVAR(compiler_lib_search_dirs, $1)=
if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
_LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
fi
_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
[The directories searched by this compiler when creating a shared library])
_LT_TAGDECL([], [predep_objects], [1],
[Dependencies to place before and after the objects being linked to
create a shared library])
_LT_TAGDECL([], [postdep_objects], [1])
_LT_TAGDECL([], [predeps], [1])
_LT_TAGDECL([], [postdeps], [1])
_LT_TAGDECL([], [compiler_lib_search_path], [1],
[The library search path used internally by the compiler when linking
a shared library])
])# _LT_SYS_HIDDEN_LIBDEPS
# _LT_LANG_F77_CONFIG([TAG])
# --------------------------
# Ensure that the configuration variables for a Fortran 77 compiler are
# suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to `libtool'.
m4_defun([_LT_LANG_F77_CONFIG],
[AC_LANG_PUSH(Fortran 77)
if test -z "$F77" || test "X$F77" = "Xno"; then
_lt_disable_F77=yes
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(archive_expsym_cmds, $1)=
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(inherit_rpath, $1)=no
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
_LT_TAGVAR(reload_flag, $1)=$reload_flag
_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
_LT_TAGVAR(no_undefined_flag, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
# Source file extension for f77 test sources.
ac_ext=f
# Object file extension for compiled f77 test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# No sense in running all these tests if we already determined that
# the F77 compiler isn't working. Some variables (like enable_shared)
# are currently assumed to apply to all compilers on this platform,
# and will be corrupted by setting them based on a non-working compiler.
if test "$_lt_disable_F77" != yes; then
# Code to be used in simple compile tests
lt_simple_compile_test_code="\
subroutine t
return
end
"
# Code to be used in simple link tests
lt_simple_link_test_code="\
program t
end
"
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
lt_save_GCC=$GCC
lt_save_CFLAGS=$CFLAGS
CC=${F77-"f77"}
CFLAGS=$FFLAGS
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_CC_BASENAME([$compiler])
GCC=$G77
if test -n "$compiler"; then
AC_MSG_CHECKING([if libtool supports shared libraries])
AC_MSG_RESULT([$can_build_shared])
AC_MSG_CHECKING([whether to build shared libraries])
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
case $host_os in
aix3*)
test "$enable_shared" = yes && enable_static=no
if test -n "$RANLIB"; then
archive_cmds="$archive_cmds~\$RANLIB \$lib"
postinstall_cmds='$RANLIB $lib'
fi
;;
aix[[4-9]]*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
;;
esac
AC_MSG_RESULT([$enable_shared])
AC_MSG_CHECKING([whether to build static libraries])
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
AC_MSG_RESULT([$enable_static])
_LT_TAGVAR(GCC, $1)="$G77"
_LT_TAGVAR(LD, $1)="$LD"
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_SYS_DYNAMIC_LINKER($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi # test -n "$compiler"
GCC=$lt_save_GCC
CC="$lt_save_CC"
CFLAGS="$lt_save_CFLAGS"
fi # test "$_lt_disable_F77" != yes
AC_LANG_POP
])# _LT_LANG_F77_CONFIG
# _LT_LANG_FC_CONFIG([TAG])
# -------------------------
# Ensure that the configuration variables for a Fortran compiler are
# suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to `libtool'.
m4_defun([_LT_LANG_FC_CONFIG],
[AC_LANG_PUSH(Fortran)
if test -z "$FC" || test "X$FC" = "Xno"; then
_lt_disable_FC=yes
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(archive_expsym_cmds, $1)=
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(inherit_rpath, $1)=no
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
_LT_TAGVAR(reload_flag, $1)=$reload_flag
_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
_LT_TAGVAR(no_undefined_flag, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
# Source file extension for fc test sources.
ac_ext=${ac_fc_srcext-f}
# Object file extension for compiled fc test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# No sense in running all these tests if we already determined that
# the FC compiler isn't working. Some variables (like enable_shared)
# are currently assumed to apply to all compilers on this platform,
# and will be corrupted by setting them based on a non-working compiler.
if test "$_lt_disable_FC" != yes; then
# Code to be used in simple compile tests
lt_simple_compile_test_code="\
subroutine t
return
end
"
# Code to be used in simple link tests
lt_simple_link_test_code="\
program t
end
"
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
lt_save_GCC=$GCC
lt_save_CFLAGS=$CFLAGS
CC=${FC-"f95"}
CFLAGS=$FCFLAGS
compiler=$CC
GCC=$ac_cv_fc_compiler_gnu
_LT_TAGVAR(compiler, $1)=$CC
_LT_CC_BASENAME([$compiler])
if test -n "$compiler"; then
AC_MSG_CHECKING([if libtool supports shared libraries])
AC_MSG_RESULT([$can_build_shared])
AC_MSG_CHECKING([whether to build shared libraries])
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
case $host_os in
aix3*)
test "$enable_shared" = yes && enable_static=no
if test -n "$RANLIB"; then
archive_cmds="$archive_cmds~\$RANLIB \$lib"
postinstall_cmds='$RANLIB $lib'
fi
;;
aix[[4-9]]*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
;;
esac
AC_MSG_RESULT([$enable_shared])
AC_MSG_CHECKING([whether to build static libraries])
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
AC_MSG_RESULT([$enable_static])
_LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
_LT_TAGVAR(LD, $1)="$LD"
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
_LT_SYS_HIDDEN_LIBDEPS($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_SYS_DYNAMIC_LINKER($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi # test -n "$compiler"
GCC=$lt_save_GCC
CC=$lt_save_CC
CFLAGS=$lt_save_CFLAGS
fi # test "$_lt_disable_FC" != yes
AC_LANG_POP
])# _LT_LANG_FC_CONFIG
# _LT_LANG_GCJ_CONFIG([TAG])
# --------------------------
# Ensure that the configuration variables for the GNU Java Compiler compiler
# are suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to `libtool'.
m4_defun([_LT_LANG_GCJ_CONFIG],
[AC_REQUIRE([LT_PROG_GCJ])dnl
AC_LANG_SAVE
# Source file extension for Java test sources.
ac_ext=java
# Object file extension for compiled Java test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
lt_simple_compile_test_code="class foo {}"
# Code to be used in simple link tests
lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC=$CC
lt_save_CFLAGS=$CFLAGS
lt_save_GCC=$GCC
GCC=yes
CC=${GCJ-"gcj"}
CFLAGS=$GCJFLAGS
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_TAGVAR(LD, $1)="$LD"
_LT_CC_BASENAME([$compiler])
# GCJ did not exist at the time GCC didn't implicitly link libc in.
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
_LT_TAGVAR(reload_flag, $1)=$reload_flag
_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
if test -n "$compiler"; then
_LT_COMPILER_NO_RTTI($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi
AC_LANG_RESTORE
GCC=$lt_save_GCC
CC=$lt_save_CC
CFLAGS=$lt_save_CFLAGS
])# _LT_LANG_GCJ_CONFIG
# _LT_LANG_GO_CONFIG([TAG])
# --------------------------
# Ensure that the configuration variables for the GNU Go compiler
# are suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to `libtool'.
m4_defun([_LT_LANG_GO_CONFIG],
[AC_REQUIRE([LT_PROG_GO])dnl
AC_LANG_SAVE
# Source file extension for Go test sources.
ac_ext=go
# Object file extension for compiled Go test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
lt_simple_compile_test_code="package main; func main() { }"
# Code to be used in simple link tests
lt_simple_link_test_code='package main; func main() { }'
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC=$CC
lt_save_CFLAGS=$CFLAGS
lt_save_GCC=$GCC
GCC=yes
CC=${GOC-"gccgo"}
CFLAGS=$GOFLAGS
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_TAGVAR(LD, $1)="$LD"
_LT_CC_BASENAME([$compiler])
# Go did not exist at the time GCC didn't implicitly link libc in.
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
_LT_TAGVAR(reload_flag, $1)=$reload_flag
_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
if test -n "$compiler"; then
_LT_COMPILER_NO_RTTI($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi
AC_LANG_RESTORE
GCC=$lt_save_GCC
CC=$lt_save_CC
CFLAGS=$lt_save_CFLAGS
])# _LT_LANG_GO_CONFIG
# _LT_LANG_RC_CONFIG([TAG])
# -------------------------
# Ensure that the configuration variables for the Windows resource compiler
# are suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to `libtool'.
m4_defun([_LT_LANG_RC_CONFIG],
[AC_REQUIRE([LT_PROG_RC])dnl
AC_LANG_SAVE
# Source file extension for RC test sources.
ac_ext=rc
# Object file extension for compiled RC test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
# Code to be used in simple link tests
lt_simple_link_test_code="$lt_simple_compile_test_code"
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
lt_save_CFLAGS=$CFLAGS
lt_save_GCC=$GCC
GCC=
CC=${RC-"windres"}
CFLAGS=
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_CC_BASENAME([$compiler])
_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
if test -n "$compiler"; then
:
_LT_CONFIG($1)
fi
GCC=$lt_save_GCC
AC_LANG_RESTORE
CC=$lt_save_CC
CFLAGS=$lt_save_CFLAGS
])# _LT_LANG_RC_CONFIG
# LT_PROG_GCJ
# -----------
AC_DEFUN([LT_PROG_GCJ],
[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
[m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
[AC_CHECK_TOOL(GCJ, gcj,)
test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
AC_SUBST(GCJFLAGS)])])[]dnl
])
# Old name:
AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
# LT_PROG_GO
# ----------
AC_DEFUN([LT_PROG_GO],
[AC_CHECK_TOOL(GOC, gccgo,)
])
# LT_PROG_RC
# ----------
AC_DEFUN([LT_PROG_RC],
[AC_CHECK_TOOL(RC, windres,)
])
# Old name:
AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([LT_AC_PROG_RC], [])
# _LT_DECL_EGREP
# --------------
# If we don't have a new enough Autoconf to choose the best grep
# available, choose the one first in the user's PATH.
m4_defun([_LT_DECL_EGREP],
[AC_REQUIRE([AC_PROG_EGREP])dnl
AC_REQUIRE([AC_PROG_FGREP])dnl
test -z "$GREP" && GREP=grep
_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
_LT_DECL([], [EGREP], [1], [An ERE matcher])
_LT_DECL([], [FGREP], [1], [A literal string matcher])
dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
AC_SUBST([GREP])
])
# _LT_DECL_OBJDUMP
# --------------
# If we don't have a new enough Autoconf to choose the best objdump
# available, choose the one first in the user's PATH.
m4_defun([_LT_DECL_OBJDUMP],
[AC_CHECK_TOOL(OBJDUMP, objdump, false)
test -z "$OBJDUMP" && OBJDUMP=objdump
_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
AC_SUBST([OBJDUMP])
])
# _LT_DECL_DLLTOOL
# ----------------
# Ensure DLLTOOL variable is set.
m4_defun([_LT_DECL_DLLTOOL],
[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
test -z "$DLLTOOL" && DLLTOOL=dlltool
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
AC_SUBST([DLLTOOL])
])
# _LT_DECL_SED
# ------------
# Check for a fully-functional sed program, that truncates
# as few characters as possible. Prefer GNU sed if found.
m4_defun([_LT_DECL_SED],
[AC_PROG_SED
test -z "$SED" && SED=sed
Xsed="$SED -e 1s/^X//"
_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
[Sed that helps us avoid accidentally triggering echo(1) options like -n])
])# _LT_DECL_SED
m4_ifndef([AC_PROG_SED], [
############################################################
# NOTE: This macro has been submitted for inclusion into #
# GNU Autoconf as AC_PROG_SED. When it is available in #
# a released version of Autoconf we should remove this #
# macro and use it instead. #
############################################################
m4_defun([AC_PROG_SED],
[AC_MSG_CHECKING([for a sed that does not truncate output])
AC_CACHE_VAL(lt_cv_path_SED,
[# Loop through the user's path and test for sed and gsed.
# Then use that list of sed's as ones to test for truncation.
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for lt_ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
fi
done
done
done
IFS=$as_save_IFS
lt_ac_max=0
lt_ac_count=0
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
# along with /bin/sed that truncates output.
for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
test ! -f $lt_ac_sed && continue
cat /dev/null > conftest.in
lt_ac_count=0
echo $ECHO_N "0123456789$ECHO_C" >conftest.in
# Check for GNU sed and select it if it is found.
if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
lt_cv_path_SED=$lt_ac_sed
break
fi
while true; do
cat conftest.in conftest.in >conftest.tmp
mv conftest.tmp conftest.in
cp conftest.in conftest.nl
echo >>conftest.nl
$lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
cmp -s conftest.out conftest.nl || break
# 10000 chars as input seems more than enough
test $lt_ac_count -gt 10 && break
lt_ac_count=`expr $lt_ac_count + 1`
if test $lt_ac_count -gt $lt_ac_max; then
lt_ac_max=$lt_ac_count
lt_cv_path_SED=$lt_ac_sed
fi
done
done
])
SED=$lt_cv_path_SED
AC_SUBST([SED])
AC_MSG_RESULT([$SED])
])#AC_PROG_SED
])#m4_ifndef
# Old name:
AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([LT_AC_PROG_SED], [])
# _LT_CHECK_SHELL_FEATURES
# ------------------------
# Find out whether the shell is Bourne or XSI compatible,
# or has some other useful features.
m4_defun([_LT_CHECK_SHELL_FEATURES],
[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
# Try some XSI features
xsi_shell=no
( _lt_dummy="a/b/c"
test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
= c,a/b,b/c, \
&& eval 'test $(( 1 + 1 )) -eq 2 \
&& test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
&& xsi_shell=yes
AC_MSG_RESULT([$xsi_shell])
_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
AC_MSG_CHECKING([whether the shell understands "+="])
lt_shell_append=no
( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
>/dev/null 2>&1 \
&& lt_shell_append=yes
AC_MSG_RESULT([$lt_shell_append])
_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
lt_unset=unset
else
lt_unset=false
fi
_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
# test EBCDIC or ASCII
case `echo X|tr X '\101'` in
A) # ASCII based system
# \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
lt_SP2NL='tr \040 \012'
lt_NL2SP='tr \015\012 \040\040'
;;
*) # EBCDIC based system
lt_SP2NL='tr \100 \n'
lt_NL2SP='tr \r\n \100\100'
;;
esac
_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
])# _LT_CHECK_SHELL_FEATURES
# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
# ------------------------------------------------------
# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
m4_defun([_LT_PROG_FUNCTION_REPLACE],
[dnl {
sed -e '/^$1 ()$/,/^} # $1 /c\
$1 ()\
{\
m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1])
} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
])
# _LT_PROG_REPLACE_SHELLFNS
# -------------------------
# Replace existing portable implementations of several shell functions with
# equivalent extended shell implementations where those features are available..
m4_defun([_LT_PROG_REPLACE_SHELLFNS],
[if test x"$xsi_shell" = xyes; then
_LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
case ${1} in
*/*) func_dirname_result="${1%/*}${2}" ;;
* ) func_dirname_result="${3}" ;;
esac])
_LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
func_basename_result="${1##*/}"])
_LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
case ${1} in
*/*) func_dirname_result="${1%/*}${2}" ;;
* ) func_dirname_result="${3}" ;;
esac
func_basename_result="${1##*/}"])
_LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
# pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
# positional parameters, so assign one to ordinary parameter first.
func_stripname_result=${3}
func_stripname_result=${func_stripname_result#"${1}"}
func_stripname_result=${func_stripname_result%"${2}"}])
_LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
func_split_long_opt_name=${1%%=*}
func_split_long_opt_arg=${1#*=}])
_LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
func_split_short_opt_arg=${1#??}
func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
_LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
case ${1} in
*.lo) func_lo2o_result=${1%.lo}.${objext} ;;
*) func_lo2o_result=${1} ;;
esac])
_LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo])
_LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))])
_LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}])
fi
if test x"$lt_shell_append" = xyes; then
_LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"])
_LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
func_quote_for_eval "${2}"
dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
# Save a `func_append' function call where possible by direct use of '+='
sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
else
# Save a `func_append' function call even when '+=' is not available
sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
fi
if test x"$_lt_function_replace_fail" = x":"; then
AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
fi
])
# _LT_PATH_CONVERSION_FUNCTIONS
# -----------------------------
# Determine which file name conversion functions should be used by
# func_to_host_file (and, implicitly, by func_to_host_path). These are needed
# for certain cross-compile configurations and native mingw.
m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_MSG_CHECKING([how to convert $build file names to $host format])
AC_CACHE_VAL(lt_cv_to_host_file_cmd,
[case $host in
*-*-mingw* )
case $build in
*-*-mingw* ) # actually msys
lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
;;
*-*-cygwin* )
lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
;;
* ) # otherwise, assume *nix
lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
;;
esac
;;
*-*-cygwin* )
case $build in
*-*-mingw* ) # actually msys
lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
;;
*-*-cygwin* )
lt_cv_to_host_file_cmd=func_convert_file_noop
;;
* ) # otherwise, assume *nix
lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
;;
esac
;;
* ) # unhandled hosts (and "normal" native builds)
lt_cv_to_host_file_cmd=func_convert_file_noop
;;
esac
])
to_host_file_cmd=$lt_cv_to_host_file_cmd
AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
[0], [convert $build file names to $host format])dnl
AC_MSG_CHECKING([how to convert $build file names to toolchain format])
AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
[#assume ordinary cross tools, or native build.
lt_cv_to_tool_file_cmd=func_convert_file_noop
case $host in
*-*-mingw* )
case $build in
*-*-mingw* ) # actually msys
lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
;;
esac
;;
esac
])
to_tool_file_cmd=$lt_cv_to_tool_file_cmd
AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
[0], [convert $build files to toolchain format])dnl
])# _LT_PATH_CONVERSION_FUNCTIONS
opendnssec-1.4.3/m4/lt~obsolete.m4 0000644 0001750 0001750 00000013756 12247571127 013761 0000000 0000000 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 5 lt~obsolete.m4
# These exist entirely to fool aclocal when bootstrapping libtool.
#
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
# which have later been changed to m4_define as they aren't part of the
# exported API, or moved to Autoconf or Automake where they belong.
#
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
# using a macro with the same name in our local m4/libtool.m4 it'll
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
# and doesn't know about Autoconf macros at all.)
#
# So we provide this file, which has a silly filename so it's always
# included after everything else. This provides aclocal with the
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
# because those macros already exist, or will be overwritten later.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
#
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
# Yes, that means every name once taken will need to remain here until
# we give up compatibility with versions before 1.7, at which point
# we need to keep only those names which we still refer to.
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
opendnssec-1.4.3/m4/acx_strict.m4 0000664 0001750 0001750 00000000463 11410415234 013526 0000000 0000000 # $Id: acx_strict.m4 3535 2010-06-23 14:30:52Z jakob $
AC_DEFUN([ACX_STRICT],[
AC_ARG_ENABLE(
[strict],
[AS_HELP_STRING([--enable-strict],[enable strict compile mode @<:@enabled@:>@])],
,
[enable_strict="yes"]
)
if test "${enable_strict}" = "yes"; then
CFLAGS="${CFLAGS} -Wall -Wextra"
fi
])
opendnssec-1.4.3/m4/acx_prefixhack.m4 0000664 0001750 0001750 00000001240 11251406661 014343 0000000 0000000 # $Id: acx_prefixhack.m4 1777 2009-09-08 07:54:25Z jakob $
#
# Special processing of paths depending on whether --prefix,
# --sysconfdir or --localstatedir arguments were given.
AC_DEFUN([ACX_PREFIXHACK],[
case "$prefix" in
NONE)
case "$sysconfdir" in
'${prefix}/etc')
sysconfdir=/etc
ac_configure_args="$ac_configure_args --sysconfdir=$sysconfdir"
AC_MSG_NOTICE([sysconfdir set to $sysconfdir])
;;
esac
case "$localstatedir" in
'${prefix}/var')
localstatedir=/var
ac_configure_args="$ac_configure_args --localstatedir=$localstatedir"
AC_MSG_NOTICE([localstate set to $localstatedir])
;;
esac
;;
esac
])
opendnssec-1.4.3/m4/acx_libc.m4 0000664 0001750 0001750 00000000214 11763104736 013136 0000000 0000000 # $Id: acx_rt.m4 3626 2010-07-27 12:23:29Z rb $
AC_DEFUN([ACX_LIBC],[
C_LIBS="-lc"
# some checks could go in here
AC_SUBST(C_LIBS)
])
opendnssec-1.4.3/m4/ltoptions.m4 0000644 0001750 0001750 00000030073 12247571127 013431 0000000 0000000 # Helper functions for option handling. -*- Autoconf -*-
#
# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 7 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
# ------------------------------------------
m4_define([_LT_MANGLE_OPTION],
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
# ---------------------------------------
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
# saved as a flag.
m4_define([_LT_SET_OPTION],
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
_LT_MANGLE_DEFUN([$1], [$2]),
[m4_warning([Unknown $1 option `$2'])])[]dnl
])
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
# ------------------------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
m4_define([_LT_IF_OPTION],
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
# -------------------------------------------------------
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
# are set.
m4_define([_LT_UNLESS_OPTIONS],
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
[m4_define([$0_found])])])[]dnl
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
])[]dnl
])
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
# ----------------------------------------
# OPTION-LIST is a space-separated list of Libtool options associated
# with MACRO-NAME. If any OPTION has a matching handler declared with
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
# the unknown option and exit.
m4_defun([_LT_SET_OPTIONS],
[# Set options
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[_LT_SET_OPTION([$1], _LT_Option)])
m4_if([$1],[LT_INIT],[
dnl
dnl Simply set some default values (i.e off) if boolean options were not
dnl specified:
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
])
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
])
dnl
dnl If no reference was made to various pairs of opposing options, then
dnl we run the default mode handler for the pair. For example, if neither
dnl `shared' nor `disable-shared' was passed, we enable building of shared
dnl archives by default:
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
[_LT_ENABLE_FAST_INSTALL])
])
])# _LT_SET_OPTIONS
## --------------------------------- ##
## Macros to handle LT_INIT options. ##
## --------------------------------- ##
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
# -----------------------------------------
m4_define([_LT_MANGLE_DEFUN],
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
# -----------------------------------------------
m4_define([LT_OPTION_DEFINE],
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
])# LT_OPTION_DEFINE
# dlopen
# ------
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
])
AU_DEFUN([AC_LIBTOOL_DLOPEN],
[_LT_SET_OPTION([LT_INIT], [dlopen])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `dlopen' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
# win32-dll
# ---------
# Declare package support for building win32 dll's.
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
esac
test -z "$AS" && AS=as
_LT_DECL([], [AS], [1], [Assembler program])dnl
test -z "$DLLTOOL" && DLLTOOL=dlltool
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
test -z "$OBJDUMP" && OBJDUMP=objdump
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
])# win32-dll
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
_LT_SET_OPTION([LT_INIT], [win32-dll])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `win32-dll' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
# _LT_ENABLE_SHARED([DEFAULT])
# ----------------------------
# implement the --enable-shared flag, and supports the `shared' and
# `disable-shared' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_SHARED],
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
_LT_DECL([build_libtool_libs], [enable_shared], [0],
[Whether or not to build shared libraries])
])# _LT_ENABLE_SHARED
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
# Old names:
AC_DEFUN([AC_ENABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
])
AC_DEFUN([AC_DISABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], [disable-shared])
])
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
# _LT_ENABLE_STATIC([DEFAULT])
# ----------------------------
# implement the --enable-static flag, and support the `static' and
# `disable-static' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_STATIC],
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
_LT_DECL([build_old_libs], [enable_static], [0],
[Whether or not to build static libraries])
])# _LT_ENABLE_STATIC
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
# Old names:
AC_DEFUN([AC_ENABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
])
AC_DEFUN([AC_DISABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], [disable-static])
])
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
# ----------------------------------
# implement the --enable-fast-install flag, and support the `fast-install'
# and `disable-fast-install' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_FAST_INSTALL],
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([fast-install],
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
_LT_DECL([fast_install], [enable_fast_install], [0],
[Whether or not to optimize for fast installation])dnl
])# _LT_ENABLE_FAST_INSTALL
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
# Old names:
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the `fast-install' option into LT_INIT's first parameter.])
])
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the `disable-fast-install' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
# LT_INIT options.
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for lt_pkg in $withval; do
IFS="$lt_save_ifs"
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[pic_mode=default])
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
# Old name:
AU_DEFUN([AC_LIBTOOL_PICMODE],
[_LT_SET_OPTION([LT_INIT], [pic-only])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `pic-only' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
## ----------------- ##
## LTDL_INIT Options ##
## ----------------- ##
m4_define([_LTDL_MODE], [])
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
[m4_define([_LTDL_MODE], [nonrecursive])])
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
[m4_define([_LTDL_MODE], [recursive])])
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
[m4_define([_LTDL_MODE], [subproject])])
m4_define([_LTDL_TYPE], [])
LT_OPTION_DEFINE([LTDL_INIT], [installable],
[m4_define([_LTDL_TYPE], [installable])])
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
[m4_define([_LTDL_TYPE], [convenience])])
opendnssec-1.4.3/libhsm/ 0000775 0001750 0001750 00000000000 12247571202 012143 5 0000000 0000000 opendnssec-1.4.3/libhsm/checks/ 0000775 0001750 0001750 00000000000 12247571202 013403 5 0000000 0000000 opendnssec-1.4.3/libhsm/checks/conf-multi.xml 0000664 0001750 0001750 00000000757 12247571176 016145 0000000 0000000
/usr/local/lib/softhsm/libsofthsm.so
softHSM
123456
/usr/local/lib/softhsm/libsofthsm.so
xyzzy
123456
opendnssec-1.4.3/libhsm/checks/softhsm.conf 0000664 0001750 0001750 00000000122 11216120322 015634 0000000 0000000 # $Id: softhsm.conf 1030 2009-06-17 07:52:50Z jakob $
0:token.db
1:othertoken.db
opendnssec-1.4.3/libhsm/checks/conf-sca6000.xml 0000664 0001750 0001750 00000000512 12247571176 016054 0000000 0000000
/usr/lib/libpkcs11.so
OpenDNSSEC
test:1234
opendnssec-1.4.3/libhsm/checks/Makefile.in 0000664 0001750 0001750 00000050521 12247571137 015402 0000000 0000000 # Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# $Id: Makefile.am 6603 2012-09-04 10:16:09Z matthijs $
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
noinst_PROGRAMS = hsmcheck$(EXEEXT)
subdir = libhsm/checks
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/conf-aepkeyper.xml.in $(srcdir)/conf-etoken.xml.in \
$(srcdir)/conf-multi.xml.in $(srcdir)/conf-ncipher.xml.in \
$(srcdir)/conf-opensc.xml.in $(srcdir)/conf-sca6000.xml.in \
$(srcdir)/conf-softhsm.xml.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_broken_setres.m4 \
$(top_srcdir)/m4/acx_check_strptime.m4 \
$(top_srcdir)/m4/acx_cunit.m4 \
$(top_srcdir)/m4/acx_database_backend.m4 \
$(top_srcdir)/m4/acx_dbparams.m4 \
$(top_srcdir)/m4/acx_dlopen.m4 $(top_srcdir)/m4/acx_ldns.m4 \
$(top_srcdir)/m4/acx_libc.m4 $(top_srcdir)/m4/acx_libxml2.m4 \
$(top_srcdir)/m4/acx_mysql.m4 $(top_srcdir)/m4/acx_pedantic.m4 \
$(top_srcdir)/m4/acx_pkcs11_modules.m4 \
$(top_srcdir)/m4/acx_prefixhack.m4 \
$(top_srcdir)/m4/acx_rpath.m4 $(top_srcdir)/m4/acx_rt.m4 \
$(top_srcdir)/m4/acx_sqlite3.m4 $(top_srcdir)/m4/acx_ssl.m4 \
$(top_srcdir)/m4/acx_strict.m4 \
$(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/check_compiler_flag.m4 \
$(top_srcdir)/m4/check_compiler_flag_needed.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/opendnssec_common.m4 $(top_srcdir)/version.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/common/config.h
CONFIG_CLEAN_FILES = conf-softhsm.xml conf-sca6000.xml conf-etoken.xml \
conf-multi.xml conf-opensc.xml conf-ncipher.xml \
conf-aepkeyper.xml
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
hsmcheck_SOURCES = hsmcheck.c
hsmcheck_OBJECTS = hsmcheck.$(OBJEXT)
hsmcheck_DEPENDENCIES = ../src/lib/libhsm.a $(LIBCOMPAT)
hsmcheck_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hsmcheck_LDFLAGS) \
$(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = hsmcheck.c
DIST_SOURCES = hsmcheck.c
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CUCUMBER = @CUCUMBER@
CUNIT_INCLUDES = @CUNIT_INCLUDES@
CUNIT_LIBS = @CUNIT_LIBS@
CYGPATH_W = @CYGPATH_W@
C_LIBS = @C_LIBS@
DB_HOST = @DB_HOST@
DB_INCLUDES = @DB_INCLUDES@
DB_LIBS = @DB_LIBS@
DB_NAME = @DB_NAME@
DB_PASS = @DB_PASS@
DB_PORT = @DB_PORT@
DB_TYPE = @DB_TYPE@
DB_USER = @DB_USER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_SSL = @HAVE_SSL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVA = @JAVA@
LD = @LD@
LDFLAGS = @LDFLAGS@
LDNS_CONFIG = @LDNS_CONFIG@
LDNS_INCLUDES = @LDNS_INCLUDES@
LDNS_LIBS = @LDNS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MYSQL = @MYSQL@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_INCLUDES = @MYSQL_INCLUDES@
MYSQL_LIBS = @MYSQL_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENDNSSEC_BIN_DIR = @OPENDNSSEC_BIN_DIR@
OPENDNSSEC_CONFIG_DIR = @OPENDNSSEC_CONFIG_DIR@
OPENDNSSEC_CONFIG_FILE = @OPENDNSSEC_CONFIG_FILE@
OPENDNSSEC_DATA_DIR = @OPENDNSSEC_DATA_DIR@
OPENDNSSEC_ENFORCER_PIDFILE = @OPENDNSSEC_ENFORCER_PIDFILE@
OPENDNSSEC_FETCH_PIDFILE = @OPENDNSSEC_FETCH_PIDFILE@
OPENDNSSEC_LIBEXEC_DIR = @OPENDNSSEC_LIBEXEC_DIR@
OPENDNSSEC_LIB_DIR = @OPENDNSSEC_LIB_DIR@
OPENDNSSEC_LOCALSTATE_DIR = @OPENDNSSEC_LOCALSTATE_DIR@
OPENDNSSEC_PID_DIR = @OPENDNSSEC_PID_DIR@
OPENDNSSEC_SBIN_DIR = @OPENDNSSEC_SBIN_DIR@
OPENDNSSEC_SCHEMA_DIR = @OPENDNSSEC_SCHEMA_DIR@
OPENDNSSEC_SIGNER_CLI = @OPENDNSSEC_SIGNER_CLI@
OPENDNSSEC_SIGNER_ENGINE = @OPENDNSSEC_SIGNER_ENGINE@
OPENDNSSEC_SIGNER_PIDFILE = @OPENDNSSEC_SIGNER_PIDFILE@
OPENDNSSEC_SIGNER_SOCKET = @OPENDNSSEC_SIGNER_SOCKET@
OPENDNSSEC_STATE_DIR = @OPENDNSSEC_STATE_DIR@
OPENDNSSEC_SYSCONF_DIR = @OPENDNSSEC_SYSCONF_DIR@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SQLITE3 = @SQLITE3@
SQLITE3_INCLUDES = @SQLITE3_INCLUDES@
SQLITE3_LIBS = @SQLITE3_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
XML2_CONFIG = @XML2_CONFIG@
XML2_INCLUDES = @XML2_INCLUDES@
XML2_LIBS = @XML2_LIBS@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkcs11_aepkeyper_module = @pkcs11_aepkeyper_module@
pkcs11_etoken_module = @pkcs11_etoken_module@
pkcs11_ncipher_module = @pkcs11_ncipher_module@
pkcs11_opensc_module = @pkcs11_opensc_module@
pkcs11_sca6000_module = @pkcs11_sca6000_module@
pkcs11_softhsm_module = @pkcs11_softhsm_module@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
CLEANFILES = token.db othertoken.db
LIBCOMPAT = ${top_builddir}/common/libcompat.a
AM_CPPFLAGS = \
-I$(top_builddir)/common \
-I$(srcdir)/../src/lib \
@LDNS_INCLUDES@
AM_CFLAGS = -std=c99
EXTRA_DIST = *.xml $(srcdir)/softhsm.conf
hsmcheck_LDADD = ../src/lib/libhsm.a @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT)
hsmcheck_LDFLAGS = -no-install
SOFTHSM_ENV = SOFTHSM_CONF=$(srcdir)/softhsm.conf
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libhsm/checks/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign libhsm/checks/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
conf-softhsm.xml: $(top_builddir)/config.status $(srcdir)/conf-softhsm.xml.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
conf-sca6000.xml: $(top_builddir)/config.status $(srcdir)/conf-sca6000.xml.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
conf-etoken.xml: $(top_builddir)/config.status $(srcdir)/conf-etoken.xml.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
conf-multi.xml: $(top_builddir)/config.status $(srcdir)/conf-multi.xml.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
conf-opensc.xml: $(top_builddir)/config.status $(srcdir)/conf-opensc.xml.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
conf-ncipher.xml: $(top_builddir)/config.status $(srcdir)/conf-ncipher.xml.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
conf-aepkeyper.xml: $(top_builddir)/config.status $(srcdir)/conf-aepkeyper.xml.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
hsmcheck$(EXEEXT): $(hsmcheck_OBJECTS) $(hsmcheck_DEPENDENCIES) $(EXTRA_hsmcheck_DEPENDENCIES)
@rm -f hsmcheck$(EXEEXT)
$(hsmcheck_LINK) $(hsmcheck_OBJECTS) $(hsmcheck_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hsmcheck.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstPROGRAMS ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am
token.db othertoken.db:
env $(SOFTHSM_ENV) \
softhsm --slot 0 --init-token --label softHSM \
--so-pin 12345678 --pin 123456
env $(SOFTHSM_ENV) \
softhsm --slot 1 --init-token --label xyzzy \
--so-pin 12345678 --pin 123456
check: regress-softhsm
regress:
@echo use target 'regress-{aepkeyper,sca6000,softhsm,etoken,opensc,ncipher,multi}'
regress-aepkeyper: hsmcheck
./hsmcheck -c conf-aepkeyper.xml -gsdr
regress-sca6000: hsmcheck
./hsmcheck -c conf-sca6000.xml -gsdr
regress-softhsm: hsmcheck token.db
env $(SOFTHSM_ENV) \
./hsmcheck -c conf-softhsm.xml -gsdr
regress-etoken: hsmcheck
./hsmcheck -c conf-etoken.xml -gsdr
regress-opensc: hsmcheck
./hsmcheck -c conf-opensc.xml -gsdr
regress-ncipher: hsmcheck
./hsmcheck -c conf-ncipher.xml -gsdr
regress-multi: hsmcheck token.db othertoken.db
env $(SOFTHSM_ENV) \
./hsmcheck -c conf-multi.xml -gsdr
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
opendnssec-1.4.3/libhsm/checks/conf-etoken.xml.in 0000664 0001750 0001750 00000000545 11260406147 016665 0000000 0000000
@pkcs11_etoken_module@
OpenDNSSEC
test.1234
10
opendnssec-1.4.3/libhsm/checks/conf-softhsm.xml.in 0000664 0001750 0001750 00000000506 11260406147 017060 0000000 0000000
@pkcs11_softhsm_module@
softHSM
123456
opendnssec-1.4.3/libhsm/checks/conf-aepkeyper.xml 0000664 0001750 0001750 00000000530 12247571176 016765 0000000 0000000
/opt/Keyper/PKCS11Provider/pkcs11.so
OpenDNSSEC
123456
opendnssec-1.4.3/libhsm/checks/conf-opensc.xml 0000664 0001750 0001750 00000000517 12247571176 016274 0000000 0000000
/usr/lib/pkcs11/opensc-pkcs11.so
OpenDNSSEC
1234
opendnssec-1.4.3/libhsm/checks/conf-etoken.xml 0000664 0001750 0001750 00000000554 12247571176 016273 0000000 0000000
/usr/local/lib/libeTPkcs11.so
OpenDNSSEC
test.1234
10
opendnssec-1.4.3/libhsm/checks/conf-softhsm.xml 0000664 0001750 0001750 00000000523 12247571176 016465 0000000 0000000
/usr/local/lib/softhsm/libsofthsm.so
softHSM
123456
opendnssec-1.4.3/libhsm/checks/conf-ncipher.xml 0000664 0001750 0001750 00000000536 12247571176 016436 0000000 0000000
/opt/nfast/toolkits/pkcs11/libcknfast.so
OpenDNSSEC
1234567890
opendnssec-1.4.3/libhsm/checks/hsmcheck.c 0000664 0001750 0001750 00000015015 12017062714 015254 0000000 0000000 /*
* $Id: hsmcheck.c 6560 2012-08-28 06:31:40Z rb $
*
* Copyright (c) 2009 Nominet UK.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include
extern char *optarg;
char *progname = NULL;
void
usage ()
{
fprintf(stderr, "usage: %s [-c config] [-gsdr]\n", progname);
}
int
main (int argc, char *argv[])
{
int result;
hsm_ctx_t *ctx;
hsm_key_t **keys;
hsm_key_t *key = NULL;
char *id;
size_t key_count = 0;
size_t i;
ldns_rr_list *rrset;
ldns_rr *rr, *sig, *dnskey_rr;
ldns_status status;
hsm_sign_params_t *sign_params;
int do_generate = 0;
int do_sign = 0;
int do_delete = 0;
int do_random = 0;
int res;
uint32_t r32;
uint64_t r64;
char *config = NULL;
const char *repository = "default";
int ch;
progname = argv[0];
while ((ch = getopt(argc, argv, "hgsdrc:")) != -1) {
switch (ch) {
case 'c':
config = strdup(optarg);
break;
case 'g':
do_generate = 1;
break;
case 'h':
usage();
exit(0);
break;
case 's':
do_sign = 1;
break;
case 'd':
do_delete = 1;
break;
case 'r':
do_random = 1;
break;
default:
usage();
exit(1);
}
}
if (!config) {
usage();
exit(1);
}
/*
* Open HSM library
*/
fprintf(stdout, "Starting HSM lib test\n");
result = hsm_open(config, hsm_prompt_pin);
fprintf(stdout, "hsm_open result: %d\n", result);
/*
* Create HSM context
*/
ctx = hsm_create_context();
printf("global: ");
hsm_print_ctx(NULL);
printf("my: ");
hsm_print_ctx(ctx);
/*
* Generate a new key OR find any key with an ID
*/
if (do_generate) {
key = hsm_generate_rsa_key(ctx, repository, 1024);
if (key) {
printf("\nCreated key!\n");
hsm_print_key(key);
printf("\n");
} else {
printf("Error creating key, bad token name?\n");
hsm_print_error(ctx);
exit(1);
}
} else if (do_sign || do_delete) {
keys = hsm_list_keys(ctx, &key_count);
printf("I have found %u keys\n", (unsigned int) key_count);
/* let's just use the very first key we find and throw away the rest */
for (i = 0; i < key_count && !key; i++) {
printf("\nFound key!\n");
hsm_print_key(keys[i]);
id = hsm_get_key_id(ctx, keys[i]);
if (id) {
printf("Using key ID: %s\n", id);
if (key) hsm_key_free(key);
key = hsm_find_key_by_id(ctx, id);
printf("ptr: 0x%p\n", (void *) key);
free(id);
} else {
printf("Got no key ID (broken key?), skipped...\n");
}
hsm_key_free(keys[i]);
}
free(keys);
if (!key) {
printf("Failed to find useful key\n");
exit(1);
}
}
/*
* Do some signing
*/
if (do_sign) {
printf("\nSigning with:\n");
hsm_print_key(key);
printf("\n");
rrset = ldns_rr_list_new();
status = ldns_rr_new_frm_str(&rr, "regress.opendnssec.se. IN A 123.123.123.123", 0, NULL, NULL);
if (status == LDNS_STATUS_OK) ldns_rr_list_push_rr(rrset, rr);
status = ldns_rr_new_frm_str(&rr, "regress.opendnssec.se. IN A 124.124.124.124", 0, NULL, NULL);
if (status == LDNS_STATUS_OK) ldns_rr_list_push_rr(rrset, rr);
sign_params = hsm_sign_params_new();
sign_params->algorithm = LDNS_RSASHA1;
sign_params->owner = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, "opendnssec.se.");
dnskey_rr = hsm_get_dnskey(ctx, key, sign_params);
sign_params->keytag = ldns_calc_keytag(dnskey_rr);
sig = hsm_sign_rrset(ctx, rrset, key, sign_params);
if (sig) {
ldns_rr_list_print(stdout, rrset);
ldns_rr_print(stdout, sig);
ldns_rr_print(stdout, dnskey_rr);
ldns_rr_free(sig);
} else {
hsm_print_error(ctx);
exit(-1);
}
/* cleanup */
ldns_rr_list_deep_free(rrset);
hsm_sign_params_free(sign_params);
ldns_rr_free(dnskey_rr);
}
/*
* Delete key
*/
if (do_delete) {
printf("\nDelete key:\n");
hsm_print_key(key);
/* res = hsm_remove_key(ctx, key); */
res = hsm_remove_key(ctx, key);
printf("Deleted key. Result: %d\n", res);
printf("\n");
}
if (key) hsm_key_free(key);
/*
* Test random{32,64} functions
*/
if (do_random) {
r32 = hsm_random32(ctx);
printf("random 32: %u\n", r32);
r64 = hsm_random64(ctx);
printf("random 64: %llu\n", (long long unsigned int)r64);
}
/*
* Destroy HSM context
*/
if (ctx) {
hsm_destroy_context(ctx);
}
/*
* Close HSM library
*/
result = hsm_close();
fprintf(stdout, "all done! hsm_close result: %d\n", result);
if (config) free(config);
return 0;
}
opendnssec-1.4.3/libhsm/checks/conf-sca6000.xml.in 0000664 0001750 0001750 00000000514 11260406147 016450 0000000 0000000
@pkcs11_sca6000_module@
OpenDNSSEC
test:1234
opendnssec-1.4.3/libhsm/checks/conf-aepkeyper.xml.in 0000664 0001750 0001750 00000000515 11260406147 017362 0000000 0000000
@pkcs11_aepkeyper_module@
OpenDNSSEC
123456
opendnssec-1.4.3/libhsm/checks/conf-ncipher.xml.in 0000664 0001750 0001750 00000000515 11260406147 017025 0000000 0000000
@pkcs11_ncipher_module@
OpenDNSSEC
1234567890
opendnssec-1.4.3/libhsm/checks/Makefile.am 0000664 0001750 0001750 00000002576 12021352351 015361 0000000 0000000 # $Id: Makefile.am 6603 2012-09-04 10:16:09Z matthijs $
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
CLEANFILES = token.db othertoken.db
LIBCOMPAT = ${top_builddir}/common/libcompat.a
AM_CPPFLAGS = \
-I$(top_builddir)/common \
-I$(srcdir)/../src/lib \
@LDNS_INCLUDES@
AM_CFLAGS = -std=c99
EXTRA_DIST = *.xml $(srcdir)/softhsm.conf
noinst_PROGRAMS = hsmcheck
hsmcheck_LDADD = ../src/lib/libhsm.a @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT)
hsmcheck_LDFLAGS = -no-install
SOFTHSM_ENV = SOFTHSM_CONF=$(srcdir)/softhsm.conf
token.db othertoken.db:
env $(SOFTHSM_ENV) \
softhsm --slot 0 --init-token --label softHSM \
--so-pin 12345678 --pin 123456
env $(SOFTHSM_ENV) \
softhsm --slot 1 --init-token --label xyzzy \
--so-pin 12345678 --pin 123456
check: regress-softhsm
regress:
@echo use target 'regress-{aepkeyper,sca6000,softhsm,etoken,opensc,ncipher,multi}'
regress-aepkeyper: hsmcheck
./hsmcheck -c conf-aepkeyper.xml -gsdr
regress-sca6000: hsmcheck
./hsmcheck -c conf-sca6000.xml -gsdr
regress-softhsm: hsmcheck token.db
env $(SOFTHSM_ENV) \
./hsmcheck -c conf-softhsm.xml -gsdr
regress-etoken: hsmcheck
./hsmcheck -c conf-etoken.xml -gsdr
regress-opensc: hsmcheck
./hsmcheck -c conf-opensc.xml -gsdr
regress-ncipher: hsmcheck
./hsmcheck -c conf-ncipher.xml -gsdr
regress-multi: hsmcheck token.db othertoken.db
env $(SOFTHSM_ENV) \
./hsmcheck -c conf-multi.xml -gsdr
opendnssec-1.4.3/libhsm/checks/conf-opensc.xml.in 0000664 0001750 0001750 00000000505 11260406147 016663 0000000 0000000
@pkcs11_opensc_module@
OpenDNSSEC
1234
opendnssec-1.4.3/libhsm/checks/conf-multi.xml.in 0000664 0001750 0001750 00000000725 11260406147 016532 0000000 0000000
@pkcs11_softhsm_module@
softHSM
123456
@pkcs11_softhsm_module@
xyzzy
123456
opendnssec-1.4.3/libhsm/Makefile.in 0000664 0001750 0001750 00000050710 12247571137 014142 0000000 0000000 # Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# $Id: Makefile.am 3682 2010-08-09 11:55:02Z jakob $
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = libhsm
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_broken_setres.m4 \
$(top_srcdir)/m4/acx_check_strptime.m4 \
$(top_srcdir)/m4/acx_cunit.m4 \
$(top_srcdir)/m4/acx_database_backend.m4 \
$(top_srcdir)/m4/acx_dbparams.m4 \
$(top_srcdir)/m4/acx_dlopen.m4 $(top_srcdir)/m4/acx_ldns.m4 \
$(top_srcdir)/m4/acx_libc.m4 $(top_srcdir)/m4/acx_libxml2.m4 \
$(top_srcdir)/m4/acx_mysql.m4 $(top_srcdir)/m4/acx_pedantic.m4 \
$(top_srcdir)/m4/acx_pkcs11_modules.m4 \
$(top_srcdir)/m4/acx_prefixhack.m4 \
$(top_srcdir)/m4/acx_rpath.m4 $(top_srcdir)/m4/acx_rt.m4 \
$(top_srcdir)/m4/acx_sqlite3.m4 $(top_srcdir)/m4/acx_ssl.m4 \
$(top_srcdir)/m4/acx_strict.m4 \
$(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/check_compiler_flag.m4 \
$(top_srcdir)/m4/check_compiler_flag_needed.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/opendnssec_common.m4 $(top_srcdir)/version.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/common/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CUCUMBER = @CUCUMBER@
CUNIT_INCLUDES = @CUNIT_INCLUDES@
CUNIT_LIBS = @CUNIT_LIBS@
CYGPATH_W = @CYGPATH_W@
C_LIBS = @C_LIBS@
DB_HOST = @DB_HOST@
DB_INCLUDES = @DB_INCLUDES@
DB_LIBS = @DB_LIBS@
DB_NAME = @DB_NAME@
DB_PASS = @DB_PASS@
DB_PORT = @DB_PORT@
DB_TYPE = @DB_TYPE@
DB_USER = @DB_USER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_SSL = @HAVE_SSL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVA = @JAVA@
LD = @LD@
LDFLAGS = @LDFLAGS@
LDNS_CONFIG = @LDNS_CONFIG@
LDNS_INCLUDES = @LDNS_INCLUDES@
LDNS_LIBS = @LDNS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MYSQL = @MYSQL@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_INCLUDES = @MYSQL_INCLUDES@
MYSQL_LIBS = @MYSQL_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENDNSSEC_BIN_DIR = @OPENDNSSEC_BIN_DIR@
OPENDNSSEC_CONFIG_DIR = @OPENDNSSEC_CONFIG_DIR@
OPENDNSSEC_CONFIG_FILE = @OPENDNSSEC_CONFIG_FILE@
OPENDNSSEC_DATA_DIR = @OPENDNSSEC_DATA_DIR@
OPENDNSSEC_ENFORCER_PIDFILE = @OPENDNSSEC_ENFORCER_PIDFILE@
OPENDNSSEC_FETCH_PIDFILE = @OPENDNSSEC_FETCH_PIDFILE@
OPENDNSSEC_LIBEXEC_DIR = @OPENDNSSEC_LIBEXEC_DIR@
OPENDNSSEC_LIB_DIR = @OPENDNSSEC_LIB_DIR@
OPENDNSSEC_LOCALSTATE_DIR = @OPENDNSSEC_LOCALSTATE_DIR@
OPENDNSSEC_PID_DIR = @OPENDNSSEC_PID_DIR@
OPENDNSSEC_SBIN_DIR = @OPENDNSSEC_SBIN_DIR@
OPENDNSSEC_SCHEMA_DIR = @OPENDNSSEC_SCHEMA_DIR@
OPENDNSSEC_SIGNER_CLI = @OPENDNSSEC_SIGNER_CLI@
OPENDNSSEC_SIGNER_ENGINE = @OPENDNSSEC_SIGNER_ENGINE@
OPENDNSSEC_SIGNER_PIDFILE = @OPENDNSSEC_SIGNER_PIDFILE@
OPENDNSSEC_SIGNER_SOCKET = @OPENDNSSEC_SIGNER_SOCKET@
OPENDNSSEC_STATE_DIR = @OPENDNSSEC_STATE_DIR@
OPENDNSSEC_SYSCONF_DIR = @OPENDNSSEC_SYSCONF_DIR@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SQLITE3 = @SQLITE3@
SQLITE3_INCLUDES = @SQLITE3_INCLUDES@
SQLITE3_LIBS = @SQLITE3_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
XML2_CONFIG = @XML2_CONFIG@
XML2_INCLUDES = @XML2_INCLUDES@
XML2_LIBS = @XML2_LIBS@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkcs11_aepkeyper_module = @pkcs11_aepkeyper_module@
pkcs11_etoken_module = @pkcs11_etoken_module@
pkcs11_ncipher_module = @pkcs11_ncipher_module@
pkcs11_opensc_module = @pkcs11_opensc_module@
pkcs11_sca6000_module = @pkcs11_sca6000_module@
pkcs11_softhsm_module = @pkcs11_softhsm_module@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
SUBDIRS = src checks
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libhsm/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign libhsm/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic clean-libtool \
ctags ctags-recursive distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am
doxygen:
rm -fr $(top_builddir)/libhsm/doxygen-doc
env $(DX_ENV) \
PROJECT_NAME="OpenDNSSEC-libhsm" \
SRCDIR=$(top_srcdir)/libhsm \
OUTPUTDIR=$(top_builddir)/libhsm/doxygen-doc \
$(DX_DOXYGEN) $(top_builddir)/$(DX_CONFIG)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
opendnssec-1.4.3/libhsm/src/ 0000775 0001750 0001750 00000000000 12247571202 012732 5 0000000 0000000 opendnssec-1.4.3/libhsm/src/Makefile.in 0000664 0001750 0001750 00000050345 12247571137 014735 0000000 0000000 # Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# $Id: Makefile.am 5348 2011-08-03 13:01:40Z rb $
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = libhsm/src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_broken_setres.m4 \
$(top_srcdir)/m4/acx_check_strptime.m4 \
$(top_srcdir)/m4/acx_cunit.m4 \
$(top_srcdir)/m4/acx_database_backend.m4 \
$(top_srcdir)/m4/acx_dbparams.m4 \
$(top_srcdir)/m4/acx_dlopen.m4 $(top_srcdir)/m4/acx_ldns.m4 \
$(top_srcdir)/m4/acx_libc.m4 $(top_srcdir)/m4/acx_libxml2.m4 \
$(top_srcdir)/m4/acx_mysql.m4 $(top_srcdir)/m4/acx_pedantic.m4 \
$(top_srcdir)/m4/acx_pkcs11_modules.m4 \
$(top_srcdir)/m4/acx_prefixhack.m4 \
$(top_srcdir)/m4/acx_rpath.m4 $(top_srcdir)/m4/acx_rt.m4 \
$(top_srcdir)/m4/acx_sqlite3.m4 $(top_srcdir)/m4/acx_ssl.m4 \
$(top_srcdir)/m4/acx_strict.m4 \
$(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/check_compiler_flag.m4 \
$(top_srcdir)/m4/check_compiler_flag_needed.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/opendnssec_common.m4 $(top_srcdir)/version.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/common/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CUCUMBER = @CUCUMBER@
CUNIT_INCLUDES = @CUNIT_INCLUDES@
CUNIT_LIBS = @CUNIT_LIBS@
CYGPATH_W = @CYGPATH_W@
C_LIBS = @C_LIBS@
DB_HOST = @DB_HOST@
DB_INCLUDES = @DB_INCLUDES@
DB_LIBS = @DB_LIBS@
DB_NAME = @DB_NAME@
DB_PASS = @DB_PASS@
DB_PORT = @DB_PORT@
DB_TYPE = @DB_TYPE@
DB_USER = @DB_USER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_SSL = @HAVE_SSL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVA = @JAVA@
LD = @LD@
LDFLAGS = @LDFLAGS@
LDNS_CONFIG = @LDNS_CONFIG@
LDNS_INCLUDES = @LDNS_INCLUDES@
LDNS_LIBS = @LDNS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MYSQL = @MYSQL@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_INCLUDES = @MYSQL_INCLUDES@
MYSQL_LIBS = @MYSQL_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENDNSSEC_BIN_DIR = @OPENDNSSEC_BIN_DIR@
OPENDNSSEC_CONFIG_DIR = @OPENDNSSEC_CONFIG_DIR@
OPENDNSSEC_CONFIG_FILE = @OPENDNSSEC_CONFIG_FILE@
OPENDNSSEC_DATA_DIR = @OPENDNSSEC_DATA_DIR@
OPENDNSSEC_ENFORCER_PIDFILE = @OPENDNSSEC_ENFORCER_PIDFILE@
OPENDNSSEC_FETCH_PIDFILE = @OPENDNSSEC_FETCH_PIDFILE@
OPENDNSSEC_LIBEXEC_DIR = @OPENDNSSEC_LIBEXEC_DIR@
OPENDNSSEC_LIB_DIR = @OPENDNSSEC_LIB_DIR@
OPENDNSSEC_LOCALSTATE_DIR = @OPENDNSSEC_LOCALSTATE_DIR@
OPENDNSSEC_PID_DIR = @OPENDNSSEC_PID_DIR@
OPENDNSSEC_SBIN_DIR = @OPENDNSSEC_SBIN_DIR@
OPENDNSSEC_SCHEMA_DIR = @OPENDNSSEC_SCHEMA_DIR@
OPENDNSSEC_SIGNER_CLI = @OPENDNSSEC_SIGNER_CLI@
OPENDNSSEC_SIGNER_ENGINE = @OPENDNSSEC_SIGNER_ENGINE@
OPENDNSSEC_SIGNER_PIDFILE = @OPENDNSSEC_SIGNER_PIDFILE@
OPENDNSSEC_SIGNER_SOCKET = @OPENDNSSEC_SIGNER_SOCKET@
OPENDNSSEC_STATE_DIR = @OPENDNSSEC_STATE_DIR@
OPENDNSSEC_SYSCONF_DIR = @OPENDNSSEC_SYSCONF_DIR@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SQLITE3 = @SQLITE3@
SQLITE3_INCLUDES = @SQLITE3_INCLUDES@
SQLITE3_LIBS = @SQLITE3_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
XML2_CONFIG = @XML2_CONFIG@
XML2_INCLUDES = @XML2_INCLUDES@
XML2_LIBS = @XML2_LIBS@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkcs11_aepkeyper_module = @pkcs11_aepkeyper_module@
pkcs11_etoken_module = @pkcs11_etoken_module@
pkcs11_ncipher_module = @pkcs11_ncipher_module@
pkcs11_opensc_module = @pkcs11_opensc_module@
pkcs11_sca6000_module = @pkcs11_sca6000_module@
pkcs11_softhsm_module = @pkcs11_softhsm_module@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
SUBDIRS = lib bin
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libhsm/src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign libhsm/src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic clean-libtool \
ctags ctags-recursive distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
opendnssec-1.4.3/libhsm/src/bin/ 0000775 0001750 0001750 00000000000 12247571202 013502 5 0000000 0000000 opendnssec-1.4.3/libhsm/src/bin/hsmspeed.c 0000664 0001750 0001750 00000017315 12017062714 015403 0000000 0000000 /*
* $Id: hsmspeed.c 6560 2012-08-28 06:31:40Z rb $
*
* Copyright (c) 2009 Nominet UK.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include
#include
#define PTHREAD_THREADS_MAX 2048
/* Algorithm identifier and name */
ldns_algorithm algorithm = LDNS_RSASHA1;
const char *algoname = "RSA/SHA1";
extern char *optarg;
char *progname = NULL;
typedef struct {
unsigned int id;
hsm_ctx_t *ctx;
hsm_key_t *key;
unsigned int iterations;
} sign_arg_t;
void
usage ()
{
fprintf(stderr,
"usage: %s "
"[-c config] -r repository [-i iterations] [-s keysize] [-t threads]\n",
progname);
}
void *
sign (void *arg)
{
hsm_ctx_t *ctx = NULL;
hsm_key_t *key = NULL;
size_t i;
unsigned int iterations = 0;
ldns_rr_list *rrset;
ldns_rr *rr, *sig, *dnskey_rr;
ldns_status status;
hsm_sign_params_t *sign_params;
sign_arg_t *sign_arg = arg;
ctx = sign_arg->ctx;
key = sign_arg->key;
iterations = sign_arg->iterations;
fprintf(stderr, "Signer thread #%d started...\n", sign_arg->id);
/* Prepare dummy RRset for signing */
rrset = ldns_rr_list_new();
status = ldns_rr_new_frm_str(&rr, "regress.opendnssec.se. IN A 123.123.123.123", 0, NULL, NULL);
if (status == LDNS_STATUS_OK) ldns_rr_list_push_rr(rrset, rr);
status = ldns_rr_new_frm_str(&rr, "regress.opendnssec.se. IN A 124.124.124.124", 0, NULL, NULL);
if (status == LDNS_STATUS_OK) ldns_rr_list_push_rr(rrset, rr);
sign_params = hsm_sign_params_new();
sign_params->algorithm = algorithm;
sign_params->owner = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, "opendnssec.se.");
dnskey_rr = hsm_get_dnskey(ctx, key, sign_params);
sign_params->keytag = ldns_calc_keytag(dnskey_rr);
/* Do some signing */
for (i=0; ierror_message,
ctx->error_action
);
break;
}
ldns_rr_free(sig);
}
/* Clean up */
ldns_rr_list_deep_free(rrset);
hsm_sign_params_free(sign_params);
ldns_rr_free(dnskey_rr);
hsm_destroy_context(ctx);
fprintf(stderr, "Signer thread #%d done.\n", sign_arg->id);
pthread_exit(NULL);
}
int
main (int argc, char *argv[])
{
int result;
hsm_ctx_t *ctx = NULL;
hsm_key_t *key = NULL;
unsigned int keysize = 1024;
unsigned int iterations = 1;
unsigned int threads = 1;
static struct timeval start,end;
char *config = NULL;
const char *repository = NULL;
sign_arg_t sign_arg_array[PTHREAD_THREADS_MAX];
pthread_t thread_array[PTHREAD_THREADS_MAX];
pthread_attr_t thread_attr;
void *thread_status;
int ch;
unsigned int n;
double elapsed, speed;
progname = argv[0];
while ((ch = getopt(argc, argv, "c:i:r:s:t:")) != -1) {
switch (ch) {
case 'c':
config = strdup(optarg);
break;
case 'i':
iterations = atoi(optarg);
break;
case 'r':
repository = strdup(optarg);
break;
case 's':
keysize = atoi(optarg);
break;
case 't':
threads = atoi(optarg);
break;
default:
usage();
exit(1);
}
}
if (!repository) {
usage();
exit(1);
}
#if 0
if (!config) {
usage();
exit(1);
}
#endif
/* Open HSM library */
fprintf(stderr, "Opening HSM Library...\n");
result = hsm_open(config, hsm_prompt_pin);
if (result) {
fprintf(stderr, "hsm_open() returned %d\n", result);
exit(-1);
}
/* Create HSM context */
ctx = hsm_create_context();
if (! ctx) {
fprintf(stderr, "hsm_create_context() returned error\n");
exit(-1);
}
/* Generate a temporary key */
fprintf(stderr, "Generating temporary key...\n");
key = hsm_generate_rsa_key(ctx, repository, keysize);
if (key) {
char *id = hsm_get_key_id(ctx, key);
fprintf(stderr, "Temporary key created: %s\n", id);
free(id);
} else {
fprintf(stderr, "Could not generate a key pair in repository \"%s\"\n", repository);
exit(-1);
}
/* Prepare threads */
pthread_attr_init(&thread_attr);
pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_JOINABLE);
for (n=0; n 1 ? "threads" : "thread"));
gettimeofday(&start, NULL);
/* Create threads for signing */
for (n=0; n 1 ? "threads" : "thread"), iterations,
speed, keysize);
/* Delete temporary key */
fprintf(stderr, "Deleting temporary key...\n");
result = hsm_remove_key(ctx, key);
if (result) {
fprintf(stderr, "hsm_remove_key() returned %d\n", result);
exit(-1);
}
/* Clean up */
hsm_destroy_context(ctx);
(void) hsm_close();
if (config) free(config);
return 0;
}
opendnssec-1.4.3/libhsm/src/bin/Makefile.in 0000664 0001750 0001750 00000060275 12247571137 015510 0000000 0000000 # Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# $Id: Makefile.am 6620 2012-09-05 07:56:36Z matthijs $
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = ods-hsmutil$(EXEEXT) ods-hsmspeed$(EXEEXT)
subdir = libhsm/src/bin
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/ods-hsmspeed.1.in $(srcdir)/ods-hsmutil.1.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_broken_setres.m4 \
$(top_srcdir)/m4/acx_check_strptime.m4 \
$(top_srcdir)/m4/acx_cunit.m4 \
$(top_srcdir)/m4/acx_database_backend.m4 \
$(top_srcdir)/m4/acx_dbparams.m4 \
$(top_srcdir)/m4/acx_dlopen.m4 $(top_srcdir)/m4/acx_ldns.m4 \
$(top_srcdir)/m4/acx_libc.m4 $(top_srcdir)/m4/acx_libxml2.m4 \
$(top_srcdir)/m4/acx_mysql.m4 $(top_srcdir)/m4/acx_pedantic.m4 \
$(top_srcdir)/m4/acx_pkcs11_modules.m4 \
$(top_srcdir)/m4/acx_prefixhack.m4 \
$(top_srcdir)/m4/acx_rpath.m4 $(top_srcdir)/m4/acx_rt.m4 \
$(top_srcdir)/m4/acx_sqlite3.m4 $(top_srcdir)/m4/acx_ssl.m4 \
$(top_srcdir)/m4/acx_strict.m4 \
$(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/check_compiler_flag.m4 \
$(top_srcdir)/m4/check_compiler_flag_needed.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/opendnssec_common.m4 $(top_srcdir)/version.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/common/config.h
CONFIG_CLEAN_FILES = ods-hsmspeed.1 ods-hsmutil.1
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
PROGRAMS = $(bin_PROGRAMS)
am_ods_hsmspeed_OBJECTS = hsmspeed.$(OBJEXT)
ods_hsmspeed_OBJECTS = $(am_ods_hsmspeed_OBJECTS)
ods_hsmspeed_DEPENDENCIES = ../lib/libhsm.a $(LIBCOMPAT)
am_ods_hsmutil_OBJECTS = hsmutil.$(OBJEXT) hsmtest.$(OBJEXT)
ods_hsmutil_OBJECTS = $(am_ods_hsmutil_OBJECTS)
ods_hsmutil_DEPENDENCIES = ../lib/libhsm.a $(LIBCOMPAT)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(ods_hsmspeed_SOURCES) $(ods_hsmutil_SOURCES)
DIST_SOURCES = $(ods_hsmspeed_SOURCES) $(ods_hsmutil_SOURCES)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
man1dir = $(mandir)/man1
NROFF = nroff
MANS = $(man1_MANS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CUCUMBER = @CUCUMBER@
CUNIT_INCLUDES = @CUNIT_INCLUDES@
CUNIT_LIBS = @CUNIT_LIBS@
CYGPATH_W = @CYGPATH_W@
C_LIBS = @C_LIBS@
DB_HOST = @DB_HOST@
DB_INCLUDES = @DB_INCLUDES@
DB_LIBS = @DB_LIBS@
DB_NAME = @DB_NAME@
DB_PASS = @DB_PASS@
DB_PORT = @DB_PORT@
DB_TYPE = @DB_TYPE@
DB_USER = @DB_USER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_SSL = @HAVE_SSL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVA = @JAVA@
LD = @LD@
LDFLAGS = @LDFLAGS@
LDNS_CONFIG = @LDNS_CONFIG@
LDNS_INCLUDES = @LDNS_INCLUDES@
LDNS_LIBS = @LDNS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MYSQL = @MYSQL@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_INCLUDES = @MYSQL_INCLUDES@
MYSQL_LIBS = @MYSQL_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENDNSSEC_BIN_DIR = @OPENDNSSEC_BIN_DIR@
OPENDNSSEC_CONFIG_DIR = @OPENDNSSEC_CONFIG_DIR@
OPENDNSSEC_CONFIG_FILE = @OPENDNSSEC_CONFIG_FILE@
OPENDNSSEC_DATA_DIR = @OPENDNSSEC_DATA_DIR@
OPENDNSSEC_ENFORCER_PIDFILE = @OPENDNSSEC_ENFORCER_PIDFILE@
OPENDNSSEC_FETCH_PIDFILE = @OPENDNSSEC_FETCH_PIDFILE@
OPENDNSSEC_LIBEXEC_DIR = @OPENDNSSEC_LIBEXEC_DIR@
OPENDNSSEC_LIB_DIR = @OPENDNSSEC_LIB_DIR@
OPENDNSSEC_LOCALSTATE_DIR = @OPENDNSSEC_LOCALSTATE_DIR@
OPENDNSSEC_PID_DIR = @OPENDNSSEC_PID_DIR@
OPENDNSSEC_SBIN_DIR = @OPENDNSSEC_SBIN_DIR@
OPENDNSSEC_SCHEMA_DIR = @OPENDNSSEC_SCHEMA_DIR@
OPENDNSSEC_SIGNER_CLI = @OPENDNSSEC_SIGNER_CLI@
OPENDNSSEC_SIGNER_ENGINE = @OPENDNSSEC_SIGNER_ENGINE@
OPENDNSSEC_SIGNER_PIDFILE = @OPENDNSSEC_SIGNER_PIDFILE@
OPENDNSSEC_SIGNER_SOCKET = @OPENDNSSEC_SIGNER_SOCKET@
OPENDNSSEC_STATE_DIR = @OPENDNSSEC_STATE_DIR@
OPENDNSSEC_SYSCONF_DIR = @OPENDNSSEC_SYSCONF_DIR@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SQLITE3 = @SQLITE3@
SQLITE3_INCLUDES = @SQLITE3_INCLUDES@
SQLITE3_LIBS = @SQLITE3_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
XML2_CONFIG = @XML2_CONFIG@
XML2_INCLUDES = @XML2_INCLUDES@
XML2_LIBS = @XML2_LIBS@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkcs11_aepkeyper_module = @pkcs11_aepkeyper_module@
pkcs11_etoken_module = @pkcs11_etoken_module@
pkcs11_ncipher_module = @pkcs11_ncipher_module@
pkcs11_opensc_module = @pkcs11_opensc_module@
pkcs11_sca6000_module = @pkcs11_sca6000_module@
pkcs11_softhsm_module = @pkcs11_softhsm_module@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
LIBCOMPAT = ${top_builddir}/common/libcompat.a
AM_CPPFLAGS = \
-I$(top_srcdir)/common \
-I$(top_builddir)/common \
-I$(srcdir)/../lib \
@LDNS_INCLUDES@ @XML2_INCLUDES@
AM_CFLAGS = -std=c99
man1_MANS = ods-hsmutil.1 ods-hsmspeed.1
ods_hsmutil_SOURCES = hsmutil.c hsmtest.c hsmtest.h
ods_hsmutil_LDADD = ../lib/libhsm.a @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT)
ods_hsmspeed_SOURCES = hsmspeed.c
ods_hsmspeed_LDADD = ../lib/libhsm.a -lpthread @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libhsm/src/bin/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign libhsm/src/bin/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
ods-hsmspeed.1: $(top_builddir)/config.status $(srcdir)/ods-hsmspeed.1.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
ods-hsmutil.1: $(top_builddir)/config.status $(srcdir)/ods-hsmutil.1.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p || test -f $$p1; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
ods-hsmspeed$(EXEEXT): $(ods_hsmspeed_OBJECTS) $(ods_hsmspeed_DEPENDENCIES) $(EXTRA_ods_hsmspeed_DEPENDENCIES)
@rm -f ods-hsmspeed$(EXEEXT)
$(LINK) $(ods_hsmspeed_OBJECTS) $(ods_hsmspeed_LDADD) $(LIBS)
ods-hsmutil$(EXEEXT): $(ods_hsmutil_OBJECTS) $(ods_hsmutil_DEPENDENCIES) $(EXTRA_ods_hsmutil_DEPENDENCIES)
@rm -f ods-hsmutil$(EXEEXT)
$(LINK) $(ods_hsmutil_OBJECTS) $(ods_hsmutil_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hsmspeed.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hsmtest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hsmutil.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-man1: $(man1_MANS)
@$(NORMAL_INSTALL)
test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
@list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \
{ for i in $$list; do echo "$$i"; done; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
done; }
uninstall-man1:
@$(NORMAL_UNINSTALL)
@list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@list='$(MANS)'; if test -n "$$list"; then \
list=`for p in $$list; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
if test -n "$$list" && \
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
echo " typically \`make maintainer-clean' will remove them" >&2; \
exit 1; \
else :; fi; \
else :; fi
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) $(MANS)
installdirs:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-man
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man: install-man1
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-man
uninstall-man: uninstall-man1
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-man1 install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-binPROGRAMS uninstall-man \
uninstall-man1
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
opendnssec-1.4.3/libhsm/src/bin/hsmutil.c 0000664 0001750 0001750 00000027560 12164523516 015270 0000000 0000000 /*
* $Id: hsmutil.c 7176 2013-07-02 10:11:26Z sara $
*
* Copyright (c) 2009 .SE (The Internet Infrastructure Foundation).
* Copyright (c) 2009 NLNet Labs.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "hsmtest.h"
#include
#include
#include
#include
#include
#include
#include
extern char *optarg;
char *progname = NULL;
unsigned int verbose = 0;
void
version ()
{
fprintf(stderr, "%s (%s) version %s\n",
progname, PACKAGE_NAME, PACKAGE_VERSION);
}
void
usage ()
{
fprintf(stderr,
"usage: %s [-c config] [-vV] command [options]\n",
progname);
fprintf(stderr," login\n");
fprintf(stderr," logout\n");
fprintf(stderr," list [repository]\n");
fprintf(stderr," generate rsa \n");
fprintf(stderr," remove \n");
fprintf(stderr," purge \n");
fprintf(stderr," dnskey \n");
fprintf(stderr," test \n");
fprintf(stderr," info\n");
#if 0
fprintf(stderr," debug\n");
#endif
}
int
cmd_login ()
{
printf("The tokens are now logged in.\n");
return 0;
}
int
cmd_logout ()
{
if (hsm_logout_pin() != HSM_OK) {
printf("Failed to erase the credentials.\n");
hsm_print_error(NULL);
return 1;
}
printf("The credentials has been erased.\n");
return 0;
}
int
cmd_list (int argc, char *argv[])
{
size_t i;
char *repository = NULL;
size_t key_count = 0;
size_t key_count_valid = 0;
hsm_key_t **keys;
hsm_ctx_t *ctx = NULL;
const char *key_info_format = "%-20s %-32s %-10s\n";
if (argc) {
repository = strdup(argv[0]);
argc--;
argv++;
/* Check for repository before starting using it */
if (hsm_token_attached(ctx, repository) == 0) {
hsm_print_error(ctx);
return 1;
}
fprintf(stdout, "\nListing keys in repository: %s\n", repository);
keys = hsm_list_keys_repository(NULL, &key_count, repository);
} else {
fprintf(stdout, "\nListing keys in all repositories.\n");
keys = hsm_list_keys(NULL, &key_count);
}
fprintf(stdout, "%u %s found.\n\n", (unsigned int) key_count,
(key_count > 1 || key_count == 0 ? "keys" : "key"));
if (!keys) {
return -1;
}
/* print fancy header */
fprintf(stdout, key_info_format, "Repository", "ID", "Type");
fprintf(stdout, key_info_format, "----------", "--", "----");
for (i = 0; i < key_count; i++) {
hsm_key_info_t *key_info;
hsm_key_t *key = NULL;
char key_type[HSM_MAX_ALGONAME + 8];
char *key_id = NULL;
key = keys[i];
if (key == NULL) {
/* Skip NULL key for now */
continue;
}
key_count_valid++;
key_info = hsm_get_key_info(NULL, key);
if (key_info) {
snprintf(key_type, sizeof(key_type), "%s/%lu",
key_info->algorithm_name, key_info->keysize);
key_id = key_info->id;
} else {
snprintf(key_type, sizeof(key_type), "UNKNOWN");
key_id = "UNKNOWN";
}
printf(key_info_format, key->module->name, key_id, key_type);
hsm_key_info_free(key_info);
}
hsm_key_list_free(keys, key_count);
if (key_count != key_count_valid) {
size_t invalid_keys;
invalid_keys = key_count - key_count_valid;
printf("\n");
fprintf(stderr, "Warning: %u %s not usable by OpenDNSSEC was found.\n",
(unsigned int) invalid_keys, invalid_keys > 1 ? "keys" : "key");
}
return 0;
}
int
cmd_generate (int argc, char *argv[])
{
char *repository = NULL;
char *algorithm = NULL;
unsigned int keysize = 1024;
hsm_key_t *key = NULL;
hsm_ctx_t *ctx = NULL;
if (argc != 3) {
usage();
return -1;
}
repository = strdup(argv[0]);
/* Check for repository before starting using it */
if (hsm_token_attached(ctx, repository) == 0) {
hsm_print_error(ctx);
return 1;
}
algorithm = strdup(argv[1]);
keysize = atoi(argv[2]);
if (!strcasecmp(algorithm, "rsa")) {
printf("Generating %d bit RSA key in repository: %s\n",
keysize, repository);
key = hsm_generate_rsa_key(NULL, repository, keysize);
if (key) {
hsm_key_info_t *key_info;
key_info = hsm_get_key_info(NULL, key);
printf("Key generation successful: %s\n",
key_info ? key_info->id : "NULL");
hsm_key_info_free(key_info);
if (verbose) hsm_print_key(key);
hsm_key_free(key);
} else {
printf("Key generation failed.\n");
return -1;
}
} else {
printf("Unknown algorithm: %s\n", algorithm);
return -1;
}
return 0;
}
int
cmd_remove (int argc, char *argv[])
{
char *id;
int result;
hsm_key_t *key = NULL;
if (argc != 1) {
usage();
return -1;
}
id = strdup(argv[0]);
key = hsm_find_key_by_id(NULL, id);
if (!key) {
printf("Key not found: %s\n", id);
return -1;
}
result = hsm_remove_key(NULL, key);
if (!result) {
printf("Key remove successful.\n");
} else {
printf("Key remove failed.\n");
}
hsm_key_free(key);
return result;
}
int
cmd_purge (int argc, char *argv[])
{
int result;
int final_result = 0;
char *fresult;
size_t i;
char *repository = NULL;
char confirm[16];
size_t key_count = 0;
hsm_key_t **keys;
hsm_ctx_t *ctx = NULL;
if (argc != 1) {
usage();
return -1;
}
repository = strdup(argv[0]);
argc--;
argv++;
/* Check for repository before starting using it */
if (hsm_token_attached(ctx, repository) == 0) {
hsm_print_error(ctx);
return 1;
}
printf("Purging all keys from repository: %s\n", repository);
keys = hsm_list_keys_repository(NULL, &key_count, repository);
printf("%u %s found.\n\n", (unsigned int) key_count,
(key_count > 1 || key_count == 0 ? "keys" : "key"));
if (!keys) {
return -1;
}
if (key_count == 0) {
return -1;
}
printf("Are you sure you want to remove ALL keys from repository %s ? (YES/NO) ", repository);
fresult = fgets(confirm, sizeof(confirm) - 1, stdin);
if (fresult == NULL || strncasecmp(confirm, "yes", 3) != 0) {
printf("\nPurge cancelled.\n");
hsm_key_list_free(keys, key_count);
return -1;
} else {
printf("\nStarting purge...\n");
}
for (i = 0; i < key_count; i++) {
hsm_key_info_t *key_info;
hsm_key_t *key = keys[i];
key_info = hsm_get_key_info(NULL, key);
result = hsm_remove_key(NULL, key);
if (!result) {
printf("Key remove successful: %s\n",
key_info ? key_info->id : "NULL");
} else {
printf("Key remove failed: %s\n",
key_info ? key_info->id : "NULL");
final_result++;
}
hsm_key_info_free(key_info);
}
hsm_key_list_free(keys, key_count);
printf("Purge done.\n");
return final_result;
}
int
cmd_dnskey (int argc, char *argv[])
{
char *id;
char *name;
hsm_key_t *key = NULL;
ldns_rr *dnskey_rr;
hsm_sign_params_t *sign_params;
if (argc != 2) {
usage();
return -1;
}
id = strdup(argv[0]);
name = strdup(argv[1]);
key = hsm_find_key_by_id(NULL, id);
if (!key) {
printf("Key not found: %s\n", id);
free(name);
free(id);
return -1;
}
sign_params = hsm_sign_params_new();
sign_params->algorithm = LDNS_RSASHA1;
sign_params->owner = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, name);
dnskey_rr = hsm_get_dnskey(NULL, key, sign_params);
sign_params->keytag = ldns_calc_keytag(dnskey_rr);
ldns_rr_print(stdout, dnskey_rr);
hsm_sign_params_free(sign_params);
ldns_rr_free(dnskey_rr);
hsm_key_free(key);
free(name);
free(id);
return 0;
}
int
cmd_test (int argc, char *argv[])
{
char *repository = NULL;
if (argc) {
repository = strdup(argv[0]);
argc--;
argv++;
printf("Testing repository: %s\n\n", repository);
return hsm_test(repository);
} else {
usage();
}
return 0;
}
int
cmd_info ()
{
hsm_print_tokeninfo(NULL);
return 0;
}
int
cmd_debug ()
{
hsm_print_ctx(NULL);
return 0;
}
int
main (int argc, char *argv[])
{
int result;
char *config = NULL;
int ch;
progname = argv[0];
while ((ch = getopt(argc, argv, "c:vVh")) != -1) {
switch (ch) {
case 'c':
config = strdup(optarg);
break;
case 'v':
verbose++;
break;
case 'V':
version();
exit(0);
break;
case 'h':
usage();
exit(0);
break;
default:
usage();
exit(1);
}
}
argc -= optind;
argv += optind;
if (!argc) {
usage();
exit(1);
}
if (!strcasecmp(argv[0], "logout")) {
if (config) free(config);
exit(cmd_logout());
}
result = hsm_open(config, hsm_prompt_pin);
if (result) {
hsm_print_error(NULL);
exit(-1);
}
openlog("hsmutil", LOG_PID, LOG_USER);
if (!strcasecmp(argv[0], "login")) {
argc --;
argv ++;
result = cmd_login();
} else if (!strcasecmp(argv[0], "list")) {
argc --;
argv ++;
result = cmd_list(argc, argv);
} else if (!strcasecmp(argv[0], "generate")) {
argc --;
argv ++;
result = cmd_generate(argc, argv);
} else if (!strcasecmp(argv[0], "remove")) {
argc --;
argv ++;
result = cmd_remove(argc, argv);
} else if (!strcasecmp(argv[0], "purge")) {
argc --;
argv ++;
result = cmd_purge(argc, argv);
} else if (!strcasecmp(argv[0], "dnskey")) {
argc --;
argv ++;
result = cmd_dnskey(argc, argv);
} else if (!strcasecmp(argv[0], "test")) {
argc --;
argv ++;
result = cmd_test(argc, argv);
} else if (!strcasecmp(argv[0], "info")) {
argc --;
argv ++;
result = cmd_info();
} else if (!strcasecmp(argv[0], "debug")) {
argc --;
argv ++;
result = cmd_debug();
} else {
usage();
result = -1;
}
(void) hsm_close();
if (config) free(config);
closelog();
exit(result);
}
opendnssec-1.4.3/libhsm/src/bin/ods-hsmutil.1.in 0000664 0001750 0001750 00000004563 12026571507 016374 0000000 0000000 .TH "ods-hsmutil" "1" "February 2010" "OpenDNSSEC" "OpenDNSSEC ods-hsmutil"
.\" $Id: ods-hsmutil.1.in 6704 2012-09-20 10:43:19Z rb $
.SH "NAME"
.LP
.B ods\-hsmutil
\- OpenDNSSEC HSM utility
.SH "SYNOPSIS"
.LP
.B ods\-hsmutil
.RB [ \-c
.IR config ]
.RB [ \-v ]
.B command
.RB [ options ]
.SH "DESCRIPTION"
.LP
The ods\-hsmutil utility is mainly used for debugging or testing. It is
designed to interact directly with your HSM and can be used to manually
list, create or delete keys. It can also be used to perform a set of
basics HSM tests. Be careful before creating or deleting keys using
ods\-hsmutil, as the changes are not synchronized with the KASP Enforcer.
The repositories are configured by the user in the OpenDNSSEC configuration
file. The configuration contains the name of the repository, the token label,
the user PIN, and the path to its shared library.
.SH "COMMANDS"
.LP
.TP
\fBlogin\fR
If there is no PIN in conf.xml, then this command will ask for it and login.
The PINs are stored in a shared memory and are accessible to the other daemons.
.TP
\fBlogout\fR
Will erase the semaphore and the shared memory containing any credentials.
Authenticated processes will still be able to interact with the HSM.
.TP
\fBlist\fR [\fIrepository\fR]
List the keys that are available in all or one \fIrepository\fR
.TP
\fBgenerate\fR \fIrepository\fR \fBrsa\fR \fIkeysize\fR
Generate a new RSA key with the given \fIkeysize\fR in the \fIrepository\fR
.TP
\fBremove\fR \fIid\fR
Delete the key with the given \fIid\fR
.TP
\fBpurge\fR \fIrepository\fR
Delete all keys in one \fIrepository\fR
.TP
\fBdnskey\fR \fIid\fR \fIname\fR
Create a DNSKEY RR for the given owner \fIname\fR based on the key with this \fIid\fR
.TP
\fBtest\fR \fIrepository\fR
Perform a number of tests on a \fIrepository\fR
.TP
\fBinfo\fR
Show detailed information about all repositories
.SH "OPTIONS"
.LP
.TP
\fB\-c\fR \fIconfig\fR
Path to an OpenDNSSEC configuration file
(defaults to @OPENDNSSEC_CONFIG_FILE@)
.TP
\fB\-h\fR
Show the help screen
.TP
\fB\-v\fR
Output more information by increasing the verbosity level
.SH "SEE ALSO"
.LP
ods\-auditor(1), ods\-control(8), ods\-enforcerd(8), ods\-hsmspeed(1),
ods\-kaspcheck(1), ods\-ksmutil(1), ods\-signer(8),
ods\-signerd(8), ods\-timing(5), opendnssec(7),
.B http://www.opendnssec.org/
.SH "AUTHORS"
.LP
.B ods\-hsmutil
was written by Jakob Schlyter as part of the OpenDNSSEC project.
opendnssec-1.4.3/libhsm/src/bin/hsmtest.c 0000664 0001750 0001750 00000021146 12017062714 015257 0000000 0000000 /*
* $Id: hsmtest.c 6560 2012-08-28 06:31:40Z rb $
*
* Copyright (c) 2009 Nominet UK.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "hsmtest.h"
#include
#include
#include
#include
#include
#include
static int
hsm_test_sign (hsm_ctx_t *ctx, hsm_key_t *key, ldns_algorithm alg)
{
int result;
ldns_rr_list *rrset;
ldns_rr *rr, *sig, *dnskey_rr;
ldns_status status;
hsm_sign_params_t *sign_params;
rrset = ldns_rr_list_new();
status = ldns_rr_new_frm_str(&rr, "example.com. IN A 192.168.0.1", 0, NULL, NULL);
if (status == LDNS_STATUS_OK) ldns_rr_list_push_rr(rrset, rr);
status = ldns_rr_new_frm_str(&rr, "example.com. IN A 192.168.0.2", 0, NULL, NULL);
if (status == LDNS_STATUS_OK) ldns_rr_list_push_rr(rrset, rr);
sign_params = hsm_sign_params_new();
sign_params->algorithm = alg;
sign_params->owner = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, "example.com.");
dnskey_rr = hsm_get_dnskey(ctx, key, sign_params);
sign_params->keytag = ldns_calc_keytag(dnskey_rr);
sig = hsm_sign_rrset(ctx, rrset, key, sign_params);
if (sig) {
result = 0;
ldns_rr_free(sig);
} else {
result = 1;
}
ldns_rr_list_deep_free(rrset);
hsm_sign_params_free(sign_params);
ldns_rr_free(dnskey_rr);
return result;
}
static int
hsm_test_random()
{
hsm_ctx_t *ctx = NULL;
int result;
unsigned char rnd_buf[1024];
uint32_t r32;
uint64_t r64;
printf("Generating %lu bytes of random data... ",
(unsigned long) sizeof(rnd_buf));
result = hsm_random_buffer(ctx, rnd_buf, sizeof(rnd_buf));
if (result) {
printf("Failed, error: %d\n", result);
hsm_print_error(ctx);
return 1;
} else {
printf("OK\n");
}
printf("Generating 32-bit random data... ");
r32 = hsm_random32(ctx);
printf("%u\n", r32);
printf("Generating 64-bit random data... ");
r64 = hsm_random64(ctx);
printf("%llu\n", (long long unsigned int)r64);
return 0;
}
int
hsm_test (const char *repository)
{
int result;
const unsigned int rsa_keysizes[] = { 512, 768, 1024, 1536, 2048, 4096 };
const unsigned int dsa_keysizes[] = { 512, 768, 1024 };
unsigned int keysize;
hsm_ctx_t *ctx = NULL;
hsm_key_t *key = NULL;
char *id;
int errors = 0;
unsigned int i = 0;
/* Check for repository before starting any tests */
if (hsm_token_attached(ctx, repository) == 0) {
hsm_print_error(ctx);
return 1;
}
/*
* Test key generation, signing and deletion for a number of key size
*/
for (i=0; i<(sizeof(rsa_keysizes)/sizeof(unsigned int)); i++) {
keysize = rsa_keysizes[i];
printf("Generating %d-bit RSA key... ", keysize);
key = hsm_generate_rsa_key(ctx, repository, keysize);
if (!key) {
errors++;
printf("Failed\n");
hsm_print_error(ctx);
printf("\n");
continue;
} else {
printf("OK\n");
}
printf("Extracting key identifier... ");
id = hsm_get_key_id(ctx, key);
if (!id) {
errors++;
printf("Failed\n");
hsm_print_error(ctx);
printf("\n");
} else {
printf("OK, %s\n", id);
}
free(id);
printf("Signing (RSA/SHA1) with key... ");
result = hsm_test_sign(ctx, key, LDNS_RSASHA1);
if (result) {
errors++;
printf("Failed, error: %d\n", result);
hsm_print_error(ctx);
} else {
printf("OK\n");
}
printf("Signing (RSA/SHA256) with key... ");
result = hsm_test_sign(ctx, key, LDNS_RSASHA256);
if (result) {
errors++;
printf("Failed, error: %d\n", result);
hsm_print_error(ctx);
} else {
printf("OK\n");
}
if ( keysize >= 1024) {
printf("Signing (RSA/SHA512) with key... ");
result = hsm_test_sign(ctx, key, LDNS_RSASHA512);
if (result) {
errors++;
printf("Failed, error: %d\n", result);
hsm_print_error(ctx);
} else {
printf("OK\n");
}
}
printf("Deleting key... ");
result = hsm_remove_key(ctx, key);
if (result) {
errors++;
printf("Failed: error: %d\n", result);
hsm_print_error(ctx);
} else {
printf("OK\n");
}
free(key);
printf("\n");
}
/*
* Test key generation, signing and deletion for a number of key size
*/
for (i=0; i<(sizeof(dsa_keysizes)/sizeof(unsigned int)); i++) {
keysize = dsa_keysizes[i];
printf("Generating %d-bit DSA key... ", keysize);
key = hsm_generate_dsa_key(ctx, repository, keysize);
if (!key) {
errors++;
printf("Failed\n");
hsm_print_error(ctx);
printf("\n");
continue;
} else {
printf("OK\n");
}
printf("Extracting key identifier... ");
id = hsm_get_key_id(ctx, key);
if (!id) {
errors++;
printf("Failed\n");
hsm_print_error(ctx);
printf("\n");
} else {
printf("OK, %s\n", id);
}
free(id);
printf("Signing (DSA/SHA1) with key... ");
result = hsm_test_sign(ctx, key, LDNS_DSA);
if (result) {
errors++;
printf("Failed, error: %d\n", result);
hsm_print_error(ctx);
} else {
printf("OK\n");
}
printf("Deleting key... ");
result = hsm_remove_key(ctx, key);
if (result) {
errors++;
printf("Failed: error: %d\n", result);
hsm_print_error(ctx);
} else {
printf("OK\n");
}
free(key);
printf("\n");
}
/*
* Test key generation, signing and deletion for a number of key size
*/
for (i=0; i<1; i++) {
printf("Generating 512-bit GOST key... ");
key = hsm_generate_gost_key(ctx, repository);
if (!key) {
errors++;
printf("Failed\n");
hsm_print_error(ctx);
printf("\n");
continue;
} else {
printf("OK\n");
}
printf("Extracting key identifier... ");
id = hsm_get_key_id(ctx, key);
if (!id) {
errors++;
printf("Failed\n");
hsm_print_error(ctx);
printf("\n");
} else {
printf("OK, %s\n", id);
}
free(id);
printf("Signing (GOST) with key... ");
result = hsm_test_sign(ctx, key, LDNS_ECC_GOST);
if (result) {
errors++;
printf("Failed, error: %d\n", result);
hsm_print_error(ctx);
} else {
printf("OK\n");
}
printf("Deleting key... ");
result = hsm_remove_key(ctx, key);
if (result) {
errors++;
printf("Failed: error: %d\n", result);
hsm_print_error(ctx);
} else {
printf("OK\n");
}
free(key);
printf("\n");
}
if (hsm_test_random()) {
errors++;
}
return errors;
}
opendnssec-1.4.3/libhsm/src/bin/hsmtest.h 0000664 0001750 0001750 00000002701 12017062714 015260 0000000 0000000 /*
* $Id: hsmtest.h 6560 2012-08-28 06:31:40Z rb $
*
* Copyright (c) 2009 Nominet UK.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef HSMTEST_H
#define HSMTEST_H 1
int
hsm_test (const char *repository);
#endif /* HSMTEST_H */
opendnssec-1.4.3/libhsm/src/bin/Makefile.am 0000664 0001750 0001750 00000001166 12021602664 015457 0000000 0000000 # $Id: Makefile.am 6620 2012-09-05 07:56:36Z matthijs $
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
LIBCOMPAT = ${top_builddir}/common/libcompat.a
AM_CPPFLAGS = \
-I$(top_srcdir)/common \
-I$(top_builddir)/common \
-I$(srcdir)/../lib \
@LDNS_INCLUDES@ @XML2_INCLUDES@
AM_CFLAGS = -std=c99
bin_PROGRAMS = ods-hsmutil ods-hsmspeed
man1_MANS = ods-hsmutil.1 ods-hsmspeed.1
ods_hsmutil_SOURCES = hsmutil.c hsmtest.c hsmtest.h
ods_hsmutil_LDADD = ../lib/libhsm.a @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT)
ods_hsmspeed_SOURCES = hsmspeed.c
ods_hsmspeed_LDADD = ../lib/libhsm.a -lpthread @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT)
opendnssec-1.4.3/libhsm/src/bin/ods-hsmspeed.1.in 0000664 0001750 0001750 00000003646 12017062714 016513 0000000 0000000 .TH "ods-hsmspeed" "1" "February 2010" "OpenDNSSEC" "OpenDNSSEC ods-hsmspeed"
.\" $Id: ods-hsmspeed.1.in 6560 2012-08-28 06:31:40Z rb $
.SH "NAME"
.LP
.B ods\-hsmspeed
\- OpenDNSSEC HSM speed tester
.SH "SYNOPSIS"
.LP
.B ods\-hsmspeed
.RB [ \-c
.IR config ]
.B \-r
.I repository
.RB [ \-i
.IR iterations ]
.RB [ \-s
.IR keysize ]
.RB [ \-t
.IR threads ]
.SH "DESCRIPTION"
.LP
The ods\-hsmspeed utility is part of OpenDNSSEC and can be used to test the
performance of the configured HSMs.
The components of OpenDNSSEC do not talk directly to the HSMs, but uses
an internal library called libhsm. It then talks to the HSMs using PKCS#11.
The libhsm simplifies the process of creating keys and signatures for the
other components of OpenDNSSEC.
ods\-hsmspeed will measure the speed by using the libhsm. The result that you
get is somewhat lower than what the manufactures promises, because the libhsm
creates some overhead to the pure PKCS#11 environment.
.SH "OPTIONS"
.LP
.TP
\fB\-c\fR \fIconfig\fR
Path to an OpenDNSSEC configuration file.
(defaults to @OPENDNSSEC_CONFIG_FILE@)
.TP
\fB\-i\fR \fIiterations\fR
Specify the number of \fIiterations\fR for signing an RRset.
A higher number of iterations will increase the performance.
(defaults to 1 iteration)
.TP
\fB\-r\fR \fIrepository\fR
The speed test will be performed on this \fIrepository\fR.
.TP
\fB\-s\fR \fIkeysize\fR
A temporary RSA key with the given \fIkeysize\fR will be used for signing.
(defaults to 1024 bit)
.TP
\fB\-t\fR \fIthreads\fR
The number of \fIthreads\fR to use.
Most HSMs will be utilized better with multiple threads.
(defaults to 1 thread)
.SH "SEE ALSO"
.LP
ods\-auditor(1), ods\-control(8), ods\-enforcerd(8),
ods\-hsmutil(1), ods\-kaspcheck(1), ods\-ksmutil(1), ods\-signer(8),
ods\-signerd(8), ods\-timing(5), opendnssec(7),
.B http://www.opendnssec.org/
.SH "AUTHORS"
.LP
.B ods\-hsmspeed
was written by Jakob Schlyter and Nominet as part of the OpenDNSSEC project.
opendnssec-1.4.3/libhsm/src/lib/ 0000775 0001750 0001750 00000000000 12247571202 013500 5 0000000 0000000 opendnssec-1.4.3/libhsm/src/lib/cryptoki_compat/ 0000775 0001750 0001750 00000000000 12247571202 016707 5 0000000 0000000 opendnssec-1.4.3/libhsm/src/lib/cryptoki_compat/pkcs11.h 0000664 0001750 0001750 00000123574 11616532031 020112 0000000 0000000 /* pkcs11.h
Copyright 2006, 2007 g10 Code GmbH
Copyright 2006 Andreas Jellinghaus
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. */
/* Please submit changes back to the Scute project at
http://www.scute.org/ (or send them to marcus@g10code.com), so that
they can be picked up by other projects from there as well. */
/* This file is a modified implementation of the PKCS #11 standard by
RSA Security Inc. It is mostly a drop-in replacement, with the
following change:
This header file does not require any macro definitions by the user
(like CK_DEFINE_FUNCTION etc). In fact, it defines those macros
for you (if useful, some are missing, let me know if you need
more).
There is an additional API available that does comply better to the
GNU coding standard. It can be switched on by defining
CRYPTOKI_GNU before including this header file. For this, the
following changes are made to the specification:
All structure types are changed to a "struct ck_foo" where CK_FOO
is the type name in PKCS #11.
All non-structure types are changed to ck_foo_t where CK_FOO is the
lowercase version of the type name in PKCS #11. The basic types
(CK_ULONG et al.) are removed without substitute.
All members of structures are modified in the following way: Type
indication prefixes are removed, and underscore characters are
inserted before words. Then the result is lowercased.
Note that function names are still in the original case, as they
need for ABI compatibility.
CK_FALSE, CK_TRUE and NULL_PTR are removed without substitute. Use
.
If CRYPTOKI_COMPAT is defined before including this header file,
then none of the API changes above take place, and the API is the
one defined by the PKCS #11 standard. */
#ifndef PKCS11_H
#define PKCS11_H 1
#if defined(__cplusplus)
extern "C" {
#endif
/* The version of cryptoki we implement. The revision is changed with
each modification of this file. If you do not use the "official"
version of this file, please consider deleting the revision macro
(you may use a macro with a different name to keep track of your
versions). */
#define CRYPTOKI_VERSION_MAJOR 2
#define CRYPTOKI_VERSION_MINOR 20
#define CRYPTOKI_VERSION_REVISION 6
/* Compatibility interface is default, unless CRYPTOKI_GNU is
given. */
#ifndef CRYPTOKI_GNU
#ifndef CRYPTOKI_COMPAT
#define CRYPTOKI_COMPAT 1
#endif
#endif
/* System dependencies. */
#if defined(_WIN32) || defined(CRYPTOKI_FORCE_WIN32)
/* There is a matching pop below. */
#pragma pack(push, cryptoki, 1)
#ifdef CRYPTOKI_EXPORTS
#define CK_SPEC __declspec(dllexport)
#else
#define CK_SPEC __declspec(dllimport)
#endif
#else
#define CK_SPEC
#endif
#ifdef CRYPTOKI_COMPAT
/* If we are in compatibility mode, switch all exposed names to the
PKCS #11 variant. There are corresponding #undefs below. */
#define ck_flags_t CK_FLAGS
#define ck_version _CK_VERSION
#define ck_info _CK_INFO
#define cryptoki_version cryptokiVersion
#define manufacturer_id manufacturerID
#define library_description libraryDescription
#define library_version libraryVersion
#define ck_notification_t CK_NOTIFICATION
#define ck_slot_id_t CK_SLOT_ID
#define ck_slot_info _CK_SLOT_INFO
#define slot_description slotDescription
#define hardware_version hardwareVersion
#define firmware_version firmwareVersion
#define ck_token_info _CK_TOKEN_INFO
#define serial_number serialNumber
#define max_session_count ulMaxSessionCount
#define session_count ulSessionCount
#define max_rw_session_count ulMaxRwSessionCount
#define rw_session_count ulRwSessionCount
#define max_pin_len ulMaxPinLen
#define min_pin_len ulMinPinLen
#define total_public_memory ulTotalPublicMemory
#define free_public_memory ulFreePublicMemory
#define total_private_memory ulTotalPrivateMemory
#define free_private_memory ulFreePrivateMemory
#define utc_time utcTime
#define ck_session_handle_t CK_SESSION_HANDLE
#define ck_user_type_t CK_USER_TYPE
#define ck_state_t CK_STATE
#define ck_session_info _CK_SESSION_INFO
#define slot_id slotID
#define device_error ulDeviceError
#define ck_object_handle_t CK_OBJECT_HANDLE
#define ck_object_class_t CK_OBJECT_CLASS
#define ck_hw_feature_type_t CK_HW_FEATURE_TYPE
#define ck_key_type_t CK_KEY_TYPE
#define ck_certificate_type_t CK_CERTIFICATE_TYPE
#define ck_attribute_type_t CK_ATTRIBUTE_TYPE
#define ck_attribute _CK_ATTRIBUTE
#define value pValue
#define value_len ulValueLen
#define ck_date _CK_DATE
#define ck_mechanism_type_t CK_MECHANISM_TYPE
#define ck_mechanism _CK_MECHANISM
#define parameter pParameter
#define parameter_len ulParameterLen
#define ck_mechanism_info _CK_MECHANISM_INFO
#define min_key_size ulMinKeySize
#define max_key_size ulMaxKeySize
#define ck_rv_t CK_RV
#define ck_notify_t CK_NOTIFY
#define ck_function_list _CK_FUNCTION_LIST
#define ck_createmutex_t CK_CREATEMUTEX
#define ck_destroymutex_t CK_DESTROYMUTEX
#define ck_lockmutex_t CK_LOCKMUTEX
#define ck_unlockmutex_t CK_UNLOCKMUTEX
#define ck_c_initialize_args _CK_C_INITIALIZE_ARGS
#define create_mutex CreateMutex
#define destroy_mutex DestroyMutex
#define lock_mutex LockMutex
#define unlock_mutex UnlockMutex
#define reserved pReserved
#endif /* CRYPTOKI_COMPAT */
typedef unsigned long ck_flags_t;
struct ck_version
{
unsigned char major;
unsigned char minor;
};
struct ck_info
{
struct ck_version cryptoki_version;
unsigned char manufacturer_id[32];
ck_flags_t flags;
unsigned char library_description[32];
struct ck_version library_version;
};
typedef unsigned long ck_notification_t;
#define CKN_SURRENDER (0)
typedef unsigned long ck_slot_id_t;
struct ck_slot_info
{
unsigned char slot_description[64];
unsigned char manufacturer_id[32];
ck_flags_t flags;
struct ck_version hardware_version;
struct ck_version firmware_version;
};
#define CKF_TOKEN_PRESENT (1 << 0)
#define CKF_REMOVABLE_DEVICE (1 << 1)
#define CKF_HW_SLOT (1 << 2)
#define CKF_ARRAY_ATTRIBUTE (1 << 30)
struct ck_token_info
{
unsigned char label[32];
unsigned char manufacturer_id[32];
unsigned char model[16];
unsigned char serial_number[16];
ck_flags_t flags;
unsigned long max_session_count;
unsigned long session_count;
unsigned long max_rw_session_count;
unsigned long rw_session_count;
unsigned long max_pin_len;
unsigned long min_pin_len;
unsigned long total_public_memory;
unsigned long free_public_memory;
unsigned long total_private_memory;
unsigned long free_private_memory;
struct ck_version hardware_version;
struct ck_version firmware_version;
unsigned char utc_time[16];
};
#define CKF_RNG (1 << 0)
#define CKF_WRITE_PROTECTED (1 << 1)
#define CKF_LOGIN_REQUIRED (1 << 2)
#define CKF_USER_PIN_INITIALIZED (1 << 3)
#define CKF_RESTORE_KEY_NOT_NEEDED (1 << 5)
#define CKF_CLOCK_ON_TOKEN (1 << 6)
#define CKF_PROTECTED_AUTHENTICATION_PATH (1 << 8)
#define CKF_DUAL_CRYPTO_OPERATIONS (1 << 9)
#define CKF_TOKEN_INITIALIZED (1 << 10)
#define CKF_SECONDARY_AUTHENTICATION (1 << 11)
#define CKF_USER_PIN_COUNT_LOW (1 << 16)
#define CKF_USER_PIN_FINAL_TRY (1 << 17)
#define CKF_USER_PIN_LOCKED (1 << 18)
#define CKF_USER_PIN_TO_BE_CHANGED (1 << 19)
#define CKF_SO_PIN_COUNT_LOW (1 << 20)
#define CKF_SO_PIN_FINAL_TRY (1 << 21)
#define CKF_SO_PIN_LOCKED (1 << 22)
#define CKF_SO_PIN_TO_BE_CHANGED (1 << 23)
#define CK_UNAVAILABLE_INFORMATION ((unsigned long) -1)
#define CK_EFFECTIVELY_INFINITE (0)
typedef unsigned long ck_session_handle_t;
#define CK_INVALID_HANDLE (0)
typedef unsigned long ck_user_type_t;
#define CKU_SO (0)
#define CKU_USER (1)
#define CKU_CONTEXT_SPECIFIC (2)
typedef unsigned long ck_state_t;
#define CKS_RO_PUBLIC_SESSION (0)
#define CKS_RO_USER_FUNCTIONS (1)
#define CKS_RW_PUBLIC_SESSION (2)
#define CKS_RW_USER_FUNCTIONS (3)
#define CKS_RW_SO_FUNCTIONS (4)
struct ck_session_info
{
ck_slot_id_t slot_id;
ck_state_t state;
ck_flags_t flags;
unsigned long device_error;
};
#define CKF_RW_SESSION (1 << 1)
#define CKF_SERIAL_SESSION (1 << 2)
typedef unsigned long ck_object_handle_t;
typedef unsigned long ck_object_class_t;
#define CKO_DATA (0)
#define CKO_CERTIFICATE (1)
#define CKO_PUBLIC_KEY (2)
#define CKO_PRIVATE_KEY (3)
#define CKO_SECRET_KEY (4)
#define CKO_HW_FEATURE (5)
#define CKO_DOMAIN_PARAMETERS (6)
#define CKO_MECHANISM (7)
#define CKO_VENDOR_DEFINED ((unsigned long) (1 << 31))
typedef unsigned long ck_hw_feature_type_t;
#define CKH_MONOTONIC_COUNTER (1)
#define CKH_CLOCK (2)
#define CKH_USER_INTERFACE (3)
#define CKH_VENDOR_DEFINED ((unsigned long) (1 << 31))
typedef unsigned long ck_key_type_t;
#define CKK_RSA (0)
#define CKK_DSA (1)
#define CKK_DH (2)
#define CKK_ECDSA (3)
#define CKK_EC (3)
#define CKK_X9_42_DH (4)
#define CKK_KEA (5)
#define CKK_GENERIC_SECRET (0x10)
#define CKK_RC2 (0x11)
#define CKK_RC4 (0x12)
#define CKK_DES (0x13)
#define CKK_DES2 (0x14)
#define CKK_DES3 (0x15)
#define CKK_CAST (0x16)
#define CKK_CAST3 (0x17)
#define CKK_CAST128 (0x18)
#define CKK_RC5 (0x19)
#define CKK_IDEA (0x1a)
#define CKK_SKIPJACK (0x1b)
#define CKK_BATON (0x1c)
#define CKK_JUNIPER (0x1d)
#define CKK_CDMF (0x1e)
#define CKK_AES (0x1f)
#define CKK_BLOWFISH (0x20)
#define CKK_TWOFISH (0x21)
#define CKK_GOSTR3410 (0x30) /* From PKCS#11 v2.30 - draft 7 */
#define CKK_VENDOR_DEFINED ((unsigned long) (1 << 31))
typedef unsigned long ck_certificate_type_t;
#define CKC_X_509 (0)
#define CKC_X_509_ATTR_CERT (1)
#define CKC_WTLS (2)
#define CKC_VENDOR_DEFINED ((unsigned long) (1 << 31))
typedef unsigned long ck_attribute_type_t;
#define CKA_CLASS (0)
#define CKA_TOKEN (1)
#define CKA_PRIVATE (2)
#define CKA_LABEL (3)
#define CKA_APPLICATION (0x10)
#define CKA_VALUE (0x11)
#define CKA_OBJECT_ID (0x12)
#define CKA_CERTIFICATE_TYPE (0x80)
#define CKA_ISSUER (0x81)
#define CKA_SERIAL_NUMBER (0x82)
#define CKA_AC_ISSUER (0x83)
#define CKA_OWNER (0x84)
#define CKA_ATTR_TYPES (0x85)
#define CKA_TRUSTED (0x86)
#define CKA_CERTIFICATE_CATEGORY (0x87)
#define CKA_JAVA_MIDP_SECURITY_DOMAIN (0x88)
#define CKA_URL (0x89)
#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY (0x8a)
#define CKA_HASH_OF_ISSUER_PUBLIC_KEY (0x8b)
#define CKA_CHECK_VALUE (0x90)
#define CKA_KEY_TYPE (0x100)
#define CKA_SUBJECT (0x101)
#define CKA_ID (0x102)
#define CKA_SENSITIVE (0x103)
#define CKA_ENCRYPT (0x104)
#define CKA_DECRYPT (0x105)
#define CKA_WRAP (0x106)
#define CKA_UNWRAP (0x107)
#define CKA_SIGN (0x108)
#define CKA_SIGN_RECOVER (0x109)
#define CKA_VERIFY (0x10a)
#define CKA_VERIFY_RECOVER (0x10b)
#define CKA_DERIVE (0x10c)
#define CKA_START_DATE (0x110)
#define CKA_END_DATE (0x111)
#define CKA_MODULUS (0x120)
#define CKA_MODULUS_BITS (0x121)
#define CKA_PUBLIC_EXPONENT (0x122)
#define CKA_PRIVATE_EXPONENT (0x123)
#define CKA_PRIME_1 (0x124)
#define CKA_PRIME_2 (0x125)
#define CKA_EXPONENT_1 (0x126)
#define CKA_EXPONENT_2 (0x127)
#define CKA_COEFFICIENT (0x128)
#define CKA_PRIME (0x130)
#define CKA_SUBPRIME (0x131)
#define CKA_BASE (0x132)
#define CKA_PRIME_BITS (0x133)
#define CKA_SUB_PRIME_BITS (0x134)
#define CKA_VALUE_BITS (0x160)
#define CKA_VALUE_LEN (0x161)
#define CKA_EXTRACTABLE (0x162)
#define CKA_LOCAL (0x163)
#define CKA_NEVER_EXTRACTABLE (0x164)
#define CKA_ALWAYS_SENSITIVE (0x165)
#define CKA_KEY_GEN_MECHANISM (0x166)
#define CKA_MODIFIABLE (0x170)
#define CKA_ECDSA_PARAMS (0x180)
#define CKA_EC_PARAMS (0x180)
#define CKA_EC_POINT (0x181)
#define CKA_SECONDARY_AUTH (0x200)
#define CKA_AUTH_PIN_FLAGS (0x201)
#define CKA_ALWAYS_AUTHENTICATE (0x202)
#define CKA_WRAP_WITH_TRUSTED (0x210)
#define CKA_GOSTR3410PARAMS (0x250) /* From PKCS#11 v2.30 - draft 7 */
#define CKA_HW_FEATURE_TYPE (0x300)
#define CKA_RESET_ON_INIT (0x301)
#define CKA_HAS_RESET (0x302)
#define CKA_PIXEL_X (0x400)
#define CKA_PIXEL_Y (0x401)
#define CKA_RESOLUTION (0x402)
#define CKA_CHAR_ROWS (0x403)
#define CKA_CHAR_COLUMNS (0x404)
#define CKA_COLOR (0x405)
#define CKA_BITS_PER_PIXEL (0x406)
#define CKA_CHAR_SETS (0x480)
#define CKA_ENCODING_METHODS (0x481)
#define CKA_MIME_TYPES (0x482)
#define CKA_MECHANISM_TYPE (0x500)
#define CKA_REQUIRED_CMS_ATTRIBUTES (0x501)
#define CKA_DEFAULT_CMS_ATTRIBUTES (0x502)
#define CKA_SUPPORTED_CMS_ATTRIBUTES (0x503)
#define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE | 0x211)
#define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE | 0x212)
#define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE | 0x600)
#define CKA_VENDOR_DEFINED ((unsigned long) (1 << 31))
struct ck_attribute
{
ck_attribute_type_t type;
void *value;
unsigned long value_len;
};
struct ck_date
{
unsigned char year[4];
unsigned char month[2];
unsigned char day[2];
};
typedef unsigned long ck_mechanism_type_t;
#define CKM_RSA_PKCS_KEY_PAIR_GEN (0)
#define CKM_RSA_PKCS (1)
#define CKM_RSA_9796 (2)
#define CKM_RSA_X_509 (3)
#define CKM_MD2_RSA_PKCS (4)
#define CKM_MD5_RSA_PKCS (5)
#define CKM_SHA1_RSA_PKCS (6)
#define CKM_RIPEMD128_RSA_PKCS (7)
#define CKM_RIPEMD160_RSA_PKCS (8)
#define CKM_RSA_PKCS_OAEP (9)
#define CKM_RSA_X9_31_KEY_PAIR_GEN (0xa)
#define CKM_RSA_X9_31 (0xb)
#define CKM_SHA1_RSA_X9_31 (0xc)
#define CKM_RSA_PKCS_PSS (0xd)
#define CKM_SHA1_RSA_PKCS_PSS (0xe)
#define CKM_DSA_KEY_PAIR_GEN (0x10)
#define CKM_DSA (0x11)
#define CKM_DSA_SHA1 (0x12)
#define CKM_DH_PKCS_KEY_PAIR_GEN (0x20)
#define CKM_DH_PKCS_DERIVE (0x21)
#define CKM_X9_42_DH_KEY_PAIR_GEN (0x30)
#define CKM_X9_42_DH_DERIVE (0x31)
#define CKM_X9_42_DH_HYBRID_DERIVE (0x32)
#define CKM_X9_42_MQV_DERIVE (0x33)
#define CKM_SHA256_RSA_PKCS (0x40)
#define CKM_SHA384_RSA_PKCS (0x41)
#define CKM_SHA512_RSA_PKCS (0x42)
#define CKM_SHA256_RSA_PKCS_PSS (0x43)
#define CKM_SHA384_RSA_PKCS_PSS (0x44)
#define CKM_SHA512_RSA_PKCS_PSS (0x45)
#define CKM_RC2_KEY_GEN (0x100)
#define CKM_RC2_ECB (0x101)
#define CKM_RC2_CBC (0x102)
#define CKM_RC2_MAC (0x103)
#define CKM_RC2_MAC_GENERAL (0x104)
#define CKM_RC2_CBC_PAD (0x105)
#define CKM_RC4_KEY_GEN (0x110)
#define CKM_RC4 (0x111)
#define CKM_DES_KEY_GEN (0x120)
#define CKM_DES_ECB (0x121)
#define CKM_DES_CBC (0x122)
#define CKM_DES_MAC (0x123)
#define CKM_DES_MAC_GENERAL (0x124)
#define CKM_DES_CBC_PAD (0x125)
#define CKM_DES2_KEY_GEN (0x130)
#define CKM_DES3_KEY_GEN (0x131)
#define CKM_DES3_ECB (0x132)
#define CKM_DES3_CBC (0x133)
#define CKM_DES3_MAC (0x134)
#define CKM_DES3_MAC_GENERAL (0x135)
#define CKM_DES3_CBC_PAD (0x136)
#define CKM_CDMF_KEY_GEN (0x140)
#define CKM_CDMF_ECB (0x141)
#define CKM_CDMF_CBC (0x142)
#define CKM_CDMF_MAC (0x143)
#define CKM_CDMF_MAC_GENERAL (0x144)
#define CKM_CDMF_CBC_PAD (0x145)
#define CKM_MD2 (0x200)
#define CKM_MD2_HMAC (0x201)
#define CKM_MD2_HMAC_GENERAL (0x202)
#define CKM_MD5 (0x210)
#define CKM_MD5_HMAC (0x211)
#define CKM_MD5_HMAC_GENERAL (0x212)
#define CKM_SHA_1 (0x220)
#define CKM_SHA_1_HMAC (0x221)
#define CKM_SHA_1_HMAC_GENERAL (0x222)
#define CKM_RIPEMD128 (0x230)
#define CKM_RIPEMD128_HMAC (0x231)
#define CKM_RIPEMD128_HMAC_GENERAL (0x232)
#define CKM_RIPEMD160 (0x240)
#define CKM_RIPEMD160_HMAC (0x241)
#define CKM_RIPEMD160_HMAC_GENERAL (0x242)
#define CKM_SHA256 (0x250)
#define CKM_SHA256_HMAC (0x251)
#define CKM_SHA256_HMAC_GENERAL (0x252)
#define CKM_SHA384 (0x260)
#define CKM_SHA384_HMAC (0x261)
#define CKM_SHA384_HMAC_GENERAL (0x262)
#define CKM_SHA512 (0x270)
#define CKM_SHA512_HMAC (0x271)
#define CKM_SHA512_HMAC_GENERAL (0x272)
#define CKM_CAST_KEY_GEN (0x300)
#define CKM_CAST_ECB (0x301)
#define CKM_CAST_CBC (0x302)
#define CKM_CAST_MAC (0x303)
#define CKM_CAST_MAC_GENERAL (0x304)
#define CKM_CAST_CBC_PAD (0x305)
#define CKM_CAST3_KEY_GEN (0x310)
#define CKM_CAST3_ECB (0x311)
#define CKM_CAST3_CBC (0x312)
#define CKM_CAST3_MAC (0x313)
#define CKM_CAST3_MAC_GENERAL (0x314)
#define CKM_CAST3_CBC_PAD (0x315)
#define CKM_CAST5_KEY_GEN (0x320)
#define CKM_CAST128_KEY_GEN (0x320)
#define CKM_CAST5_ECB (0x321)
#define CKM_CAST128_ECB (0x321)
#define CKM_CAST5_CBC (0x322)
#define CKM_CAST128_CBC (0x322)
#define CKM_CAST5_MAC (0x323)
#define CKM_CAST128_MAC (0x323)
#define CKM_CAST5_MAC_GENERAL (0x324)
#define CKM_CAST128_MAC_GENERAL (0x324)
#define CKM_CAST5_CBC_PAD (0x325)
#define CKM_CAST128_CBC_PAD (0x325)
#define CKM_RC5_KEY_GEN (0x330)
#define CKM_RC5_ECB (0x331)
#define CKM_RC5_CBC (0x332)
#define CKM_RC5_MAC (0x333)
#define CKM_RC5_MAC_GENERAL (0x334)
#define CKM_RC5_CBC_PAD (0x335)
#define CKM_IDEA_KEY_GEN (0x340)
#define CKM_IDEA_ECB (0x341)
#define CKM_IDEA_CBC (0x342)
#define CKM_IDEA_MAC (0x343)
#define CKM_IDEA_MAC_GENERAL (0x344)
#define CKM_IDEA_CBC_PAD (0x345)
#define CKM_GENERIC_SECRET_KEY_GEN (0x350)
#define CKM_CONCATENATE_BASE_AND_KEY (0x360)
#define CKM_CONCATENATE_BASE_AND_DATA (0x362)
#define CKM_CONCATENATE_DATA_AND_BASE (0x363)
#define CKM_XOR_BASE_AND_DATA (0x364)
#define CKM_EXTRACT_KEY_FROM_KEY (0x365)
#define CKM_SSL3_PRE_MASTER_KEY_GEN (0x370)
#define CKM_SSL3_MASTER_KEY_DERIVE (0x371)
#define CKM_SSL3_KEY_AND_MAC_DERIVE (0x372)
#define CKM_SSL3_MASTER_KEY_DERIVE_DH (0x373)
#define CKM_TLS_PRE_MASTER_KEY_GEN (0x374)
#define CKM_TLS_MASTER_KEY_DERIVE (0x375)
#define CKM_TLS_KEY_AND_MAC_DERIVE (0x376)
#define CKM_TLS_MASTER_KEY_DERIVE_DH (0x377)
#define CKM_SSL3_MD5_MAC (0x380)
#define CKM_SSL3_SHA1_MAC (0x381)
#define CKM_MD5_KEY_DERIVATION (0x390)
#define CKM_MD2_KEY_DERIVATION (0x391)
#define CKM_SHA1_KEY_DERIVATION (0x392)
#define CKM_PBE_MD2_DES_CBC (0x3a0)
#define CKM_PBE_MD5_DES_CBC (0x3a1)
#define CKM_PBE_MD5_CAST_CBC (0x3a2)
#define CKM_PBE_MD5_CAST3_CBC (0x3a3)
#define CKM_PBE_MD5_CAST5_CBC (0x3a4)
#define CKM_PBE_MD5_CAST128_CBC (0x3a4)
#define CKM_PBE_SHA1_CAST5_CBC (0x3a5)
#define CKM_PBE_SHA1_CAST128_CBC (0x3a5)
#define CKM_PBE_SHA1_RC4_128 (0x3a6)
#define CKM_PBE_SHA1_RC4_40 (0x3a7)
#define CKM_PBE_SHA1_DES3_EDE_CBC (0x3a8)
#define CKM_PBE_SHA1_DES2_EDE_CBC (0x3a9)
#define CKM_PBE_SHA1_RC2_128_CBC (0x3aa)
#define CKM_PBE_SHA1_RC2_40_CBC (0x3ab)
#define CKM_PKCS5_PBKD2 (0x3b0)
#define CKM_PBA_SHA1_WITH_SHA1_HMAC (0x3c0)
#define CKM_KEY_WRAP_LYNKS (0x400)
#define CKM_KEY_WRAP_SET_OAEP (0x401)
#define CKM_SKIPJACK_KEY_GEN (0x1000)
#define CKM_SKIPJACK_ECB64 (0x1001)
#define CKM_SKIPJACK_CBC64 (0x1002)
#define CKM_SKIPJACK_OFB64 (0x1003)
#define CKM_SKIPJACK_CFB64 (0x1004)
#define CKM_SKIPJACK_CFB32 (0x1005)
#define CKM_SKIPJACK_CFB16 (0x1006)
#define CKM_SKIPJACK_CFB8 (0x1007)
#define CKM_SKIPJACK_WRAP (0x1008)
#define CKM_SKIPJACK_PRIVATE_WRAP (0x1009)
#define CKM_SKIPJACK_RELAYX (0x100a)
#define CKM_KEA_KEY_PAIR_GEN (0x1010)
#define CKM_KEA_KEY_DERIVE (0x1011)
#define CKM_FORTEZZA_TIMESTAMP (0x1020)
#define CKM_BATON_KEY_GEN (0x1030)
#define CKM_BATON_ECB128 (0x1031)
#define CKM_BATON_ECB96 (0x1032)
#define CKM_BATON_CBC128 (0x1033)
#define CKM_BATON_COUNTER (0x1034)
#define CKM_BATON_SHUFFLE (0x1035)
#define CKM_BATON_WRAP (0x1036)
#define CKM_ECDSA_KEY_PAIR_GEN (0x1040)
#define CKM_EC_KEY_PAIR_GEN (0x1040)
#define CKM_ECDSA (0x1041)
#define CKM_ECDSA_SHA1 (0x1042)
#define CKM_ECDH1_DERIVE (0x1050)
#define CKM_ECDH1_COFACTOR_DERIVE (0x1051)
#define CKM_ECMQV_DERIVE (0x1052)
#define CKM_JUNIPER_KEY_GEN (0x1060)
#define CKM_JUNIPER_ECB128 (0x1061)
#define CKM_JUNIPER_CBC128 (0x1062)
#define CKM_JUNIPER_COUNTER (0x1063)
#define CKM_JUNIPER_SHUFFLE (0x1064)
#define CKM_JUNIPER_WRAP (0x1065)
#define CKM_FASTHASH (0x1070)
#define CKM_AES_KEY_GEN (0x1080)
#define CKM_AES_ECB (0x1081)
#define CKM_AES_CBC (0x1082)
#define CKM_AES_MAC (0x1083)
#define CKM_AES_MAC_GENERAL (0x1084)
#define CKM_AES_CBC_PAD (0x1085)
#define CKM_GOSTR3410_KEY_PAIR_GEN (0x1200) /* From PKCS#11 v2.30 - draft 7 */
#define CKM_GOSTR3410 (0x1201) /* From PKCS#11 v2.30 - draft 7 */
#define CKM_GOSTR3410_WITH_GOSTR3411 (0x1202) /* From PKCS#11 v2.30 - draft 7 */
#define CKM_GOSTR3411 (0x1210) /* From PKCS#11 v2.30 - draft 7 */
#define CKM_DSA_PARAMETER_GEN (0x2000)
#define CKM_DH_PKCS_PARAMETER_GEN (0x2001)
#define CKM_X9_42_DH_PARAMETER_GEN (0x2002)
#define CKM_VENDOR_DEFINED ((unsigned long) (1 << 31))
struct ck_mechanism
{
ck_mechanism_type_t mechanism;
void *parameter;
unsigned long parameter_len;
};
struct ck_mechanism_info
{
unsigned long min_key_size;
unsigned long max_key_size;
ck_flags_t flags;
};
#define CKF_HW (1 << 0)
#define CKF_ENCRYPT (1 << 8)
#define CKF_DECRYPT (1 << 9)
#define CKF_DIGEST (1 << 10)
#define CKF_SIGN (1 << 11)
#define CKF_SIGN_RECOVER (1 << 12)
#define CKF_VERIFY (1 << 13)
#define CKF_VERIFY_RECOVER (1 << 14)
#define CKF_GENERATE (1 << 15)
#define CKF_GENERATE_KEY_PAIR (1 << 16)
#define CKF_WRAP (1 << 17)
#define CKF_UNWRAP (1 << 18)
#define CKF_DERIVE (1 << 19)
#define CKF_EXTENSION ((unsigned long) (1 << 31))
/* Flags for C_WaitForSlotEvent. */
#define CKF_DONT_BLOCK (1)
typedef unsigned long ck_rv_t;
typedef ck_rv_t (*ck_notify_t) (ck_session_handle_t session,
ck_notification_t event, void *application);
/* Forward reference. */
struct ck_function_list;
#define _CK_DECLARE_FUNCTION(name, args) \
typedef ck_rv_t (*CK_ ## name) args; \
ck_rv_t CK_SPEC name args
_CK_DECLARE_FUNCTION (C_Initialize, (void *init_args));
_CK_DECLARE_FUNCTION (C_Finalize, (void *reserved));
_CK_DECLARE_FUNCTION (C_GetInfo, (struct ck_info *info));
_CK_DECLARE_FUNCTION (C_GetFunctionList,
(struct ck_function_list **function_list));
_CK_DECLARE_FUNCTION (C_GetSlotList,
(unsigned char token_present, ck_slot_id_t *slot_list,
unsigned long *count));
_CK_DECLARE_FUNCTION (C_GetSlotInfo,
(ck_slot_id_t slot_id, struct ck_slot_info *info));
_CK_DECLARE_FUNCTION (C_GetTokenInfo,
(ck_slot_id_t slot_id, struct ck_token_info *info));
_CK_DECLARE_FUNCTION (C_WaitForSlotEvent,
(ck_flags_t flags, ck_slot_id_t *slot, void *reserved));
_CK_DECLARE_FUNCTION (C_GetMechanismList,
(ck_slot_id_t slot_id,
ck_mechanism_type_t *mechanism_list,
unsigned long *count));
_CK_DECLARE_FUNCTION (C_GetMechanismInfo,
(ck_slot_id_t slot_id, ck_mechanism_type_t type,
struct ck_mechanism_info *info));
_CK_DECLARE_FUNCTION (C_InitToken,
(ck_slot_id_t slot_id, unsigned char *pin,
unsigned long pin_len, unsigned char *label));
_CK_DECLARE_FUNCTION (C_InitPIN,
(ck_session_handle_t session, unsigned char *pin,
unsigned long pin_len));
_CK_DECLARE_FUNCTION (C_SetPIN,
(ck_session_handle_t session, unsigned char *old_pin,
unsigned long old_len, unsigned char *new_pin,
unsigned long new_len));
_CK_DECLARE_FUNCTION (C_OpenSession,
(ck_slot_id_t slot_id, ck_flags_t flags,
void *application, ck_notify_t notify,
ck_session_handle_t *session));
_CK_DECLARE_FUNCTION (C_CloseSession, (ck_session_handle_t session));
_CK_DECLARE_FUNCTION (C_CloseAllSessions, (ck_slot_id_t slot_id));
_CK_DECLARE_FUNCTION (C_GetSessionInfo,
(ck_session_handle_t session,
struct ck_session_info *info));
_CK_DECLARE_FUNCTION (C_GetOperationState,
(ck_session_handle_t session,
unsigned char *operation_state,
unsigned long *operation_state_len));
_CK_DECLARE_FUNCTION (C_SetOperationState,
(ck_session_handle_t session,
unsigned char *operation_state,
unsigned long operation_state_len,
ck_object_handle_t encryption_key,
ck_object_handle_t authentiation_key));
_CK_DECLARE_FUNCTION (C_Login,
(ck_session_handle_t session, ck_user_type_t user_type,
unsigned char *pin, unsigned long pin_len));
_CK_DECLARE_FUNCTION (C_Logout, (ck_session_handle_t session));
_CK_DECLARE_FUNCTION (C_CreateObject,
(ck_session_handle_t session,
struct ck_attribute *templ,
unsigned long count, ck_object_handle_t *object));
_CK_DECLARE_FUNCTION (C_CopyObject,
(ck_session_handle_t session, ck_object_handle_t object,
struct ck_attribute *templ, unsigned long count,
ck_object_handle_t *new_object));
_CK_DECLARE_FUNCTION (C_DestroyObject,
(ck_session_handle_t session,
ck_object_handle_t object));
_CK_DECLARE_FUNCTION (C_GetObjectSize,
(ck_session_handle_t session,
ck_object_handle_t object,
unsigned long *size));
_CK_DECLARE_FUNCTION (C_GetAttributeValue,
(ck_session_handle_t session,
ck_object_handle_t object,
struct ck_attribute *templ,
unsigned long count));
_CK_DECLARE_FUNCTION (C_SetAttributeValue,
(ck_session_handle_t session,
ck_object_handle_t object,
struct ck_attribute *templ,
unsigned long count));
_CK_DECLARE_FUNCTION (C_FindObjectsInit,
(ck_session_handle_t session,
struct ck_attribute *templ,
unsigned long count));
_CK_DECLARE_FUNCTION (C_FindObjects,
(ck_session_handle_t session,
ck_object_handle_t *object,
unsigned long max_object_count,
unsigned long *object_count));
_CK_DECLARE_FUNCTION (C_FindObjectsFinal,
(ck_session_handle_t session));
_CK_DECLARE_FUNCTION (C_EncryptInit,
(ck_session_handle_t session,
struct ck_mechanism *mechanism,
ck_object_handle_t key));
_CK_DECLARE_FUNCTION (C_Encrypt,
(ck_session_handle_t session,
unsigned char *data, unsigned long data_len,
unsigned char *encrypted_data,
unsigned long *encrypted_data_len));
_CK_DECLARE_FUNCTION (C_EncryptUpdate,
(ck_session_handle_t session,
unsigned char *part, unsigned long part_len,
unsigned char *encrypted_part,
unsigned long *encrypted_part_len));
_CK_DECLARE_FUNCTION (C_EncryptFinal,
(ck_session_handle_t session,
unsigned char *last_encrypted_part,
unsigned long *last_encrypted_part_len));
_CK_DECLARE_FUNCTION (C_DecryptInit,
(ck_session_handle_t session,
struct ck_mechanism *mechanism,
ck_object_handle_t key));
_CK_DECLARE_FUNCTION (C_Decrypt,
(ck_session_handle_t session,
unsigned char *encrypted_data,
unsigned long encrypted_data_len,
unsigned char *data, unsigned long *data_len));
_CK_DECLARE_FUNCTION (C_DecryptUpdate,
(ck_session_handle_t session,
unsigned char *encrypted_part,
unsigned long encrypted_part_len,
unsigned char *part, unsigned long *part_len));
_CK_DECLARE_FUNCTION (C_DecryptFinal,
(ck_session_handle_t session,
unsigned char *last_part,
unsigned long *last_part_len));
_CK_DECLARE_FUNCTION (C_DigestInit,
(ck_session_handle_t session,
struct ck_mechanism *mechanism));
_CK_DECLARE_FUNCTION (C_Digest,
(ck_session_handle_t session,
unsigned char *data, unsigned long data_len,
unsigned char *digest,
unsigned long *digest_len));
_CK_DECLARE_FUNCTION (C_DigestUpdate,
(ck_session_handle_t session,
unsigned char *part, unsigned long part_len));
_CK_DECLARE_FUNCTION (C_DigestKey,
(ck_session_handle_t session, ck_object_handle_t key));
_CK_DECLARE_FUNCTION (C_DigestFinal,
(ck_session_handle_t session,
unsigned char *digest,
unsigned long *digest_len));
_CK_DECLARE_FUNCTION (C_SignInit,
(ck_session_handle_t session,
struct ck_mechanism *mechanism,
ck_object_handle_t key));
_CK_DECLARE_FUNCTION (C_Sign,
(ck_session_handle_t session,
unsigned char *data, unsigned long data_len,
unsigned char *signature,
unsigned long *signature_len));
_CK_DECLARE_FUNCTION (C_SignUpdate,
(ck_session_handle_t session,
unsigned char *part, unsigned long part_len));
_CK_DECLARE_FUNCTION (C_SignFinal,
(ck_session_handle_t session,
unsigned char *signature,
unsigned long *signature_len));
_CK_DECLARE_FUNCTION (C_SignRecoverInit,
(ck_session_handle_t session,
struct ck_mechanism *mechanism,
ck_object_handle_t key));
_CK_DECLARE_FUNCTION (C_SignRecover,
(ck_session_handle_t session,
unsigned char *data, unsigned long data_len,
unsigned char *signature,
unsigned long *signature_len));
_CK_DECLARE_FUNCTION (C_VerifyInit,
(ck_session_handle_t session,
struct ck_mechanism *mechanism,
ck_object_handle_t key));
_CK_DECLARE_FUNCTION (C_Verify,
(ck_session_handle_t session,
unsigned char *data, unsigned long data_len,
unsigned char *signature,
unsigned long signature_len));
_CK_DECLARE_FUNCTION (C_VerifyUpdate,
(ck_session_handle_t session,
unsigned char *part, unsigned long part_len));
_CK_DECLARE_FUNCTION (C_VerifyFinal,
(ck_session_handle_t session,
unsigned char *signature,
unsigned long signature_len));
_CK_DECLARE_FUNCTION (C_VerifyRecoverInit,
(ck_session_handle_t session,
struct ck_mechanism *mechanism,
ck_object_handle_t key));
_CK_DECLARE_FUNCTION (C_VerifyRecover,
(ck_session_handle_t session,
unsigned char *signature,
unsigned long signature_len,
unsigned char *data,
unsigned long *data_len));
_CK_DECLARE_FUNCTION (C_DigestEncryptUpdate,
(ck_session_handle_t session,
unsigned char *part, unsigned long part_len,
unsigned char *encrypted_part,
unsigned long *encrypted_part_len));
_CK_DECLARE_FUNCTION (C_DecryptDigestUpdate,
(ck_session_handle_t session,
unsigned char *encrypted_part,
unsigned long encrypted_part_len,
unsigned char *part,
unsigned long *part_len));
_CK_DECLARE_FUNCTION (C_SignEncryptUpdate,
(ck_session_handle_t session,
unsigned char *part, unsigned long part_len,
unsigned char *encrypted_part,
unsigned long *encrypted_part_len));
_CK_DECLARE_FUNCTION (C_DecryptVerifyUpdate,
(ck_session_handle_t session,
unsigned char *encrypted_part,
unsigned long encrypted_part_len,
unsigned char *part,
unsigned long *part_len));
_CK_DECLARE_FUNCTION (C_GenerateKey,
(ck_session_handle_t session,
struct ck_mechanism *mechanism,
struct ck_attribute *templ,
unsigned long count,
ck_object_handle_t *key));
_CK_DECLARE_FUNCTION (C_GenerateKeyPair,
(ck_session_handle_t session,
struct ck_mechanism *mechanism,
struct ck_attribute *public_key_template,
unsigned long public_key_attribute_count,
struct ck_attribute *private_key_template,
unsigned long private_key_attribute_count,
ck_object_handle_t *public_key,
ck_object_handle_t *private_key));
_CK_DECLARE_FUNCTION (C_WrapKey,
(ck_session_handle_t session,
struct ck_mechanism *mechanism,
ck_object_handle_t wrapping_key,
ck_object_handle_t key,
unsigned char *wrapped_key,
unsigned long *wrapped_key_len));
_CK_DECLARE_FUNCTION (C_UnwrapKey,
(ck_session_handle_t session,
struct ck_mechanism *mechanism,
ck_object_handle_t unwrapping_key,
unsigned char *wrapped_key,
unsigned long wrapped_key_len,
struct ck_attribute *templ,
unsigned long attribute_count,
ck_object_handle_t *key));
_CK_DECLARE_FUNCTION (C_DeriveKey,
(ck_session_handle_t session,
struct ck_mechanism *mechanism,
ck_object_handle_t base_key,
struct ck_attribute *templ,
unsigned long attribute_count,
ck_object_handle_t *key));
_CK_DECLARE_FUNCTION (C_SeedRandom,
(ck_session_handle_t session, unsigned char *seed,
unsigned long seed_len));
_CK_DECLARE_FUNCTION (C_GenerateRandom,
(ck_session_handle_t session,
unsigned char *random_data,
unsigned long random_len));
_CK_DECLARE_FUNCTION (C_GetFunctionStatus, (ck_session_handle_t session));
_CK_DECLARE_FUNCTION (C_CancelFunction, (ck_session_handle_t session));
struct ck_function_list
{
struct ck_version version;
CK_C_Initialize C_Initialize;
CK_C_Finalize C_Finalize;
CK_C_GetInfo C_GetInfo;
CK_C_GetFunctionList C_GetFunctionList;
CK_C_GetSlotList C_GetSlotList;
CK_C_GetSlotInfo C_GetSlotInfo;
CK_C_GetTokenInfo C_GetTokenInfo;
CK_C_GetMechanismList C_GetMechanismList;
CK_C_GetMechanismInfo C_GetMechanismInfo;
CK_C_InitToken C_InitToken;
CK_C_InitPIN C_InitPIN;
CK_C_SetPIN C_SetPIN;
CK_C_OpenSession C_OpenSession;
CK_C_CloseSession C_CloseSession;
CK_C_CloseAllSessions C_CloseAllSessions;
CK_C_GetSessionInfo C_GetSessionInfo;
CK_C_GetOperationState C_GetOperationState;
CK_C_SetOperationState C_SetOperationState;
CK_C_Login C_Login;
CK_C_Logout C_Logout;
CK_C_CreateObject C_CreateObject;
CK_C_CopyObject C_CopyObject;
CK_C_DestroyObject C_DestroyObject;
CK_C_GetObjectSize C_GetObjectSize;
CK_C_GetAttributeValue C_GetAttributeValue;
CK_C_SetAttributeValue C_SetAttributeValue;
CK_C_FindObjectsInit C_FindObjectsInit;
CK_C_FindObjects C_FindObjects;
CK_C_FindObjectsFinal C_FindObjectsFinal;
CK_C_EncryptInit C_EncryptInit;
CK_C_Encrypt C_Encrypt;
CK_C_EncryptUpdate C_EncryptUpdate;
CK_C_EncryptFinal C_EncryptFinal;
CK_C_DecryptInit C_DecryptInit;
CK_C_Decrypt C_Decrypt;
CK_C_DecryptUpdate C_DecryptUpdate;
CK_C_DecryptFinal C_DecryptFinal;
CK_C_DigestInit C_DigestInit;
CK_C_Digest C_Digest;
CK_C_DigestUpdate C_DigestUpdate;
CK_C_DigestKey C_DigestKey;
CK_C_DigestFinal C_DigestFinal;
CK_C_SignInit C_SignInit;
CK_C_Sign C_Sign;
CK_C_SignUpdate C_SignUpdate;
CK_C_SignFinal C_SignFinal;
CK_C_SignRecoverInit C_SignRecoverInit;
CK_C_SignRecover C_SignRecover;
CK_C_VerifyInit C_VerifyInit;
CK_C_Verify C_Verify;
CK_C_VerifyUpdate C_VerifyUpdate;
CK_C_VerifyFinal C_VerifyFinal;
CK_C_VerifyRecoverInit C_VerifyRecoverInit;
CK_C_VerifyRecover C_VerifyRecover;
CK_C_DigestEncryptUpdate C_DigestEncryptUpdate;
CK_C_DecryptDigestUpdate C_DecryptDigestUpdate;
CK_C_SignEncryptUpdate C_SignEncryptUpdate;
CK_C_DecryptVerifyUpdate C_DecryptVerifyUpdate;
CK_C_GenerateKey C_GenerateKey;
CK_C_GenerateKeyPair C_GenerateKeyPair;
CK_C_WrapKey C_WrapKey;
CK_C_UnwrapKey C_UnwrapKey;
CK_C_DeriveKey C_DeriveKey;
CK_C_SeedRandom C_SeedRandom;
CK_C_GenerateRandom C_GenerateRandom;
CK_C_GetFunctionStatus C_GetFunctionStatus;
CK_C_CancelFunction C_CancelFunction;
CK_C_WaitForSlotEvent C_WaitForSlotEvent;
};
typedef ck_rv_t (*ck_createmutex_t) (void **mutex);
typedef ck_rv_t (*ck_destroymutex_t) (void *mutex);
typedef ck_rv_t (*ck_lockmutex_t) (void *mutex);
typedef ck_rv_t (*ck_unlockmutex_t) (void *mutex);
struct ck_c_initialize_args
{
ck_createmutex_t create_mutex;
ck_destroymutex_t destroy_mutex;
ck_lockmutex_t lock_mutex;
ck_unlockmutex_t unlock_mutex;
ck_flags_t flags;
void *reserved;
};
#define CKF_LIBRARY_CANT_CREATE_OS_THREADS (1 << 0)
#define CKF_OS_LOCKING_OK (1 << 1)
#define CKR_OK (0)
#define CKR_CANCEL (1)
#define CKR_HOST_MEMORY (2)
#define CKR_SLOT_ID_INVALID (3)
#define CKR_GENERAL_ERROR (5)
#define CKR_FUNCTION_FAILED (6)
#define CKR_ARGUMENTS_BAD (7)
#define CKR_NO_EVENT (8)
#define CKR_NEED_TO_CREATE_THREADS (9)
#define CKR_CANT_LOCK (0xa)
#define CKR_ATTRIBUTE_READ_ONLY (0x10)
#define CKR_ATTRIBUTE_SENSITIVE (0x11)
#define CKR_ATTRIBUTE_TYPE_INVALID (0x12)
#define CKR_ATTRIBUTE_VALUE_INVALID (0x13)
#define CKR_DATA_INVALID (0x20)
#define CKR_DATA_LEN_RANGE (0x21)
#define CKR_DEVICE_ERROR (0x30)
#define CKR_DEVICE_MEMORY (0x31)
#define CKR_DEVICE_REMOVED (0x32)
#define CKR_ENCRYPTED_DATA_INVALID (0x40)
#define CKR_ENCRYPTED_DATA_LEN_RANGE (0x41)
#define CKR_FUNCTION_CANCELED (0x50)
#define CKR_FUNCTION_NOT_PARALLEL (0x51)
#define CKR_FUNCTION_NOT_SUPPORTED (0x54)
#define CKR_KEY_HANDLE_INVALID (0x60)
#define CKR_KEY_SIZE_RANGE (0x62)
#define CKR_KEY_TYPE_INCONSISTENT (0x63)
#define CKR_KEY_NOT_NEEDED (0x64)
#define CKR_KEY_CHANGED (0x65)
#define CKR_KEY_NEEDED (0x66)
#define CKR_KEY_INDIGESTIBLE (0x67)
#define CKR_KEY_FUNCTION_NOT_PERMITTED (0x68)
#define CKR_KEY_NOT_WRAPPABLE (0x69)
#define CKR_KEY_UNEXTRACTABLE (0x6a)
#define CKR_MECHANISM_INVALID (0x70)
#define CKR_MECHANISM_PARAM_INVALID (0x71)
#define CKR_OBJECT_HANDLE_INVALID (0x82)
#define CKR_OPERATION_ACTIVE (0x90)
#define CKR_OPERATION_NOT_INITIALIZED (0x91)
#define CKR_PIN_INCORRECT (0xa0)
#define CKR_PIN_INVALID (0xa1)
#define CKR_PIN_LEN_RANGE (0xa2)
#define CKR_PIN_EXPIRED (0xa3)
#define CKR_PIN_LOCKED (0xa4)
#define CKR_SESSION_CLOSED (0xb0)
#define CKR_SESSION_COUNT (0xb1)
#define CKR_SESSION_HANDLE_INVALID (0xb3)
#define CKR_SESSION_PARALLEL_NOT_SUPPORTED (0xb4)
#define CKR_SESSION_READ_ONLY (0xb5)
#define CKR_SESSION_EXISTS (0xb6)
#define CKR_SESSION_READ_ONLY_EXISTS (0xb7)
#define CKR_SESSION_READ_WRITE_SO_EXISTS (0xb8)
#define CKR_SIGNATURE_INVALID (0xc0)
#define CKR_SIGNATURE_LEN_RANGE (0xc1)
#define CKR_TEMPLATE_INCOMPLETE (0xd0)
#define CKR_TEMPLATE_INCONSISTENT (0xd1)
#define CKR_TOKEN_NOT_PRESENT (0xe0)
#define CKR_TOKEN_NOT_RECOGNIZED (0xe1)
#define CKR_TOKEN_WRITE_PROTECTED (0xe2)
#define CKR_UNWRAPPING_KEY_HANDLE_INVALID (0xf0)
#define CKR_UNWRAPPING_KEY_SIZE_RANGE (0xf1)
#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT (0xf2)
#define CKR_USER_ALREADY_LOGGED_IN (0x100)
#define CKR_USER_NOT_LOGGED_IN (0x101)
#define CKR_USER_PIN_NOT_INITIALIZED (0x102)
#define CKR_USER_TYPE_INVALID (0x103)
#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN (0x104)
#define CKR_USER_TOO_MANY_TYPES (0x105)
#define CKR_WRAPPED_KEY_INVALID (0x110)
#define CKR_WRAPPED_KEY_LEN_RANGE (0x112)
#define CKR_WRAPPING_KEY_HANDLE_INVALID (0x113)
#define CKR_WRAPPING_KEY_SIZE_RANGE (0x114)
#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT (0x115)
#define CKR_RANDOM_SEED_NOT_SUPPORTED (0x120)
#define CKR_RANDOM_NO_RNG (0x121)
#define CKR_DOMAIN_PARAMS_INVALID (0x130)
#define CKR_BUFFER_TOO_SMALL (0x150)
#define CKR_SAVED_STATE_INVALID (0x160)
#define CKR_INFORMATION_SENSITIVE (0x170)
#define CKR_STATE_UNSAVEABLE (0x180)
#define CKR_CRYPTOKI_NOT_INITIALIZED (0x190)
#define CKR_CRYPTOKI_ALREADY_INITIALIZED (0x191)
#define CKR_MUTEX_BAD (0x1a0)
#define CKR_MUTEX_NOT_LOCKED (0x1a1)
#define CKR_FUNCTION_REJECTED (0x200)
#define CKR_VENDOR_DEFINED ((unsigned long) (1 << 31))
/* Compatibility layer. */
#ifdef CRYPTOKI_COMPAT
#undef CK_DEFINE_FUNCTION
#define CK_DEFINE_FUNCTION(retval, name) retval CK_SPEC name
/* For NULL. */
#include
typedef unsigned char CK_BYTE;
typedef unsigned char CK_CHAR;
typedef unsigned char CK_UTF8CHAR;
typedef unsigned char CK_BBOOL;
typedef unsigned long int CK_ULONG;
typedef long int CK_LONG;
typedef CK_BYTE *CK_BYTE_PTR;
typedef CK_CHAR *CK_CHAR_PTR;
typedef CK_UTF8CHAR *CK_UTF8CHAR_PTR;
typedef CK_ULONG *CK_ULONG_PTR;
typedef void *CK_VOID_PTR;
typedef void **CK_VOID_PTR_PTR;
#define CK_FALSE 0
#define CK_TRUE 1
#ifndef CK_DISABLE_TRUE_FALSE
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#endif
typedef struct ck_version CK_VERSION;
typedef struct ck_version *CK_VERSION_PTR;
typedef struct ck_info CK_INFO;
typedef struct ck_info *CK_INFO_PTR;
typedef ck_slot_id_t *CK_SLOT_ID_PTR;
typedef struct ck_slot_info CK_SLOT_INFO;
typedef struct ck_slot_info *CK_SLOT_INFO_PTR;
typedef struct ck_token_info CK_TOKEN_INFO;
typedef struct ck_token_info *CK_TOKEN_INFO_PTR;
typedef ck_session_handle_t *CK_SESSION_HANDLE_PTR;
typedef struct ck_session_info CK_SESSION_INFO;
typedef struct ck_session_info *CK_SESSION_INFO_PTR;
typedef ck_object_handle_t *CK_OBJECT_HANDLE_PTR;
typedef ck_object_class_t *CK_OBJECT_CLASS_PTR;
typedef struct ck_attribute CK_ATTRIBUTE;
typedef struct ck_attribute *CK_ATTRIBUTE_PTR;
typedef struct ck_date CK_DATE;
typedef struct ck_date *CK_DATE_PTR;
typedef ck_mechanism_type_t *CK_MECHANISM_TYPE_PTR;
typedef struct ck_mechanism CK_MECHANISM;
typedef struct ck_mechanism *CK_MECHANISM_PTR;
typedef struct ck_mechanism_info CK_MECHANISM_INFO;
typedef struct ck_mechanism_info *CK_MECHANISM_INFO_PTR;
typedef struct ck_function_list CK_FUNCTION_LIST;
typedef struct ck_function_list *CK_FUNCTION_LIST_PTR;
typedef struct ck_function_list **CK_FUNCTION_LIST_PTR_PTR;
typedef struct ck_c_initialize_args CK_C_INITIALIZE_ARGS;
typedef struct ck_c_initialize_args *CK_C_INITIALIZE_ARGS_PTR;
#define NULL_PTR NULL
/* Delete the helper macros defined at the top of the file. */
#undef ck_flags_t
#undef ck_version
#undef ck_info
#undef cryptoki_version
#undef manufacturer_id
#undef library_description
#undef library_version
#undef ck_notification_t
#undef ck_slot_id_t
#undef ck_slot_info
#undef slot_description
#undef hardware_version
#undef firmware_version
#undef ck_token_info
#undef serial_number
#undef max_session_count
#undef session_count
#undef max_rw_session_count
#undef rw_session_count
#undef max_pin_len
#undef min_pin_len
#undef total_public_memory
#undef free_public_memory
#undef total_private_memory
#undef free_private_memory
#undef utc_time
#undef ck_session_handle_t
#undef ck_user_type_t
#undef ck_state_t
#undef ck_session_info
#undef slot_id
#undef device_error
#undef ck_object_handle_t
#undef ck_object_class_t
#undef ck_hw_feature_type_t
#undef ck_key_type_t
#undef ck_certificate_type_t
#undef ck_attribute_type_t
#undef ck_attribute
#undef value
#undef value_len
#undef ck_date
#undef ck_mechanism_type_t
#undef ck_mechanism
#undef parameter
#undef parameter_len
#undef ck_mechanism_info
#undef min_key_size
#undef max_key_size
#undef ck_rv_t
#undef ck_notify_t
#undef ck_function_list
#undef ck_createmutex_t
#undef ck_destroymutex_t
#undef ck_lockmutex_t
#undef ck_unlockmutex_t
#undef ck_c_initialize_args
#undef create_mutex
#undef destroy_mutex
#undef lock_mutex
#undef unlock_mutex
#undef reserved
#endif /* CRYPTOKI_COMPAT */
/* System dependencies. */
#if defined(_WIN32) || defined(CRYPTOKI_FORCE_WIN32)
#pragma pack(pop, cryptoki)
#endif
#if defined(__cplusplus)
}
#endif
#endif /* PKCS11_H */
opendnssec-1.4.3/libhsm/src/lib/libhsm.c 0000664 0001750 0001750 00000307670 12245347113 015057 0000000 0000000 /* $Id: libhsm.c 7439 2013-11-27 10:49:47Z matthijs $ */
/*
* Copyright (c) 2009 .SE (The Internet Infrastructure Foundation).
* Copyright (c) 2009 NLNet Labs.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "libhsm.h"
#include "libhsmdns.h"
#include "compat.h"
#include
/*! Fixed length from PKCS#11 specification */
#define HSM_TOKEN_LABEL_LENGTH 32
/*! Global (initial) context */
hsm_ctx_t *_hsm_ctx;
/*! General PKCS11 helper functions */
static char *
ldns_pkcs11_rv_str(CK_RV rv)
{
switch (rv)
{
case CKR_OK:
return "CKR_OK";
case CKR_CANCEL:
return "CKR_CANCEL";
case CKR_HOST_MEMORY:
return "CKR_HOST_MEMORY";
case CKR_GENERAL_ERROR:
return "CKR_GENERAL_ERROR";
case CKR_FUNCTION_FAILED:
return "CKR_FUNCTION_FAILED";
case CKR_SLOT_ID_INVALID:
return "CKR_SLOT_ID_INVALID";
case CKR_ATTRIBUTE_READ_ONLY:
return "CKR_ATTRIBUTE_READ_ONLY";
case CKR_ATTRIBUTE_SENSITIVE:
return "CKR_ATTRIBUTE_SENSITIVE";
case CKR_ATTRIBUTE_TYPE_INVALID:
return "CKR_ATTRIBUTE_TYPE_INVALID";
case CKR_ATTRIBUTE_VALUE_INVALID:
return "CKR_ATTRIBUTE_VALUE_INVALID";
case CKR_DATA_INVALID:
return "CKR_DATA_INVALID";
case CKR_DATA_LEN_RANGE:
return "CKR_DATA_LEN_RANGE";
case CKR_DEVICE_ERROR:
return "CKR_DEVICE_ERROR";
case CKR_DEVICE_MEMORY:
return "CKR_DEVICE_MEMORY";
case CKR_DEVICE_REMOVED:
return "CKR_DEVICE_REMOVED";
case CKR_ENCRYPTED_DATA_INVALID:
return "CKR_ENCRYPTED_DATA_INVALID";
case CKR_ENCRYPTED_DATA_LEN_RANGE:
return "CKR_ENCRYPTED_DATA_LEN_RANGE";
case CKR_FUNCTION_CANCELED:
return "CKR_FUNCTION_CANCELED";
case CKR_FUNCTION_NOT_PARALLEL:
return "CKR_FUNCTION_NOT_PARALLEL";
case CKR_FUNCTION_NOT_SUPPORTED:
return "CKR_FUNCTION_NOT_SUPPORTED";
case CKR_KEY_HANDLE_INVALID:
return "CKR_KEY_HANDLE_INVALID";
case CKR_KEY_SIZE_RANGE:
return "CKR_KEY_SIZE_RANGE";
case CKR_KEY_TYPE_INCONSISTENT:
return "CKR_KEY_TYPE_INCONSISTENT";
case CKR_MECHANISM_INVALID:
return "CKR_MECHANISM_INVALID";
case CKR_MECHANISM_PARAM_INVALID:
return "CKR_MECHANISM_PARAM_INVALID";
case CKR_OBJECT_HANDLE_INVALID:
return "CKR_OBJECT_HANDLE_INVALID";
case CKR_OPERATION_ACTIVE:
return "CKR_OPERATION_ACTIVE";
case CKR_OPERATION_NOT_INITIALIZED:
return "CKR_OPERATION_NOT_INITIALIZED";
case CKR_PIN_INCORRECT:
return "CKR_PIN_INCORRECT";
case CKR_PIN_INVALID:
return "CKR_PIN_INVALID";
case CKR_PIN_LEN_RANGE:
return "CKR_PIN_LEN_RANGE";
case CKR_SESSION_CLOSED:
return "CKR_SESSION_CLOSED";
case CKR_SESSION_COUNT:
return "CKR_SESSION_COUNT";
case CKR_SESSION_HANDLE_INVALID:
return "CKR_SESSION_HANDLE_INVALID";
case CKR_SESSION_PARALLEL_NOT_SUPPORTED:
return "CKR_SESSION_PARALLEL_NOT_SUPPORTED";
case CKR_SESSION_READ_ONLY:
return "CKR_SESSION_READ_ONLY";
case CKR_SESSION_EXISTS:
return "CKR_SESSION_EXISTS";
case CKR_SIGNATURE_INVALID:
return "CKR_SIGNATURE_INVALID";
case CKR_SIGNATURE_LEN_RANGE:
return "CKR_SIGNATURE_LEN_RANGE";
case CKR_TEMPLATE_INCOMPLETE:
return "CKR_TEMPLATE_INCOMPLETE";
case CKR_TEMPLATE_INCONSISTENT:
return "CKR_TEMPLATE_INCONSISTENT";
case CKR_TOKEN_NOT_PRESENT:
return "CKR_TOKEN_NOT_PRESENT";
case CKR_TOKEN_NOT_RECOGNIZED:
return "CKR_TOKEN_NOT_RECOGNIZED";
case CKR_TOKEN_WRITE_PROTECTED:
return "CKR_TOKEN_WRITE_PROTECTED";
case CKR_UNWRAPPING_KEY_HANDLE_INVALID:
return "CKR_UNWRAPPING_KEY_HANDLE_INVALID";
case CKR_UNWRAPPING_KEY_SIZE_RANGE:
return "CKR_UNWRAPPING_KEY_SIZE_RANGE";
case CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT:
return "CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT";
case CKR_USER_ALREADY_LOGGED_IN:
return "CKR_USER_ALREADY_LOGGED_IN";
case CKR_USER_NOT_LOGGED_IN:
return "CKR_USER_NOT_LOGGED_IN";
case CKR_USER_PIN_NOT_INITIALIZED:
return "CKR_USER_PIN_NOT_INITIALIZED";
case CKR_USER_TYPE_INVALID:
return "CKR_USER_TYPE_INVALID";
case CKR_WRAPPED_KEY_INVALID:
return "CKR_WRAPPED_KEY_INVALID";
case CKR_WRAPPED_KEY_LEN_RANGE:
return "CKR_WRAPPED_KEY_LEN_RANGE";
case CKR_WRAPPING_KEY_HANDLE_INVALID:
return "CKR_WRAPPING_KEY_HANDLE_INVALID";
case CKR_WRAPPING_KEY_SIZE_RANGE:
return "CKR_WRAPPING_KEY_SIZE_RANGE";
case CKR_WRAPPING_KEY_TYPE_INCONSISTENT:
return "CKR_WRAPPING_KEY_TYPE_INCONSISTENT";
case CKR_RANDOM_SEED_NOT_SUPPORTED:
return "CKR_RANDOM_SEED_NOT_SUPPORTED";
case CKR_VENDOR_DEFINED:
return "CKR_VENDOR_DEFINED";
case CKR_BUFFER_TOO_SMALL:
return "CKR_BUFFER_TOO_SMALL";
case CKR_SAVED_STATE_INVALID:
return "CKR_SAVED_STATE_INVALID";
case CKR_INFORMATION_SENSITIVE:
return "CKR_INFORMATION_SENSITIVE";
case CKR_STATE_UNSAVEABLE:
return "CKR_STATE_UNSAVEABLE";
case CKR_CRYPTOKI_NOT_INITIALIZED:
return "CKR_CRYPTOKI_NOT_INITIALIZED";
case CKR_CRYPTOKI_ALREADY_INITIALIZED:
return "CKR_CRYPTOKI_ALREADY_INITIALIZED";
case CKR_MUTEX_BAD:
return "CKR_MUTEX_BAD";
case CKR_MUTEX_NOT_LOCKED:
return "CKR_MUTEX_NOT_LOCKED";
default:
return "Unknown error";
}
}
/*! Set HSM Context Error
If the ctx is given, and it's error value is still 0, the value will be
set to 'error', and the error_message and error_action will be set to
the given strings.
\param ctx HSM context
\param error error code
\param action action for which the error occured
\param message error message format string
*/
void
hsm_ctx_set_error(hsm_ctx_t *ctx, int error, const char *action,
const char *message, ...)
{
va_list args;
if (ctx && ctx->error == 0) {
ctx->error = error;
ctx->error_action = action;
va_start(args, message);
vsnprintf(ctx->error_message, sizeof(ctx->error_message),
message, args);
va_end(args);
}
}
/*! Check HSM Context for Error
If the rv is not CKR_OK, and there is not previous error registered in
the context, to set the context error based on PKCS#11 return value.
\param ctx HSM context
\param rv PKCS#11 return value
\param action action for which the error occured
\param message error message format string
\return 0 if rv == CKR_OK, otherwise 1
*/
static int
hsm_pkcs11_check_error(hsm_ctx_t *ctx, CK_RV rv, const char *action)
{
if (rv != CKR_OK) {
if (ctx && ctx->error == 0) {
ctx->error = (int) rv;
ctx->error_action = action;
strlcpy(ctx->error_message, ldns_pkcs11_rv_str(rv), sizeof(ctx->error_message));
}
return 1;
}
return 0;
}
/*! Unload PKCS#11 provider */
static void
hsm_pkcs11_unload_functions(void *handle)
{
int result;
if (handle) {
#if defined(HAVE_LOADLIBRARY)
/* no idea */
#elif defined(HAVE_DLOPEN)
result = dlclose(handle);
#endif
}
}
/*! Load PKCS#11 provider */
static CK_RV
hsm_pkcs11_load_functions(hsm_module_t *module)
{
CK_C_GetFunctionList pGetFunctionList = NULL;
if (module && module->path) {
/* library provided by application or user */
#if defined(HAVE_LOADLIBRARY)
/* Load PKCS #11 library */
HINSTANCE hDLL = LoadLibrary(_T(module->path));
if (hDLL == NULL) {
/* Failed to load the PKCS #11 library */
return CKR_FUNCTION_FAILED;
}
/* Retrieve the entry point for C_GetFunctionList */
pGetFunctionList = (CK_C_GetFunctionList)
GetProcAddress(hDLL, _T("C_GetFunctionList"));
#elif defined(HAVE_DLOPEN)
/* Load PKCS #11 library */
void* pDynLib = dlopen(module->path, RTLD_NOW | RTLD_LOCAL);
if (pDynLib == NULL) {
/* Failed to load the PKCS #11 library */
return CKR_FUNCTION_FAILED;
}
/* Retrieve the entry point for C_GetFunctionList */
pGetFunctionList = (CK_C_GetFunctionList) dlsym(pDynLib, "C_GetFunctionList");
/* Store the handle so we can dlclose it later */
module->handle = pDynLib;
#else
return CKR_FUNCTION_FAILED;
#endif
} else {
/* No library provided, use the statically compiled softHSM */
#ifdef HAVE_PKCS11_MODULE
return C_GetFunctionList(pkcs11_functions);
#else
return CKR_FUNCTION_FAILED;
#endif
}
if (pGetFunctionList == NULL) {
/* Failed to load the PKCS #11 library */
return CKR_FUNCTION_FAILED;
}
/* Retrieve the function list */
(pGetFunctionList)((CK_FUNCTION_LIST_PTR_PTR)(&module->sym));
return CKR_OK;
}
static void
hsm_remove_leading_zeroes(CK_BYTE_PTR data, CK_ULONG *len)
{
CK_BYTE_PTR p = data;
CK_ULONG l;
if (data == NULL || len == NULL) return;
l = *len;
while ((unsigned short int)(*p) == 0 && l > 1) {
p++;
l--;
}
if (p != data) {
memmove(data, p, l);
*len = l;
}
}
static int
hsm_pkcs11_check_token_name(hsm_ctx_t *ctx,
CK_FUNCTION_LIST_PTR pkcs11_functions,
CK_SLOT_ID slotId,
const char *token_name)
{
/* token label is always 32 bytes */
char token_name_bytes[HSM_TOKEN_LABEL_LENGTH];
int result = 0;
CK_RV rv;
CK_TOKEN_INFO token_info;
rv = pkcs11_functions->C_GetTokenInfo(slotId, &token_info);
if (hsm_pkcs11_check_error(ctx, rv, "C_GetTokenInfo")) {
return 0;
}
memset(token_name_bytes, ' ', HSM_TOKEN_LABEL_LENGTH);
if (strlen(token_name) < HSM_TOKEN_LABEL_LENGTH) {
memcpy(token_name_bytes, token_name, strlen(token_name));
} else {
memcpy(token_name_bytes, token_name, HSM_TOKEN_LABEL_LENGTH);
}
result = memcmp(token_info.label,
token_name_bytes,
HSM_TOKEN_LABEL_LENGTH) == 0;
return result;
}
int
hsm_get_slot_id(hsm_ctx_t *ctx,
CK_FUNCTION_LIST_PTR pkcs11_functions,
const char *token_name, CK_SLOT_ID *slotId)
{
CK_RV rv;
CK_ULONG slotCount;
CK_SLOT_ID cur_slot;
CK_SLOT_ID *slotIds;
int found = 0;
if (token_name == NULL || slotId == NULL) return HSM_ERROR;
rv = pkcs11_functions->C_GetSlotList(CK_TRUE, NULL_PTR, &slotCount);
if (hsm_pkcs11_check_error(ctx, rv, "get slot list")) {
return HSM_ERROR;
}
if (slotCount < 1) {
hsm_ctx_set_error(ctx, HSM_ERROR, "hsm_get_slot_id()",
"No slots found in HSM");
return HSM_ERROR;
}
slotIds = malloc(sizeof(CK_SLOT_ID) * slotCount);
rv = pkcs11_functions->C_GetSlotList(CK_TRUE, slotIds, &slotCount);
if (hsm_pkcs11_check_error(ctx, rv, "get slot list")) {
return HSM_ERROR;
}
for (cur_slot = 0; cur_slot < slotCount; cur_slot++) {
if (hsm_pkcs11_check_token_name(ctx,
pkcs11_functions,
slotIds[cur_slot],
token_name)) {
*slotId = slotIds[cur_slot];
found = 1;
break;
}
}
free(slotIds);
if (!found) {
hsm_ctx_set_error(ctx, -1, "hsm_get_slot_id()",
"could not find token with the name %s", token_name);
return HSM_ERROR;
}
return HSM_OK;
}
/* internal functions */
static hsm_module_t *
hsm_module_new(const char *repository,
const char *token_label,
const char *path,
const hsm_config_t *config)
{
hsm_module_t *module;
if (!repository || !path) return NULL;
module = malloc(sizeof(hsm_module_t));
if (!module) return NULL;
if (config) {
module->config = malloc(sizeof(hsm_config_t));
if (!module->config) {
free(module);
return NULL;
}
memcpy(module->config, config, sizeof(hsm_config_t));
} else {
module->config = NULL;
}
module->id = 0; /*TODO i think we can remove this*/
module->name = strdup(repository);
module->token_label = strdup(token_label);
module->path = strdup(path);
module->handle = NULL;
module->sym = NULL;
return module;
}
static void
hsm_module_free(hsm_module_t *module)
{
if (module) {
if (module->name) free(module->name);
if (module->token_label) free(module->token_label);
if (module->path) free(module->path);
if (module->config) free(module->config);
free(module);
}
}
static hsm_session_t *
hsm_session_new(hsm_module_t *module, CK_SESSION_HANDLE session_handle)
{
hsm_session_t *session;
session = malloc(sizeof(hsm_session_t));
session->module = module;
session->session = session_handle;
return session;
}
static void
hsm_session_free(hsm_session_t *session) {
if (session) {
free(session);
}
}
/*! Set default HSM configuration */
static void
hsm_config_default(hsm_config_t *config)
{
config->use_pubkey = 1;
}
/* creates a session_t structure, and automatically adds and initializes
* a module_t struct for it
*/
static int
hsm_session_init(hsm_ctx_t *ctx, hsm_session_t **session,
const char *repository, const char *token_label,
const char *module_path, const char *pin,
const hsm_config_t *config)
{
CK_RV rv;
CK_RV rv_login;
hsm_module_t *module;
CK_SLOT_ID slot_id;
CK_SESSION_HANDLE session_handle;
int first = 1, result;
CK_C_INITIALIZE_ARGS InitArgs = {NULL, NULL, NULL, NULL,
CKF_OS_LOCKING_OK, NULL };
if (pin == NULL) return HSM_ERROR;
module = hsm_module_new(repository, token_label, module_path, config);
if (!module) return HSM_ERROR;
rv = hsm_pkcs11_load_functions(module);
if (rv != CKR_OK) {
hsm_ctx_set_error(ctx, HSM_MODULE_NOT_FOUND,
"hsm_session_init()",
"PKCS#11 module load failed: %s", module_path);
hsm_module_free(module);
return HSM_MODULE_NOT_FOUND;
}
rv = ((CK_FUNCTION_LIST_PTR) module->sym)->C_Initialize((CK_VOID_PTR) &InitArgs);
/* ALREADY_INITIALIZED is ok, apparently we are using a second
* device with the same library */
if (rv != CKR_CRYPTOKI_ALREADY_INITIALIZED) {
if (hsm_pkcs11_check_error(ctx, rv, "Initialization")) {
hsm_module_free(module);
return HSM_ERROR;
}
} else {
first = 0;
}
result = hsm_get_slot_id(ctx, module->sym, token_label, &slot_id);
if (result != HSM_OK) {
hsm_module_free(module);
return HSM_ERROR;
}
rv = ((CK_FUNCTION_LIST_PTR) module->sym)->C_OpenSession(slot_id,
CKF_SERIAL_SESSION | CKF_RW_SESSION,
NULL,
NULL,
&session_handle);
if (hsm_pkcs11_check_error(ctx, rv, "Open first session")) {
hsm_module_free(module);
return HSM_ERROR;
}
rv_login = ((CK_FUNCTION_LIST_PTR) module->sym)->C_Login(session_handle,
CKU_USER,
(unsigned char *) pin,
strlen((char *)pin));
if (rv_login == CKR_OK) {
*session = hsm_session_new(module, session_handle);
return HSM_OK;
} else {
/* uninitialize the session again */
if (session_handle) {
rv = ((CK_FUNCTION_LIST_PTR) module->sym)->
C_CloseSession(session_handle);
if (hsm_pkcs11_check_error(ctx, rv,
"finalize after failed login")) {
hsm_module_free(module);
return HSM_ERROR;
}
}
/* if this was not the first, don't close the library for
* the rest of us */
if (first) {
rv = ((CK_FUNCTION_LIST_PTR) module->sym)->C_Finalize(NULL);
if (hsm_pkcs11_check_error(ctx, rv, "finalize after failed login")) {
hsm_module_free(module);
return HSM_ERROR;
}
}
hsm_module_free(module);
*session = NULL;
switch(rv_login) {
case CKR_PIN_INCORRECT:
hsm_ctx_set_error(ctx, HSM_PIN_INCORRECT,
"hsm_session_init()",
"Incorrect PIN for repository %s", repository);
return HSM_PIN_INCORRECT;
default:
return HSM_ERROR;
}
}
}
/* open a second session from the given one */
static hsm_session_t *
hsm_session_clone(hsm_ctx_t *ctx, hsm_session_t *session)
{
CK_RV rv;
CK_SLOT_ID slot_id;
CK_SESSION_HANDLE session_handle;
hsm_session_t *new_session;
int result;
result = hsm_get_slot_id(ctx,
session->module->sym,
session->module->token_label,
&slot_id);
if (result != HSM_OK) return NULL;
rv = ((CK_FUNCTION_LIST_PTR) session->module->sym)->C_OpenSession(slot_id,
CKF_SERIAL_SESSION | CKF_RW_SESSION,
NULL,
NULL,
&session_handle);
if (hsm_pkcs11_check_error(ctx, rv, "Clone session")) {
return NULL;
}
new_session = hsm_session_new(session->module, session_handle);
return new_session;
}
static hsm_ctx_t *
hsm_ctx_new()
{
hsm_ctx_t *ctx;
ctx = malloc(sizeof(hsm_ctx_t));
memset(ctx->session, 0, HSM_MAX_SESSIONS);
ctx->session_count = 0;
ctx->error = 0;
return ctx;
}
/* ctx_free frees the structure */
static void
hsm_ctx_free(hsm_ctx_t *ctx)
{
unsigned int i;
if (ctx) {
for (i = 0; i < ctx->session_count; i++) {
hsm_session_free(ctx->session[i]);
}
free(ctx);
}
}
/* close the session, and free the allocated data
*
* if unload is non-zero, C_Logout() is called,
* the dlopen()d module is closed and unloaded
* (only call this on the last session for each
* module, ie. the one in the global ctx)
*/
static void
hsm_session_close(hsm_ctx_t *ctx, hsm_session_t *session, int unload)
{
/* If we loaded this library more than once, we may have
* already finalized it before, so we can safely ignore
* NOT_INITIALIZED */
CK_RV rv;
if (unload) {
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_Logout(session->session);
if (rv != CKR_CRYPTOKI_NOT_INITIALIZED) {
(void) hsm_pkcs11_check_error(ctx, rv, "Logout");
}
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_CloseSession(session->session);
if (rv != CKR_CRYPTOKI_NOT_INITIALIZED) {
(void) hsm_pkcs11_check_error(ctx, rv, "Close session");
}
if (unload) {
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_Finalize(NULL);
if (rv != CKR_CRYPTOKI_NOT_INITIALIZED) {
(void) hsm_pkcs11_check_error(ctx, rv, "Finalize");
hsm_pkcs11_unload_functions(session->module->handle);
}
hsm_module_free(session->module);
session->module = NULL;
}
hsm_session_free(session);
}
/* ctx_close closes all session, and free
* the structures.
*
* if unload is non-zero, the associated dynamic libraries are unloaded
* (hence only use that on the last, global, ctx)
*/
static void
hsm_ctx_close(hsm_ctx_t *ctx, int unload)
{
unsigned int i;
if (ctx) {
for (i = 0; i < ctx->session_count; i++) {
/* todo syslog? */
/*printf("close session %u (unload: %d)\n", i, unload);*/
/*hsm_print_ctx(ctx);*/
hsm_session_close(ctx, ctx->session[i], unload);
ctx->session[i] = NULL;
/* if this was the last session in the array, decrease
* the session counter of the context */
if (i == _hsm_ctx->session_count) {
while(ctx->session_count > 0 && !ctx->session[i]) {
ctx->session_count--;
}
}
}
free(ctx);
}
}
/* adds a session to the context.
* returns 0 on success
* 1 if the maximum number of sessions (HSM_MAX_SESSIONS) was
* reached
* -1 if one of the arguments is NULL
*/
static int
hsm_ctx_add_session(hsm_ctx_t *ctx, hsm_session_t *session)
{
if (!ctx || !session) return -1;
if (ctx->session_count >= HSM_MAX_SESSIONS) return 1;
ctx->session[ctx->session_count] = session;
ctx->session_count++;
return 0;
}
static hsm_ctx_t *
hsm_ctx_clone(hsm_ctx_t *ctx)
{
unsigned int i;
hsm_ctx_t *new_ctx;
hsm_session_t *new_session;
new_ctx = NULL;
if (ctx) {
new_ctx = hsm_ctx_new();
for (i = 0; i < ctx->session_count; i++) {
new_session = hsm_session_clone(ctx, ctx->session[i]);
if (!new_session) {
/* one of the sessions failed to clone. Clear the
* new ctx and return NULL */
hsm_ctx_close(new_ctx, 0);
return NULL;
}
hsm_ctx_add_session(new_ctx, new_session);
}
}
return new_ctx;
}
static hsm_key_t *
hsm_key_new()
{
hsm_key_t *key;
key = malloc(sizeof(hsm_key_t));
key->module = NULL;
key->private_key = 0;
key->public_key = 0;
return key;
}
/* find the session belonging to a key, by iterating over the modules
* in the context */
static hsm_session_t *
hsm_find_key_session(hsm_ctx_t *ctx, const hsm_key_t *key)
{
unsigned int i;
if (!key || !key->module) return NULL;
if (!ctx) ctx = _hsm_ctx;
for (i = 0; i < ctx->session_count; i++) {
if (ctx->session[i] && ctx->session[i]->module == key->module) {
return ctx->session[i];
}
}
return NULL;
}
/* Returns the key type (algorithm) of the given key */
static CK_KEY_TYPE
hsm_get_key_algorithm(hsm_ctx_t *ctx, const hsm_session_t *session,
const hsm_key_t *key)
{
CK_RV rv;
CK_KEY_TYPE key_type;
CK_ATTRIBUTE template[] = {
{CKA_KEY_TYPE, &key_type, sizeof(CK_KEY_TYPE)}
};
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
key->private_key,
template,
1);
if (hsm_pkcs11_check_error(ctx, rv,
"Get attr value algorithm type")) {
/* this is actually not a good return value;
* CKK_RSA is also 0. But we can't return a negative
* value. Should we #define a specific 'key type' that
* indicates an error? (TODO) */
return 0;
}
if ((CK_LONG)template[0].ulValueLen < 1) {
/* this is actually not a good return value;
* CKK_RSA is also 0. But we can't return a negative
* value. Should we #define a specific 'key type' that
* indicates an error? (TODO) */
return 0;
}
return key_type;
}
/* returns a CK_ULONG with the key size of the given RSA key. The
* key is not checked for type. For RSA, the number of bits in the
* modulus is the key size (CKA_MODULUS_BITS)
*/
static CK_ULONG
hsm_get_key_size_rsa(hsm_ctx_t *ctx, const hsm_session_t *session,
const hsm_key_t *key)
{
CK_RV rv;
CK_ULONG modulus_bits;
/* Template for public keys */
CK_ATTRIBUTE template[] = {
{CKA_MODULUS_BITS, &modulus_bits, sizeof(CK_KEY_TYPE)}
};
/* Template for private keys */
CK_BYTE_PTR modulus = NULL;
int mask;
CK_ATTRIBUTE template2[] = {
{CKA_MODULUS, NULL, 0}
};
if (session->module->config->use_pubkey) {
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
key->public_key,
template,
1);
if (hsm_pkcs11_check_error(ctx, rv,
"Get attr value algorithm type")) {
return 0;
}
if ((CK_ULONG)template[0].ulValueLen < 1) {
return 0;
}
} else {
// Get buffer size
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
key->private_key,
template2,
1);
if (hsm_pkcs11_check_error(ctx, rv, "Could not get the size of the modulus of the private key")) {
return 0;
}
// Allocate memory
modulus = (CK_BYTE_PTR)malloc(template2[0].ulValueLen);
template2[0].pValue = modulus;
if (modulus == NULL) {
hsm_ctx_set_error(ctx, -1, "hsm_get_key_size_rsa()",
"Error allocating memory for modulus");
return 0;
}
// Get attribute
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
key->private_key,
template2,
1);
if (hsm_pkcs11_check_error(ctx, rv, "Could not get the modulus of the private key")) {
free(modulus);
return 0;
}
// Calculate size
modulus_bits = template2[0].ulValueLen * 8;
mask = 0x80;
for (int i = 0; modulus_bits && (modulus[i] & mask) == 0; modulus_bits--) {
mask >>= 1;
if (mask == 0) {
i++;
mask = 0x80;
}
}
free(modulus);
}
return modulus_bits;
}
/* returns a CK_ULONG with the key size of the given DSA key. The
* key is not checked for type. For DSA, the number of bits in the
* prime is the key size (CKA_PRIME)
*/
static CK_ULONG
hsm_get_key_size_dsa(hsm_ctx_t *ctx, const hsm_session_t *session,
const hsm_key_t *key)
{
CK_RV rv;
/* Template */
CK_ATTRIBUTE template2[] = {
{CKA_PRIME, NULL, 0}
};
// Get buffer size
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
key->private_key,
template2,
1);
if (hsm_pkcs11_check_error(ctx, rv, "Could not get the size of the prime of the private key")) {
return 0;
}
return template2[0].ulValueLen * 8;
}
/* Wrapper for specific key size functions */
static CK_ULONG
hsm_get_key_size(hsm_ctx_t *ctx, const hsm_session_t *session,
const hsm_key_t *key, const unsigned long algorithm)
{
/* TODO: Add ECDSA */
switch (algorithm) {
case CKK_RSA:
return hsm_get_key_size_rsa(ctx, session, key);
break;
case CKK_DSA:
return hsm_get_key_size_dsa(ctx, session, key);
break;
case CKK_GOSTR3410:
/* GOST public keys always have a size of 512 bits */
return 512;
break;
default:
return 0;
}
}
static CK_OBJECT_HANDLE
hsm_find_object_handle_for_id(hsm_ctx_t *ctx,
const hsm_session_t *session,
CK_OBJECT_CLASS key_class,
CK_BYTE *id,
CK_ULONG id_len)
{
CK_ULONG objectCount;
CK_OBJECT_HANDLE object;
CK_RV rv;
CK_ATTRIBUTE template[] = {
{ CKA_CLASS, &key_class, sizeof(key_class) },
{ CKA_ID, id, id_len },
};
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_FindObjectsInit(session->session,
template, 2);
if (hsm_pkcs11_check_error(ctx, rv, "Find objects init")) {
return 0;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_FindObjects(session->session,
&object,
1,
&objectCount);
if (hsm_pkcs11_check_error(ctx, rv, "Find object")) {
return 0;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_FindObjectsFinal(session->session);
if (hsm_pkcs11_check_error(ctx, rv, "Find object final")) {
return 0;
}
if (objectCount > 0) {
return object;
} else {
return 0;
}
}
/*
* Parses the null-terminated string hex as hex values,
* Returns allocated data that needs to be freed (or NULL on error)
* len will contain the number of bytes allocated, or 0 on error
*/
static unsigned char *
hsm_hex_parse(const char *hex, size_t *len)
{
unsigned char *bytes;
/* length of the hex input */
size_t hex_len;
size_t i;
if (!len) return NULL;
*len = 0;
if (!hex) return NULL;
hex_len = strlen(hex);
if (hex_len % 2 != 0) {
return NULL;
}
*len = hex_len / 2;
bytes = malloc(*len);
for (i = 0; i < *len; i++) {
bytes[i] = ldns_hexdigit_to_int(hex[2*i]) * 16 +
ldns_hexdigit_to_int(hex[2*i+1]);
}
return bytes;
}
/* put a hexadecimal representation of the data from src into dst
* len is the number of bytes to read from src
* dst must have allocated enough space (len*2 + 1)
*/
static void
hsm_hex_unparse(char *dst, const unsigned char *src, size_t len)
{
size_t dst_len = len*2 + 1;
size_t i;
for (i = 0; i < len; i++) {
snprintf(dst + (2*i), dst_len, "%02x", src[i]);
}
dst[len*2] = '\0';
}
/* returns an allocated byte array with the CKA_ID for the given object
* len will contain the result size
* returns NULL and size zero if not found in this session
*/
static CK_BYTE *
hsm_get_id_for_object(hsm_ctx_t *ctx,
const hsm_session_t *session,
CK_OBJECT_HANDLE object,
size_t *len)
{
CK_RV rv;
CK_BYTE *id = NULL;
CK_ATTRIBUTE template[] = {
{CKA_ID, id, 0}
};
/* find out the size of the id first */
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
object,
template,
1);
if (hsm_pkcs11_check_error(ctx, rv, "Get attr value")) {
*len = 0;
return NULL;
}
if ((CK_LONG)template[0].ulValueLen < 1) {
/* No CKA_ID found, return NULL */
*len = 0;
return NULL;
}
template[0].pValue = malloc(template[0].ulValueLen);
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
object,
template,
1);
if (hsm_pkcs11_check_error(ctx, rv, "Get attr value 2")) {
*len = 0;
free(template[0].pValue);
return NULL;
}
*len = template[0].ulValueLen;
return template[0].pValue;
}
/* returns an hsm_key_t object for the given *private key* object handle
* the module, private key, and public key handle are set
* The session needs to be free to perform a search for the public key
*/
static hsm_key_t *
hsm_key_new_privkey_object_handle(hsm_ctx_t *ctx,
const hsm_session_t *session,
CK_OBJECT_HANDLE object)
{
hsm_key_t *key;
CK_BYTE *id;
size_t len;
id = hsm_get_id_for_object(ctx, session, object, &len);
if (!id) return NULL;
key = hsm_key_new();
key->module = session->module;
key->private_key = object;
if (session->module->config->use_pubkey) {
key->public_key = hsm_find_object_handle_for_id(
ctx,
session,
CKO_PUBLIC_KEY,
id,
len);
} else {
key->public_key = 0;
}
free(id);
return key;
}
/* helper function to find both key counts or the keys themselves
* if the argument store is 0, results are not returned; the
* function will only set the count and return NULL
* Otherwise, a newly allocated key array will be returned
* (on error, the count will also be zero and NULL returned)
*/
static hsm_key_t **
hsm_list_keys_session_internal(hsm_ctx_t *ctx,
const hsm_session_t *session,
size_t *count,
int store)
{
hsm_key_t **keys = NULL;
hsm_key_t *key;
CK_RV rv;
CK_OBJECT_CLASS key_class = CKO_PRIVATE_KEY;
CK_ATTRIBUTE template[] = {
{ CKA_CLASS, &key_class, sizeof(key_class) },
};
CK_ULONG total_count = 0;
CK_ULONG objectCount = 1;
/* find 100 keys at a time (and loop until there are none left) */
CK_ULONG max_object_count = 100;
CK_ULONG i, j;
CK_OBJECT_HANDLE object[max_object_count];
CK_OBJECT_HANDLE *key_handles = NULL;
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_FindObjectsInit(session->session,
template, 1);
if (hsm_pkcs11_check_error(ctx, rv, "Find objects init")) {
*count = 0;
return NULL;
}
j = 0;
while (objectCount > 0) {
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_FindObjects(session->session,
object,
max_object_count,
&objectCount);
if (hsm_pkcs11_check_error(ctx, rv, "Find first object")) {
free(key_handles);
*count = 0;
return NULL;
}
total_count += objectCount;
if (objectCount > 0 && store) {
key_handles = realloc(key_handles, total_count * sizeof(CK_OBJECT_HANDLE));
for (i = 0; i < objectCount; i++) {
key_handles[j] = object[i];
j++;
}
}
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_FindObjectsFinal(session->session);
if (hsm_pkcs11_check_error(ctx, rv, "Find objects final")) {
free(key_handles);
*count = 0;
return NULL;
}
if (store) {
keys = realloc(keys, total_count * sizeof(hsm_key_t *));
for (i = 0; i < total_count; i++) {
key = hsm_key_new_privkey_object_handle(ctx, session,
key_handles[i]);
/* todo, if we get NULL, free all and return error? */
keys[i] = key;
}
}
free(key_handles);
*count = total_count;
return keys;
}
/* returns an array of all keys available to the given session
*
* \param session the session to find the keys in
* \param count this value will contain the number of keys found
*
* \return the list of keys
*/
hsm_key_t **
hsm_list_keys_session(hsm_ctx_t *ctx, const hsm_session_t *session,
size_t *count)
{
return hsm_list_keys_session_internal(ctx, session, count, 1);
}
/* returns a count all keys available to the given session
*
* \param session the session to find the keys in
*
* \return the number of keys
*/
size_t
hsm_count_keys_session(hsm_ctx_t *ctx, const hsm_session_t *session)
{
size_t count = 0;
(void) hsm_list_keys_session_internal(ctx, session, &count, 0);
return count;
}
/* returns a newly allocated key structure containing the key data
* for the given CKA_ID available in the session. Returns NULL if not
* found
*/
static hsm_key_t *
hsm_find_key_by_id_session(hsm_ctx_t *ctx, const hsm_session_t *session,
const unsigned char *id, size_t len)
{
hsm_key_t *key;
CK_OBJECT_HANDLE private_key_handle;
private_key_handle = hsm_find_object_handle_for_id(
ctx,
session,
CKO_PRIVATE_KEY,
(CK_BYTE *) id,
(CK_ULONG) len);
if (private_key_handle != 0) {
key = hsm_key_new_privkey_object_handle(ctx, session,
private_key_handle);
return key;
} else {
return NULL;
}
}
/* Find a key pair by CKA_ID (as byte array)
The returned key structure can be freed with hsm_key_free()
\param context HSM context
\param id CKA_ID of key to find (array of bytes)
\param len number of bytes in the id
\return key identifier or NULL if not found
*/
static hsm_key_t *
hsm_find_key_by_id_bin(hsm_ctx_t *ctx,
const unsigned char *id,
size_t len)
{
hsm_key_t *key;
unsigned int i;
if (!ctx) ctx = _hsm_ctx;
if (!id) return NULL;
for (i = 0; i < ctx->session_count; i++) {
key = hsm_find_key_by_id_session(ctx, ctx->session[i], id, len);
if (key) return key;
}
return NULL;
}
/**
* returns the first session found if repository is null, otherwise
* finds the session belonging to the repository with the given name
* returns NULL if not found
*/
static hsm_session_t *
hsm_find_repository_session(hsm_ctx_t *ctx, const char *repository)
{
unsigned int i;
if (!repository) {
for (i = 0; i < ctx->session_count; i++) {
if (ctx->session[i]) {
return ctx->session[i];
}
}
} else {
for (i = 0; i < ctx->session_count; i++) {
if (ctx->session[i] &&
strcmp(repository, ctx->session[i]->module->name) == 0)
{
return ctx->session[i];
}
}
}
hsm_ctx_set_error(ctx, HSM_REPOSITORY_NOT_FOUND,
"hsm_find_repository_session()",
"Can't find repository: %s", repository);
return NULL;
}
static ldns_rdf *
hsm_get_key_rdata_rsa(hsm_ctx_t *ctx, hsm_session_t *session,
const hsm_key_t *key)
{
CK_RV rv;
CK_BYTE_PTR public_exponent = NULL;
CK_ULONG public_exponent_len = 0;
CK_BYTE_PTR modulus = NULL;
CK_ULONG modulus_len = 0;
unsigned long hKey = 0;
unsigned char *data = NULL;
size_t data_size = 0;
CK_ATTRIBUTE template[] = {
{CKA_PUBLIC_EXPONENT, NULL, 0},
{CKA_MODULUS, NULL, 0},
};
ldns_rdf *rdf;
if (!session || !session->module) {
return NULL;
}
if (session->module->config->use_pubkey) {
hKey = key->public_key;
} else {
hKey = key->private_key;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
hKey,
template,
2);
if (hsm_pkcs11_check_error(ctx, rv, "C_GetAttributeValue")) {
return NULL;
}
public_exponent_len = template[0].ulValueLen;
modulus_len = template[1].ulValueLen;
public_exponent = template[0].pValue = malloc(public_exponent_len);
if (!public_exponent) {
hsm_ctx_set_error(ctx, -1, "hsm_get_key_rdata_rsa()",
"Error allocating memory for public exponent");
return NULL;
}
modulus = template[1].pValue = malloc(modulus_len);
if (!modulus) {
hsm_ctx_set_error(ctx, -1, "hsm_get_key_rdata_rsa()",
"Error allocating memory for modulus");
free(public_exponent);
return NULL;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
hKey,
template,
2);
if (hsm_pkcs11_check_error(ctx, rv, "get attribute value")) {
free(template[0].pValue);
free(template[1].pValue);
return NULL;
}
// Remove leading zeroes
hsm_remove_leading_zeroes(public_exponent, &public_exponent_len);
hsm_remove_leading_zeroes(modulus, &modulus_len);
data_size = public_exponent_len + modulus_len + 1;
if (public_exponent_len <= 256) {
data = malloc(data_size);
if (!data) {
hsm_ctx_set_error(ctx, -1, "hsm_get_key_rdata_rsa()",
"Error allocating memory for pub key rr data");
free(public_exponent);
free(modulus);
return NULL;
}
data[0] = public_exponent_len;
memcpy(&data[1], public_exponent, public_exponent_len);
memcpy(&data[1 + public_exponent_len], modulus, modulus_len);
} else if (public_exponent_len <= 65535) {
data_size += 2;
data = malloc(data_size);
if (!data) {
hsm_ctx_set_error(ctx, -1, "hsm_get_key_rdata_rsa()",
"Error allocating memory for pub key rr data");
free(public_exponent);
free(modulus);
return NULL;
}
data[0] = 0;
ldns_write_uint16(&data[1], (uint16_t) public_exponent_len);
memcpy(&data[3], public_exponent, public_exponent_len);
memcpy(&data[3 + public_exponent_len], modulus, modulus_len);
} else {
hsm_ctx_set_error(ctx, -1, "hsm_get_key_rdata_rsa()",
"Public exponent too big");
free(public_exponent);
free(modulus);
return NULL;
}
rdf = ldns_rdf_new(LDNS_RDF_TYPE_B64, data_size, data);
free(public_exponent);
free(modulus);
return rdf;
}
static ldns_rdf *
hsm_get_key_rdata_dsa(hsm_ctx_t *ctx, hsm_session_t *session,
const hsm_key_t *key)
{
CK_RV rv;
CK_BYTE_PTR prime = NULL;
CK_ULONG prime_len = 0;
CK_BYTE_PTR subprime = NULL;
CK_ULONG subprime_len = 0;
CK_BYTE_PTR base = NULL;
CK_ULONG base_len = 0;
CK_BYTE_PTR value = NULL;
CK_ULONG value_len = 0;
unsigned char *data = NULL;
size_t data_size = 0;
CK_ATTRIBUTE template[] = {
{CKA_PRIME, NULL, 0},
{CKA_SUBPRIME, NULL, 0},
{CKA_BASE, NULL, 0},
{CKA_VALUE, NULL, 0},
};
ldns_rdf *rdf;
if (!session || !session->module) {
return NULL;
}
/* DSA needs the public key compared with RSA */
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
key->public_key,
template,
4);
if (hsm_pkcs11_check_error(ctx, rv, "C_GetAttributeValue")) {
return NULL;
}
prime_len = template[0].ulValueLen;
subprime_len = template[1].ulValueLen;
base_len = template[2].ulValueLen;
value_len = template[3].ulValueLen;
prime = template[0].pValue = malloc(prime_len);
if (!prime) {
hsm_ctx_set_error(ctx, -1, "hsm_get_key_rdata_dsa()",
"Error allocating memory for prime");
return NULL;
}
subprime = template[1].pValue = malloc(subprime_len);
if (!subprime) {
hsm_ctx_set_error(ctx, -1, "hsm_get_key_rdata_dsa()",
"Error allocating memory for subprime");
free(prime);
return NULL;
}
base = template[2].pValue = malloc(base_len);
if (!base) {
hsm_ctx_set_error(ctx, -1, "hsm_get_key_rdata_dsa()",
"Error allocating memory for base");
free(prime);
free(subprime);
return NULL;
}
value = template[3].pValue = malloc(value_len);
if (!value) {
hsm_ctx_set_error(ctx, -1, "hsm_get_key_rdata_dsa()",
"Error allocating memory for value");
free(prime);
free(subprime);
free(base);
return NULL;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
key->public_key,
template,
4);
if (hsm_pkcs11_check_error(ctx, rv, "get attribute value")) {
free(prime);
free(subprime);
free(base);
free(value);
return NULL;
}
data_size = prime_len + subprime_len + base_len + value_len + 1;
data = malloc(data_size);
if (!data) {
hsm_ctx_set_error(ctx, -1, "hsm_get_key_rdata_dsa()",
"Error allocating memory for pub key rr data");
free(prime);
free(subprime);
free(base);
free(value);
return NULL;
}
data[0] = (prime_len - 64) / 8;
memcpy(&data[1], subprime, subprime_len);
memcpy(&data[1 + subprime_len], prime, prime_len);
memcpy(&data[1 + subprime_len + prime_len], base, base_len);
memcpy(&data[1 + subprime_len + prime_len + base_len], value, value_len);
rdf = ldns_rdf_new(LDNS_RDF_TYPE_B64, data_size, data);
free(prime);
free(subprime);
free(base);
free(value);
return rdf;
}
static ldns_rdf *
hsm_get_key_rdata_gost(hsm_ctx_t *ctx, hsm_session_t *session,
const hsm_key_t *key)
{
CK_RV rv;
CK_BYTE_PTR value = NULL;
CK_ULONG value_len = 0;
CK_ATTRIBUTE template[] = {
{CKA_VALUE, NULL, 0},
};
ldns_rdf *rdf;
if (!session || !session->module) {
return NULL;
}
/* GOST needs the public key compared with RSA */
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
key->public_key,
template,
1);
if (hsm_pkcs11_check_error(ctx, rv, "C_GetAttributeValue")) {
return NULL;
}
value_len = template[0].ulValueLen;
value = template[0].pValue = malloc(value_len);
if (!value) {
hsm_ctx_set_error(ctx, -1, "hsm_get_key_rdata_dsa()",
"Error allocating memory for value");
return NULL;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(
session->session,
key->public_key,
template,
1);
if (hsm_pkcs11_check_error(ctx, rv, "get attribute value")) {
free(value);
return NULL;
}
rdf = ldns_rdf_new(LDNS_RDF_TYPE_B64, value_len, value);
return rdf;
}
static ldns_rdf *
hsm_get_key_rdata(hsm_ctx_t *ctx, hsm_session_t *session,
const hsm_key_t *key)
{
/* TODO: Add ECDSA */
switch (hsm_get_key_algorithm(ctx, session, key)) {
case CKK_RSA:
return hsm_get_key_rdata_rsa(ctx, session, key);
break;
case CKK_DSA:
return hsm_get_key_rdata_dsa(ctx, session, key);
break;
case CKK_GOSTR3410:
return hsm_get_key_rdata_gost(ctx, session, key);
break;
default:
return 0;
}
}
/* this function allocates memory for the mechanism ID and enough room
* to leave the upcoming digest data. It fills in the mechanism id
* use with care. The returned data must be free'd by the caller.
* Only used by RSA PKCS. */
static CK_BYTE *
hsm_create_prefix(CK_ULONG digest_len,
ldns_algorithm algorithm,
CK_ULONG *data_size)
{
CK_BYTE *data;
const CK_BYTE RSA_MD5_ID[] = { 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10 };
const CK_BYTE RSA_SHA1_ID[] = { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14 };
const CK_BYTE RSA_SHA256_ID[] = { 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20 };
const CK_BYTE RSA_SHA512_ID[] = { 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40 };
switch(algorithm) {
case LDNS_SIGN_RSAMD5:
*data_size = sizeof(RSA_MD5_ID) + digest_len;
data = malloc(*data_size);
memcpy(data, RSA_MD5_ID, sizeof(RSA_MD5_ID));
break;
case LDNS_SIGN_RSASHA1:
case LDNS_SIGN_RSASHA1_NSEC3:
*data_size = sizeof(RSA_SHA1_ID) + digest_len;
data = malloc(*data_size);
memcpy(data, RSA_SHA1_ID, sizeof(RSA_SHA1_ID));
break;
case LDNS_SIGN_RSASHA256:
*data_size = sizeof(RSA_SHA256_ID) + digest_len;
data = malloc(*data_size);
memcpy(data, RSA_SHA256_ID, sizeof(RSA_SHA256_ID));
break;
case LDNS_SIGN_RSASHA512:
*data_size = sizeof(RSA_SHA512_ID) + digest_len;
data = malloc(*data_size);
memcpy(data, RSA_SHA512_ID, sizeof(RSA_SHA512_ID));
break;
case LDNS_SIGN_DSA:
case LDNS_SIGN_DSA_NSEC3:
case LDNS_SIGN_ECC_GOST:
#if LDNS_BUILD_CONFIG_USE_ECDSA
case LDNS_SIGN_ECDSAP256SHA256:
case LDNS_SIGN_ECDSAP384SHA384:
#endif
*data_size = digest_len;
data = malloc(*data_size);
break;
default:
return NULL;
}
return data;
}
static CK_BYTE *
hsm_digest_through_hsm(hsm_ctx_t *ctx,
hsm_session_t *session,
CK_MECHANISM_TYPE mechanism_type,
CK_ULONG digest_len,
ldns_buffer *sign_buf)
{
CK_MECHANISM digest_mechanism;
CK_BYTE *digest;
CK_RV rv;
digest_mechanism.pParameter = NULL;
digest_mechanism.ulParameterLen = 0;
digest_mechanism.mechanism = mechanism_type;
digest = malloc(digest_len);
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_DigestInit(session->session,
&digest_mechanism);
if (hsm_pkcs11_check_error(ctx, rv, "HSM digest init")) {
free(digest);
return NULL;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_Digest(session->session,
ldns_buffer_begin(sign_buf),
ldns_buffer_position(sign_buf),
digest,
&digest_len);
if (hsm_pkcs11_check_error(ctx, rv, "HSM digest")) {
free(digest);
return NULL;
}
return digest;
}
static ldns_rdf *
hsm_sign_buffer(hsm_ctx_t *ctx,
ldns_buffer *sign_buf,
const hsm_key_t *key,
ldns_algorithm algorithm)
{
CK_RV rv;
CK_ULONG signatureLen = HSM_MAX_SIGNATURE_LENGTH;
CK_BYTE signature[HSM_MAX_SIGNATURE_LENGTH];
CK_MECHANISM sign_mechanism;
ldns_rdf *sig_rdf;
CK_BYTE *digest = NULL;
CK_ULONG digest_len;
CK_BYTE *data = NULL;
CK_ULONG data_len = 0;
hsm_session_t *session;
session = hsm_find_key_session(ctx, key);
if (!session) return NULL;
/* some HSMs don't really handle CKM_SHA1_RSA_PKCS well, so
* we'll do the hashing manually */
/* When adding algorithms, remember there is another switch below */
switch (algorithm) {
case LDNS_SIGN_RSAMD5:
digest_len = 16;
digest = hsm_digest_through_hsm(ctx, session,
CKM_MD5, digest_len,
sign_buf);
break;
case LDNS_SIGN_RSASHA1:
case LDNS_SIGN_RSASHA1_NSEC3:
case LDNS_SIGN_DSA:
case LDNS_SIGN_DSA_NSEC3:
digest_len = LDNS_SHA1_DIGEST_LENGTH;
digest = malloc(digest_len);
digest = ldns_sha1(ldns_buffer_begin(sign_buf),
ldns_buffer_position(sign_buf),
digest);
break;
case LDNS_SIGN_RSASHA256:
#if LDNS_BUILD_CONFIG_USE_ECDSA
case LDNS_SIGN_ECDSAP256SHA256:
#endif
digest_len = LDNS_SHA256_DIGEST_LENGTH;
digest = malloc(digest_len);
digest = ldns_sha256(ldns_buffer_begin(sign_buf),
ldns_buffer_position(sign_buf),
digest);
break;
#if LDNS_BUILD_CONFIG_USE_ECDSA
case LDNS_SIGN_ECDSAP384SHA384:
digest_len = LDNS_SHA384_DIGEST_LENGTH;
digest = malloc(digest_len);
digest = ldns_sha384(ldns_buffer_begin(sign_buf),
ldns_buffer_position(sign_buf),
digest);
break;
#endif
case LDNS_SIGN_RSASHA512:
digest_len = LDNS_SHA512_DIGEST_LENGTH;
digest = malloc(digest_len);
digest = ldns_sha512(ldns_buffer_begin(sign_buf),
ldns_buffer_position(sign_buf),
digest);
break;
case LDNS_SIGN_ECC_GOST:
digest_len = 16;
digest = hsm_digest_through_hsm(ctx, session,
CKM_GOSTR3411, digest_len,
sign_buf);
break;
default:
/* log error? or should we not even get here for
* unsupported algorithms? */
return NULL;
}
if (!digest) {
return NULL;
}
/* CKM_RSA_PKCS does the padding, but cannot know the identifier
* prefix, so we need to add that ourselves.
* The other algorithms will just get the digest buffer returned. */
data = hsm_create_prefix(digest_len, algorithm, &data_len);
memcpy(data + data_len - digest_len, digest, digest_len);
sign_mechanism.pParameter = NULL;
sign_mechanism.ulParameterLen = 0;
switch(algorithm) {
case LDNS_SIGN_RSAMD5:
case LDNS_SIGN_RSASHA1:
case LDNS_SIGN_RSASHA1_NSEC3:
case LDNS_SIGN_RSASHA256:
case LDNS_SIGN_RSASHA512:
sign_mechanism.mechanism = CKM_RSA_PKCS;
break;
case LDNS_SIGN_DSA:
case LDNS_SIGN_DSA_NSEC3:
sign_mechanism.mechanism = CKM_DSA;
break;
case LDNS_SIGN_ECC_GOST:
sign_mechanism.mechanism = CKM_GOSTR3410;
break;
#if LDNS_BUILD_CONFIG_USE_ECDSA
/* TODO: Add ECDSA */
case LDNS_SIGN_ECDSAP256SHA256:
case LDNS_SIGN_ECDSAP384SHA384:
#endif
default:
/* log error? or should we not even get here for
* unsupported algorithms? */
free(data);
free(digest);
return NULL;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_SignInit(
session->session,
&sign_mechanism,
key->private_key);
if (hsm_pkcs11_check_error(ctx, rv, "sign init")) {
free(data);
free(digest);
return NULL;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_Sign(session->session, data, data_len,
signature,
&signatureLen);
if (hsm_pkcs11_check_error(ctx, rv, "sign final")) {
free(data);
free(digest);
return NULL;
}
sig_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64,
signatureLen,
signature);
free(data);
free(digest);
return sig_rdf;
}
static int
hsm_dname_is_wildcard(const ldns_rdf* dname)
{
return ( ldns_dname_label_count(dname) > 0 &&
ldns_rdf_data(dname)[0] == 1 &&
ldns_rdf_data(dname)[1] == '*');
}
static ldns_rr *
hsm_create_empty_rrsig(const ldns_rr_list *rrset,
const hsm_sign_params_t *sign_params)
{
ldns_rr *rrsig;
uint32_t orig_ttl;
uint32_t orig_class;
time_t now;
uint8_t label_count;
label_count = ldns_dname_label_count(
ldns_rr_owner(ldns_rr_list_rr(rrset, 0)));
/* RFC 4035 section 2.2: dnssec label length and wildcards */
if (hsm_dname_is_wildcard(ldns_rr_owner(ldns_rr_list_rr(rrset, 0)))) {
label_count--;
}
rrsig = ldns_rr_new_frm_type(LDNS_RR_TYPE_RRSIG);
/* set the type on the new signature */
orig_ttl = ldns_rr_ttl(ldns_rr_list_rr(rrset, 0));
orig_class = ldns_rr_get_class(ldns_rr_list_rr(rrset, 0));
ldns_rr_set_class(rrsig, orig_class);
ldns_rr_set_ttl(rrsig, orig_ttl);
ldns_rr_set_owner(rrsig,
ldns_rdf_clone(
ldns_rr_owner(
ldns_rr_list_rr(rrset,
0))));
/* fill in what we know of the signature */
/* set the orig_ttl */
(void)ldns_rr_rrsig_set_origttl(
rrsig,
ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32,
orig_ttl));
/* the signers name */
(void)ldns_rr_rrsig_set_signame(
rrsig,
ldns_rdf_clone(sign_params->owner));
/* label count - get it from the first rr in the rr_list */
(void)ldns_rr_rrsig_set_labels(
rrsig,
ldns_native2rdf_int8(LDNS_RDF_TYPE_INT8,
label_count));
/* inception, expiration */
now = time(NULL);
if (sign_params->inception != 0) {
(void)ldns_rr_rrsig_set_inception(
rrsig,
ldns_native2rdf_int32(
LDNS_RDF_TYPE_TIME,
sign_params->inception));
} else {
(void)ldns_rr_rrsig_set_inception(
rrsig,
ldns_native2rdf_int32(LDNS_RDF_TYPE_TIME, now));
}
if (sign_params->expiration != 0) {
(void)ldns_rr_rrsig_set_expiration(
rrsig,
ldns_native2rdf_int32(
LDNS_RDF_TYPE_TIME,
sign_params->expiration));
} else {
(void)ldns_rr_rrsig_set_expiration(
rrsig,
ldns_native2rdf_int32(
LDNS_RDF_TYPE_TIME,
now + LDNS_DEFAULT_EXP_TIME));
}
(void)ldns_rr_rrsig_set_keytag(
rrsig,
ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16,
sign_params->keytag));
(void)ldns_rr_rrsig_set_algorithm(
rrsig,
ldns_native2rdf_int8(
LDNS_RDF_TYPE_ALG,
sign_params->algorithm));
(void)ldns_rr_rrsig_set_typecovered(
rrsig,
ldns_native2rdf_int16(
LDNS_RDF_TYPE_TYPE,
ldns_rr_get_type(ldns_rr_list_rr(rrset,
0))));
return rrsig;
}
/*
* API functions
*/
int
hsm_open(const char *config,
char *(pin_callback)(unsigned int, const char *, unsigned int))
{
xmlDocPtr doc;
xmlXPathContextPtr xpath_ctx;
xmlXPathObjectPtr xpath_obj;
xmlNode *curNode;
xmlChar *xexpr;
int i;
char *config_file;
char *repository;
char *token_label;
char *module_path;
char *module_pin;
hsm_config_t module_config;
int result = HSM_OK;
int tries;
int repositories = 0;
/* create an internal context with an attached session for each
* configured HSM. */
_hsm_ctx = hsm_ctx_new();
if (config) {
config_file = strdup(config);
} else{
config_file = strdup(HSM_DEFAULT_CONFIG);
}
/* Load XML document */
doc = xmlParseFile(config_file);
free(config_file);
if (doc == NULL) {
return HSM_CONFIG_FILE_ERROR;
}
/* Create xpath evaluation context */
xpath_ctx = xmlXPathNewContext(doc);
if(xpath_ctx == NULL) {
xmlFreeDoc(doc);
hsm_ctx_free(_hsm_ctx);
_hsm_ctx = NULL;
return -1;
}
/* Evaluate xpath expression */
xexpr = (xmlChar *)"//Configuration/RepositoryList/Repository";
xpath_obj = xmlXPathEvalExpression(xexpr, xpath_ctx);
if(xpath_obj == NULL) {
xmlXPathFreeContext(xpath_ctx);
xmlFreeDoc(doc);
hsm_ctx_free(_hsm_ctx);
_hsm_ctx = NULL;
return -1;
}
if (xpath_obj->nodesetval) {
for (i = 0; i < xpath_obj->nodesetval->nodeNr; i++) {
/*module = hsm_module_new();*/
token_label = NULL;
module_path = NULL;
module_pin = NULL;
hsm_config_default(&module_config);
curNode = xpath_obj->nodesetval->nodeTab[i]->xmlChildrenNode;
repository = (char *) xmlGetProp(xpath_obj->nodesetval->nodeTab[i],
(const xmlChar *)"name");
while (curNode) {
if (xmlStrEqual(curNode->name, (const xmlChar *)"TokenLabel"))
token_label = (char *) xmlNodeGetContent(curNode);
if (xmlStrEqual(curNode->name, (const xmlChar *)"Module"))
module_path = (char *) xmlNodeGetContent(curNode);
if (xmlStrEqual(curNode->name, (const xmlChar *)"PIN"))
module_pin = (char *) xmlNodeGetContent(curNode);
if (xmlStrEqual(curNode->name, (const xmlChar *)"SkipPublicKey"))
module_config.use_pubkey = 0;
curNode = curNode->next;
}
if (repository && token_label && module_path) {
if (module_pin) {
result = hsm_attach(repository,
token_label,
module_path,
module_pin,
&module_config);
free(module_pin);
} else {
if (pin_callback) {
result = HSM_PIN_INCORRECT;
tries = 0;
while (result == HSM_PIN_INCORRECT &&
tries < 3) {
if (tries == 0) {
module_pin = pin_callback(_hsm_ctx->session_count,
repository,
HSM_PIN_FIRST);
} else {
module_pin = pin_callback(_hsm_ctx->session_count,
repository,
HSM_PIN_RETRY);
}
if (module_pin == NULL) break;
result = hsm_attach(repository,
token_label,
module_path,
module_pin,
&module_config);
if (result == HSM_OK) {
pin_callback(_hsm_ctx->session_count - 1,
repository,
HSM_PIN_SAVE);
}
memset(module_pin, 0, strlen(module_pin));
tries++;
}
} else {
/* no pin, no callback */
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_open()",
"No pin or callback function");
result = HSM_ERROR;
}
}
free(repository);
free(token_label);
free(module_path);
if (result != HSM_OK) {
break;
}
repositories++;
}
}
}
xmlXPathFreeObject(xpath_obj);
xmlXPathFreeContext(xpath_ctx);
xmlFreeDoc(doc);
if (result == HSM_OK && repositories == 0) {
hsm_ctx_set_error(_hsm_ctx, HSM_NO_REPOSITORIES, "hsm_open()",
"No repositories found");
return HSM_NO_REPOSITORIES;
}
return result;
}
int
hsm_close()
{
hsm_ctx_close(_hsm_ctx, 1);
return 0;
}
hsm_ctx_t *
hsm_create_context()
{
return hsm_ctx_clone(_hsm_ctx);
}
int
hsm_check_context(hsm_ctx_t *ctx)
{
unsigned int i;
hsm_session_t *session;
CK_SESSION_INFO info;
CK_RV rv;
CK_SESSION_HANDLE session_handle;
if (ctx == NULL) {
ctx = _hsm_ctx;
}
for (i = 0; i < ctx->session_count; i++) {
session = ctx->session[i];
if (session == NULL) continue;
/* Get session info */
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetSessionInfo(
session->session,
&info);
if (hsm_pkcs11_check_error(ctx, rv, "get session info")) {
return HSM_ERROR;
}
/* Check session info */
if (info.state != CKS_RW_USER_FUNCTIONS) {
hsm_ctx_set_error(ctx, HSM_ERROR, "hsm_check_context()",
"Session not logged in");
return HSM_ERROR;
}
/* Try open and close a session with the token */
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_OpenSession(info.slotID,
CKF_SERIAL_SESSION | CKF_RW_SESSION,
NULL,
NULL,
&session_handle);
if (hsm_pkcs11_check_error(ctx, rv, "test open session")) {
return HSM_ERROR;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_CloseSession(session_handle);
if (hsm_pkcs11_check_error(ctx, rv, "test close session")) {
return HSM_ERROR;
}
}
return HSM_OK;
}
void
hsm_destroy_context(hsm_ctx_t *ctx)
{
hsm_ctx_close(ctx, 0);
}
/**
* Returns an allocated hsm_sign_params_t with some defaults
*/
hsm_sign_params_t *
hsm_sign_params_new()
{
hsm_sign_params_t *params;
params = malloc(sizeof(hsm_sign_params_t));
if (!params) {
return NULL;
}
params->algorithm = LDNS_SIGN_RSASHA256;
params->flags = LDNS_KEY_ZONE_KEY;
params->inception = 0;
params->expiration = 0;
params->keytag = 0;
params->owner = NULL;
return params;
}
void
hsm_sign_params_free(hsm_sign_params_t *params)
{
if (params) {
if (params->owner) ldns_rdf_deep_free(params->owner);
free(params);
}
}
hsm_key_t **
hsm_list_keys(hsm_ctx_t *ctx, size_t *count)
{
hsm_key_t **keys = NULL;
size_t key_count = 0;
size_t cur_key_count;
hsm_key_t **session_keys;
unsigned int i, j;
if (!ctx) {
ctx = _hsm_ctx;
}
for (i = 0; i < ctx->session_count; i++) {
session_keys = hsm_list_keys_session(ctx, ctx->session[i],
&cur_key_count);
keys = realloc(keys,
(key_count + cur_key_count) * sizeof(hsm_key_t *));
for (j = 0; j < cur_key_count; j++) {
keys[key_count + j] = session_keys[j];
}
key_count += cur_key_count;
free(session_keys);
}
if (count) {
*count = key_count;
}
return keys;
}
hsm_key_t **
hsm_list_keys_repository(hsm_ctx_t *ctx,
size_t *count,
const char *repository)
{
hsm_session_t *session;
if (!repository) return NULL;
if (!ctx) ctx = _hsm_ctx;
session = hsm_find_repository_session(ctx, repository);
if (!session) {
*count = 0;
return NULL;
}
return hsm_list_keys_session(ctx, session, count);
}
size_t
hsm_count_keys(hsm_ctx_t *ctx)
{
size_t count = 0;
unsigned int i;
if (!ctx) ctx = _hsm_ctx;
for (i = 0; i < ctx->session_count; i++) {
count += hsm_count_keys_session(ctx, ctx->session[i]);
}
return count;
}
size_t
hsm_count_keys_repository(hsm_ctx_t *ctx,
const char *repository)
{
hsm_session_t *session;
if (!repository) return 0;
if (!ctx) ctx = _hsm_ctx;
session = hsm_find_repository_session(ctx, repository);
if (!session) {
return 0;
}
return hsm_count_keys_session(ctx, session);
}
hsm_key_t *
hsm_find_key_by_id(hsm_ctx_t *ctx, const char *id)
{
unsigned char *id_bytes;
size_t len;
hsm_key_t *key;
id_bytes = hsm_hex_parse(id, &len);
if (!id_bytes) return NULL;
key = hsm_find_key_by_id_bin(ctx, id_bytes, len);
free(id_bytes);
return key;
}
hsm_key_t *
hsm_generate_rsa_key(hsm_ctx_t *ctx,
const char *repository,
unsigned long keysize)
{
hsm_key_t *new_key;
hsm_session_t *session;
/* ids we create are 16 bytes of data */
unsigned char id[16];
/* that's 33 bytes in string (16*2 + 1 for \0) */
char id_str[33];
CK_RV rv;
CK_OBJECT_HANDLE publicKey, privateKey;
CK_KEY_TYPE keyType = CKK_RSA;
CK_MECHANISM mechanism = {
CKM_RSA_PKCS_KEY_PAIR_GEN, NULL_PTR, 0
};
CK_BYTE publicExponent[] = { 1, 0, 1 };
CK_BBOOL ctrue = CK_TRUE;
CK_BBOOL cfalse = CK_FALSE;
CK_BBOOL ctoken = CK_TRUE;
if (!ctx) ctx = _hsm_ctx;
session = hsm_find_repository_session(ctx, repository);
if (!session) return NULL;
/* check whether this key doesn't happen to exist already */
do {
hsm_random_buffer(ctx, id, 16);
} while (hsm_find_key_by_id_bin(ctx, id, 16));
/* the CKA_LABEL will contain a hexadecimal string representation
* of the id */
hsm_hex_unparse(id_str, id, 16);
if (! session->module->config->use_pubkey) {
ctoken = CK_FALSE;
}
CK_ATTRIBUTE publicKeyTemplate[] = {
{ CKA_LABEL,(CK_UTF8CHAR*) id_str, strlen(id_str) },
{ CKA_ID, id, 16 },
{ CKA_KEY_TYPE, &keyType, sizeof(keyType) },
{ CKA_VERIFY, &ctrue, sizeof(ctrue) },
{ CKA_ENCRYPT, &cfalse, sizeof(cfalse) },
{ CKA_WRAP, &cfalse, sizeof(cfalse) },
{ CKA_TOKEN, &ctoken, sizeof(ctoken) },
{ CKA_MODULUS_BITS, &keysize, sizeof(keysize) },
{ CKA_PUBLIC_EXPONENT, &publicExponent, sizeof(publicExponent)}
};
CK_ATTRIBUTE privateKeyTemplate[] = {
{ CKA_LABEL,(CK_UTF8CHAR *) id_str, strlen (id_str) },
{ CKA_ID, id, 16 },
{ CKA_KEY_TYPE, &keyType, sizeof(keyType) },
{ CKA_SIGN, &ctrue, sizeof (ctrue) },
{ CKA_DECRYPT, &cfalse, sizeof (cfalse) },
{ CKA_UNWRAP, &cfalse, sizeof (cfalse) },
{ CKA_SENSITIVE, &ctrue, sizeof (ctrue) },
{ CKA_TOKEN, &ctrue, sizeof (ctrue) },
{ CKA_PRIVATE, &ctrue, sizeof (ctrue) },
{ CKA_EXTRACTABLE, &cfalse, sizeof (cfalse) }
};
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GenerateKeyPair(session->session,
&mechanism,
publicKeyTemplate, 9,
privateKeyTemplate, 10,
&publicKey,
&privateKey);
if (hsm_pkcs11_check_error(ctx, rv, "generate key pair")) {
return NULL;
}
new_key = hsm_key_new();
new_key->module = session->module;
if (session->module->config->use_pubkey) {
new_key->public_key = publicKey;
} else {
new_key->public_key = 0;
}
new_key->private_key = privateKey;
return new_key;
}
hsm_key_t *
hsm_generate_dsa_key(hsm_ctx_t *ctx,
const char *repository,
unsigned long keysize)
{
CK_RV rv;
hsm_key_t *new_key;
hsm_session_t *session;
CK_OBJECT_HANDLE domainPar, publicKey, privateKey;
CK_BBOOL ctrue = CK_TRUE;
CK_BBOOL cfalse = CK_FALSE;
/* ids we create are 16 bytes of data */
unsigned char id[16];
/* that's 33 bytes in string (16*2 + 1 for \0) */
char id_str[33];
CK_KEY_TYPE keyType = CKK_DSA;
CK_MECHANISM mechanism1 = {
CKM_DSA_PARAMETER_GEN, NULL_PTR, 0
};
CK_MECHANISM mechanism2 = {
CKM_DSA_KEY_PAIR_GEN, NULL_PTR, 0
};
/* The maximum size for DSA in DNSSEC */
CK_BYTE dsa_p[128];
CK_BYTE dsa_q[20];
CK_BYTE dsa_g[128];
CK_ATTRIBUTE domainTemplate[] = {
{ CKA_PRIME_BITS, &keysize, sizeof(keysize) }
};
CK_ATTRIBUTE publicKeyTemplate[] = {
{ CKA_PRIME, dsa_p, sizeof(dsa_p) },
{ CKA_SUBPRIME, dsa_q, sizeof(dsa_q) },
{ CKA_BASE, dsa_g, sizeof(dsa_g) },
{ CKA_LABEL,(CK_UTF8CHAR*) id_str, strlen(id_str) },
{ CKA_ID, id, 16 },
{ CKA_KEY_TYPE, &keyType, sizeof(keyType) },
{ CKA_VERIFY, &ctrue, sizeof(ctrue) },
{ CKA_ENCRYPT, &cfalse, sizeof(cfalse) },
{ CKA_WRAP, &cfalse, sizeof(cfalse) },
{ CKA_TOKEN, &ctrue, sizeof(ctrue) }
};
CK_ATTRIBUTE privateKeyTemplate[] = {
{ CKA_LABEL,(CK_UTF8CHAR*) id_str, strlen (id_str) },
{ CKA_ID, id, 16 },
{ CKA_KEY_TYPE, &keyType, sizeof(keyType) },
{ CKA_SIGN, &ctrue, sizeof(ctrue) },
{ CKA_DECRYPT, &cfalse, sizeof(cfalse) },
{ CKA_UNWRAP, &cfalse, sizeof(cfalse) },
{ CKA_SENSITIVE, &ctrue, sizeof(ctrue) },
{ CKA_TOKEN, &ctrue, sizeof(ctrue) },
{ CKA_PRIVATE, &ctrue, sizeof(ctrue) },
{ CKA_EXTRACTABLE, &cfalse, sizeof(cfalse) }
};
if (!ctx) ctx = _hsm_ctx;
session = hsm_find_repository_session(ctx, repository);
if (!session) return NULL;
/* check whether this key doesn't happen to exist already */
do {
hsm_random_buffer(ctx, id, 16);
} while (hsm_find_key_by_id_bin(ctx, id, 16));
/* the CKA_LABEL will contain a hexadecimal string representation
* of the id */
hsm_hex_unparse(id_str, id, 16);
/* Generate the domain parameters */
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GenerateKey(session->session,
&mechanism1,
domainTemplate, 1,
&domainPar);
if (hsm_pkcs11_check_error(ctx, rv, "generate domain parameters")) {
return NULL;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GetAttributeValue(session->session,
domainPar, publicKeyTemplate, 3);
if (hsm_pkcs11_check_error(ctx, rv, "get domain parameters")) {
return NULL;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_DestroyObject(session->session, domainPar);
if (hsm_pkcs11_check_error(ctx, rv, "destroy domain parameters")) {
return NULL;
}
/* Generate key pair */
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GenerateKeyPair(session->session,
&mechanism2,
publicKeyTemplate, 10,
privateKeyTemplate, 10,
&publicKey,
&privateKey);
if (hsm_pkcs11_check_error(ctx, rv, "generate key pair")) {
return NULL;
}
new_key = hsm_key_new();
new_key->module = session->module;
new_key->public_key = publicKey;
new_key->private_key = privateKey;
return new_key;
}
hsm_key_t *
hsm_generate_gost_key(hsm_ctx_t *ctx,
const char *repository)
{
CK_RV rv;
hsm_key_t *new_key;
hsm_session_t *session;
CK_OBJECT_HANDLE publicKey, privateKey;
CK_BBOOL ctrue = CK_TRUE;
CK_BBOOL cfalse = CK_FALSE;
/* ids we create are 16 bytes of data */
unsigned char id[16];
/* that's 33 bytes in string (16*2 + 1 for \0) */
char id_str[33];
CK_KEY_TYPE keyType = CKK_GOSTR3410;
CK_MECHANISM mechanism = {
CKM_GOSTR3410_KEY_PAIR_GEN, NULL_PTR, 0
};
CK_BYTE oid[] = { 0x06, 0x07, 0x2A, 0x85, 0x03, 0x02, 0x02, 0x23, 0x01 };
CK_ATTRIBUTE publicKeyTemplate[] = {
{ CKA_GOSTR3410PARAMS, oid, sizeof(oid) },
{ CKA_LABEL,(CK_UTF8CHAR*) id_str, strlen(id_str) },
{ CKA_ID, id, 16 },
{ CKA_KEY_TYPE, &keyType, sizeof(keyType) },
{ CKA_VERIFY, &ctrue, sizeof(ctrue) },
{ CKA_ENCRYPT, &cfalse, sizeof(cfalse) },
{ CKA_WRAP, &cfalse, sizeof(cfalse) },
{ CKA_TOKEN, &ctrue, sizeof(ctrue) }
};
CK_ATTRIBUTE privateKeyTemplate[] = {
{ CKA_LABEL,(CK_UTF8CHAR*) id_str, strlen (id_str) },
{ CKA_ID, id, 16 },
{ CKA_KEY_TYPE, &keyType, sizeof(keyType) },
{ CKA_SIGN, &ctrue, sizeof(ctrue) },
{ CKA_DECRYPT, &cfalse, sizeof(cfalse) },
{ CKA_UNWRAP, &cfalse, sizeof(cfalse) },
{ CKA_SENSITIVE, &ctrue, sizeof(ctrue) },
{ CKA_TOKEN, &ctrue, sizeof(ctrue) },
{ CKA_PRIVATE, &ctrue, sizeof(ctrue) },
{ CKA_EXTRACTABLE, &cfalse, sizeof(cfalse) }
};
if (!ctx) ctx = _hsm_ctx;
session = hsm_find_repository_session(ctx, repository);
if (!session) return NULL;
/* check whether this key doesn't happen to exist already */
do {
hsm_random_buffer(ctx, id, 16);
} while (hsm_find_key_by_id_bin(ctx, id, 16));
/* the CKA_LABEL will contain a hexadecimal string representation
* of the id */
hsm_hex_unparse(id_str, id, 16);
/* Generate key pair */
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GenerateKeyPair(session->session,
&mechanism,
publicKeyTemplate, 10,
privateKeyTemplate, 10,
&publicKey,
&privateKey);
if (hsm_pkcs11_check_error(ctx, rv, "generate key pair")) {
return NULL;
}
new_key = hsm_key_new();
new_key->module = session->module;
new_key->public_key = publicKey;
new_key->private_key = privateKey;
return new_key;
}
int
hsm_remove_key(hsm_ctx_t *ctx, hsm_key_t *key)
{
CK_RV rv;
hsm_session_t *session;
if (!ctx) ctx = _hsm_ctx;
if (!key) return -1;
session = hsm_find_key_session(ctx, key);
if (!session) return -2;
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_DestroyObject(session->session,
key->private_key);
if (hsm_pkcs11_check_error(ctx, rv, "Destroy private key")) {
return -3;
}
key->private_key = 0;
if (session->module->config->use_pubkey) {
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_DestroyObject(session->session,
key->public_key);
if (hsm_pkcs11_check_error(ctx, rv, "Destroy public key")) {
return -4;
}
}
key->public_key = 0;
return 0;
}
void
hsm_key_free(hsm_key_t *key)
{
if (key) {
free(key);
}
}
void
hsm_key_list_free(hsm_key_t **key_list, size_t count)
{
size_t i;
for (i = 0; i < count; i++) {
hsm_key_free(key_list[i]);
}
free(key_list);
}
char *
hsm_get_key_id(hsm_ctx_t *ctx, const hsm_key_t *key)
{
unsigned char *id;
char *id_str;
size_t len;
hsm_session_t *session;
if (!ctx) ctx = _hsm_ctx;
if (!key) return NULL;
session = hsm_find_key_session(ctx, key);
if (!session) return NULL;
id = hsm_get_id_for_object(ctx, session, key->private_key, &len);
if (!id) return NULL;
/* this is plain binary data, we need to convert it to hex */
id_str = malloc(len * 2 + 1);
if (!id_str) return NULL;
hsm_hex_unparse(id_str, id, len);
free(id);
return id_str;
}
hsm_key_info_t *
hsm_get_key_info(hsm_ctx_t *ctx,
const hsm_key_t *key)
{
hsm_key_info_t *key_info;
hsm_session_t *session;
if (!ctx) ctx = _hsm_ctx;
session = hsm_find_key_session(ctx, key);
if (!session) return NULL;
key_info = malloc(sizeof(hsm_key_info_t));
key_info->id = hsm_get_key_id(ctx, key);
if (key_info->id == NULL) {
key_info->id = strdup("");
}
key_info->algorithm = (unsigned long) hsm_get_key_algorithm(ctx,
session,
key);
key_info->keysize = (unsigned long) hsm_get_key_size(ctx,
session,
key,
key_info->algorithm);
/* TODO: Add ECDSA */
switch(key_info->algorithm) {
case CKK_RSA:
key_info->algorithm_name = strdup("RSA");
break;
case CKK_DSA:
key_info->algorithm_name = strdup("DSA");
break;
case CKK_GOSTR3410:
key_info->algorithm_name = strdup("GOST");
break;
default:
key_info->algorithm_name = malloc(HSM_MAX_ALGONAME);
snprintf(key_info->algorithm_name, HSM_MAX_ALGONAME,
"%lu", key_info->algorithm);
break;
}
return key_info;
}
void
hsm_key_info_free(hsm_key_info_t *key_info)
{
if (key_info) {
if (key_info->id) {
free(key_info->id);
}
if (key_info->algorithm_name) {
free(key_info->algorithm_name);
}
free(key_info);
}
}
ldns_rr*
hsm_sign_rrset(hsm_ctx_t *ctx,
const ldns_rr_list* rrset,
const hsm_key_t *key,
const hsm_sign_params_t *sign_params)
{
ldns_rr *signature;
ldns_buffer *sign_buf;
ldns_rdf *b64_rdf;
size_t i;
(void) ctx;
if (!key) return NULL;
if (!sign_params) return NULL;
signature = hsm_create_empty_rrsig((ldns_rr_list *)rrset,
sign_params);
/* right now, we have: a key, a semi-sig and an rrset. For
* which we can create the sig and base64 encode that and
* add that to the signature */
sign_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN);
if (ldns_rrsig2buffer_wire(sign_buf, signature)
!= LDNS_STATUS_OK) {
ldns_buffer_free(sign_buf);
/* ERROR */
return NULL;
}
/* make it canonical */
for(i = 0; i < ldns_rr_list_rr_count(rrset); i++) {
ldns_rr2canonical(ldns_rr_list_rr(rrset, i));
}
/* add the rrset in sign_buf */
if (ldns_rr_list2buffer_wire(sign_buf, rrset)
!= LDNS_STATUS_OK) {
ldns_buffer_free(sign_buf);
return NULL;
}
b64_rdf = hsm_sign_buffer(ctx, sign_buf, key, sign_params->algorithm);
ldns_buffer_free(sign_buf);
if (!b64_rdf) {
/* signing went wrong */
return NULL;
}
ldns_rr_rrsig_set_sig(signature, b64_rdf);
return signature;
}
/* returns a newly allocated (not null-terminated!) string containing
* the message digest of the given source string
* digest length contains the length of the result
* caller must free returned data with free()
* returns NULL (and zero digest length) on error
*/
static CK_BYTE *
hsm_digest(hsm_ctx_t *ctx,
hsm_session_t *session,
CK_MECHANISM digest_mechanism,
char *source,
size_t length,
size_t *digest_length)
{
CK_RV rv;
CK_BYTE *digest;
CK_ULONG d = 0;
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_DigestInit(session->session,
&digest_mechanism);
if (hsm_pkcs11_check_error(ctx, rv, "digest init")) {
*digest_length = 0;
return NULL;
}
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_Digest(session->session,
(CK_BYTE *)source,
length,
NULL,
&d);
if (hsm_pkcs11_check_error(ctx, rv, "digest to determine result size")) {
*digest_length = 0;
return NULL;
}
digest = malloc(d);
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_Digest(session->session,
(CK_BYTE *)source,
length,
digest,
&d);
if (hsm_pkcs11_check_error(ctx, rv, "digest")) {
*digest_length = 0;
free(digest);
return NULL;
}
*digest_length = d;
return digest;
}
ldns_rdf *
hsm_nsec3_hash_name(hsm_ctx_t *ctx,
ldns_rdf *name,
uint8_t algorithm,
uint16_t iterations,
uint8_t salt_length,
uint8_t *salt)
{
char *orig_owner_str;
size_t hashed_owner_str_len;
ldns_rdf *hashed_owner;
char *hashed_owner_str;
char *hashed_owner_b32;
int hashed_owner_b32_len;
uint32_t cur_it;
char *hash = NULL;
size_t hash_length = 0;
ldns_status status;
CK_MECHANISM mechanism;
unsigned int i;
hsm_session_t *session = NULL;
char *error_name;
switch(algorithm) {
case 1:
mechanism.mechanism = CKM_SHA_1;
mechanism.pParameter = NULL;
mechanism.ulParameterLen = 0;
break;
default:
printf("unknown algo: %u\n", (unsigned int)algorithm);
return NULL;
break;
}
/* just use the first available session */
if (!ctx) ctx = _hsm_ctx;
for (i = 0; i < ctx->session_count; i++) {
if (ctx->session[i]) session = ctx->session[i];
}
if (!session) {
return NULL;
}
/* prepare the owner name according to the draft section bla */
orig_owner_str = ldns_rdf2str(name);
hashed_owner_str_len = salt_length + ldns_rdf_size(name);
hashed_owner_str = LDNS_XMALLOC(char, hashed_owner_str_len);
memcpy(hashed_owner_str, ldns_rdf_data(name), ldns_rdf_size(name));
memcpy(hashed_owner_str + ldns_rdf_size(name), salt, salt_length);
for (cur_it = iterations + 1; cur_it > 0; cur_it--) {
if (hash != NULL) free(hash);
hash = (char *) hsm_digest(ctx,
session,
mechanism,
hashed_owner_str,
hashed_owner_str_len,
&hash_length);
LDNS_FREE(hashed_owner_str);
hashed_owner_str_len = salt_length + hash_length;
hashed_owner_str = LDNS_XMALLOC(char, hashed_owner_str_len);
if (!hashed_owner_str) {
hsm_ctx_set_error(ctx, -1, "hsm_nsec3_hash_name()",
"Memory error");
return NULL;
}
memcpy(hashed_owner_str, hash, hash_length);
memcpy(hashed_owner_str + hash_length, salt, salt_length);
}
LDNS_FREE(hashed_owner_str);
hashed_owner_str = hash;
hashed_owner_str_len = hash_length;
hashed_owner_b32 = LDNS_XMALLOC(char,
ldns_b32_ntop_calculate_size(
hashed_owner_str_len) + 1);
LDNS_FREE(orig_owner_str);
hashed_owner_b32_len =
(size_t) ldns_b32_ntop_extended_hex((uint8_t *) hashed_owner_str,
hashed_owner_str_len,
hashed_owner_b32,
ldns_b32_ntop_calculate_size(
hashed_owner_str_len));
if (hashed_owner_b32_len < 1) {
error_name = ldns_rdf2str(name);
hsm_ctx_set_error(ctx, -1, "hsm_nsec3_hash_name()",
"Error in base32 extended hex encoding "
"of hashed owner name (name: %s, return code: %d)",
error_name, hashed_owner_b32_len);
LDNS_FREE(error_name);
LDNS_FREE(hashed_owner_b32);
return NULL;
}
hashed_owner_str_len = hashed_owner_b32_len;
hashed_owner_b32[hashed_owner_b32_len] = '\0';
status = ldns_str2rdf_dname(&hashed_owner, hashed_owner_b32);
if (status != LDNS_STATUS_OK) {
hsm_ctx_set_error(ctx, -1, "hsm_nsec3_hash_name()",
"Error creating rdf from %s", hashed_owner_b32);
LDNS_FREE(hashed_owner_b32);
return NULL;
}
free(hash);
LDNS_FREE(hashed_owner_b32);
return hashed_owner;
}
ldns_rr *
hsm_get_dnskey(hsm_ctx_t *ctx,
const hsm_key_t *key,
const hsm_sign_params_t *sign_params)
{
/* CK_RV rv; */
ldns_rr *dnskey;
hsm_session_t *session;
ldns_rdf *rdata;
if (!ctx) ctx = _hsm_ctx;
if (!key) {
hsm_ctx_set_error(ctx, -1, "hsm_get_dnskey()", "Got NULL key");
return NULL;
}
if (!sign_params) {
hsm_ctx_set_error(ctx, -1, "hsm_get_dnskey()", "Got NULL sign_params");
return NULL;
}
session = hsm_find_key_session(ctx, key);
if (!session) return NULL;
dnskey = ldns_rr_new();
ldns_rr_set_type(dnskey, LDNS_RR_TYPE_DNSKEY);
ldns_rr_set_owner(dnskey, ldns_rdf_clone(sign_params->owner));
ldns_rr_push_rdf(dnskey,
ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16,
sign_params->flags));
ldns_rr_push_rdf(dnskey,
ldns_native2rdf_int8(LDNS_RDF_TYPE_INT8,
LDNS_DNSSEC_KEYPROTO));
ldns_rr_push_rdf(dnskey,
ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG,
sign_params->algorithm));
rdata = hsm_get_key_rdata(ctx, session, key);
if (rdata == NULL) {
ldns_rr_free(dnskey);
return NULL;
}
ldns_rr_push_rdf(dnskey, rdata);
return dnskey;
}
int
hsm_random_buffer(hsm_ctx_t *ctx,
unsigned char *buffer,
unsigned long length)
{
CK_RV rv;
unsigned int i;
hsm_session_t *session;
if (!buffer) return -1;
if (!ctx) ctx = _hsm_ctx;
/* just try every attached token. If one errors (be it NO_RNG, or
* any other error, simply try the next */
for (i = 0; i < ctx->session_count; i++) {
session = ctx->session[i];
if (session) {
rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GenerateRandom(
session->session,
buffer,
length);
if (rv == CKR_OK) {
return 0;
}
}
}
return 1;
}
uint32_t
hsm_random32(hsm_ctx_t *ctx)
{
uint32_t rnd;
int result;
unsigned char rnd_buf[4];
result = hsm_random_buffer(ctx, rnd_buf, 4);
if (result == 0) {
memcpy(&rnd, rnd_buf, 4);
return rnd;
} else {
return 0;
}
}
uint64_t
hsm_random64(hsm_ctx_t *ctx)
{
uint64_t rnd;
int result;
unsigned char rnd_buf[8];
result = hsm_random_buffer(ctx, rnd_buf, 8);
if (result == 0) {
memcpy(&rnd, rnd_buf, 8);
return rnd;
} else {
return 0;
}
}
/*
* Additional functions
*/
int hsm_attach(const char *repository,
const char *token_label,
const char *path,
const char *pin,
const hsm_config_t *config)
{
hsm_session_t *session;
int result;
result = hsm_session_init(_hsm_ctx,
&session,
repository,
token_label,
path,
pin,
config);
if (result == HSM_OK) {
return hsm_ctx_add_session(_hsm_ctx, session);
} else {
return result;
}
}
/*! Detach a named HSM */
int hsm_detach(const char *repository)
{
unsigned int i;
for (i = 0; i < _hsm_ctx->session_count; i++) {
if (_hsm_ctx->session[i] &&
strcmp(_hsm_ctx->session[i]->module->name,
repository) == 0) {
hsm_session_close(_hsm_ctx, _hsm_ctx->session[i], 1);
_hsm_ctx->session[i] = NULL;
/* if this was the last session in the list, decrease the
* session count */
if (i == _hsm_ctx->session_count) {
while(_hsm_ctx->session_count > 0 &&
!_hsm_ctx->session[i]) {
_hsm_ctx->session_count--;
}
}
return 0;
}
}
return -1;
}
int
hsm_token_attached(hsm_ctx_t *ctx, const char *repository)
{
unsigned int i;
if (!ctx) ctx = _hsm_ctx;
for (i = 0; i < ctx->session_count; i++) {
if (ctx->session[i] &&
strcmp(ctx->session[i]->module->name, repository) == 0) {
return 1;
}
}
hsm_ctx_set_error(ctx, HSM_REPOSITORY_NOT_FOUND,
"hsm_token_attached()",
"Can't find repository: %s", repository);
return 0;
}
int
hsm_supported_algorithm(ldns_algorithm algorithm)
{
switch(algorithm) {
case LDNS_SIGN_RSAMD5:
case LDNS_SIGN_RSASHA1:
case LDNS_SIGN_RSASHA1_NSEC3:
case LDNS_SIGN_RSASHA256:
case LDNS_SIGN_RSASHA512:
case LDNS_SIGN_DSA:
case LDNS_SIGN_DSA_NSEC3:
case LDNS_SIGN_ECC_GOST:
return 0;
break;
#if LDNS_BUILD_CONFIG_USE_ECDSA
case LDNS_SIGN_ECDSAP256SHA256:
case LDNS_SIGN_ECDSAP384SHA384:
#endif
default:
return -1;
}
}
char *
hsm_get_error(hsm_ctx_t *gctx)
{
hsm_ctx_t *ctx;
char *message;
if (!gctx) {
ctx = _hsm_ctx;
} else {
ctx = gctx;
}
if (ctx->error) {
ctx->error = 0;
message = malloc(HSM_ERROR_MSGSIZE);
if (message == NULL) {
return strdup("libhsm memory allocation failed");
}
snprintf(message, HSM_ERROR_MSGSIZE,
"%s: %s",
ctx->error_action ? ctx->error_action : "unknown()",
ctx->error_message ? ctx->error_message : "unknown error");
return message;
};
return NULL;
}
void
hsm_print_session(hsm_session_t *session)
{
printf("\t\tmodule at %p (sym %p)\n", (void *) session->module, (void *) session->module->sym);
printf("\t\tmodule path: %s\n", session->module->path);
printf("\t\trepository name: %s\n", session->module->name);
printf("\t\ttoken label: %s\n", session->module->token_label);
printf("\t\tsess handle: %u\n", (unsigned int) session->session);
}
void
hsm_print_ctx(hsm_ctx_t *gctx) {
hsm_ctx_t *ctx;
unsigned int i;
if (!gctx) {
ctx = _hsm_ctx;
} else {
ctx = gctx;
}
printf("CTX Sessions: %lu\n",
(long unsigned int) ctx->session_count);
for (i = 0; i < ctx->session_count; i++) {
printf("\tSession at %p\n", (void *) ctx->session[i]);
hsm_print_session(ctx->session[i]);
}
}
void
hsm_print_key(hsm_key_t *key) {
hsm_key_info_t *key_info;
if (key) {
key_info = hsm_get_key_info(NULL, key);
if (key_info) {
printf("key:\n");
printf("\tmodule: %p\n", (void *) key->module);
printf("\tprivkey handle: %u\n", (unsigned int) key->private_key);
if (key->module->config->use_pubkey) {
printf("\tpubkey handle: %u\n", (unsigned int) key->public_key);
} else {
printf("\tpubkey handle: %s\n", "NULL");
}
printf("\trepository: %s\n", key->module->name);
printf("\talgorithm: %s\n", key_info->algorithm_name);
printf("\tsize: %lu\n", key_info->keysize);
printf("\tid: %s\n", key_info->id);
hsm_key_info_free(key_info);
} else {
printf("key: hsm_get_key_info() returned NULL\n");
}
} else {
printf("key: \n");
}
}
void
hsm_print_error(hsm_ctx_t *gctx)
{
char *message;
message = hsm_get_error(gctx);
if (message) {
fprintf(stderr, "%s\n", message);
free(message);
} else {
fprintf(stderr, "Unknown error\n");
}
}
void
hsm_print_tokeninfo(hsm_ctx_t *gctx)
{
CK_RV rv;
CK_SLOT_ID slot_id;
CK_TOKEN_INFO token_info;
hsm_ctx_t *ctx;
unsigned int i;
hsm_session_t *session;
int result;
if (!gctx) {
ctx = _hsm_ctx;
} else {
ctx = gctx;
}
for (i = 0; i < ctx->session_count; i++) {
session = ctx->session[i];
result = hsm_get_slot_id(ctx,
session->module->sym,
session->module->token_label,
&slot_id);
if (result != HSM_OK) return;
rv = ((CK_FUNCTION_LIST_PTR) session->module->sym)->C_GetTokenInfo(slot_id, &token_info);
if (hsm_pkcs11_check_error(ctx, rv, "C_GetTokenInfo")) {
return;
}
printf("Repository: %s\n",session->module->name);
printf("\tModule: %s\n", session->module->path);
printf("\tSlot: %lu\n", slot_id);
printf("\tToken Label: %.*s\n",
(int) sizeof(token_info.label), token_info.label);
printf("\tManufacturer: %.*s\n",
(int) sizeof(token_info.manufacturerID), token_info.manufacturerID);
printf("\tModel: %.*s\n",
(int) sizeof(token_info.model), token_info.model);
printf("\tSerial: %.*s\n",
(int) sizeof(token_info.serialNumber), token_info.serialNumber);
if (i + 1 != ctx->session_count)
printf("\n");
}
}
opendnssec-1.4.3/libhsm/src/lib/Makefile.in 0000664 0001750 0001750 00000043417 12247571137 015505 0000000 0000000 # Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# $Id: Makefile.am 6560 2012-08-28 06:31:40Z rb $
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = libhsm/src/lib
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_broken_setres.m4 \
$(top_srcdir)/m4/acx_check_strptime.m4 \
$(top_srcdir)/m4/acx_cunit.m4 \
$(top_srcdir)/m4/acx_database_backend.m4 \
$(top_srcdir)/m4/acx_dbparams.m4 \
$(top_srcdir)/m4/acx_dlopen.m4 $(top_srcdir)/m4/acx_ldns.m4 \
$(top_srcdir)/m4/acx_libc.m4 $(top_srcdir)/m4/acx_libxml2.m4 \
$(top_srcdir)/m4/acx_mysql.m4 $(top_srcdir)/m4/acx_pedantic.m4 \
$(top_srcdir)/m4/acx_pkcs11_modules.m4 \
$(top_srcdir)/m4/acx_prefixhack.m4 \
$(top_srcdir)/m4/acx_rpath.m4 $(top_srcdir)/m4/acx_rt.m4 \
$(top_srcdir)/m4/acx_sqlite3.m4 $(top_srcdir)/m4/acx_ssl.m4 \
$(top_srcdir)/m4/acx_strict.m4 \
$(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/check_compiler_flag.m4 \
$(top_srcdir)/m4/check_compiler_flag_needed.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/opendnssec_common.m4 $(top_srcdir)/version.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/common/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
libhsm_a_AR = $(AR) $(ARFLAGS)
libhsm_a_LIBADD =
am_libhsm_a_OBJECTS = libhsm.$(OBJEXT) pin.$(OBJEXT)
libhsm_a_OBJECTS = $(am_libhsm_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libhsm_a_SOURCES)
DIST_SOURCES = $(libhsm_a_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CUCUMBER = @CUCUMBER@
CUNIT_INCLUDES = @CUNIT_INCLUDES@
CUNIT_LIBS = @CUNIT_LIBS@
CYGPATH_W = @CYGPATH_W@
C_LIBS = @C_LIBS@
DB_HOST = @DB_HOST@
DB_INCLUDES = @DB_INCLUDES@
DB_LIBS = @DB_LIBS@
DB_NAME = @DB_NAME@
DB_PASS = @DB_PASS@
DB_PORT = @DB_PORT@
DB_TYPE = @DB_TYPE@
DB_USER = @DB_USER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_SSL = @HAVE_SSL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVA = @JAVA@
LD = @LD@
LDFLAGS = @LDFLAGS@
LDNS_CONFIG = @LDNS_CONFIG@
LDNS_INCLUDES = @LDNS_INCLUDES@
LDNS_LIBS = @LDNS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MYSQL = @MYSQL@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_INCLUDES = @MYSQL_INCLUDES@
MYSQL_LIBS = @MYSQL_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENDNSSEC_BIN_DIR = @OPENDNSSEC_BIN_DIR@
OPENDNSSEC_CONFIG_DIR = @OPENDNSSEC_CONFIG_DIR@
OPENDNSSEC_CONFIG_FILE = @OPENDNSSEC_CONFIG_FILE@
OPENDNSSEC_DATA_DIR = @OPENDNSSEC_DATA_DIR@
OPENDNSSEC_ENFORCER_PIDFILE = @OPENDNSSEC_ENFORCER_PIDFILE@
OPENDNSSEC_FETCH_PIDFILE = @OPENDNSSEC_FETCH_PIDFILE@
OPENDNSSEC_LIBEXEC_DIR = @OPENDNSSEC_LIBEXEC_DIR@
OPENDNSSEC_LIB_DIR = @OPENDNSSEC_LIB_DIR@
OPENDNSSEC_LOCALSTATE_DIR = @OPENDNSSEC_LOCALSTATE_DIR@
OPENDNSSEC_PID_DIR = @OPENDNSSEC_PID_DIR@
OPENDNSSEC_SBIN_DIR = @OPENDNSSEC_SBIN_DIR@
OPENDNSSEC_SCHEMA_DIR = @OPENDNSSEC_SCHEMA_DIR@
OPENDNSSEC_SIGNER_CLI = @OPENDNSSEC_SIGNER_CLI@
OPENDNSSEC_SIGNER_ENGINE = @OPENDNSSEC_SIGNER_ENGINE@
OPENDNSSEC_SIGNER_PIDFILE = @OPENDNSSEC_SIGNER_PIDFILE@
OPENDNSSEC_SIGNER_SOCKET = @OPENDNSSEC_SIGNER_SOCKET@
OPENDNSSEC_STATE_DIR = @OPENDNSSEC_STATE_DIR@
OPENDNSSEC_SYSCONF_DIR = @OPENDNSSEC_SYSCONF_DIR@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SQLITE3 = @SQLITE3@
SQLITE3_INCLUDES = @SQLITE3_INCLUDES@
SQLITE3_LIBS = @SQLITE3_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
XML2_CONFIG = @XML2_CONFIG@
XML2_INCLUDES = @XML2_INCLUDES@
XML2_LIBS = @XML2_LIBS@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkcs11_aepkeyper_module = @pkcs11_aepkeyper_module@
pkcs11_etoken_module = @pkcs11_etoken_module@
pkcs11_ncipher_module = @pkcs11_ncipher_module@
pkcs11_opensc_module = @pkcs11_opensc_module@
pkcs11_sca6000_module = @pkcs11_sca6000_module@
pkcs11_softhsm_module = @pkcs11_softhsm_module@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
AM_CPPFLAGS = \
-I$(top_srcdir)/common \
-I$(top_builddir)/common \
-I$(srcdir)/cryptoki_compat \
@LDNS_INCLUDES@ @XML2_INCLUDES@
AM_CFLAGS = -std=c99
noinst_LIBRARIES = libhsm.a
libhsm_a_SOURCES = libhsm.c libhsm.h libhsmdns.h pin.c \
cryptoki_compat/pkcs11.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libhsm/src/lib/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign libhsm/src/lib/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libhsm.a: $(libhsm_a_OBJECTS) $(libhsm_a_DEPENDENCIES) $(EXTRA_libhsm_a_DEPENDENCIES)
-rm -f libhsm.a
$(libhsm_a_AR) libhsm.a $(libhsm_a_OBJECTS) $(libhsm_a_LIBADD)
$(RANLIB) libhsm.a
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhsm.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pin.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
opendnssec-1.4.3/libhsm/src/lib/libhsm.h 0000664 0001750 0001750 00000035002 12026571507 015052 0000000 0000000 /* $Id: libhsm.h 6704 2012-09-20 10:43:19Z rb $ */
/*
* Copyright (c) 2009 .SE (The Internet Infrastructure Foundation).
* Copyright (c) 2009 NLNet Labs.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef HSM_H
#define HSM_H 1
#include
/* Note that currently the MySQL kasp schema limits the number of HSMs to
* 127; so to increase it beyond that requires some database changes similar
* to when keypairs(id) was increased, see svn r4465.
*
* Note that this constant also determines the size of the shared PIN memory.
* Increasing this size requires any existing memory to be removed and should
* be part of a migration script.
*/
#define HSM_MAX_SESSIONS 100
#define HSM_MAX_ALGONAME 16
#define HSM_ERROR_MSGSIZE 512
/* TODO: depends on type and key, or just leave it at current
* maximum? */
#define HSM_MAX_SIGNATURE_LENGTH 512
/* Note that this constant also determines the size of the shared PIN memory.
* Increasing this size requires any existing memory to be removed and should
* be part of a migration script.
*/
#define HSM_MAX_PIN_LENGTH 255
/*! Return codes for some of the functions */
/*! These should be different than the list of CKR_ values defined
* by pkcs11 (for easier debugging purposes of calling applications)
*/
#define HSM_OK 0
#define HSM_ERROR 0x10000001
#define HSM_PIN_INCORRECT 0x10000002
#define HSM_CONFIG_FILE_ERROR 0x10000003
#define HSM_REPOSITORY_NOT_FOUND 0x10000004
#define HSM_NO_REPOSITORIES 0x10000005
#define HSM_MODULE_NOT_FOUND 0x10000006
/*! The mode for the PIN callback functions */
#define HSM_PIN_FIRST 0 /* Used when getting the PIN for the first time. */
#define HSM_PIN_RETRY 1 /* Used when we failed to login the first time. */
#define HSM_PIN_SAVE 2 /* The latest PIN can be saved for future use. Called
after a successful login. */
/*! HSM configuration */
typedef struct {
unsigned int use_pubkey; /*!< Maintain public keys in HSM */
} hsm_config_t;
/*! Data type to describe an HSM */
typedef struct {
unsigned int id; /*!< HSM numerical identifier */
char *name; /*!< name of repository */
char *token_label; /*!< label of the token */
char *path; /*!< path to PKCS#11 library */
void *handle; /*!< handle from dlopen()*/
void *sym; /*!< Function list from dlsym */
hsm_config_t *config; /*!< optional per HSM configuration */
} hsm_module_t;
/*! HSM Session */
typedef struct {
hsm_module_t *module;
unsigned long session;
} hsm_session_t;
/*! HSM Key Pair */
typedef struct {
const hsm_module_t *module; /*!< pointer to module */
unsigned long private_key; /*!< private key within module */
unsigned long public_key; /*!< public key within module */
} hsm_key_t;
/*! HSM Key Pair Information */
typedef struct {
char *id; /*!< key id */
unsigned long algorithm; /*!< key algorithm (cast from CKK_*)*/
char *algorithm_name; /*!< key algorithm name */
unsigned long keysize; /*!< key size */
} hsm_key_info_t;
/*! HSM context to keep track of sessions */
typedef struct {
hsm_session_t *session[HSM_MAX_SESSIONS]; /*!< HSM sessions */
size_t session_count; /*!< number of configured HSMs */
/*!< non-zero if the last operation failed (only the first error will be set) */
int error;
/*!< static string describing the action we were trying to do
when the first error happened */
const char *error_action;
/*!< static string describing the first error */
char error_message[HSM_ERROR_MSGSIZE];
} hsm_ctx_t;
/*! Open HSM library
\param config path to OpenDNSSEC XML configuration file
\param pin_callback This function will be called for tokens that have
no PIN configured. The default hsm_prompt_pin() can
be used. If this value is NULL, these tokens will
be skipped
\return 0 if successful, !0 if failed
Attaches all configured HSMs, querying for PINs (using the given
callback function) if not known.
Also creates initial sessions (not part of any context; every API
function that takes a context can be passed NULL, in which case the
global context will be used) and log into each HSM.
*/
int
hsm_open(const char *config,
char *(pin_callback)(unsigned int, const char *, unsigned int));
/*! Function that queries for a PIN, can be used as callback
for hsm_open(). Stores the PIN in the shared memory.
\param id Used for identifying the repository. Will have a value between zero and
HSM_MAX_SESSIONS.
\param repository The repository name will be included in the prompt
\param mode The type of mode the function should run in.
\return The string the user enters
*/
char *
hsm_prompt_pin(unsigned int id, const char *repository, unsigned int mode);
/*! Function that will check if there is a PIN in the shared memory and returns it.
\param id Used for identifying the repository. Will have a value between zero and
HSM_MAX_SESSIONS.
\param repository The repository name will be included in the prompt
\param mode The type of mode the function should run in.
\return The string the user enters
*/
char *
hsm_check_pin(unsigned int id, const char *repository, unsigned int mode);
/*! Logout
Function that will logout the user by deleting the shared memory and
semaphore. Any authenticated process will still be able to interact
with the HSM.
*/
int
hsm_logout_pin();
/*! Close HSM library
Log out and detach from all configured HSMs
This cleans up all data for libhsm, and should be the last function
called.
*/
int
hsm_close();
/*! Create new HSM context
Creates a new session for each attached HSM. The returned hsm_ctx_t *
can be freed with hsm_destroy_context()
*/
hsm_ctx_t *
hsm_create_context(void);
/*! Check HSM context
Check if the associated sessions are still alive.
If they are not alive, then try re-open libhsm.
\param context HSM context
\return 0 if successful, !0 if failed
*/
int
hsm_check_context(hsm_ctx_t *context);
/*! Destroy HSM context
\param context HSM context
Also destroys any associated sessions.
*/
void
hsm_destroy_context(hsm_ctx_t *context);
/*! List all known keys in all attached HSMs
After the function has run, the value at count contains the number
of keys found.
The resulting key list can be freed with hsm_key_list_free()
Alternatively, each individual key structure in the list could be
freed with hsm_key_free()
\param context HSM context
\param count location to store the number of keys found
*/
hsm_key_t **
hsm_list_keys(hsm_ctx_t *context, size_t *count);
/*! List all known keys in a HSM
After the function has run, the value at count contains the number
of keys found.
The resulting key list can be freed with hsm_key_list_free()
Alternatively, each individual key structure in the list could be
freed with hsm_key_free()
\param context HSM context
\param count location to store the number of keys found
\param repository repository to list the keys in
*/
hsm_key_t **
hsm_list_keys_repository(hsm_ctx_t *context,
size_t *count,
const char *repository);
/*! Count all known keys in all attached HSMs
\param context HSM context
*/
size_t
hsm_count_keys(hsm_ctx_t *context);
/*! Count all known keys in a HSM
\param context HSM context
\param repository repository in where to count the keys
*/
size_t
hsm_count_keys_repository(hsm_ctx_t *context,
const char *repository);
/*! Find a key pair by CKA_ID (as hex string)
The returned key structure can be freed with hsm_key_free()
\param context HSM context
\param id CKA_ID of key to find (null-terminated
string of hex characters)
\return key identifier or NULL if not found (or invalid input)
*/
hsm_key_t *
hsm_find_key_by_id(hsm_ctx_t *context,
const char *id);
/*! Generate new key pair in HSM
Keys generated by libhsm will have a 16-byte identifier set as CKA_ID
and the hexadecimal representation of it set as CKA_LABEL.
Other stuff, like exponent, may be needed here as well.
The returned key structure can be freed with hsm_key_free()
\param context HSM context
\param repository repository in where to create the key
\param keysize Size of RSA key
\return return key identifier or NULL if key generation failed
*/
hsm_key_t *
hsm_generate_rsa_key(hsm_ctx_t *context,
const char *repository,
unsigned long keysize);
/*! Generate new key pair in HSM
Keys generated by libhsm will have a 16-byte identifier set as CKA_ID
and the hexadecimal representation of it set as CKA_LABEL.
The returned key structure can be freed with hsm_key_free()
\param context HSM context
\param repository repository in where to create the key
\param keysize Size of DSA key
\return return key identifier or NULL if key generation failed
*/
hsm_key_t *
hsm_generate_dsa_key(hsm_ctx_t *context,
const char *repository,
unsigned long keysize);
/*! Generate new key pair in HSM
Keys generated by libhsm will have a 16-byte identifier set as CKA_ID
and the hexadecimal representation of it set as CKA_LABEL.
The returned key structure can be freed with hsm_key_free()
\param context HSM context
\param repository repository in where to create the key
\return return key identifier or NULL if key generation failed
*/
hsm_key_t *
hsm_generate_gost_key(hsm_ctx_t *context,
const char *repository);
/*! Remove a key pair from HSM
When a key is removed, the module pointer is set to NULL, and
the public and private key handles are set to 0. The structure still
needs to be freed.
\param context HSM context
\param key Key pair to be removed
\return 0 if successful, !0 if failed
*/
int
hsm_remove_key(hsm_ctx_t *context, hsm_key_t *key);
/*! Free the memory for a key structure.
\param key The key structure to free
*/
void
hsm_key_free(hsm_key_t *key);
/*! Free the memory of an array of key structures, as returned by
hsm_list_keys()
\param key_list The array of keys to free
\param count The number of keys in the array
*/
void
hsm_key_list_free(hsm_key_t **key_list, size_t count);
/*! Get id as null-terminated hex string using key identifier
The returned id is allocated data, and must be free()d by the caller
\param context HSM context
\param key Key pair to get the ID from
\return id of key pair
*/
char *
hsm_get_key_id(hsm_ctx_t *context,
const hsm_key_t *key);
/*! Get extended key information
The returned id is allocated data, and must be freed by the caller
With hsm_key_info_free()
\param context HSM context
\param key Key pair to get information about
\return key information
*/
hsm_key_info_t *
hsm_get_key_info(hsm_ctx_t *context,
const hsm_key_t *key);
/*! Frees the hsm_key_info_t structure
\param key_info The structure to free
*/
void
hsm_key_info_free(hsm_key_info_t *key_info);
/*! Fill a buffer with random data from any attached HSM
\param context HSM context
\param buffer Buffer to fill with random data
\param length Size of random buffer
\return 0 if successful, !0 if failed
*/
int
hsm_random_buffer(hsm_ctx_t *ctx,
unsigned char *buffer,
unsigned long length);
/*! Return unsigned 32-bit random number from any attached HSM
\param context HSM context
\return 32-bit random number, or 0 if no HSM with a random generator is
attached
*/
uint32_t
hsm_random32(hsm_ctx_t *ctx);
/*! Return unsigned 64-bit random number from any attached HSM
\param context HSM context
\return 64-bit random number, or 0 if no HSM with a random generator is
attached
*/
uint64_t
hsm_random64(hsm_ctx_t *ctx);
/*
* Additional functions for debugging, and non-general use-cases.
*/
/*! Attached a named HSM using a PKCS#11 shared library and
optional credentials (may be NULL, but then undefined)
This function changes the global state, and is not threadsafe
\param repository the name of the repository
\param token_label the name of the token to attach
\param path the path of the shared PKCS#11 library
\param pin the PIN to log into the token
\param config optional configuration
\return 0 on success, -1 on error
*/
int
hsm_attach(const char *repository,
const char *token_name,
const char *path,
const char *pin,
const hsm_config_t *config);
/*! Detach a named HSM
This function changes the global state, and is not threadsafe
\param token_name the token to detach
\return 0 on success, -1 on error
*/
int
hsm_detach(const char *repository);
/*! Check whether a named token has been initialized in this context
\param ctx HSM context
\param token_name The name of the token
\return 1 if the token is attached, 0 if not found
*/
int
hsm_token_attached(hsm_ctx_t *ctx,
const char *repository);
/*! Return the current error message
The returned message is allocated data, and must be free()d by the caller
\param ctx HSM context
\return error message string
*/
char *
hsm_get_error(hsm_ctx_t *gctx);
/* a few debug functions for applications */
void hsm_print_session(hsm_session_t *session);
void hsm_print_ctx(hsm_ctx_t *gctx);
void hsm_print_key(hsm_key_t *key);
void hsm_print_error(hsm_ctx_t *ctx);
void hsm_print_tokeninfo(hsm_ctx_t *gctx);
#endif /* HSM_H */
opendnssec-1.4.3/libhsm/src/lib/pin.c 0000664 0001750 0001750 00000032030 12026571507 014353 0000000 0000000 /* $Id: pin.c 6704 2012-09-20 10:43:19Z rb $ */
/*
* Copyright (c) 2011 .SE (The Internet Infrastructure Foundation).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "libhsm.h"
/*! Global (initial) context */
extern hsm_ctx_t *_hsm_ctx;
/* Function from libhsm.c */
void
hsm_ctx_set_error(hsm_ctx_t *ctx, int error, const char *action,
const char *message, ...);
/* Constants */
#define SHM_KEY (key_t)0x0d50d5ec
#define SEM_KEY (key_t)0x0d50d5ec
#define SHM_PERM S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP
#define SEM_PERM S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP
#ifndef HAVE_UNION_SEMUN
/* From man page for semctl */
union semun {
int val; /* Value for SETVAL */
struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
unsigned short *array; /* Array for GETALL, SETALL */
};
#endif
/* Remember PIN that we can save */
static char pin[HSM_MAX_PIN_LENGTH+1];
char *
prompt_pass(char *prompt)
{
int c, i = 0;
static char pass[HSM_MAX_PIN_LENGTH+1];
struct termios oldt, newt;
if (prompt == NULL) return NULL;
printf("%s", prompt);
/* Turn echoing off */
if (isatty(fileno(stdin))) {
if (tcgetattr(fileno(stdin), &oldt) != 0) return NULL;
newt = oldt;
newt.c_lflag &= ~ECHO;
if (tcsetattr(fileno(stdin), TCSAFLUSH, &newt) != 0) return NULL;
}
/* Get the password */
do {
c = fgetc(stdin);
pass[i] = c;
i++;
} while (c != EOF && c != '\n' && c != '\r' && i < HSM_MAX_PIN_LENGTH+1);
pass[i-1] = '\0';
/* Restore echoing */
if (isatty(fileno(stdin))) {
tcsetattr(fileno(stdin), TCSAFLUSH, &oldt);
}
printf("\n");
return pass;
}
int
hsm_sem_open()
{
int semid;
struct semid_ds buf;
union semun arg;
/* Create/get the semaphore */
semid = semget(SEM_KEY, 1, IPC_CREAT|IPC_EXCL|SEM_PERM);
if (semid == -1) {
semid = semget(SEM_KEY, 1, IPC_CREAT|SEM_PERM);
if (semid == -1) {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_sem_open()",
"Could not access the semaphore: %s", strerror(errno));
return -1;
}
} else {
/* Set value to 1 if we created it */
arg.val = 1;
if (semctl(semid, 0, SETVAL, arg) == -1) {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_sem_open()",
"Could not set value on the semaphore: %s", strerror(errno));
return -1;
}
}
/* Get information about the semaphore */
arg.buf = &buf;
if (semctl(semid, 0, IPC_STAT, arg) != 0) {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_sem_open()",
"Could not stat the semaphore: %s", strerror(errno));
return -1;
}
/* Check permission to avoid an attack */
if ((buf.sem_perm.mode & (SEM_PERM)) != (SEM_PERM) ||
buf.sem_perm.gid != getegid())
{
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_sem_open()",
"Bad permissions on the semaphore, please read Getting Help/Troubleshooting on OpenDNSSEC Wiki about this.");
return -1;
}
return semid;
}
int
hsm_sem_wait(int semid)
{
struct sembuf sb = { 0, -1, 0 };
if (semop(semid, &sb, 1) == -1) {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_sem_wait()",
"Could not lock the semaphore: %s", strerror(errno));
return -1;
}
return 0;
}
int
hsm_sem_post(int semid)
{
struct sembuf sb = { 0, 1, 0 };
if (semop(semid, &sb, 1) == -1) {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_sem_post()",
"Could not unlock the semaphore: %s", strerror(errno));
return -1;
}
return 0;
}
int
hsm_shm_open()
{
int shmid;
size_t shmsize;
struct shmid_ds buf;
/* Create/get the shared memory */
shmsize = sizeof(char)*HSM_MAX_SESSIONS*(HSM_MAX_PIN_LENGTH+1);
shmid = shmget(SHM_KEY, shmsize, IPC_CREAT|IPC_EXCL|SHM_PERM);
if (shmid == -1) {
shmid = shmget(SHM_KEY, shmsize, IPC_CREAT|SHM_PERM);
if (shmid == -1) {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_shm_open()",
"Could not access the shared memory: %s", strerror(errno));
return -1;
}
} else {
/* Zeroize if we created the memory area */
/* The data should be set to zero according to man page */
}
/* Get information about the shared memory */
if (shmctl(shmid, IPC_STAT, &buf) != 0) {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_shm_open()",
"Could not stat the semaphore: %s", strerror(errno));
return -1;
}
/* Check the size of the memory segment */
if (buf.shm_segsz != shmsize) {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_shm_open()",
"Bad memory size, please read Getting Help/Troubleshooting on OpenDNSSEC Wiki about this.");
return -1;
}
/* Check permission to avoid an attack */
if ((buf.shm_perm.mode & (SHM_PERM)) != (SHM_PERM) ||
buf.shm_perm.gid != getegid())
{
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_shm_open()",
"Bad permissions on the shared memory, please read Getting Help/Troubleshooting on OpenDNSSEC Wiki about this.");
return -1;
}
return shmid;
}
char *
hsm_prompt_pin(unsigned int id, const char *repository, unsigned int mode)
{
/* Shared memory */
int shmid;
int semid;
char *pins = NULL;
int index = id * (HSM_MAX_PIN_LENGTH + 1);
/* PIN from getpass */
char prompt[64];
char *prompt_pin = NULL;
unsigned int size = 0;
/* Check input data */
if (id >= HSM_MAX_SESSIONS) return NULL;
if (repository == NULL) return NULL;
if (mode != HSM_PIN_FIRST && mode != HSM_PIN_RETRY && mode != HSM_PIN_SAVE) return NULL;
/* Create/get the semaphore */
semid = hsm_sem_open();
if (semid == -1) return NULL;
/* Lock the semaphore */
if (hsm_sem_wait(semid) != 0) return NULL;
/* Create/get the shared memory */
shmid = hsm_shm_open();
if (shmid == -1) {
hsm_sem_post(semid);
return NULL;
}
/* Attach to the shared memory */
pins = (char *)shmat(shmid, NULL, 0);
if (pins == (char *)-1) {
pins = NULL;
hsm_sem_post(semid);
return NULL;
}
/* Get the PIN */
if (mode != HSM_PIN_SAVE) {
/* Do we have a PIN in the shared memory? */
if (mode == HSM_PIN_FIRST && pins[index] != '\0') {
size = strlen(&pins[index]);
if (size > HSM_MAX_PIN_LENGTH) size = HSM_MAX_PIN_LENGTH;
memcpy(pin, &pins[index], size);
pin[size] = '\0';
} else {
/* Zeroize bad PIN in shared memory */
if (mode == HSM_PIN_RETRY && pins[index] != '\0') {
memset(&pins[index], '\0', HSM_MAX_PIN_LENGTH+1);
}
/* Unlock the semaphore if someone would do Ctrl+C */
hsm_sem_post(semid);
/* Get PIN */
snprintf(prompt, 64, "Enter PIN for token %s: ", repository);
prompt_pin = prompt_pass(prompt);
if (prompt_pin == NULL) {
shmdt(pins);
pins = NULL;
return NULL;
}
/* Lock the semaphore */
hsm_sem_wait(semid);
/* Remember PIN */
size = strlen(prompt_pin);
if (size > HSM_MAX_PIN_LENGTH) size = HSM_MAX_PIN_LENGTH;
memset(pin, '\0', HSM_MAX_PIN_LENGTH+1);
memcpy(pin, prompt_pin, size);
/* Zeroize the prompt_pass PIN */
memset(prompt_pin, '\0', strlen(prompt_pin));
}
} else {
/* Save the PIN */
memcpy(&pins[index], pin, HSM_MAX_PIN_LENGTH+1);
/* Zeroize the PIN */
memset(pin, '\0', HSM_MAX_PIN_LENGTH+1);
}
/* Detach from the shared memory */
shmdt(pins);
pins = NULL;
/* Unlock the semaphore */
hsm_sem_post(semid);
return pin;
}
char *
hsm_check_pin(unsigned int id, const char *repository, unsigned int mode)
{
/* Shared memory */
int shmid;
int semid;
char *pins = NULL;
int index = id * (HSM_MAX_PIN_LENGTH + 1);
unsigned int size = 0;
/* Check input data */
if (id >= HSM_MAX_SESSIONS) return NULL;
if (repository == NULL) return NULL;
if (mode != HSM_PIN_FIRST && mode != HSM_PIN_RETRY && mode != HSM_PIN_SAVE) return NULL;
if (mode == HSM_PIN_SAVE) {
/* Nothing to save */
/* Zeroize the PIN */
memset(pin, '\0', HSM_MAX_PIN_LENGTH+1);
return pin;
}
/* Create/get the semaphore */
semid = hsm_sem_open();
if (semid == -1) return NULL;
/* Lock the semaphore */
if (hsm_sem_wait(semid) != 0) return NULL;
/* Create/get the shared memory */
shmid = hsm_shm_open();
if (shmid == -1) {
hsm_sem_post(semid);
return NULL;
}
/* Attach to the shared memory */
pins = (char *)shmat(shmid, NULL, 0);
if (pins == (char *)-1) {
pins = NULL;
hsm_sem_post(semid);
return NULL;
}
/* Zeroize PIN buffer */
memset(pin, '\0', HSM_MAX_PIN_LENGTH+1);
/* Check if there is no PIN */
if (pins[index] == '\0') {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_check_pin()",
"No PIN in shared memory. "
"Please login with \"ods-hsmutil login\"");
shmdt(pins);
pins = NULL;
hsm_sem_post(semid);
return NULL;
}
/* Zeroize bad PIN in shared memory */
if (mode == HSM_PIN_RETRY) {
memset(&pins[index], '\0', HSM_MAX_PIN_LENGTH+1);
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_check_pin()",
"Removed bad PIN in shared memory. "
"Please login again with \"ods-hsmutil login\"");
shmdt(pins);
pins = NULL;
hsm_sem_post(semid);
return NULL;
}
/* Get the PIN */
size = strlen(&pins[index]);
if (size > HSM_MAX_PIN_LENGTH) size = HSM_MAX_PIN_LENGTH;
memcpy(pin, &pins[index], size);
pin[size] = '\0';
/* Detach from the shared memory */
shmdt(pins);
pins = NULL;
/* Unlock the semaphore */
hsm_sem_post(semid);
return pin;
}
int
hsm_logout_pin()
{
int semid;
int shmid;
union semun arg;
struct shmid_ds buf;
/* Get the semaphore */
semid = semget(SEM_KEY, 1, 0);
if (semid == -1) {
if (errno != ENOENT) {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_logout_pin()",
"Could not access the semaphore: %s", strerror(errno));
return HSM_ERROR;
}
} else {
/* Remove the semaphore */
if (semctl(semid, 0, IPC_RMID, arg) != 0) {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_logout_pin()",
"Could not delete the semaphore: %s", strerror(errno));
return HSM_ERROR;
}
}
/* Get the shared memory */
shmid = shmget(SHM_KEY, 0, 0);
if (shmid == -1) {
if (errno != ENOENT) {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_logout_pin()",
"Could not access the shared memory: %s", strerror(errno));
return HSM_ERROR;
}
} else {
/* Remove the shared memory */
if (shmctl(shmid, IPC_RMID, &buf) != 0) {
hsm_ctx_set_error(_hsm_ctx, HSM_ERROR, "hsm_logout_pin()",
"Could not stat the semaphore: %s", strerror(errno));
return HSM_ERROR;
}
}
return HSM_OK;
}
opendnssec-1.4.3/libhsm/src/lib/Makefile.am 0000664 0001750 0001750 00000000563 12017062714 015456 0000000 0000000 # $Id: Makefile.am 6560 2012-08-28 06:31:40Z rb $
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
AM_CPPFLAGS = \
-I$(top_srcdir)/common \
-I$(top_builddir)/common \
-I$(srcdir)/cryptoki_compat \
@LDNS_INCLUDES@ @XML2_INCLUDES@
AM_CFLAGS = -std=c99
noinst_LIBRARIES = libhsm.a
libhsm_a_SOURCES = libhsm.c libhsm.h libhsmdns.h pin.c \
cryptoki_compat/pkcs11.h
opendnssec-1.4.3/libhsm/src/lib/libhsmdns.h 0000664 0001750 0001750 00000007407 12017062714 015562 0000000 0000000 /* $Id: libhsmdns.h 6560 2012-08-28 06:31:40Z rb $ */
/*
* Copyright (c) 2009 .SE (The Internet Infrastructure Foundation).
* Copyright (c) 2009 NLNet Labs.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef HSMDNS_H
#define HSMDNS_H 1
#include
/*! Extra information for signing rrsets (algorithm, expiration, etc) */
typedef struct {
/** The DNS signing algorithm identifier */
ldns_algorithm algorithm;
/** Key flags */
uint16_t flags;
/** The inception date of signatures made with this key. */
uint32_t inception;
/** The expiration date of signatures made with this key. */
uint32_t expiration;
/** The keytag of the key (is this necessary?) */
uint16_t keytag;
/** The owner name of the key */
ldns_rdf *owner;
} hsm_sign_params_t;
/*!
* Returns an allocated hsm_sign_params_t with some defaults
*/
hsm_sign_params_t *
hsm_sign_params_new();
/*!
Free the signer parameters structure
If params->owner has been set, ldns_rdf_deep_free() will be called
on it.
\param params The signer parameters to free
*/
void
hsm_sign_params_free(hsm_sign_params_t *params);
/*! Sign RRset using key
The returned ldns_rr structure can be freed with ldns_rr_free()
\param context HSM context
\param rrset RRset to sign
\param key Key pair used to sign
\return ldns_rr* Signed RRset
*/
ldns_rr*
hsm_sign_rrset(hsm_ctx_t *ctx,
const ldns_rr_list* rrset,
const hsm_key_t *key,
const hsm_sign_params_t *sign_params);
/*! Generate a base32 encoded hashed NSEC3 name
\param ctx HSM context
\param name Domain name to hash
\param algorithm NSEC3 algorithm (must be 1 atm)
\param iteration number of hash iterations
\param salt_length the length of the salt
\param salt the salt
*/
ldns_rdf *
hsm_nsec3_hash_name(hsm_ctx_t *ctx,
ldns_rdf *name,
uint8_t algorithm,
uint16_t iterations,
uint8_t salt_length,
uint8_t *salt);
/*! Get DNSKEY RR
The returned ldns_rr structure can be freed with ldns_rr_free()
\param context HSM context
\param key Key to get DNSKEY RR from
\param sign_params the signing parameters (flags, algorithm, etc)
\return ldns_rr*
*/
ldns_rr*
hsm_get_dnskey(hsm_ctx_t *ctx,
const hsm_key_t *key,
const hsm_sign_params_t *sign_params);
/*! Check if a given DNSSEC algorithm is supported
\param ldns_algorithm algorithm number
\return 0 if supported, -1 otherwise
*/
int
hsm_supported_algorithm(ldns_algorithm algorithm);
#endif /* HSMDNS_H */
opendnssec-1.4.3/libhsm/src/Makefile.am 0000664 0001750 0001750 00000000163 11616243264 014711 0000000 0000000 # $Id: Makefile.am 5348 2011-08-03 13:01:40Z rb $
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
SUBDIRS = lib bin
opendnssec-1.4.3/libhsm/Makefile.am 0000664 0001750 0001750 00000000542 11427766226 014133 0000000 0000000 # $Id: Makefile.am 3682 2010-08-09 11:55:02Z jakob $
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
SUBDIRS = src checks
doxygen:
rm -fr $(top_builddir)/libhsm/doxygen-doc
env $(DX_ENV) \
PROJECT_NAME="OpenDNSSEC-libhsm" \
SRCDIR=$(top_srcdir)/libhsm \
OUTPUTDIR=$(top_builddir)/libhsm/doxygen-doc \
$(DX_DOXYGEN) $(top_builddir)/$(DX_CONFIG)
opendnssec-1.4.3/signer/ 0000775 0001750 0001750 00000000000 12247571206 012160 5 0000000 0000000 opendnssec-1.4.3/signer/Makefile.in 0000664 0001750 0001750 00000050732 12247571137 014157 0000000 0000000 # Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# $Id: Makefile.am 4098 2010-10-13 14:40:53Z matthijs $
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = signer
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
AUTHORS
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_broken_setres.m4 \
$(top_srcdir)/m4/acx_check_strptime.m4 \
$(top_srcdir)/m4/acx_cunit.m4 \
$(top_srcdir)/m4/acx_database_backend.m4 \
$(top_srcdir)/m4/acx_dbparams.m4 \
$(top_srcdir)/m4/acx_dlopen.m4 $(top_srcdir)/m4/acx_ldns.m4 \
$(top_srcdir)/m4/acx_libc.m4 $(top_srcdir)/m4/acx_libxml2.m4 \
$(top_srcdir)/m4/acx_mysql.m4 $(top_srcdir)/m4/acx_pedantic.m4 \
$(top_srcdir)/m4/acx_pkcs11_modules.m4 \
$(top_srcdir)/m4/acx_prefixhack.m4 \
$(top_srcdir)/m4/acx_rpath.m4 $(top_srcdir)/m4/acx_rt.m4 \
$(top_srcdir)/m4/acx_sqlite3.m4 $(top_srcdir)/m4/acx_ssl.m4 \
$(top_srcdir)/m4/acx_strict.m4 \
$(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/check_compiler_flag.m4 \
$(top_srcdir)/m4/check_compiler_flag_needed.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/opendnssec_common.m4 $(top_srcdir)/version.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/common/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CUCUMBER = @CUCUMBER@
CUNIT_INCLUDES = @CUNIT_INCLUDES@
CUNIT_LIBS = @CUNIT_LIBS@
CYGPATH_W = @CYGPATH_W@
C_LIBS = @C_LIBS@
DB_HOST = @DB_HOST@
DB_INCLUDES = @DB_INCLUDES@
DB_LIBS = @DB_LIBS@
DB_NAME = @DB_NAME@
DB_PASS = @DB_PASS@
DB_PORT = @DB_PORT@
DB_TYPE = @DB_TYPE@
DB_USER = @DB_USER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_SSL = @HAVE_SSL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVA = @JAVA@
LD = @LD@
LDFLAGS = @LDFLAGS@
LDNS_CONFIG = @LDNS_CONFIG@
LDNS_INCLUDES = @LDNS_INCLUDES@
LDNS_LIBS = @LDNS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MYSQL = @MYSQL@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_INCLUDES = @MYSQL_INCLUDES@
MYSQL_LIBS = @MYSQL_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENDNSSEC_BIN_DIR = @OPENDNSSEC_BIN_DIR@
OPENDNSSEC_CONFIG_DIR = @OPENDNSSEC_CONFIG_DIR@
OPENDNSSEC_CONFIG_FILE = @OPENDNSSEC_CONFIG_FILE@
OPENDNSSEC_DATA_DIR = @OPENDNSSEC_DATA_DIR@
OPENDNSSEC_ENFORCER_PIDFILE = @OPENDNSSEC_ENFORCER_PIDFILE@
OPENDNSSEC_FETCH_PIDFILE = @OPENDNSSEC_FETCH_PIDFILE@
OPENDNSSEC_LIBEXEC_DIR = @OPENDNSSEC_LIBEXEC_DIR@
OPENDNSSEC_LIB_DIR = @OPENDNSSEC_LIB_DIR@
OPENDNSSEC_LOCALSTATE_DIR = @OPENDNSSEC_LOCALSTATE_DIR@
OPENDNSSEC_PID_DIR = @OPENDNSSEC_PID_DIR@
OPENDNSSEC_SBIN_DIR = @OPENDNSSEC_SBIN_DIR@
OPENDNSSEC_SCHEMA_DIR = @OPENDNSSEC_SCHEMA_DIR@
OPENDNSSEC_SIGNER_CLI = @OPENDNSSEC_SIGNER_CLI@
OPENDNSSEC_SIGNER_ENGINE = @OPENDNSSEC_SIGNER_ENGINE@
OPENDNSSEC_SIGNER_PIDFILE = @OPENDNSSEC_SIGNER_PIDFILE@
OPENDNSSEC_SIGNER_SOCKET = @OPENDNSSEC_SIGNER_SOCKET@
OPENDNSSEC_STATE_DIR = @OPENDNSSEC_STATE_DIR@
OPENDNSSEC_SYSCONF_DIR = @OPENDNSSEC_SYSCONF_DIR@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SQLITE3 = @SQLITE3@
SQLITE3_INCLUDES = @SQLITE3_INCLUDES@
SQLITE3_LIBS = @SQLITE3_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
XML2_CONFIG = @XML2_CONFIG@
XML2_INCLUDES = @XML2_INCLUDES@
XML2_LIBS = @XML2_LIBS@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkcs11_aepkeyper_module = @pkcs11_aepkeyper_module@
pkcs11_etoken_module = @pkcs11_etoken_module@
pkcs11_ncipher_module = @pkcs11_ncipher_module@
pkcs11_opensc_module = @pkcs11_opensc_module@
pkcs11_sca6000_module = @pkcs11_sca6000_module@
pkcs11_softhsm_module = @pkcs11_softhsm_module@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
SUBDIRS = src man
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign signer/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign signer/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic clean-libtool \
ctags ctags-recursive distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am
doxygen:
rm -fr $(top_builddir)/signer/doxygen-doc
env $(DX_ENV) \
PROJECT_NAME="OpenDNSSEC-signer" \
SRCDIR=$(top_srcdir)/signer \
OUTPUTDIR=$(top_builddir)/signer/doxygen-doc \
$(DX_DOXYGEN) $(top_builddir)/$(DX_CONFIG)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
opendnssec-1.4.3/signer/man/ 0000775 0001750 0001750 00000000000 12247571207 012734 5 0000000 0000000 opendnssec-1.4.3/signer/man/Makefile.in 0000664 0001750 0001750 00000041671 12247571137 014734 0000000 0000000 # Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# $Id$
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = signer/man
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/ods-signer.8.in $(srcdir)/ods-signerd.8.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_broken_setres.m4 \
$(top_srcdir)/m4/acx_check_strptime.m4 \
$(top_srcdir)/m4/acx_cunit.m4 \
$(top_srcdir)/m4/acx_database_backend.m4 \
$(top_srcdir)/m4/acx_dbparams.m4 \
$(top_srcdir)/m4/acx_dlopen.m4 $(top_srcdir)/m4/acx_ldns.m4 \
$(top_srcdir)/m4/acx_libc.m4 $(top_srcdir)/m4/acx_libxml2.m4 \
$(top_srcdir)/m4/acx_mysql.m4 $(top_srcdir)/m4/acx_pedantic.m4 \
$(top_srcdir)/m4/acx_pkcs11_modules.m4 \
$(top_srcdir)/m4/acx_prefixhack.m4 \
$(top_srcdir)/m4/acx_rpath.m4 $(top_srcdir)/m4/acx_rt.m4 \
$(top_srcdir)/m4/acx_sqlite3.m4 $(top_srcdir)/m4/acx_ssl.m4 \
$(top_srcdir)/m4/acx_strict.m4 \
$(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/check_compiler_flag.m4 \
$(top_srcdir)/m4/check_compiler_flag_needed.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/opendnssec_common.m4 $(top_srcdir)/version.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/common/config.h
CONFIG_CLEAN_FILES = ods-signer.8 ods-signerd.8
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
man8dir = $(mandir)/man8
am__installdirs = "$(DESTDIR)$(man8dir)"
NROFF = nroff
MANS = $(man8_MANS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CUCUMBER = @CUCUMBER@
CUNIT_INCLUDES = @CUNIT_INCLUDES@
CUNIT_LIBS = @CUNIT_LIBS@
CYGPATH_W = @CYGPATH_W@
C_LIBS = @C_LIBS@
DB_HOST = @DB_HOST@
DB_INCLUDES = @DB_INCLUDES@
DB_LIBS = @DB_LIBS@
DB_NAME = @DB_NAME@
DB_PASS = @DB_PASS@
DB_PORT = @DB_PORT@
DB_TYPE = @DB_TYPE@
DB_USER = @DB_USER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_SSL = @HAVE_SSL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVA = @JAVA@
LD = @LD@
LDFLAGS = @LDFLAGS@
LDNS_CONFIG = @LDNS_CONFIG@
LDNS_INCLUDES = @LDNS_INCLUDES@
LDNS_LIBS = @LDNS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MYSQL = @MYSQL@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_INCLUDES = @MYSQL_INCLUDES@
MYSQL_LIBS = @MYSQL_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENDNSSEC_BIN_DIR = @OPENDNSSEC_BIN_DIR@
OPENDNSSEC_CONFIG_DIR = @OPENDNSSEC_CONFIG_DIR@
OPENDNSSEC_CONFIG_FILE = @OPENDNSSEC_CONFIG_FILE@
OPENDNSSEC_DATA_DIR = @OPENDNSSEC_DATA_DIR@
OPENDNSSEC_ENFORCER_PIDFILE = @OPENDNSSEC_ENFORCER_PIDFILE@
OPENDNSSEC_FETCH_PIDFILE = @OPENDNSSEC_FETCH_PIDFILE@
OPENDNSSEC_LIBEXEC_DIR = @OPENDNSSEC_LIBEXEC_DIR@
OPENDNSSEC_LIB_DIR = @OPENDNSSEC_LIB_DIR@
OPENDNSSEC_LOCALSTATE_DIR = @OPENDNSSEC_LOCALSTATE_DIR@
OPENDNSSEC_PID_DIR = @OPENDNSSEC_PID_DIR@
OPENDNSSEC_SBIN_DIR = @OPENDNSSEC_SBIN_DIR@
OPENDNSSEC_SCHEMA_DIR = @OPENDNSSEC_SCHEMA_DIR@
OPENDNSSEC_SIGNER_CLI = @OPENDNSSEC_SIGNER_CLI@
OPENDNSSEC_SIGNER_ENGINE = @OPENDNSSEC_SIGNER_ENGINE@
OPENDNSSEC_SIGNER_PIDFILE = @OPENDNSSEC_SIGNER_PIDFILE@
OPENDNSSEC_SIGNER_SOCKET = @OPENDNSSEC_SIGNER_SOCKET@
OPENDNSSEC_STATE_DIR = @OPENDNSSEC_STATE_DIR@
OPENDNSSEC_SYSCONF_DIR = @OPENDNSSEC_SYSCONF_DIR@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SQLITE3 = @SQLITE3@
SQLITE3_INCLUDES = @SQLITE3_INCLUDES@
SQLITE3_LIBS = @SQLITE3_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
XML2_CONFIG = @XML2_CONFIG@
XML2_INCLUDES = @XML2_INCLUDES@
XML2_LIBS = @XML2_LIBS@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkcs11_aepkeyper_module = @pkcs11_aepkeyper_module@
pkcs11_etoken_module = @pkcs11_etoken_module@
pkcs11_ncipher_module = @pkcs11_ncipher_module@
pkcs11_opensc_module = @pkcs11_opensc_module@
pkcs11_sca6000_module = @pkcs11_sca6000_module@
pkcs11_softhsm_module = @pkcs11_softhsm_module@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
man8_MANS = ods-signer.8 ods-signerd.8
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign signer/man/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign signer/man/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
ods-signer.8: $(top_builddir)/config.status $(srcdir)/ods-signer.8.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
ods-signerd.8: $(top_builddir)/config.status $(srcdir)/ods-signerd.8.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-man8: $(man8_MANS)
@$(NORMAL_INSTALL)
test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
@list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \
{ for i in $$list; do echo "$$i"; done; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
done; }
uninstall-man8:
@$(NORMAL_UNINSTALL)
@list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir)
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@list='$(MANS)'; if test -n "$$list"; then \
list=`for p in $$list; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
if test -n "$$list" && \
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
echo " typically \`make maintainer-clean' will remove them" >&2; \
exit 1; \
else :; fi; \
else :; fi
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(MANS)
installdirs:
for dir in "$(DESTDIR)$(man8dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-man
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man: install-man8
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-man
uninstall-man: uninstall-man8
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-man8 \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
uninstall uninstall-am uninstall-man uninstall-man8
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
opendnssec-1.4.3/signer/man/ods-signerd.8.in 0000664 0001750 0001750 00000002405 11721247530 015564 0000000 0000000 .TH "ods-signerd" "22" "February 2012" "OpenDNSSEC" "OpenDNSSEC ods-signerd"
.\" $Id: ods-signerd.8.in 2785 2010-02-02 16:45:00Z rb $
.SH "NAME"
.LP
.B ods\-signerd
\- OpenDNSSEC Signer Engine daemon
.SH "SYNOPSIS"
.LP
.B ods\-signerd
.RB [ \-1 ]
.RB [ \-c
.IR FILE ]
.RB [ \-d ]
.RB [ \-h ]
.RB [ \-i ]
.RB [ \-v ]
.RB [ \-V ]
.P
.SH "DESCRIPTION"
.LP
ods\-signerd is part of the OpenDNSSEC software. It will keep your DNS zones
continuous signed. For more information, go to
.B http://www.opendnssec.org
and visit the Documentation page.
.P
.SH "OPTIONS"
.LP
.TP
.B \-1
Run signer engine once, then exit (for debugging purposes).
.TP
.B \-c\fI FILE
Read configuration from file, instead of using the default.
.TP
.B \-d
Run daemon in foreground.
.TP
.B \-h
Show this help.
.TP
.B \-i
Print configuration and exit (for debugging purposes).
.TP
.B \-v
Increase verbosity.
.TP
.B \-V
Show version and exit.
.P
.SH "DIAGNOSTICS"
.LP
will log all the problems via standard syslog(8).
.SH "SEE ALSO"
.LP
ods\-control(8), ods\-enforcerd(8), ods\-hsmspeed(1),
ods\-hsmutil(1), ods\-kaspcheck(1), ods\-ksmutil(1), ods\-signer(8),
ods\-timing(5), opendnssec(7),
.B http://www.opendnssec.org/
.SH "AUTHORS"
.LP
.B ods\-signerd
was written by NLnet Labs as part of the OpenDNSSEC project.
opendnssec-1.4.3/signer/man/ods-signer.8.in 0000664 0001750 0001750 00000002143 12156031121 015405 0000000 0000000 .TH "ods-signer" "22" "February 2012" "OpenDNSSEC" "OpenDNSSEC ods-signer"
.\" $Id: ods-signer.8.in 3709 2010-08-10 13:03:45Z rb $
.SH "NAME"
.B ods\-signer
\- OpenDNSSEC Signer Engine client
.LP
.SH "SYNOPSIS"
.B ods\-signer
.RB [ \-h ]
.I clear
.IR
|
.I flush
|
.I queue
|
.I reload
|
.I running
|
.I sign
.IR [ \-\-serial ]
|
.I sign \-\-all
|
.I start
|
.I stop
|
.I update
.RB [ \-\-all ]
|
.I update
.IR
|
.I verbosity
.IR
|
.I zones
.LP
.SH "DESCRIPTION"
ods\-signer is part of the OpenDNSSEC software. With this tool, you can send
commands to the signer engine daemon. For more information, go to
.B http://www.opendnssec.org
and visit the Documentation page.
.LP
.SH "OPTIONS"
.LP
.TP
.B \-h
Show this help.
.P
.SH "DIAGNOSTICS"
.LP
will log all the problems via stderr.
.SH "SEE ALSO"
.LP
ods\-control(8), ods\-enforcerd(8), ods\-hsmspeed(1),
ods\-hsmutil(1), ods\-kaspcheck(1), ods\-ksmutil(1),
ods\-signerd(8), ods\-timing(5), opendnssec(7),
.B http://www.opendnssec.org/
.SH "AUTHORS"
.LP
.B ods\-signer
was written by NLnet Labs as part of the OpenDNSSEC project.
opendnssec-1.4.3/signer/man/Makefile.am 0000664 0001750 0001750 00000000136 11455342344 014706 0000000 0000000 # $Id$
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
man8_MANS = ods-signer.8 ods-signerd.8
opendnssec-1.4.3/signer/AUTHORS 0000664 0001750 0001750 00000000277 11261074127 013151 0000000 0000000 $Id: AUTHORS 1992 2009-10-01 09:37:27Z matthijs $
Main developers:
Jelte Jansen (jelte@NLnetLabs.nl) http://www.NLnetLabs.nl
Matthijs Mekking (matthijs@NLnetLabs.nl) http://www.NLnetLabs.nl
opendnssec-1.4.3/signer/src/ 0000775 0001750 0001750 00000000000 12247571206 012747 5 0000000 0000000 opendnssec-1.4.3/signer/src/scheduler/ 0000775 0001750 0001750 00000000000 12247571206 014725 5 0000000 0000000 opendnssec-1.4.3/signer/src/scheduler/schedule.c 0000664 0001750 0001750 00000023163 12107367651 016614 0000000 0000000 /*
* $Id$
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Task scheduling.
*
*/
#include "config.h"
#include "scheduler/schedule.h"
#include "scheduler/task.h"
#include "shared/duration.h"
#include "shared/log.h"
#include
static const char* schedule_str = "scheduler";
/**
* Create new schedule.
*
*/
schedule_type*
schedule_create(allocator_type* allocator)
{
schedule_type* schedule;
if (!allocator) {
return NULL;
}
schedule = (schedule_type*) allocator_alloc(allocator,
sizeof(schedule_type));
if (!schedule) {
ods_log_error("[%s] unable to create schedule: allocator_alloc() "
"failed", schedule_str);
return NULL;
}
schedule->allocator = allocator;
schedule->loading = 0;
schedule->flushcount = 0;
schedule->tasks = ldns_rbtree_create(task_compare);
if (!schedule->tasks) {
ods_log_error("[%s] unable to create schedule: ldns_rbtree_create() "
"failed", schedule_str);
allocator_deallocate(allocator, (void*) schedule);
return NULL;
}
lock_basic_init(&schedule->schedule_lock);
return schedule;
}
/**
* Flush schedule.
*
*/
void
schedule_flush(schedule_type* schedule, task_id override)
{
ldns_rbnode_t* node = LDNS_RBTREE_NULL;
task_type* task = NULL;
ods_log_debug("[%s] flush all tasks", schedule_str);
if (!schedule || !schedule->tasks) {
return;
}
node = ldns_rbtree_first(schedule->tasks);
while (node && node != LDNS_RBTREE_NULL) {
task = (task_type*) node->data;
task->flush = 1;
schedule->flushcount++;
if (override != TASK_NONE) {
task->what = override;
}
node = ldns_rbtree_next(node);
}
return;
}
/**
* Convert task to a tree node.
*
*/
static ldns_rbnode_t*
task2node(task_type* task)
{
ldns_rbnode_t* node = (ldns_rbnode_t*) malloc(sizeof(ldns_rbnode_t));
if (node) {
node->key = task;
node->data = task;
}
return node;
}
/**
* Look up task.
*
*/
task_type*
schedule_lookup_task(schedule_type* schedule, task_type* task)
{
ldns_rbnode_t* node = LDNS_RBTREE_NULL;
task_type* lookup = NULL;
if (!schedule || !task) {
return NULL;
}
ods_log_assert(schedule->tasks);
node = ldns_rbtree_search(schedule->tasks, task);
if (node && node != LDNS_RBTREE_NULL) {
lookup = (task_type*) node->data;
}
return lookup;
}
/**
* Schedule task.
*
*/
ods_status
schedule_task(schedule_type* schedule, task_type* task, int log)
{
ldns_rbnode_t* new_node = NULL;
ldns_rbnode_t* ins_node = NULL;
if (!task || !schedule || !schedule->tasks) {
return ODS_STATUS_ASSERT_ERR;
}
ods_log_debug("[%s] schedule task %s for zone %s", schedule_str,
task_what2str(task->what), task_who2str(task));
if (schedule_lookup_task(schedule, task) != NULL) {
ods_log_error("[%s] unable to schedule task %s for zone %s: "
" already present", schedule_str, task_what2str(task->what),
task_who2str(task));
return ODS_STATUS_ERR;
}
new_node = task2node(task);
if (!new_node) {
ods_log_error("[%s] unable to schedule task %s for zone %s: "
" task2node() failed", schedule_str, task_what2str(task->what),
task_who2str(task));
return ODS_STATUS_MALLOC_ERR;
}
ins_node = ldns_rbtree_insert(schedule->tasks, new_node);
if (!ins_node) {
ods_log_error("[%s] unable to schedule task %s for zone %s: "
" insert failed", schedule_str, task_what2str(task->what),
task_who2str(task));
free((void*)new_node);
return ODS_STATUS_ERR;
}
if (task->flush) {
schedule->flushcount++;
}
if (log) {
task_log(task);
}
return ODS_STATUS_OK;
}
/**
* Unschedule task.
*
*/
task_type*
unschedule_task(schedule_type* schedule, task_type* task)
{
ldns_rbnode_t* del_node = LDNS_RBTREE_NULL;
task_type* del_task = NULL;
if (!task || !schedule || !schedule->tasks) {
return NULL;
}
ods_log_debug("[%s] unschedule task %s for zone %s",
schedule_str, task_what2str(task->what), task_who2str(task));
del_node = ldns_rbtree_delete(schedule->tasks, (const void*) task);
if (del_node) {
del_task = (task_type*) del_node->data;
free((void*)del_node);
} else {
ods_log_warning("[%s] unable to unschedule task %s for zone %s: not "
"scheduled", schedule_str, task_what2str(task->what),
task_who2str(task));
return NULL;
}
if (del_task->flush) {
del_task->flush = 0;
schedule->flushcount--;
}
return del_task;
}
/**
* Reschedule task.
*
*/
ods_status
reschedule_task(schedule_type* schedule, task_type* task, task_id what,
time_t when)
{
task_type* del_task = NULL;
if (!task || !schedule || !schedule->tasks) {
return ODS_STATUS_ASSERT_ERR;
}
del_task = unschedule_task(schedule, task);
if (!del_task) {
del_task = task;
}
del_task->what = what;
del_task->when = when;
return schedule_task(schedule, del_task, 1);
}
/**
* Get the first scheduled task.
*
*/
task_type*
schedule_get_first_task(schedule_type* schedule)
{
ldns_rbnode_t* first_node = LDNS_RBTREE_NULL;
ldns_rbnode_t* node = LDNS_RBTREE_NULL;
task_type* pop = NULL;
if (!schedule || !schedule->tasks) {
return NULL;
}
first_node = ldns_rbtree_first(schedule->tasks);
if (!first_node) {
return NULL;
}
if (schedule->flushcount > 0) {
/* find remaining to be flushed tasks */
node = first_node;
while (node && node != LDNS_RBTREE_NULL) {
pop = (task_type*) node->data;
if (pop->flush) {
return pop;
}
node = ldns_rbtree_next(node);
}
/* no more to be flushed tasks found */
ods_log_warning("[%s] unable to get first scheduled task: could not "
"find flush-task, while there should be %i flush-tasks left",
schedule_str, schedule->flushcount);
ods_log_info("[%s] reset flush count to 0", schedule_str);
schedule->flushcount = 0;
}
/* no more tasks to be flushed, return first task in schedule */
pop = (task_type*) first_node->data;
return pop;
}
/**
* Pop the first scheduled task.
*
*/
task_type*
schedule_pop_task(schedule_type* schedule)
{
task_type* pop = NULL;
time_t now = 0;
if (!schedule || !schedule->tasks) {
return NULL;
}
now = time_now();
pop = schedule_get_first_task(schedule);
if (pop && (pop->flush || pop->when <= now)) {
if (pop->flush) {
ods_log_debug("[%s] flush task for zone %s", schedule_str,
task_who2str(pop));
} else {
ods_log_debug("[%s] pop task for zone %s", schedule_str,
task_who2str(pop));
}
return unschedule_task(schedule, pop);
}
return NULL;
}
/**
* Print schedule.
*
*/
void
schedule_print(FILE* out, schedule_type* schedule)
{
ldns_rbnode_t* node = LDNS_RBTREE_NULL;
task_type* task = NULL;
if (!out || !schedule || !schedule->tasks) {
return;
}
node = ldns_rbtree_first(schedule->tasks);
while (node && node != LDNS_RBTREE_NULL) {
task = (task_type*) node->data;
task_print(out, task);
node = ldns_rbtree_next(node);
}
fprintf(out, "\n");
return;
}
/**
* Internal task cleanup function.
*
*/
static void
task_delfunc(ldns_rbnode_t* elem)
{
task_type* task;
if (elem && elem != LDNS_RBTREE_NULL) {
task = (task_type*) elem->data;
task_delfunc(elem->left);
task_delfunc(elem->right);
task_cleanup(task);
free((void*)elem);
}
return;
}
/**
* Clean up schedule.
*
*/
void
schedule_cleanup(schedule_type* schedule)
{
allocator_type* allocator;
lock_basic_type schedule_lock;
if (!schedule) {
return;
}
ods_log_debug("[%s] cleanup schedule", schedule_str);
if (schedule->tasks) {
task_delfunc(schedule->tasks->root);
ldns_rbtree_free(schedule->tasks);
schedule->tasks = NULL;
}
allocator = schedule->allocator;
schedule_lock = schedule->schedule_lock;
allocator_deallocate(allocator, (void*) schedule);
lock_basic_destroy(&schedule_lock);
return;
}
opendnssec-1.4.3/signer/src/scheduler/fifoq.h 0000664 0001750 0001750 00000005557 12127027127 016131 0000000 0000000 /*
* $Id$
*
* Copyright (c) 2011 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* FIFO Queue.
*
*/
#ifndef SCHEDULER_FIFOQ_H
#define SCHEDULER_FIFOQ_H
#include "config.h"
#include "daemon/worker.h"
#include "shared/allocator.h"
#include "shared/locks.h"
#include "shared/status.h"
#include
#include
#ifdef HAVE_SYS_TYPES_H
# include
#endif
#ifdef HAVE_UNISTD_H
# include
#endif
#include
#define FIFOQ_MAX_COUNT 1000
#define FIFOQ_TRIES_COUNT 10
/**
* FIFO Queue.
*/
typedef struct fifoq_struct fifoq_type;
struct fifoq_struct {
allocator_type* allocator;
void* blob[FIFOQ_MAX_COUNT];
worker_type* owner[FIFOQ_MAX_COUNT];
size_t count;
lock_basic_type q_lock;
cond_basic_type q_threshold;
cond_basic_type q_nonfull;
};
/**
* Create new FIFO queue.
* \param[in] allocator memory allocator
* \return fifoq_type* created queue
*
*/
fifoq_type* fifoq_create(allocator_type* allocator);
/**
* Wipe queue.
* \param[in] q queue to be wiped
*
*/
void fifoq_wipe(fifoq_type* q);
/**
* Pop item from queue.
* \param[in] q queue
* \param[out] worker worker that owns the item
* \return void* popped item
*
*/
void* fifoq_pop(fifoq_type* q, worker_type** worker);
/**
* Push item to queue.
* \param[in] q queue
* \param[in] item item
* \param[in] worker owner of item
* \param[out] tries number of tries
* \return ods_status status
*
*/
ods_status fifoq_push(fifoq_type* q, void* item, worker_type* worker,
int* tries);
/**
* Clean up queue.
* \param[in] q queue to be cleaned up
*
*/
void fifoq_cleanup(fifoq_type* q);
#endif /* SCHEDULER_FIFOQ_H */
opendnssec-1.4.3/signer/src/scheduler/schedule.h 0000664 0001750 0001750 00000007536 11541662172 016624 0000000 0000000 /*
* $Id$
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Task scheduling.
*
*/
#ifndef SCHEDULER_SCHEDULE_H
#define SCHEDULER_SCHEDULE_H
#include "config.h"
#include "scheduler/task.h"
#include "shared/allocator.h"
#include "shared/locks.h"
#include "shared/status.h"
#include
#include
#ifdef HAVE_SYS_TYPES_H
# include
#endif
#ifdef HAVE_UNISTD_H
# include
#endif
#include
/**
* Task schedule.
*/
typedef struct schedule_struct schedule_type;
struct schedule_struct {
allocator_type* allocator;
ldns_rbtree_t* tasks;
int flushcount;
int loading; /* to determine backoff */
lock_basic_type schedule_lock;
};
/**
* Create new schedule.
* \param[in] allocator memory allocator
* \return schedule_type* created schedule
*
*/
schedule_type* schedule_create(allocator_type* allocator);
/**
* Flush schedule.
* \param[in] schedule schedule to be flushed
* \param[in] override override task
*
*/
void schedule_flush(schedule_type* schedule, task_id override);
/**
* Look up task.
* \param[in] schedule schedule
* \param[in] task task
* \return task_type* task, if found
*
*/
task_type* schedule_lookup_task(schedule_type* schedule, task_type* task);
/**
* Schedule task.
* \param[in] schedule schedule
* \param[in] task task
* \param[in] log add entry in log for this
* \return ods_status status
*
*/
ods_status schedule_task(schedule_type* schedule, task_type* task, int log);
/**
* Unschedule task.
* \param[in] schedule schedule
* \param[in] task task to delete
* \return task_type* task, if it was scheduled
*
*/
task_type* unschedule_task(schedule_type* schedule, task_type* task);
/**
* Reschedule task.
* \param[in] schedule schedule
* \param[in] task task to delete
* \param[in] what new task
* \param[in] when new time
* \return ods_status status
*
*/
ods_status reschedule_task(schedule_type* schedule, task_type* task,
task_id what, time_t when);
/**
* Pop the first scheduled task.
* \param[in] schedule schedule
* \return task_type* popped task
*
*/
task_type* schedule_pop_task(schedule_type* schedule);
/**
* Get the first scheduled task.
* \param[in] schedule schedule
* \return task_type* first scheduled task
*
*/
task_type* schedule_get_first_task(schedule_type* schedule);
/**
* Print schedule.
* \param[in] out file descriptor
* \param[in] schedule schedule
*
*/
void schedule_print(FILE* out, schedule_type* schedule);
/**
* Clean up schedule.
* \param[in] schedule schedule to be cleaned up
*
*/
void schedule_cleanup(schedule_type* schedule);
#endif /* SCHEDULER_SCHEDULE_H */
opendnssec-1.4.3/signer/src/scheduler/task.h 0000664 0001750 0001750 00000006445 11720723101 015755 0000000 0000000 /*
* $Id: task.h 6181 2012-02-21 14:12:17Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Tasks.
*
*/
#ifndef SCHEDULER_TASK_H
#define SCHEDULER_TASK_H
#include "config.h"
#include "shared/allocator.h"
#include
enum task_id_enum {
TASK_NONE = 0,
TASK_SIGNCONF, /* ods-signer update */
TASK_READ, /* ods-signer sign */
TASK_NSECIFY,
TASK_SIGN, /* ods-signer flush */
TASK_WRITE
};
typedef enum task_id_enum task_id;
/**
* Task.
*/
typedef struct task_struct task_type;
struct task_struct {
allocator_type* allocator;
task_id what;
task_id interrupt;
task_id halted;
time_t when;
time_t halted_when;
time_t backoff;
int flush;
void* zone;
};
/**
* Create a new task.
* \param[in] what task identifier
* \param[in] when scheduled time
* \param[in] zone zone reference
* \return task_type* created task
*
*/
task_type* task_create(task_id what, time_t when, void* zone);
/**
* Backup task.
* \param[in] fd file descriptor
* \param[in] task task
*
*/
void task_backup(FILE* fd, task_type* task);
/**
* Compare tasks.
* \param[in] a one task
* \param[in] b another task
* \return int -1, 0 or 1
*
*/
int task_compare(const void* a, const void* b);
/**
* Convert task to string.
* \param[in] task task
* \param[out] buffer to store string-based task in
* \return string-format task
*
*/
char* task2str(task_type* task, char* buftask);
/**
* String-format of who.
* \param[in] what task identifier
* \return const char* string-format of what
*
*/
const char* task_what2str(task_id what);
/**
* String-format of who.
* \param[in] task task
* \return const char* string-format of who
*/
const char* task_who2str(task_type* task);
/**
* Print task.
* \param[in] out file descriptor
* \param[in] task task
*
*/
void task_print(FILE* out, task_type* task);
/**
* Log task.
* \param[in] task task
*
*/
void task_log(task_type* task);
/**
* Clean up task.
* \param[in] task task
*
*/
void task_cleanup(task_type* task);
#endif /* SCHEDULER_TASK_H */
opendnssec-1.4.3/signer/src/scheduler/fifoq.c 0000664 0001750 0001750 00000010615 12062067777 016130 0000000 0000000 /*
* $Id$
*
* Copyright (c) 2011 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* FIFO Queue.
*
*/
#include "config.h"
#include "scheduler/fifoq.h"
#include "shared/log.h"
#include
static const char* fifoq_str = "fifo";
/**
* Create new FIFO queue.
*
*/
fifoq_type*
fifoq_create(allocator_type* allocator)
{
fifoq_type* fifoq;
if (!allocator) {
return NULL;
}
fifoq = (fifoq_type*) allocator_alloc(allocator, sizeof(fifoq_type));
if (!fifoq) {
ods_log_error("[%s] unable to create fifoq: allocator_alloc() failed",
fifoq_str);
return NULL;
}
fifoq->allocator = allocator;
fifoq_wipe(fifoq);
lock_basic_init(&fifoq->q_lock);
lock_basic_set(&fifoq->q_threshold);
lock_basic_set(&fifoq->q_nonfull);
return fifoq;
}
/**
* Wipe queue.
*
*/
void
fifoq_wipe(fifoq_type* q)
{
size_t i = 0;
for (i=0; i < FIFOQ_MAX_COUNT; i++) {
q->blob[i] = NULL;
q->owner[i] = NULL;
}
q->count = 0;
return;
}
/**
* Pop item from queue.
*
*/
void*
fifoq_pop(fifoq_type* q, worker_type** worker)
{
void* pop = NULL;
size_t i = 0;
if (!q || q->count <= 0) {
return NULL;
}
pop = q->blob[0];
*worker = q->owner[0];
for (i = 0; i < q->count-1; i++) {
q->blob[i] = q->blob[i+1];
q->owner[i] = q->owner[i+1];
}
q->count -= 1;
if (q->count <= (size_t) FIFOQ_MAX_COUNT * 0.1) {
/**
* Notify waiting workers that they can start queuing again
* If no workers are waiting, this call has no effect.
*/
lock_basic_broadcast(&q->q_nonfull);
}
return pop;
}
/**
* Push item to queue.
*
*/
ods_status
fifoq_push(fifoq_type* q, void* item, worker_type* worker, int* tries)
{
if (!q || !item || !worker) {
return ODS_STATUS_ASSERT_ERR;
}
if (q->count >= FIFOQ_MAX_COUNT) {
/**
* #262:
* If drudgers remain on hold, do additional broadcast.
* If no drudgers are waiting, this call has no effect.
*/
if (*tries > FIFOQ_TRIES_COUNT) {
lock_basic_broadcast(&q->q_threshold);
ods_log_debug("[%s] queue full, notify drudgers again", fifoq_str);
/* reset tries */
*tries = 0;
}
return ODS_STATUS_UNCHANGED;
}
q->blob[q->count] = item;
q->owner[q->count] = worker;
q->count += 1;
if (q->count == 1) {
ods_log_deeebug("[%s] threshold %u reached, notify drudgers",
fifoq_str, q->count);
/* If no drudgers are waiting, this call has no effect. */
lock_basic_broadcast(&q->q_threshold);
}
return ODS_STATUS_OK;
}
/**
* Clean up queue.
*
*/
void
fifoq_cleanup(fifoq_type* q)
{
allocator_type* allocator;
lock_basic_type q_lock;
cond_basic_type q_threshold;
cond_basic_type q_nonfull;
if (!q) {
return;
}
allocator = q->allocator;
q_lock = q->q_lock;
q_threshold = q->q_threshold;
q_nonfull = q->q_nonfull;
allocator_deallocate(allocator, (void*) q);
lock_basic_off(&q_threshold);
lock_basic_off(&q_nonfull);
lock_basic_destroy(&q_lock);
return;
}
opendnssec-1.4.3/signer/src/scheduler/task.c 0000664 0001750 0001750 00000015320 12107367651 015756 0000000 0000000 /*
* $Id: task.c 7040 2013-02-15 08:19:53Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Tasks.
*
*/
#include "config.h"
#include "scheduler/task.h"
#include "shared/allocator.h"
#include "shared/duration.h"
#include "shared/file.h"
#include "shared/log.h"
#include "signer/zone.h"
static const char* task_str = "task";
/**
* Create a new task.
*
*/
task_type*
task_create(task_id what, time_t when, void* zone)
{
allocator_type* allocator = NULL;
task_type* task = NULL;
if (!zone) {
return NULL;
}
allocator = allocator_create(malloc, free);
if (!allocator) {
ods_log_error("[%s] unable to create task: allocator_create() failed",
task_str);
return NULL;
}
task = (task_type*) allocator_alloc(allocator, sizeof(task_type));
if (!task) {
ods_log_error("[%s] unable to create task: allocator_alloc() failed",
task_str);
allocator_cleanup(allocator);
return NULL;
}
task->allocator = allocator;
task->what = what;
task->interrupt = TASK_NONE;
task->halted = TASK_NONE;
task->when = when;
task->halted_when = 0;
task->backoff = 0;
task->flush = 0;
task->zone = zone;
return task;
}
/**
* Backup task.
*
*/
void
task_backup(FILE* fd, task_type* task)
{
if (!fd || !task) {
return;
}
ods_log_assert(fd);
ods_log_assert(task);
fprintf(fd, ";;Task: when %u what %i interrupt %i halted %i backoff %i "
"flush %i\n",
(unsigned) task->when,
(int) task->what,
(int) task->interrupt,
(int) task->halted,
(unsigned) task->backoff,
task->flush);
return;
}
/**
* Compare tasks.
*
*/
int
task_compare(const void* a, const void* b)
{
task_type* x = (task_type*)a;
task_type* y = (task_type*)b;
zone_type* zx = NULL;
zone_type* zy = NULL;
ods_log_assert(x);
ods_log_assert(y);
zx = (zone_type*) x->zone;
zy = (zone_type*) y->zone;
if (!ldns_dname_compare((const void*) zx->apex,
(const void*) zy->apex)) {
/* if dname is the same, consider the same task */
return 0;
}
/* order task on time, what to do, dname */
if (x->when != y->when) {
return (int) x->when - y->when;
}
if (x->what != y->what) {
return (int) x->what - y->what;
}
/* this is unfair, it prioritizes zones that are first in canonical line */
return ldns_dname_compare((const void*) zx->apex,
(const void*) zy->apex);
}
/**
* String-format of what.
*
*/
const char*
task_what2str(task_id what)
{
switch (what) {
case TASK_NONE:
return "[ignore]";
break;
case TASK_SIGNCONF:
return "[configure]";
break;
case TASK_READ:
return "[read]";
break;
case TASK_SIGN:
return "[sign]";
break;
case TASK_WRITE:
return "[write]";
break;
default:
break;
}
return "[???]";
}
/**
* String-format of who.
*
*/
const char*
task_who2str(task_type* task)
{
zone_type* zone = NULL;
if (task) {
zone = (zone_type*) task->zone;
}
if (zone && zone->name) {
return zone->name;
}
return "(null)";
}
/**
* Convert task to string.
*
*/
char*
task2str(task_type* task, char* buftask)
{
char* strtime = NULL;
char* strtask = NULL;
if (task) {
strtime = ctime(&task->when);
if (strtime) {
strtime[strlen(strtime)-1] = '\0';
}
if (buftask) {
(void)snprintf(buftask, ODS_SE_MAXLINE, "%s %s I will %s zone %s"
"\n", task->flush?"Flush":"On", strtime?strtime:"(null)",
task_what2str(task->what), task_who2str(task));
return buftask;
} else {
strtask = (char*) calloc(ODS_SE_MAXLINE, sizeof(char));
if (strtask) {
snprintf(strtask, ODS_SE_MAXLINE, "%s %s I will %s zone %s\n",
task->flush?"Flush":"On", strtime?strtime:"(null)",
task_what2str(task->what), task_who2str(task));
return strtask;
} else {
ods_log_error("[%s] unable to convert task to string: malloc "
"error", task_str);
}
}
}
return NULL;
}
/**
* Print task.
*
*/
void
task_print(FILE* out, task_type* task)
{
char* strtime = NULL;
if (out && task) {
strtime = ctime(&task->when);
if (strtime) {
strtime[strlen(strtime)-1] = '\0';
}
fprintf(out, "%s %s I will %s zone %s\n",
task->flush?"Flush":"On", strtime?strtime:"(null)",
task_what2str(task->what), task_who2str(task));
}
return;
}
/**
* Log task.
*
*/
void
task_log(task_type* task)
{
char* strtime = NULL;
if (task) {
strtime = ctime(&task->when);
if (strtime) {
strtime[strlen(strtime)-1] = '\0';
}
ods_log_debug("[%s] %s %s I will %s zone %s", task_str,
task->flush?"Flush":"On", strtime?strtime:"(null)",
task_what2str(task->what), task_who2str(task));
}
return;
}
/**
* Clean up task.
*
*/
void
task_cleanup(task_type* task)
{
allocator_type* allocator;
if (!task) {
return;
}
allocator = task->allocator;
allocator_deallocate(allocator, (void*) task);
allocator_cleanup(allocator);
return;
}
opendnssec-1.4.3/signer/src/parser/ 0000775 0001750 0001750 00000000000 12247571206 014243 5 0000000 0000000 opendnssec-1.4.3/signer/src/parser/confparser.h 0000664 0001750 0001750 00000007456 12117625023 016503 0000000 0000000 /*
* $Id: confparser.h 7065 2013-03-12 13:13:55Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Parsing configuration files.
*
*/
#ifndef PARSER_CONFPARSER_H
#define PARSER_CONFPARSER_H
#include "config.h"
#include "wire/listener.h"
#include "shared/allocator.h"
#include "shared/status.h"
#define ADMAX 6 /* Maximum number of adapters that can be initialized */
/**
* Check config file with rng file.
* \param[in] cfgfile the configuration file name
* \param[in] rngfile the rng file name
* \return ods_status status
*
*/
ods_status parse_file_check(const char* cfgfile, const char* rngfile);
/**
* Parse elements from the configuration file.
* \param[in] cfgfile configuration file
* \param[in] expr xml expression
* \param[in] required if the element is required
* \return const char* string value
*
*/
const char* parse_conf_string(const char* cfgfile, const char* expr,
int required);
/**
* Parse the listener interfaces.
* \param[in] allocator the allocator
* \param[in] cfgfile the configuration file name
* \return listener_type* listener interfaces
*
*/
listener_type* parse_conf_listener(allocator_type* allocator,
const char* cfgfile);
/**
* Parse elements from the configuration file.
* \param[in] allocator the allocator
* \param[in] cfgfile the configuration file name
* \return const char* string
*
*/
/** Common */
const char* parse_conf_zonelist_filename(allocator_type* allocator,
const char* cfgfile);
const char* parse_conf_log_filename(allocator_type* allocator,
const char* cfgfile);
/** Signer specific */
const char* parse_conf_pid_filename(allocator_type* allocator,
const char* cfgfile);
const char* parse_conf_notify_command(allocator_type* allocator,
const char* cfgfile);
const char* parse_conf_clisock_filename(allocator_type* allocator,
const char* cfgfile);
const char* parse_conf_working_dir(allocator_type* allocator,
const char* cfgfile);
const char* parse_conf_username(allocator_type* allocator,
const char* cfgfile);
const char* parse_conf_group(allocator_type* allocator,
const char* cfgfile);
const char* parse_conf_chroot(allocator_type* allocator,
const char* cfgfile);
/**
* Parse elements from the configuration file.
* \param[in] cfgfile the configuration file name
* \return int integer
*
*/
/** Common */
int parse_conf_use_syslog(const char* cfgfile);
int parse_conf_verbosity(const char* cfgfile);
/** Signer specific */
int parse_conf_worker_threads(const char* cfgfile);
int parse_conf_signer_threads(const char* cfgfile);
#endif /* PARSE_CONFPARSER_H */
opendnssec-1.4.3/signer/src/parser/addnsparser.h 0000664 0001750 0001750 00000005543 11665407046 016654 0000000 0000000 /*
* $Id: addnsparser.h 4661 2011-03-25 10:30:29Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Parsing DNS Adapter.
*
*/
#ifndef PARSER_ADDNSPARSER_H
#define PARSER_ADDNSPARSER_H
#include "wire/acl.h"
#include "wire/tsig.h"
#include
#include
/**
* Parse .
* \param[in] allocator memory allocator
* \param[in] filename filename
* \param[in] tsig list of TSIGs
* \return acl_type* ACL
*
*/
acl_type* parse_addns_request_xfr(allocator_type* allocator,
const char* filename, tsig_type* tsig);
/**
* Parse .
* \param[in] allocator memory allocator
* \param[in] filename filename
* \param[in] tsig list of TSIGs
* \return acl_type* ACL
*
*/
acl_type* parse_addns_allow_notify(allocator_type* allocator,
const char* filename, tsig_type* tsig);
/**
* Parse .
* \param[in] allocator memory allocator
* \param[in] filename filename
* \param[in] tsig list of TSIGs
* \return acl_type* ACL
*
*/
acl_type* parse_addns_provide_xfr(allocator_type* allocator,
const char* filename, tsig_type* tsig);
/**
* Parse .
* \param[in] allocator memory allocator
* \param[in] filename filename
* \param[in] tsig list of TSIGs
* \return acl_type* ACL
*
*/
acl_type* parse_addns_do_notify(allocator_type* allocator,
const char* filename, tsig_type* tsig);
/**
* Parse .
* \param[in] allocator memory allocator
* \param[in] filename filename
* \return tsig_type* TSIG
*
*/
tsig_type* parse_addns_tsig(allocator_type* allocator, const char* filename);
#endif /* PARSER_ADDNSPARSER_H */
opendnssec-1.4.3/signer/src/parser/confparser.c 0000664 0001750 0001750 00000034262 12117625023 016471 0000000 0000000 /*
* $Id: confparser.c 7065 2013-03-12 13:13:55Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Parsing configuration files.
*
*/
#include "parser/confparser.h"
#include "parser/zonelistparser.h"
#include "shared/allocator.h"
#include "shared/log.h"
#include "shared/status.h"
#include "wire/acl.h"
#include
#include
#include
#include
#include
static const char* parser_str = "parser";
/**
* Parse elements from the configuration file.
*
*/
ods_status
parse_file_check(const char* cfgfile, const char* rngfile)
{
xmlDocPtr doc = NULL;
xmlDocPtr rngdoc = NULL;
xmlRelaxNGParserCtxtPtr rngpctx = NULL;
xmlRelaxNGValidCtxtPtr rngctx = NULL;
xmlRelaxNGPtr schema = NULL;
int status = 0;
if (!cfgfile || !rngfile) {
return ODS_STATUS_ASSERT_ERR;
}
ods_log_debug("[%s] check cfgfile %s with rngfile %s", parser_str,
cfgfile, rngfile);
/* Load XML document */
doc = xmlParseFile(cfgfile);
if (doc == NULL) {
ods_log_error("[%s] unable to parse file: failed to load cfgfile %s",
parser_str, cfgfile);
return ODS_STATUS_XML_ERR;
}
/* Load rng document */
rngdoc = xmlParseFile(rngfile);
if (rngdoc == NULL) {
ods_log_error("[%s] unable to parse file: failed to load rngfile %s",
parser_str, rngfile);
xmlFreeDoc(doc);
return ODS_STATUS_XML_ERR;
}
/* Create an XML RelaxNGs parser context for the relax-ng document. */
rngpctx = xmlRelaxNGNewDocParserCtxt(rngdoc);
if (rngpctx == NULL) {
ods_log_error("[%s] unable to parse file: "
"xmlRelaxNGNewDocParserCtxt() failed", parser_str);
xmlFreeDoc(rngdoc);
xmlFreeDoc(doc);
return ODS_STATUS_XML_ERR;
}
/* Parse a schema definition resource and
* build an internal XML schema structure.
*/
schema = xmlRelaxNGParse(rngpctx);
if (schema == NULL) {
ods_log_error("[%s] unable to parse file: xmlRelaxNGParse() failed",
parser_str);
xmlRelaxNGFreeParserCtxt(rngpctx);
xmlFreeDoc(rngdoc);
xmlFreeDoc(doc);
return ODS_STATUS_PARSE_ERR;
}
/* Create an XML RelaxNGs validation context. */
rngctx = xmlRelaxNGNewValidCtxt(schema);
if (rngctx == NULL) {
ods_log_error("[%s] unable to parse file: xmlRelaxNGNewValidCtxt() "
"failed", parser_str);
xmlRelaxNGFree(schema);
xmlRelaxNGFreeParserCtxt(rngpctx);
xmlFreeDoc(rngdoc);
xmlFreeDoc(doc);
return ODS_STATUS_RNG_ERR;
}
/* Validate a document tree in memory. */
status = xmlRelaxNGValidateDoc(rngctx,doc);
if (status != 0) {
ods_log_error("[%s] unable to parse file: xmlRelaxNGValidateDoc() "
"failed", parser_str);
xmlRelaxNGFreeValidCtxt(rngctx);
xmlRelaxNGFree(schema);
xmlRelaxNGFreeParserCtxt(rngpctx);
xmlFreeDoc(rngdoc);
xmlFreeDoc(doc);
return ODS_STATUS_RNG_ERR;
}
xmlRelaxNGFreeValidCtxt(rngctx);
xmlRelaxNGFree(schema);
xmlRelaxNGFreeParserCtxt(rngpctx);
xmlFreeDoc(rngdoc);
xmlFreeDoc(doc);
return ODS_STATUS_OK;
}
/* TODO: look how the enforcer reads this now */
/**
* Parse the listener interfaces.
*
*/
listener_type*
parse_conf_listener(allocator_type* allocator, const char* cfgfile)
{
listener_type* listener = NULL;
interface_type* interface = NULL;
int i = 0;
char* address = NULL;
char* port = NULL;
xmlDocPtr doc = NULL;
xmlXPathContextPtr xpathCtx = NULL;
xmlXPathObjectPtr xpathObj = NULL;
xmlNode* curNode = NULL;
xmlChar* xexpr = NULL;
ods_log_assert(allocator);
ods_log_assert(cfgfile);
/* Load XML document */
doc = xmlParseFile(cfgfile);
if (doc == NULL) {
ods_log_error("[%s] could not parse : "
"xmlParseFile() failed", parser_str);
return NULL;
}
/* Create xpath evaluation context */
xpathCtx = xmlXPathNewContext(doc);
if(xpathCtx == NULL) {
xmlFreeDoc(doc);
ods_log_error("[%s] could not parse : "
"xmlXPathNewContext() failed", parser_str);
return NULL;
}
/* Evaluate xpath expression */
xexpr = (xmlChar*) "//Configuration/Signer/Listener/Interface";
xpathObj = xmlXPathEvalExpression(xexpr, xpathCtx);
if(xpathObj == NULL) {
xmlXPathFreeContext(xpathCtx);
xmlFreeDoc(doc);
ods_log_error("[%s] could not parse : "
"xmlXPathEvalExpression failed", parser_str);
return NULL;
}
/* Parse interfaces */
listener = listener_create(allocator);
ods_log_assert(listener);
if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) {
for (i = 0; i < xpathObj->nodesetval->nodeNr; i++) {
address = NULL;
port = NULL;
curNode = xpathObj->nodesetval->nodeTab[i]->xmlChildrenNode;
while (curNode) {
if (xmlStrEqual(curNode->name, (const xmlChar *)"Address")) {
address = (char *) xmlNodeGetContent(curNode);
} else if (xmlStrEqual(curNode->name, (const xmlChar *)"Port")) {
port = (char *) xmlNodeGetContent(curNode);
}
curNode = curNode->next;
}
if (address) {
interface = listener_push(listener, address,
acl_parse_family(address), port);
} else {
interface = listener_push(listener, "", AF_INET, port);
if (interface) {
interface = listener_push(listener, "", AF_INET6, port);
}
}
if (!interface) {
ods_log_error("[%s] unable to add %s:%s interface: "
"listener_push() failed", parser_str, address?address:"",
port?port:"");
} else {
ods_log_debug("[%s] added %s:%s interface to listener",
parser_str, address?address:"", port?port:"");
}
free((void*)port);
free((void*)address);
}
}
xmlXPathFreeObject(xpathObj);
xmlXPathFreeContext(xpathCtx);
if (doc) {
xmlFreeDoc(doc);
}
return listener;
}
/**
* Parse elements from the configuration file.
*
*/
const char*
parse_conf_string(const char* cfgfile, const char* expr, int required)
{
xmlDocPtr doc = NULL;
xmlXPathContextPtr xpathCtx = NULL;
xmlXPathObjectPtr xpathObj = NULL;
xmlChar *xexpr = NULL;
const char* string = NULL;
ods_log_assert(expr);
ods_log_assert(cfgfile);
/* Load XML document */
doc = xmlParseFile(cfgfile);
if (doc == NULL) {
ods_log_error("[%s] unable to parse file %s: xmlParseFile() failed",
parser_str, cfgfile);
return NULL;
}
/* Create xpath evaluation context */
xpathCtx = xmlXPathNewContext(doc);
if (xpathCtx == NULL) {
ods_log_error("[%s] unable to parse file %s: xmlXPathNewContext() "
"failed", parser_str, cfgfile);
xmlFreeDoc(doc);
return NULL;
}
/* Get string */
xexpr = (unsigned char*) expr;
xpathObj = xmlXPathEvalExpression(xexpr, xpathCtx);
if (xpathObj == NULL || xpathObj->nodesetval == NULL ||
xpathObj->nodesetval->nodeNr <= 0) {
if (required) {
ods_log_error("[%s] unable to evaluate expression %s in cfgile %s",
parser_str, (char*) xexpr, cfgfile);
}
xmlXPathFreeContext(xpathCtx);
if (xpathObj) {
xmlXPathFreeObject(xpathObj);
}
xmlFreeDoc(doc);
return NULL;
}
if (xpathObj->nodesetval != NULL &&
xpathObj->nodesetval->nodeNr > 0) {
string = (const char*) xmlXPathCastToString(xpathObj);
xmlXPathFreeContext(xpathCtx);
xmlXPathFreeObject(xpathObj);
xmlFreeDoc(doc);
return string;
}
xmlXPathFreeContext(xpathCtx);
xmlXPathFreeObject(xpathObj);
xmlFreeDoc(doc);
return NULL;
}
const char*
parse_conf_zonelist_filename(allocator_type* allocator, const char* cfgfile)
{
const char* dup = NULL;
const char* str = parse_conf_string(
cfgfile,
"//Configuration/Common/ZoneListFile",
1);
if (str) {
dup = allocator_strdup(allocator, str);
free((void*)str);
}
return dup;
}
const char*
parse_conf_log_filename(allocator_type* allocator, const char* cfgfile)
{
const char* dup = NULL;
const char* str = parse_conf_string(cfgfile,
"//Configuration/Common/Logging/Syslog/Facility",
0);
if (!str) {
str = parse_conf_string(cfgfile,
"//Configuration/Common/Logging/File/Filename",
0);
}
if (str) {
dup = allocator_strdup(allocator, str);
free((void*)str);
}
return dup; /* NULL, Facility or Filename */
}
const char*
parse_conf_pid_filename(allocator_type* allocator, const char* cfgfile)
{
const char* dup = NULL;
const char* str = parse_conf_string(
cfgfile,
"//Configuration/Signer/PidFile",
0);
if (str) {
dup = allocator_strdup(allocator, str);
free((void*)str);
} else {
dup = allocator_strdup(allocator, ODS_SE_PIDFILE);
}
return dup;
}
const char*
parse_conf_notify_command(allocator_type* allocator, const char* cfgfile)
{
const char* dup = NULL;
const char* str = parse_conf_string(
cfgfile,
"//Configuration/Signer/NotifyCommand",
0);
if (str) {
dup = allocator_strdup(allocator, str);
free((void*)str);
}
return dup;
}
const char*
parse_conf_clisock_filename(allocator_type* allocator, const char* cfgfile)
{
const char* dup = NULL;
const char* str = parse_conf_string(
cfgfile,
"//Configuration/Signer/SocketFile",
0);
if (str) {
dup = allocator_strdup(allocator, str);
free((void*)str);
} else {
dup = allocator_strdup(allocator, ODS_SE_SOCKFILE);
}
return dup;
}
const char*
parse_conf_working_dir(allocator_type* allocator, const char* cfgfile)
{
const char* dup = NULL;
const char* str = parse_conf_string(
cfgfile,
"//Configuration/Signer/WorkingDirectory",
0);
if (str) {
dup = allocator_strdup(allocator, str);
free((void*)str);
} else {
dup = allocator_strdup(allocator, ODS_SE_WORKDIR);
}
ods_log_assert(dup);
return dup;
}
const char*
parse_conf_username(allocator_type* allocator, const char* cfgfile)
{
const char* dup = NULL;
const char* str = parse_conf_string(
cfgfile,
"//Configuration/Signer/Privileges/User",
0);
if (str) {
dup = allocator_strdup(allocator, str);
free((void*)str);
}
return dup;
}
const char*
parse_conf_group(allocator_type* allocator, const char* cfgfile)
{
const char* dup = NULL;
const char* str = parse_conf_string(
cfgfile,
"//Configuration/Signer/Privileges/Group",
0);
if (str) {
dup = allocator_strdup(allocator, str);
free((void*)str);
}
return dup;
}
const char*
parse_conf_chroot(allocator_type* allocator, const char* cfgfile)
{
const char* dup = NULL;
const char* str = parse_conf_string(
cfgfile,
"//Configuration/Signer/Privileges/Directory",
0);
if (str) {
dup = allocator_strdup(allocator, str);
free((void*)str);
}
return dup;
}
/**
* Parse elements from the configuration file.
*
*/
int
parse_conf_use_syslog(const char* cfgfile)
{
const char* str = parse_conf_string(cfgfile,
"//Configuration/Common/Logging/Syslog/Facility",
0);
if (str) {
free((void*)str);
return 1;
}
return 0;
}
int
parse_conf_verbosity(const char* cfgfile)
{
int verbosity = ODS_SE_VERBOSITY;
const char* str = parse_conf_string(cfgfile,
"//Configuration/Common/Logging/Verbosity",
0);
if (str) {
if (strlen(str) > 0) {
verbosity = atoi(str);
}
free((void*)str);
}
return verbosity;
}
int
parse_conf_worker_threads(const char* cfgfile)
{
int numwt = ODS_SE_WORKERTHREADS;
const char* str = parse_conf_string(cfgfile,
"//Configuration/Signer/WorkerThreads",
0);
if (str) {
if (strlen(str) > 0) {
numwt = atoi(str);
}
free((void*)str);
}
return numwt;
}
int
parse_conf_signer_threads(const char* cfgfile)
{
int numwt = ODS_SE_WORKERTHREADS;
const char* str = parse_conf_string(cfgfile,
"//Configuration/Signer/SignerThreads",
0);
if (str) {
if (strlen(str) > 0) {
numwt = atoi(str);
}
free((void*)str);
return numwt;
}
/* no SignerThreads value configured, look at WorkerThreads */
return parse_conf_worker_threads(cfgfile);
}
opendnssec-1.4.3/signer/src/parser/signconfparser.h 0000664 0001750 0001750 00000007103 12242400745 017352 0000000 0000000 /*
* $Id: signconfparser.h 7409 2013-11-18 12:02:45Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Parsing signer configuration files.
*
*/
#ifndef PARSER_SIGNCONFPARSER_H
#define PARSER_SIGNCONFPARSER_H
#include "parser/confparser.h"
#include "shared/allocator.h"
#include "shared/duration.h"
#include "signer/keys.h"
#include "config.h"
#include
/**
* Parse keys from the signer configuration file.
* \param[in] sc signer configuration reference
* \param[in] cfgfile the configuration file name.
* \return keylist_type* key list
*
*/
keylist_type* parse_sc_keys(void* sc, const char* cfgfile);
/**
* Parse elements from the configuration file.
* \param[in] cfgfile the configuration file name.
* \return duration_type* duration
*
*/
duration_type* parse_sc_sig_resign_interval(const char* cfgfile);
duration_type* parse_sc_sig_refresh_interval(const char* cfgfile);
duration_type* parse_sc_sig_validity_default(const char* cfgfile);
duration_type* parse_sc_sig_validity_denial(const char* cfgfile);
duration_type* parse_sc_sig_jitter(const char* cfgfile);
duration_type* parse_sc_sig_inception_offset(const char* cfgfile);
duration_type* parse_sc_dnskey_ttl(const char* cfgfile);
duration_type* parse_sc_nsec3param_ttl(const char* cfgfile);
duration_type* parse_sc_soa_ttl(const char* cfgfile);
duration_type* parse_sc_soa_min(const char* cfgfile);
/**
* Parse elements from the configuration file.
* \param[in] cfgfile the configuration file name.
* \return ldns_rr_type rr type
*
*/
ldns_rr_type parse_sc_nsec_type(const char* cfgfile);
/**
* Parse elements from the configuration file.
* \param[in] cfgfile the configuration file name.
* \return uint32_t integer
*
*/
uint32_t parse_sc_nsec3_algorithm(const char* cfgfile);
uint32_t parse_sc_nsec3_iterations(const char* cfgfile);
/**
* Parse elements from the configuration file.
* \param[in] cfgfile the configuration file name.
* \return int integer
*
*/
int parse_sc_nsec3_optout(const char* cfgfile);
/**
* Parse elements from the configuration file.
* \param[in] cfgfile the configuration file name.
* \return const char* string
*
*/
const char* parse_sc_soa_serial(allocator_type* allocator,
const char* cfgfile);
const char* parse_sc_nsec3_salt(allocator_type* allocator,
const char* cfgfile);
#endif /* PARSER_SIGNCONFPARSER_H */
opendnssec-1.4.3/signer/src/parser/zonelistparser.c 0000664 0001750 0001750 00000022503 12107375456 017421 0000000 0000000 /*
* $Id: zonelistparser.c 7041 2013-02-15 09:09:02Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Parsing zonelist files.
*
*/
#include "adapter/adapter.h"
#include "parser/zonelistparser.h"
#include "shared/file.h"
#include "shared/log.h"
#include "shared/status.h"
#include "signer/zonelist.h"
#include "signer/zone.h"
#include
#include
#include
#include
static const char* parser_str = "parser";
/**
* Parse expr inside XPath Context.
*
*/
static const char*
parse_zonelist_element(xmlXPathContextPtr xpathCtx, xmlChar* expr)
{
xmlXPathObjectPtr xpathObj = NULL;
const char* str = NULL;
ods_log_assert(xpathCtx);
ods_log_assert(expr);
xpathObj = xmlXPathEvalExpression(expr, xpathCtx);
if (xpathObj == NULL) {
ods_log_error("[%s] unable to evaluate xpath expression %s",
parser_str, expr);
return NULL;
}
str = (const char*) xmlXPathCastToString(xpathObj);
xmlXPathFreeObject(xpathObj);
return str;
}
/**
* Create adapter from configuration.
*
*/
static adapter_type*
zlp_adapter(xmlNode* curNode, adapter_mode type, unsigned inbound)
{
const char* file = NULL;
adapter_type* adapter = NULL;
file = (const char*) xmlNodeGetContent(curNode);
if (!file) {
ods_log_error("[%s] unable to read %s adapter", parser_str,
inbound?"input":"output");
return NULL;
}
adapter = adapter_create(file, type, inbound);
free((void*)file);
return adapter;
}
/**
* Parse adapter.
*
*/
adapter_type*
parse_zonelist_adapter(xmlXPathContextPtr xpathCtx, xmlChar* expr,
int inbound)
{
xmlXPathObjectPtr xpathObj = NULL;
xmlNode* curNode = NULL;
xmlChar* type = NULL;
adapter_type* adapter = NULL;
int i = 0;
if (!xpathCtx || !expr) {
return NULL;
}
xpathObj = xmlXPathEvalExpression(expr, xpathCtx);
if (xpathObj == NULL) {
ods_log_error("[%s] unable to parse adapter: xmlPathEvalExpression() "
"failed (expr %s)", parser_str, expr);
return NULL;
}
if (xpathObj->nodesetval) {
for (i=0; i < xpathObj->nodesetval->nodeNr; i++) {
curNode = xpathObj->nodesetval->nodeTab[i]->xmlChildrenNode;
while (curNode) {
if (xmlStrEqual(curNode->name, (const xmlChar*)"File")) {
adapter = zlp_adapter(curNode, ADAPTER_FILE, inbound);
} else if (xmlStrEqual(curNode->name,
(const xmlChar*)"Adapter")) {
type = xmlGetProp(curNode, (const xmlChar*)"type");
if (xmlStrEqual(type, (const xmlChar*)"File")) {
adapter = zlp_adapter(curNode, ADAPTER_FILE, inbound);
} else if (xmlStrEqual(type, (const xmlChar*)"DNS")) {
adapter = zlp_adapter(curNode, ADAPTER_DNS, inbound);
} else {
ods_log_error("[%s] unable to parse %s adapter: "
"unknown type", parser_str, (const char*) type);
}
free((void*)type);
type = NULL;
}
if (adapter) {
break;
}
curNode = curNode->next;
}
}
}
xmlXPathFreeObject(xpathObj);
return adapter;
}
/**
* Parse the adapters.
*
*/
static void
parse_zonelist_adapters(xmlXPathContextPtr xpathCtx, zone_type* zone)
{
xmlChar* i_expr = (xmlChar*) "//Zone/Adapters/Input";
xmlChar* o_expr = (xmlChar*) "//Zone/Adapters/Output";
if (!xpathCtx || !zone) {
return;
}
zone->adinbound = parse_zonelist_adapter(xpathCtx, i_expr, 1);
zone->adoutbound = parse_zonelist_adapter(xpathCtx, o_expr, 0);
return;
}
/**
* Parse the zonelist file.
*
*/
ods_status
parse_zonelist_zones(void* zlist, const char* zlfile)
{
char* tag_name = NULL;
char* zone_name = NULL;
zone_type* new_zone = NULL;
int ret = 0;
int error = 0;
xmlTextReaderPtr reader = NULL;
xmlDocPtr doc = NULL;
xmlXPathContextPtr xpathCtx = NULL;
xmlChar* name_expr = (unsigned char*) "name";
xmlChar* policy_expr = (unsigned char*) "//Zone/Policy";
xmlChar* signconf_expr = (unsigned char*) "//Zone/SignerConfiguration";
if (!zlist || !zlfile) {
return ODS_STATUS_ASSERT_ERR;
}
reader = xmlNewTextReaderFilename(zlfile);
if (!reader) {
ods_log_error("[%s] unable to parse zonelist: failed to open file %s",
parser_str, zlfile);
return ODS_STATUS_XML_ERR;
}
ret = xmlTextReaderRead(reader);
while (ret == XML_READER_TYPE_ELEMENT) {
tag_name = (char*) xmlTextReaderLocalName(reader);
if (ods_strcmp(tag_name, "Zone") == 0 &&
ods_strcmp(tag_name, "ZoneList") != 0 &&
xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {
/* Found a zone */
zone_name = (char*) xmlTextReaderGetAttribute(reader,
name_expr);
if (!zone_name || strlen(zone_name) <= 0) {
ods_log_alert("[%s] unable to extract zone name from "
"zonelist %s, skipping...", parser_str, zlfile);
if (zone_name) {
free((void*) zone_name);
}
free((void*) tag_name);
ret = xmlTextReaderRead(reader);
continue;
}
/* Expand this node to get the rest of the info */
xmlTextReaderExpand(reader);
doc = xmlTextReaderCurrentDoc(reader);
if (doc) {
xpathCtx = xmlXPathNewContext(doc);
}
if (doc == NULL || xpathCtx == NULL) {
ods_log_alert("[%s] unable to read zone %s, skipping...",
parser_str, zone_name);
ret = xmlTextReaderRead(reader);
free((void*) zone_name);
free((void*) tag_name);
continue;
}
/* That worked, now read out the contents... */
new_zone = zone_create(zone_name, LDNS_RR_CLASS_IN);
if (new_zone) {
new_zone->policy_name = parse_zonelist_element(xpathCtx,
policy_expr);
new_zone->signconf_filename = parse_zonelist_element(xpathCtx,
signconf_expr);
parse_zonelist_adapters(xpathCtx, new_zone);
if (!new_zone->policy_name || !new_zone->signconf_filename ||
!new_zone->adinbound || !new_zone->adoutbound) {
zone_cleanup(new_zone);
new_zone = NULL;
ods_log_crit("[%s] unable to create zone %s", parser_str,
zone_name);
error = 1;
} else if (zonelist_add_zone((zonelist_type*) zlist, new_zone)
== NULL) {
ods_log_crit("[%s] unable to add zone %s", parser_str,
zone_name);
zone_cleanup(new_zone);
new_zone = NULL;
error = 1;
}
} else {
ods_log_crit("[%s] unable to create zone %s", parser_str,
zone_name);
error = 1;
}
xmlXPathFreeContext(xpathCtx);
xpathCtx = NULL;
free((void*) zone_name);
if (error) {
free((void*) tag_name);
tag_name = NULL;
ret = 1;
break;
}
ods_log_debug("[%s] zone %s added", parser_str, new_zone->name);
}
free((void*) tag_name);
ret = xmlTextReaderRead(reader);
}
/* no more zones */
ods_log_debug("[%s] no more zones", parser_str);
xmlFreeTextReader(reader);
if (doc) {
xmlFreeDoc(doc);
}
if (ret != 0) {
ods_log_error("[%s] unable to parse zonelist: parse error in %s",
parser_str, zlfile);
return ODS_STATUS_PARSE_ERR;
}
return ODS_STATUS_OK;
}
opendnssec-1.4.3/signer/src/parser/addnsparser.c 0000664 0001750 0001750 00000027302 12024053237 016631 0000000 0000000 /*
* $Id: addnsparser.h 4661 2011-03-25 10:30:29Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Parsing DNS Adapter.
*
*/
#include "parser/addnsparser.h"
#include "shared/log.h"
#include
#include
#include
#include
static const char* parser_str = "parser";
/**
* Parse the remote servers.
*
*/
static acl_type*
parse_addns_remote(allocator_type* allocator, const char* filename,
tsig_type* tsig, char* expr)
{
acl_type* acl = NULL;
acl_type* new_acl = NULL;
int i = 0;
char* address = NULL;
char* port = NULL;
char* key = NULL;
xmlDocPtr doc = NULL;
xmlXPathContextPtr xpathCtx = NULL;
xmlXPathObjectPtr xpathObj = NULL;
xmlNode* curNode = NULL;
xmlChar* xexpr = NULL;
if (!allocator || !filename || !expr) {
return NULL;
}
/* Load XML document */
doc = xmlParseFile(filename);
if (doc == NULL) {
ods_log_error("[%s] could not parse %s: xmlParseFile() failed",
parser_str, expr);
return NULL;
}
/* Create xpath evaluation context */
xpathCtx = xmlXPathNewContext(doc);
if(xpathCtx == NULL) {
xmlFreeDoc(doc);
ods_log_error("[%s] could not parse %s: xmlXPathNewContext() failed",
parser_str, expr);
return NULL;
}
/* Evaluate xpath expression */
xexpr = (xmlChar*) expr;
xpathObj = xmlXPathEvalExpression(xexpr, xpathCtx);
if(xpathObj == NULL) {
xmlXPathFreeContext(xpathCtx);
xmlFreeDoc(doc);
ods_log_error("[%s] could not parse %s: xmlXPathEvalExpression() "
"failed", parser_str, expr);
return NULL;
}
/* Parse interfaces */
if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) {
for (i = 0; i < xpathObj->nodesetval->nodeNr; i++) {
address = NULL;
port = NULL;
key = NULL;
curNode = xpathObj->nodesetval->nodeTab[i]->xmlChildrenNode;
while (curNode) {
if (xmlStrEqual(curNode->name, (const xmlChar *)"Address")) {
address = (char *) xmlNodeGetContent(curNode);
} else if (xmlStrEqual(curNode->name,
(const xmlChar *)"Port")) {
port = (char *) xmlNodeGetContent(curNode);
} else if (xmlStrEqual(curNode->name,
(const xmlChar *)"Key")) {
key = (char *) xmlNodeGetContent(curNode);
}
curNode = curNode->next;
}
if (address) {
new_acl = acl_create(allocator, address, port, key, tsig);
if (!new_acl) {
ods_log_error("[%s] unable to add server %s:%s %s to list "
"%s: acl_create() failed", parser_str, address,
port?port:"", key?key:"", (char*) expr);
} else {
new_acl->next = acl;
acl = new_acl;
ods_log_debug("[%s] added server %s:%s %s to list %s",
parser_str, address, port?port:"", key?key:"",
(char*) expr);
}
}
free((void*)address);
free((void*)port);
free((void*)key);
}
}
xmlXPathFreeObject(xpathObj);
xmlXPathFreeContext(xpathCtx);
if (doc) {
xmlFreeDoc(doc);
}
return acl;
}
/**
* Parse the ACL interfaces.
*
*/
static acl_type*
parse_addns_acl(allocator_type* allocator, const char* filename,
tsig_type* tsig, char* expr)
{
acl_type* acl = NULL;
acl_type* new_acl = NULL;
int i = 0;
char* prefix = NULL;
char* key = NULL;
xmlDocPtr doc = NULL;
xmlXPathContextPtr xpathCtx = NULL;
xmlXPathObjectPtr xpathObj = NULL;
xmlNode* curNode = NULL;
xmlChar* xexpr = NULL;
if (!allocator || !filename || !expr) {
return NULL;
}
/* Load XML document */
doc = xmlParseFile(filename);
if (doc == NULL) {
ods_log_error("[%s] could not parse %s: xmlParseFile() failed",
parser_str, expr);
return NULL;
}
/* Create xpath evaluation context */
xpathCtx = xmlXPathNewContext(doc);
if(xpathCtx == NULL) {
xmlFreeDoc(doc);
ods_log_error("[%s] could not parse %s: xmlXPathNewContext() failed",
parser_str, expr);
return NULL;
}
/* Evaluate xpath expression */
xexpr = (xmlChar*) expr;
xpathObj = xmlXPathEvalExpression(xexpr, xpathCtx);
if(xpathObj == NULL) {
xmlXPathFreeContext(xpathCtx);
xmlFreeDoc(doc);
ods_log_error("[%s] could not parse %s: xmlXPathEvalExpression() "
"failed", parser_str, expr);
return NULL;
}
/* Parse interfaces */
if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) {
for (i = 0; i < xpathObj->nodesetval->nodeNr; i++) {
prefix = NULL;
key = NULL;
curNode = xpathObj->nodesetval->nodeTab[i]->xmlChildrenNode;
while (curNode) {
if (xmlStrEqual(curNode->name, (const xmlChar *)"Prefix")) {
prefix = (char *) xmlNodeGetContent(curNode);
} else if (xmlStrEqual(curNode->name,
(const xmlChar *)"Key")) {
key = (char *) xmlNodeGetContent(curNode);
}
curNode = curNode->next;
}
if (prefix || key) {
new_acl = acl_create(allocator, prefix, NULL, key, tsig);
if (!new_acl) {
ods_log_error("[%s] unable to add acl for %s %s to list "
"%s: acl_create() failed", parser_str, prefix?prefix:"",
key?key:"", (char*) expr);
} else {
new_acl->next = acl;
acl = new_acl;
ods_log_debug("[%s] added %s %s interface to list %s",
parser_str, prefix?prefix:"", key?key:"", (char*) expr);
}
}
free((void*)prefix);
free((void*)key);
}
}
xmlXPathFreeObject(xpathObj);
xmlXPathFreeContext(xpathCtx);
if (doc) {
xmlFreeDoc(doc);
}
return acl;
}
/**
* Parse the TSIG credentials.
*
*/
static tsig_type*
parse_addns_tsig_static(allocator_type* allocator, const char* filename,
char* expr)
{
tsig_type* tsig = NULL;
tsig_type* new_tsig = NULL;
int i = 0;
char* name = NULL;
char* algo = NULL;
char* secret = NULL;
xmlDocPtr doc = NULL;
xmlXPathContextPtr xpathCtx = NULL;
xmlXPathObjectPtr xpathObj = NULL;
xmlNode* curNode = NULL;
xmlChar* xexpr = NULL;
if (!allocator || !filename || !expr) {
return NULL;
}
/* Load XML document */
doc = xmlParseFile(filename);
if (doc == NULL) {
ods_log_error("[%s] could not parse %s: xmlParseFile() failed",
parser_str, expr);
return NULL;
}
/* Create xpath evaluation context */
xpathCtx = xmlXPathNewContext(doc);
if(xpathCtx == NULL) {
xmlFreeDoc(doc);
ods_log_error("[%s] could not parse %s: xmlXPathNewContext() failed",
parser_str, expr);
return NULL;
}
/* Evaluate xpath expression */
xexpr = (xmlChar*) expr;
xpathObj = xmlXPathEvalExpression(xexpr, xpathCtx);
if(xpathObj == NULL) {
xmlXPathFreeContext(xpathCtx);
xmlFreeDoc(doc);
ods_log_error("[%s] could not parse %s: xmlXPathEvalExpression() "
"failed", parser_str, expr);
return NULL;
}
/* Parse interfaces */
if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) {
for (i = 0; i < xpathObj->nodesetval->nodeNr; i++) {
name = NULL;
algo = NULL;
secret = NULL;
curNode = xpathObj->nodesetval->nodeTab[i]->xmlChildrenNode;
while (curNode) {
if (xmlStrEqual(curNode->name, (const xmlChar *)"Name")) {
name = (char *) xmlNodeGetContent(curNode);
} else if (xmlStrEqual(curNode->name,
(const xmlChar *)"Algorithm")) {
algo = (char *) xmlNodeGetContent(curNode);
} else if (xmlStrEqual(curNode->name,
(const xmlChar *)"Secret")) {
secret = (char *) xmlNodeGetContent(curNode);
}
curNode = curNode->next;
}
if (name && algo && secret) {
new_tsig = tsig_create(allocator, name, algo, secret);
if (!new_tsig) {
ods_log_error("[%s] unable to add tsig %s: "
"tsig_create() failed", parser_str, name);
} else {
new_tsig->next = tsig;
tsig = new_tsig;
ods_log_debug("[%s] added %s tsig to list %s",
parser_str, name, (char*) expr);
}
}
free((void*)name);
free((void*)algo);
free((void*)secret);
}
}
xmlXPathFreeObject(xpathObj);
xmlXPathFreeContext(xpathCtx);
if (doc) {
xmlFreeDoc(doc);
}
return tsig;
}
/**
* Parse .
*
*/
acl_type*
parse_addns_request_xfr(allocator_type* allocator, const char* filename,
tsig_type* tsig)
{
return parse_addns_remote(allocator, filename, tsig,
"//Adapter/DNS/Inbound/RequestTransfer/Remote"
);
}
/**
* Parse .
*
*/
acl_type*
parse_addns_allow_notify(allocator_type* allocator, const char* filename,
tsig_type* tsig)
{
return parse_addns_acl(allocator, filename, tsig,
"//Adapter/DNS/Inbound/AllowNotify/Peer"
);
}
/**
* Parse .
*
*/
acl_type*
parse_addns_provide_xfr(allocator_type* allocator, const char* filename,
tsig_type* tsig)
{
return parse_addns_acl(allocator, filename, tsig,
"//Adapter/DNS/Outbound/ProvideTransfer/Peer"
);
}
/**
* Parse .
*
*/
acl_type*
parse_addns_do_notify(allocator_type* allocator, const char* filename,
tsig_type* tsig)
{
return parse_addns_remote(allocator, filename, tsig,
"//Adapter/DNS/Outbound/Notify/Remote"
);
}
/**
* Parse .
*
*/
tsig_type*
parse_addns_tsig(allocator_type* allocator, const char* filename)
{
return parse_addns_tsig_static(allocator, filename,
"//Adapter/DNS/TSIG"
);
}
opendnssec-1.4.3/signer/src/parser/signconfparser.c 0000664 0001750 0001750 00000026577 12225246663 017375 0000000 0000000 /*
* $Id: signconfparser.c 7354 2013-10-09 12:36:03Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Parsing signer configuration files.
*
*/
#include "parser/confparser.h"
#include "parser/signconfparser.h"
#include "shared/duration.h"
#include "shared/log.h"
#include
#include
#include
#include
#include
static const char* parser_str = "parser";
/**
* Parse keys from the signer configuration file.
*
*/
keylist_type*
parse_sc_keys(void* sc, const char* cfgfile)
{
xmlDocPtr doc = NULL;
xmlXPathContextPtr xpathCtx = NULL;
xmlXPathObjectPtr xpathObj = NULL;
xmlNode* curNode = NULL;
xmlChar* xexpr = NULL;
key_type* new_key = NULL;
keylist_type* kl = NULL;
char* locator = NULL;
char* flags = NULL;
char* algorithm = NULL;
int ksk, zsk, publish, i;
if (!cfgfile || !sc) {
return NULL;
}
/* Load XML document */
doc = xmlParseFile(cfgfile);
if (doc == NULL) {
ods_log_error("[%s] unable to parse : "
"xmlParseFile() failed", parser_str);
return NULL;
}
/* Create xpath evaluation context */
xpathCtx = xmlXPathNewContext(doc);
if(xpathCtx == NULL) {
xmlFreeDoc(doc);
ods_log_error("[%s] unable to parse : "
"xmlXPathNewContext() failed", parser_str);
return NULL;
}
/* Evaluate xpath expression */
xexpr = (xmlChar*) "//SignerConfiguration/Zone/Keys/Key";
xpathObj = xmlXPathEvalExpression(xexpr, xpathCtx);
if(xpathObj == NULL) {
xmlXPathFreeContext(xpathCtx);
xmlFreeDoc(doc);
ods_log_error("[%s] unable to parse : "
"xmlXPathEvalExpression() failed", parser_str);
return NULL;
}
/* Parse keys */
kl = keylist_create(sc);
ods_log_assert(kl);
if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) {
for (i = 0; i < xpathObj->nodesetval->nodeNr; i++) {
locator = NULL;
flags = NULL;
algorithm = NULL;
ksk = 0;
zsk = 0;
publish = 0;
curNode = xpathObj->nodesetval->nodeTab[i]->xmlChildrenNode;
while (curNode) {
if (xmlStrEqual(curNode->name, (const xmlChar *)"Locator")) {
locator = (char *) xmlNodeGetContent(curNode);
} else if (xmlStrEqual(curNode->name, (const xmlChar *)"Algorithm")) {
algorithm = (char *) xmlNodeGetContent(curNode);
} else if (xmlStrEqual(curNode->name, (const xmlChar *)"Flags")) {
flags = (char *) xmlNodeGetContent(curNode);
} else if (xmlStrEqual(curNode->name, (const xmlChar *)"KSK")) {
ksk = 1;
} else if (xmlStrEqual(curNode->name, (const xmlChar *)"ZSK")) {
zsk = 1;
} else if (xmlStrEqual(curNode->name, (const xmlChar *)"Publish")) {
publish = 1;
}
curNode = curNode->next;
}
if (locator && algorithm && flags) {
/* search for duplicates */
new_key = keylist_lookup_by_locator(kl, locator);
if (new_key &&
new_key->algorithm == (uint8_t) atoi(algorithm) &&
new_key->flags == (uint32_t) atoi(flags) &&
new_key->publish == publish &&
new_key->ksk == ksk &&
new_key->zsk == zsk) {
/* duplicate */
ods_log_warning("[%s] unable to push duplicate key %s "
"to keylist, skipping", parser_str, locator);
} else {
(void) keylist_push(kl, locator,
(uint8_t) atoi(algorithm), (uint32_t) atoi(flags),
publish, ksk, zsk);
}
} else {
ods_log_error("[%s] unable to push key to keylist: "
"is missing required elements, skipping",
parser_str);
}
/* free((void*)locator); */
free((void*)algorithm);
free((void*)flags);
}
}
xmlXPathFreeObject(xpathObj);
xmlXPathFreeContext(xpathCtx);
if (doc) {
xmlFreeDoc(doc);
}
return kl;
}
/**
* Parse elements from the configuration file.
*
*/
duration_type*
parse_sc_sig_resign_interval(const char* cfgfile)
{
duration_type* duration = NULL;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Signatures/Resign",
1);
if (!str) {
return NULL;
}
duration = duration_create_from_string(str);
free((void*)str);
return duration;
}
duration_type*
parse_sc_sig_refresh_interval(const char* cfgfile)
{
duration_type* duration = NULL;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Signatures/Refresh",
1);
if (!str) {
return NULL;
}
duration = duration_create_from_string(str);
free((void*)str);
return duration;
}
duration_type*
parse_sc_sig_validity_default(const char* cfgfile)
{
duration_type* duration = NULL;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Signatures/Validity/Default",
1);
if (!str) {
return NULL;
}
duration = duration_create_from_string(str);
free((void*)str);
return duration;
}
duration_type*
parse_sc_sig_validity_denial(const char* cfgfile)
{
duration_type* duration = NULL;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Signatures/Validity/Denial",
1);
if (!str) {
return NULL;
}
duration = duration_create_from_string(str);
free((void*)str);
return duration;
}
duration_type*
parse_sc_sig_jitter(const char* cfgfile)
{
duration_type* duration = NULL;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Signatures/Jitter",
1);
if (!str) {
return NULL;
}
duration = duration_create_from_string(str);
free((void*)str);
return duration;
}
duration_type*
parse_sc_sig_inception_offset(const char* cfgfile)
{
duration_type* duration = NULL;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Signatures/InceptionOffset",
1);
if (!str) {
return NULL;
}
duration = duration_create_from_string(str);
free((void*)str);
return duration;
}
duration_type*
parse_sc_dnskey_ttl(const char* cfgfile)
{
duration_type* duration = NULL;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Keys/TTL",
1);
if (!str) {
return NULL;
}
duration = duration_create_from_string(str);
free((void*)str);
return duration;
}
duration_type*
parse_sc_nsec3param_ttl(const char* cfgfile)
{
duration_type* duration = NULL;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Denial/NSEC3/TTL",
0);
if (!str) {
return NULL;
}
duration = duration_create_from_string(str);
free((void*)str);
return duration;
}
duration_type*
parse_sc_soa_ttl(const char* cfgfile)
{
duration_type* duration = NULL;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/SOA/TTL",
1);
if (!str) {
return NULL;
}
duration = duration_create_from_string(str);
free((void*)str);
return duration;
}
duration_type*
parse_sc_soa_min(const char* cfgfile)
{
duration_type* duration = NULL;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/SOA/Minimum",
1);
if (!str) {
return NULL;
}
duration = duration_create_from_string(str);
free((void*)str);
return duration;
}
/**
* Parse elements from the configuration file.
*
*/
ldns_rr_type
parse_sc_nsec_type(const char* cfgfile)
{
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Denial/NSEC3",
0);
if (str) {
free((void*)str);
return LDNS_RR_TYPE_NSEC3;
}
str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Denial/NSEC",
0);
if (str) {
free((void*)str);
return LDNS_RR_TYPE_NSEC;
}
return LDNS_RR_TYPE_FIRST;
}
/**
* Parse elements from the configuration file.
*
*/
uint32_t
parse_sc_nsec3_algorithm(const char* cfgfile)
{
int ret = 0;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Denial/NSEC3/Hash/Algorithm",
1);
if (str) {
if (strlen(str) > 0) {
ret = atoi(str);
}
free((void*)str);
}
return ret;
}
uint32_t
parse_sc_nsec3_iterations(const char* cfgfile)
{
int ret = 0;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Denial/NSEC3/Hash/Iterations",
1);
if (str) {
if (strlen(str) > 0) {
ret = atoi(str);
}
free((void*)str);
}
return ret;
}
int
parse_sc_nsec3_optout(const char* cfgfile)
{
int ret = 0;
const char* str = parse_conf_string(cfgfile,
"//SignerConfiguration/Zone/Denial/NSEC3/OptOut",
0);
if (str) {
ret = 1;
free((void*)str);
}
return ret;
}
/**
* Parse elements from the configuration file.
*
*/
const char*
parse_sc_soa_serial(allocator_type* allocator, const char* cfgfile)
{
const char* dup = NULL;
const char* str = parse_conf_string(
cfgfile,
"//SignerConfiguration/Zone/SOA/Serial",
1);
if (str) {
dup = allocator_strdup(allocator, str);
free((void*)str);
}
return dup;
}
const char*
parse_sc_nsec3_salt(allocator_type* allocator, const char* cfgfile)
{
const char* dup = NULL;
const char* str = parse_conf_string(
cfgfile,
"//SignerConfiguration/Zone/Denial/NSEC3/Hash/Salt",
1);
if (str) {
dup = allocator_strdup(allocator, str);
free((void*)str);
}
return dup;
}
opendnssec-1.4.3/signer/src/parser/zonelistparser.h 0000664 0001750 0001750 00000004122 11631413634 017413 0000000 0000000 /*
* $Id: zonelistparser.h 5557 2011-09-06 12:52:44Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Parsing zonelist files.
*
*/
#ifndef PARSER_ZONELISTPARSER_H
#define PARSER_ZONELISTPARSER_H
#include "adapter/adapter.h"
#include "shared/allocator.h"
#include "shared/status.h"
#include
#include
/**
* Parse adapter.
* \param[in] xpathCtx XPath Context Pointer
* \param[in] expr expression
* \param[in] inbound true if Input Adapter
*
*/
adapter_type* parse_zonelist_adapter(xmlXPathContextPtr xpathCtx,
xmlChar* expr, int inbound);
/**
* Parse the zonelist file.
* \param[in] zlist zone list storage
* \param[in] zlfile zonelist file name
* \return ods_status status
*
*/
ods_status parse_zonelist_zones(void* zlist, const char* zlfile);
#endif /* PARSER_ZONELISTPARSER_H */
opendnssec-1.4.3/signer/src/daemon/ 0000775 0001750 0001750 00000000000 12247571206 014212 5 0000000 0000000 opendnssec-1.4.3/signer/src/daemon/engine.c 0000664 0001750 0001750 00000105721 12173457426 015556 0000000 0000000 /*
* $Id: engine.c 7194 2013-07-23 10:46:46Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* The engine.
*
*/
#include "config.h"
#include "daemon/cfg.h"
#include "daemon/engine.h"
#include "daemon/signal.h"
#include "shared/allocator.h"
#include "shared/duration.h"
#include "shared/file.h"
#include "shared/hsm.h"
#include "shared/locks.h"
#include "shared/log.h"
#include "shared/privdrop.h"
#include "shared/status.h"
#include "shared/util.h"
#include "signer/zonelist.h"
#include "wire/tsig.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
static const char* engine_str = "engine";
/**
* Create engine.
*
*/
static engine_type*
engine_create(void)
{
engine_type* engine;
allocator_type* allocator = allocator_create(malloc, free);
if (!allocator) {
ods_log_error("[%s] unable to create engine: allocator_create() "
"failed", engine_str);
return NULL;
}
engine = (engine_type*) allocator_alloc(allocator, sizeof(engine_type));
if (!engine) {
ods_log_error("[%s] unable to create engine: allocator_alloc() "
"failed", engine_str);
allocator_cleanup(allocator);
return NULL;
}
engine->allocator = allocator;
engine->config = NULL;
engine->workers = NULL;
engine->drudgers = NULL;
engine->cmdhandler = NULL;
engine->cmdhandler_done = 0;
engine->dnshandler = NULL;
engine->xfrhandler = NULL;
engine->pid = -1;
engine->uid = -1;
engine->gid = -1;
engine->daemonize = 0;
engine->need_to_exit = 0;
engine->need_to_reload = 0;
lock_basic_init(&engine->signal_lock);
lock_basic_set(&engine->signal_cond);
lock_basic_lock(&engine->signal_lock);
engine->signal = SIGNAL_INIT;
lock_basic_unlock(&engine->signal_lock);
engine->zonelist = zonelist_create(engine->allocator);
if (!engine->zonelist) {
engine_cleanup(engine);
return NULL;
}
engine->taskq = schedule_create(engine->allocator);
if (!engine->taskq) {
engine_cleanup(engine);
return NULL;
}
engine->signq = fifoq_create(engine->allocator);
if (!engine->signq) {
engine_cleanup(engine);
return NULL;
}
return engine;
}
/**
* Start command handler.
*
*/
static void*
cmdhandler_thread_start(void* arg)
{
cmdhandler_type* cmd = (cmdhandler_type*) arg;
ods_thread_blocksigs();
cmdhandler_start(cmd);
return NULL;
}
static void
engine_start_cmdhandler(engine_type* engine)
{
ods_log_assert(engine);
ods_log_debug("[%s] start command handler", engine_str);
engine->cmdhandler->engine = engine;
ods_thread_create(&engine->cmdhandler->thread_id,
cmdhandler_thread_start, engine->cmdhandler);
return;
}
/**
* Self pipe trick (see Unix Network Programming).
*
*/
static int
self_pipe_trick(engine_type* engine)
{
int sockfd, ret;
struct sockaddr_un servaddr;
const char* servsock_filename = ODS_SE_SOCKFILE;
ods_log_assert(engine);
ods_log_assert(engine->cmdhandler);
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sockfd < 0) {
ods_log_error("[%s] unable to connect to command handler: "
"socket() failed (%s)", engine_str, strerror(errno));
return 1;
} else {
bzero(&servaddr, sizeof(servaddr));
servaddr.sun_family = AF_UNIX;
strncpy(servaddr.sun_path, servsock_filename,
sizeof(servaddr.sun_path) - 1);
ret = connect(sockfd, (const struct sockaddr*) &servaddr,
sizeof(servaddr));
if (ret != 0) {
ods_log_error("[%s] unable to connect to command handler: "
"connect() failed (%s)", engine_str, strerror(errno));
close(sockfd);
return 1;
} else {
/* self-pipe trick */
ods_writen(sockfd, "", 1);
close(sockfd);
}
}
return 0;
}
/**
* Stop command handler.
*
*/
static void
engine_stop_cmdhandler(engine_type* engine)
{
ods_log_assert(engine);
if (!engine->cmdhandler) {
return;
}
ods_log_debug("[%s] stop command handler", engine_str);
engine->cmdhandler->need_to_exit = 1;
if (self_pipe_trick(engine) == 0) {
while (!engine->cmdhandler_done) {
ods_log_debug("[%s] waiting for command handler to exit...",
engine_str);
sleep(1);
}
} else {
ods_log_error("[%s] command handler self pipe trick failed, "
"unclean shutdown", engine_str);
}
return;
}
/**
* Start/stop dnshandler.
*
*/
static void*
dnshandler_thread_start(void* arg)
{
dnshandler_type* dnshandler = (dnshandler_type*) arg;
dnshandler_start(dnshandler);
return NULL;
}
static void
engine_start_dnshandler(engine_type* engine)
{
if (!engine || !engine->dnshandler) {
return;
}
ods_log_debug("[%s] start dnshandler", engine_str);
engine->dnshandler->engine = engine;
ods_thread_create(&engine->dnshandler->thread_id,
dnshandler_thread_start, engine->dnshandler);
return;
}
static void
engine_stop_dnshandler(engine_type* engine)
{
if (!engine || !engine->dnshandler || !engine->dnshandler->thread_id) {
return;
}
ods_log_debug("[%s] stop dnshandler", engine_str);
engine->dnshandler->need_to_exit = 1;
dnshandler_signal(engine->dnshandler);
ods_log_debug("[%s] join dnshandler", engine_str);
ods_thread_join(engine->dnshandler->thread_id);
engine->dnshandler->engine = NULL;
return;
}
/**
* Start/stop xfrhandler.
*
*/
static void*
xfrhandler_thread_start(void* arg)
{
xfrhandler_type* xfrhandler = (xfrhandler_type*) arg;
xfrhandler_start(xfrhandler);
return NULL;
}
static void
engine_start_xfrhandler(engine_type* engine)
{
if (!engine || !engine->xfrhandler) {
return;
}
ods_log_debug("[%s] start xfrhandler", engine_str);
engine->xfrhandler->engine = engine;
ods_thread_create(&engine->xfrhandler->thread_id,
xfrhandler_thread_start, engine->xfrhandler);
/* This might be the wrong place to mark the xfrhandler started but
* if its isn't done here we might try to shutdown and stop it before
* it has marked itself started
*/
engine->xfrhandler->started = 1;
return;
}
static void
engine_stop_xfrhandler(engine_type* engine)
{
if (!engine || !engine->xfrhandler) {
return;
}
ods_log_debug("[%s] stop xfrhandler", engine_str);
engine->xfrhandler->need_to_exit = 1;
xfrhandler_signal(engine->xfrhandler);
ods_log_debug("[%s] join xfrhandler", engine_str);
if (engine->xfrhandler->started) {
ods_thread_join(engine->xfrhandler->thread_id);
engine->xfrhandler->started = 0;
}
engine->xfrhandler->engine = NULL;
return;
}
/**
* Drop privileges.
*
*/
static ods_status
engine_privdrop(engine_type* engine)
{
ods_status status = ODS_STATUS_OK;
uid_t uid = -1;
gid_t gid = -1;
ods_log_assert(engine);
ods_log_assert(engine->config);
ods_log_debug("[%s] drop privileges", engine_str);
if (engine->config->username && engine->config->group) {
ods_log_verbose("[%s] drop privileges to user %s, group %s",
engine_str, engine->config->username, engine->config->group);
} else if (engine->config->username) {
ods_log_verbose("[%s] drop privileges to user %s", engine_str,
engine->config->username);
} else if (engine->config->group) {
ods_log_verbose("[%s] drop privileges to group %s", engine_str,
engine->config->group);
}
if (engine->config->chroot) {
ods_log_verbose("[%s] chroot to %s", engine_str,
engine->config->chroot);
}
status = privdrop(engine->config->username, engine->config->group,
engine->config->chroot, &uid, &gid);
engine->uid = uid;
engine->gid = gid;
privclose(engine->config->username, engine->config->group);
return status;
}
/**
* Start/stop workers.
*
*/
static void
engine_create_workers(engine_type* engine)
{
size_t i = 0;
ods_log_assert(engine);
ods_log_assert(engine->config);
ods_log_assert(engine->allocator);
engine->workers = (worker_type**) allocator_alloc(engine->allocator,
((size_t)engine->config->num_worker_threads) * sizeof(worker_type*));
for (i=0; i < (size_t) engine->config->num_worker_threads; i++) {
engine->workers[i] = worker_create(engine->allocator, i,
WORKER_WORKER);
}
return;
}
static void
engine_create_drudgers(engine_type* engine)
{
size_t i = 0;
ods_log_assert(engine);
ods_log_assert(engine->config);
ods_log_assert(engine->allocator);
engine->drudgers = (worker_type**) allocator_alloc(engine->allocator,
((size_t)engine->config->num_signer_threads) * sizeof(worker_type*));
for (i=0; i < (size_t) engine->config->num_signer_threads; i++) {
engine->drudgers[i] = worker_create(engine->allocator, i,
WORKER_DRUDGER);
}
return;
}
static void*
worker_thread_start(void* arg)
{
worker_type* worker = (worker_type*) arg;
ods_thread_blocksigs();
worker_start(worker);
return NULL;
}
static void
engine_start_workers(engine_type* engine)
{
size_t i = 0;
ods_log_assert(engine);
ods_log_assert(engine->config);
ods_log_debug("[%s] start workers", engine_str);
for (i=0; i < (size_t) engine->config->num_worker_threads; i++) {
engine->workers[i]->need_to_exit = 0;
engine->workers[i]->engine = (void*) engine;
ods_thread_create(&engine->workers[i]->thread_id, worker_thread_start,
engine->workers[i]);
}
return;
}
void
engine_start_drudgers(engine_type* engine)
{
size_t i = 0;
ods_log_assert(engine);
ods_log_assert(engine->config);
ods_log_debug("[%s] start drudgers", engine_str);
for (i=0; i < (size_t) engine->config->num_signer_threads; i++) {
engine->drudgers[i]->need_to_exit = 0;
engine->drudgers[i]->engine = (void*) engine;
ods_thread_create(&engine->drudgers[i]->thread_id, worker_thread_start,
engine->drudgers[i]);
}
return;
}
static void
engine_stop_workers(engine_type* engine)
{
size_t i = 0;
ods_log_assert(engine);
ods_log_assert(engine->config);
ods_log_debug("[%s] stop workers", engine_str);
/* tell them to exit and wake up sleepyheads */
for (i=0; i < (size_t) engine->config->num_worker_threads; i++) {
engine->workers[i]->need_to_exit = 1;
worker_wakeup(engine->workers[i]);
}
ods_log_debug("[%s] notify workers", engine_str);
worker_notify_all(&engine->signq->q_lock, &engine->signq->q_nonfull);
/* head count */
for (i=0; i < (size_t) engine->config->num_worker_threads; i++) {
ods_log_debug("[%s] join worker %i", engine_str, i+1);
ods_thread_join(engine->workers[i]->thread_id);
engine->workers[i]->engine = NULL;
}
return;
}
void
engine_stop_drudgers(engine_type* engine)
{
size_t i = 0;
ods_log_assert(engine);
ods_log_assert(engine->config);
ods_log_debug("[%s] stop drudgers", engine_str);
/* tell them to exit and wake up sleepyheads */
for (i=0; i < (size_t) engine->config->num_signer_threads; i++) {
engine->drudgers[i]->need_to_exit = 1;
}
ods_log_debug("[%s] notify drudgers", engine_str);
worker_notify_all(&engine->signq->q_lock, &engine->signq->q_threshold);
/* head count */
for (i=0; i < (size_t) engine->config->num_signer_threads; i++) {
ods_log_debug("[%s] join drudger %i", engine_str, i+1);
ods_thread_join(engine->drudgers[i]->thread_id);
engine->drudgers[i]->engine = NULL;
}
return;
}
/**
* Wake up all workers.
*
*/
void
engine_wakeup_workers(engine_type* engine)
{
size_t i = 0;
ods_log_assert(engine);
ods_log_assert(engine->config);
ods_log_debug("[%s] wake up workers", engine_str);
/* wake up sleepyheads */
for (i=0; i < (size_t) engine->config->num_worker_threads; i++) {
worker_wakeup(engine->workers[i]);
}
return;
}
/**
* Set up engine.
*
*/
static ods_status
engine_setup(engine_type* engine)
{
ods_status status = ODS_STATUS_OK;
struct sigaction action;
int result = 0;
int sockets[2] = {0,0};
ods_log_debug("[%s] setup signer engine", engine_str);
if (!engine || !engine->config) {
return ODS_STATUS_ASSERT_ERR;
}
/* set edns */
edns_init(&engine->edns, EDNS_MAX_MESSAGE_LEN);
/* create command handler (before chowning socket file) */
engine->cmdhandler = cmdhandler_create(engine->allocator,
engine->config->clisock_filename);
if (!engine->cmdhandler) {
return ODS_STATUS_CMDHANDLER_ERR;
}
engine->dnshandler = dnshandler_create(engine->allocator,
engine->config->interfaces);
engine->xfrhandler = xfrhandler_create(engine->allocator);
if (!engine->xfrhandler) {
return ODS_STATUS_XFRHANDLER_ERR;
}
if (engine->dnshandler) {
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sockets) == -1) {
return ODS_STATUS_XFRHANDLER_ERR;
}
engine->xfrhandler->dnshandler.fd = sockets[0];
engine->dnshandler->xfrhandler.fd = sockets[1];
status = dnshandler_listen(engine->dnshandler);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] setup: unable to listen to sockets (%s)",
engine_str, ods_status2str(status));
}
}
/* privdrop */
engine->uid = privuid(engine->config->username);
engine->gid = privgid(engine->config->group);
/* TODO: does piddir exists? */
/* remove the chown stuff: piddir? */
ods_chown(engine->config->pid_filename, engine->uid, engine->gid, 1);
ods_chown(engine->config->clisock_filename, engine->uid, engine->gid, 0);
ods_chown(engine->config->working_dir, engine->uid, engine->gid, 0);
if (engine->config->log_filename && !engine->config->use_syslog) {
ods_chown(engine->config->log_filename, engine->uid, engine->gid, 0);
}
if (engine->config->working_dir &&
chdir(engine->config->working_dir) != 0) {
ods_log_error("[%s] setup: unable to chdir to %s (%s)", engine_str,
engine->config->working_dir, strerror(errno));
return ODS_STATUS_CHDIR_ERR;
}
if (engine_privdrop(engine) != ODS_STATUS_OK) {
return ODS_STATUS_PRIVDROP_ERR;
}
/* daemonize */
if (engine->daemonize) {
switch ((engine->pid = fork())) {
case -1: /* error */
ods_log_error("[%s] setup: unable to fork daemon (%s)",
engine_str, strerror(errno));
return ODS_STATUS_FORK_ERR;
case 0: /* child */
break;
default: /* parent */
engine_cleanup(engine);
engine = NULL;
xmlCleanupParser();
xmlCleanupGlobals();
xmlCleanupThreads();
exit(0);
}
if (setsid() == -1) {
ods_log_error("[%s] setup: unable to setsid daemon (%s)",
engine_str, strerror(errno));
return ODS_STATUS_SETSID_ERR;
}
}
engine->pid = getpid();
ods_log_verbose("[%s] running as pid %lu", engine_str,
(unsigned long) engine->pid);
/* catch signals */
signal_set_engine(engine);
action.sa_handler = signal_handler;
sigfillset(&action.sa_mask);
action.sa_flags = 0;
sigaction(SIGTERM, &action, NULL);
sigaction(SIGHUP, &action, NULL);
sigaction(SIGINT, &action, NULL);
sigaction(SIGILL, &action, NULL);
sigaction(SIGUSR1, &action, NULL);
sigaction(SIGALRM, &action, NULL);
sigaction(SIGCHLD, &action, NULL);
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
/* set up hsm */ /* LEAK */
result = lhsm_open(engine->config->cfg_filename);
if (result != HSM_OK) {
return ODS_STATUS_HSM_ERR;
}
/* create workers/drudgers */
engine_create_workers(engine);
engine_create_drudgers(engine);
/* start cmd/dns/xfr handlers */
engine_start_cmdhandler(engine);
engine_start_dnshandler(engine);
engine_start_xfrhandler(engine);
tsig_handler_init(engine->allocator);
/* write pidfile */
if (util_write_pidfile(engine->config->pid_filename, engine->pid) == -1) {
hsm_close();
return ODS_STATUS_WRITE_PIDFILE_ERR;
}
/* setup done */
return ODS_STATUS_OK;
}
/**
* Make sure that all zones have been worked on at least once.
*
*/
static int
engine_all_zones_processed(engine_type* engine)
{
ldns_rbnode_t* node = LDNS_RBTREE_NULL;
zone_type* zone = NULL;
ods_log_assert(engine);
ods_log_assert(engine->zonelist);
ods_log_assert(engine->zonelist->zones);
node = ldns_rbtree_first(engine->zonelist->zones);
while (node && node != LDNS_RBTREE_NULL) {
zone = (zone_type*) node->key;
ods_log_assert(zone);
ods_log_assert(zone->db);
if (!zone->db->is_processed) {
return 0;
}
node = ldns_rbtree_next(node);
}
return 1;
}
/**
* Run engine, run!.
*
*/
static void
engine_run(engine_type* engine, int single_run)
{
if (!engine) {
return;
}
engine_start_workers(engine);
engine_start_drudgers(engine);
lock_basic_lock(&engine->signal_lock);
engine->signal = SIGNAL_RUN;
lock_basic_unlock(&engine->signal_lock);
while (!engine->need_to_exit && !engine->need_to_reload) {
lock_basic_lock(&engine->signal_lock);
engine->signal = signal_capture(engine->signal);
switch (engine->signal) {
case SIGNAL_RUN:
ods_log_assert(1);
break;
case SIGNAL_RELOAD:
engine->need_to_reload = 1;
break;
case SIGNAL_SHUTDOWN:
engine->need_to_exit = 1;
break;
default:
ods_log_warning("[%s] invalid signal %d captured, "
"keep running", engine_str, signal);
engine->signal = SIGNAL_RUN;
break;
}
lock_basic_unlock(&engine->signal_lock);
if (single_run) {
engine->need_to_exit = engine_all_zones_processed(engine);
}
lock_basic_lock(&engine->signal_lock);
if (engine->signal == SIGNAL_RUN && !single_run) {
ods_log_debug("[%s] taking a break", engine_str);
lock_basic_sleep(&engine->signal_cond, &engine->signal_lock, 3600);
}
lock_basic_unlock(&engine->signal_lock);
}
ods_log_debug("[%s] signer halted", engine_str);
engine_stop_drudgers(engine);
engine_stop_workers(engine);
(void)lhsm_reopen(engine->config->cfg_filename);
return;
}
/**
* Parse notify command.
*
*/
static void
set_notify_ns(zone_type* zone, const char* cmd)
{
const char* str = NULL;
const char* str2 = NULL;
char* token = NULL;
ods_log_assert(cmd);
ods_log_assert(zone);
ods_log_assert(zone->name);
ods_log_assert(zone->adoutbound);
if (zone->adoutbound->type == ADAPTER_FILE) {
str = ods_replace(cmd, "%zonefile", zone->adoutbound->configstr);
if (!str) {
ods_log_error("[%s] unable to set notify ns: replace zonefile failed",
engine_str);
}
str2 = ods_replace(str, "%zone", zone->name);
free((void*)str);
} else {
str2 = ods_replace(cmd, "%zone", zone->name);
}
if (str2) {
ods_str_trim((char*) str2);
str = str2;
if (*str) {
token = NULL;
while ((token = strtok((char*) str, " "))) {
if (*token) {
ods_str_list_add(&zone->notify_args, token);
}
str = NULL;
}
}
zone->notify_command = (char*) str2;
zone->notify_ns = zone->notify_args[0];
ods_log_debug("[%s] set notify ns: %s", engine_str, zone->notify_ns);
} else {
ods_log_error("[%s] unable to set notify ns: replace zone failed",
engine_str);
}
return;
}
/**
* Update DNS configuration for zone.
*
*/
static int
dnsconfig_zone(engine_type* engine, zone_type* zone)
{
int numdns = 0;
ods_log_assert(engine);
ods_log_assert(engine->xfrhandler);
ods_log_assert(engine->xfrhandler->netio);
ods_log_assert(zone);
ods_log_assert(zone->adinbound);
ods_log_assert(zone->adoutbound);
ods_log_assert(zone->name);
if (zone->adinbound->type == ADAPTER_DNS) {
/* zone transfer handler */
if (!zone->xfrd) {
ods_log_debug("[%s] add transfer handler for zone %s",
engine_str, zone->name);
zone->xfrd = xfrd_create((void*) engine->xfrhandler,
(void*) zone);
ods_log_assert(zone->xfrd);
netio_add_handler(engine->xfrhandler->netio,
&zone->xfrd->handler);
} else if (!zone->xfrd->serial_disk_acquired) {
xfrd_set_timer_now(zone->xfrd);
}
numdns++;
} else if (zone->xfrd) {
netio_remove_handler(engine->xfrhandler->netio,
&zone->xfrd->handler);
xfrd_cleanup(zone->xfrd);
zone->xfrd = NULL;
}
if (zone->adoutbound->type == ADAPTER_DNS) {
/* notify handler */
if (!zone->notify) {
ods_log_debug("[%s] add notify handler for zone %s",
engine_str, zone->name);
zone->notify = notify_create((void*) engine->xfrhandler,
(void*) zone);
ods_log_assert(zone->notify);
netio_add_handler(engine->xfrhandler->netio,
&zone->notify->handler);
}
numdns++;
} else if (zone->notify) {
netio_remove_handler(engine->xfrhandler->netio,
&zone->notify->handler);
notify_cleanup(zone->notify);
zone->notify = NULL;
}
return numdns;
}
/**
* Update zones.
*
*/
void
engine_update_zones(engine_type* engine, ods_status zl_changed)
{
ldns_rbnode_t* node = LDNS_RBTREE_NULL;
zone_type* zone = NULL;
zone_type* delzone = NULL;
task_type* task = NULL;
ods_status status = ODS_STATUS_OK;
unsigned wake_up = 0;
int warnings = 0;
time_t now = 0;
if (!engine || !engine->zonelist || !engine->zonelist->zones) {
return;
}
now = time_now();
ods_log_debug("[%s] commit zone list changes", engine_str);
lock_basic_lock(&engine->zonelist->zl_lock);
node = ldns_rbtree_first(engine->zonelist->zones);
while (node && node != LDNS_RBTREE_NULL) {
zone = (zone_type*) node->data;
task = NULL; /* reset task */
if (zone->zl_status == ZONE_ZL_REMOVED) {
node = ldns_rbtree_next(node);
lock_basic_lock(&zone->zone_lock);
delzone = zonelist_del_zone(engine->zonelist, zone);
if (delzone) {
lock_basic_lock(&engine->taskq->schedule_lock);
task = unschedule_task(engine->taskq,
(task_type*) zone->task);
lock_basic_unlock(&engine->taskq->schedule_lock);
}
task_cleanup(task);
task = NULL;
lock_basic_unlock(&zone->zone_lock);
netio_remove_handler(engine->xfrhandler->netio,
&zone->xfrd->handler);
zone_cleanup(zone);
zone = NULL;
continue;
} else if (zone->zl_status == ZONE_ZL_ADDED) {
lock_basic_lock(&zone->zone_lock);
ods_log_assert(!zone->task);
/* set notify nameserver command */
if (engine->config->notify_command && !zone->notify_ns) {
set_notify_ns(zone, engine->config->notify_command);
}
/* create task */
task = task_create(TASK_SIGNCONF, now, zone);
lock_basic_unlock(&zone->zone_lock);
if (!task) {
ods_log_crit("[%s] unable to create task for zone %s: "
"task_create() failed", engine_str, zone->name);
node = ldns_rbtree_next(node);
continue;
}
}
/* load adapter config */
status = adapter_load_config(zone->adinbound);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] unable to load config for inbound adapter "
"for zone %s: %s", engine_str, zone->name,
ods_status2str(status));
}
status = adapter_load_config(zone->adoutbound);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] unable to load config for outbound adapter "
"for zone %s: %s", engine_str, zone->name,
ods_status2str(status));
}
/* for dns adapters */
warnings += dnsconfig_zone(engine, zone);
if (zone->zl_status == ZONE_ZL_ADDED) {
ods_log_assert(task);
lock_basic_lock(&zone->zone_lock);
zone->task = task;
lock_basic_unlock(&zone->zone_lock);
lock_basic_lock(&engine->taskq->schedule_lock);
status = schedule_task(engine->taskq, task, 0);
lock_basic_unlock(&engine->taskq->schedule_lock);
} else if (zl_changed == ODS_STATUS_OK) {
/* always try to update signconf */
lock_basic_lock(&zone->zone_lock);
status = zone_reschedule_task(zone, engine->taskq, TASK_SIGNCONF);
lock_basic_unlock(&zone->zone_lock);
}
if (status != ODS_STATUS_OK) {
ods_log_crit("[%s] unable to schedule task for zone %s: %s",
engine_str, zone->name, ods_status2str(status));
} else {
wake_up = 1;
zone->zl_status = ZONE_ZL_OK;
}
node = ldns_rbtree_next(node);
}
lock_basic_unlock(&engine->zonelist->zl_lock);
if (engine->dnshandler) {
dnshandler_fwd_notify(engine->dnshandler,
(uint8_t*) ODS_SE_NOTIFY_CMD, strlen(ODS_SE_NOTIFY_CMD));
} else if (warnings) {
ods_log_warning("[%s] no dnshandler/listener configured, but zones "
"are configured with dns adapters: notify and zone transfer "
"requests will not work properly", engine_str);
}
if (wake_up) {
engine_wakeup_workers(engine);
}
return;
}
/**
* Try to recover from the backup files.
*
*/
static ods_status
engine_recover(engine_type* engine)
{
ldns_rbnode_t* node = LDNS_RBTREE_NULL;
zone_type* zone = NULL;
ods_status status = ODS_STATUS_OK;
ods_status result = ODS_STATUS_UNCHANGED;
if (!engine || !engine->zonelist || !engine->zonelist->zones) {
ods_log_error("[%s] cannot recover zones: no engine or zonelist",
engine_str);
return ODS_STATUS_ERR; /* no need to update zones */
}
ods_log_assert(engine);
ods_log_assert(engine->zonelist);
ods_log_assert(engine->zonelist->zones);
lock_basic_lock(&engine->zonelist->zl_lock);
/* [LOCK] zonelist */
node = ldns_rbtree_first(engine->zonelist->zones);
while (node && node != LDNS_RBTREE_NULL) {
zone = (zone_type*) node->data;
ods_log_assert(zone->zl_status == ZONE_ZL_ADDED);
lock_basic_lock(&zone->zone_lock);
status = zone_recover2(zone);
if (status == ODS_STATUS_OK) {
ods_log_assert(zone->task);
ods_log_assert(zone->db);
ods_log_assert(zone->signconf);
/* notify nameserver */
if (engine->config->notify_command && !zone->notify_ns) {
set_notify_ns(zone, engine->config->notify_command);
}
/* schedule task */
lock_basic_lock(&engine->taskq->schedule_lock);
/* [LOCK] schedule */
status = schedule_task(engine->taskq, (task_type*) zone->task, 0);
/* [UNLOCK] schedule */
lock_basic_unlock(&engine->taskq->schedule_lock);
if (status != ODS_STATUS_OK) {
ods_log_crit("[%s] unable to schedule task for zone %s: %s",
engine_str, zone->name, ods_status2str(status));
task_cleanup((task_type*) zone->task);
zone->task = NULL;
result = ODS_STATUS_OK; /* will trigger update zones */
} else {
ods_log_debug("[%s] recovered zone %s", engine_str,
zone->name);
/* recovery done */
zone->zl_status = ZONE_ZL_OK;
}
} else {
if (status != ODS_STATUS_UNCHANGED) {
ods_log_warning("[%s] unable to recover zone %s from backup,"
" performing full sign", engine_str, zone->name);
}
result = ODS_STATUS_OK; /* will trigger update zones */
}
lock_basic_unlock(&zone->zone_lock);
node = ldns_rbtree_next(node);
}
/* [UNLOCK] zonelist */
lock_basic_unlock(&engine->zonelist->zl_lock);
return result;
}
/**
* Start engine.
*
*/
void
engine_start(const char* cfgfile, int cmdline_verbosity, int daemonize,
int info, int single_run)
{
engine_type* engine = NULL;
int use_syslog = 0;
ods_status zl_changed = ODS_STATUS_UNCHANGED;
ods_status status = ODS_STATUS_OK;
int close_hsm = 0;
ods_log_assert(cfgfile);
ods_log_init(NULL, use_syslog, cmdline_verbosity);
ods_log_verbose("[%s] starting signer", engine_str);
/* initialize */
xmlInitGlobals();
xmlInitParser();
xmlInitThreads();
engine = engine_create();
if (!engine) {
ods_fatal_exit("[%s] create failed", engine_str);
return;
}
engine->daemonize = daemonize;
/* config */
engine->config = engine_config(engine->allocator, cfgfile,
cmdline_verbosity);
status = engine_config_check(engine->config);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] cfgfile %s has errors", engine_str, cfgfile);
goto earlyexit;
}
if (info) {
engine_config_print(stdout, engine->config); /* for debugging */
goto earlyexit;
}
/* check pidfile */
if (!util_check_pidfile(engine->config->pid_filename)) {
exit(1);
}
/* open log */
ods_log_init(engine->config->log_filename, engine->config->use_syslog,
engine->config->verbosity);
/* setup */
tzset(); /* for portability */
status = engine_setup(engine);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] setup failed: %s", engine_str,
ods_status2str(status));
engine->need_to_exit = 1;
if (status != ODS_STATUS_WRITE_PIDFILE_ERR) {
/* command handler had not yet been started */
engine->cmdhandler_done = 1;
}
} else {
/* setup ok, mark hsm open */
close_hsm = 1;
}
/* run */
while (engine->need_to_exit == 0) {
/* update zone list */
lock_basic_lock(&engine->zonelist->zl_lock);
zl_changed = zonelist_update(engine->zonelist,
engine->config->zonelist_filename);
engine->zonelist->just_removed = 0;
engine->zonelist->just_added = 0;
engine->zonelist->just_updated = 0;
lock_basic_unlock(&engine->zonelist->zl_lock);
/* start/reload */
if (engine->need_to_reload) {
ods_log_info("[%s] signer reloading", engine_str);
engine->need_to_reload = 0;
} else {
ods_log_info("[%s] signer started (version %s), pid %u",
engine_str, PACKAGE_VERSION, engine->pid);
zl_changed = engine_recover(engine);
}
if (zl_changed == ODS_STATUS_OK ||
zl_changed == ODS_STATUS_UNCHANGED) {
engine_update_zones(engine, zl_changed);
}
engine_run(engine, single_run);
}
/* shutdown */
ods_log_info("[%s] signer shutdown", engine_str);
if (close_hsm) {
ods_log_verbose("[%s] close hsm", engine_str);
hsm_close();
}
if (!engine->cmdhandler_done) {
engine_stop_xfrhandler(engine);
engine_stop_dnshandler(engine);
engine_stop_cmdhandler(engine);
}
earlyexit:
if (engine && engine->config) {
if (engine->config->pid_filename) {
(void)unlink(engine->config->pid_filename);
}
if (engine->config->clisock_filename) {
(void)unlink(engine->config->clisock_filename);
}
}
tsig_handler_cleanup();
engine_cleanup(engine);
engine = NULL;
ods_log_close();
xmlCleanupParser();
xmlCleanupGlobals();
xmlCleanupThreads();
return;
}
/**
* Clean up engine.
*
*/
void
engine_cleanup(engine_type* engine)
{
size_t i = 0;
allocator_type* allocator;
cond_basic_type signal_cond;
lock_basic_type signal_lock;
if (!engine) {
return;
}
allocator = engine->allocator;
signal_cond = engine->signal_cond;
signal_lock = engine->signal_lock;
if (engine->workers && engine->config) {
for (i=0; i < (size_t) engine->config->num_worker_threads; i++) {
worker_cleanup(engine->workers[i]);
}
allocator_deallocate(allocator, (void*) engine->workers);
}
if (engine->drudgers && engine->config) {
for (i=0; i < (size_t) engine->config->num_signer_threads; i++) {
worker_cleanup(engine->drudgers[i]);
}
allocator_deallocate(allocator, (void*) engine->drudgers);
}
zonelist_cleanup(engine->zonelist);
schedule_cleanup(engine->taskq);
fifoq_cleanup(engine->signq);
cmdhandler_cleanup(engine->cmdhandler);
dnshandler_cleanup(engine->dnshandler);
xfrhandler_cleanup(engine->xfrhandler);
engine_config_cleanup(engine->config);
allocator_deallocate(allocator, (void*) engine);
lock_basic_destroy(&signal_lock);
lock_basic_off(&signal_cond);
allocator_cleanup(allocator);
return;
}
opendnssec-1.4.3/signer/src/daemon/dnshandler.h 0000664 0001750 0001750 00000006173 12073770157 016437 0000000 0000000 /*
* $Id: dnshandler.h 4518 2011-02-24 15:39:09Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* DNS handler.
*
*/
#ifndef DAEMON_DNSHANDLER_H
#define DAEMON_DNSHANDLER_H
#include "config.h"
#include "shared/allocator.h"
#include "shared/locks.h"
#include "shared/status.h"
#include "wire/listener.h"
#include "wire/netio.h"
#include "wire/query.h"
#include "wire/sock.h"
#include
#define ODS_SE_NOTIFY_CMD "NOTIFY"
#define ODS_SE_MAX_HANDLERS 5
typedef struct dnshandler_struct dnshandler_type;
struct dnshandler_struct {
allocator_type* allocator;
ods_thread_type thread_id;
void* engine;
listener_type* interfaces;
socklist_type* socklist;
netio_type* netio;
query_type* query;
netio_handler_type xfrhandler;
unsigned need_to_exit;
};
/**
* Create dns handler.
* \param[in] allocator memory allocator
* \param[in] interfaces list of interfaces
* \return dnshandler_type* created dns handler
*
*/
dnshandler_type* dnshandler_create(allocator_type* allocator,
listener_type* interfaces);
/**
* Start dns handler listener.
* \param[in] dnshandler_type* dns handler
* \return ods_status status
*
*/
ods_status dnshandler_listen(dnshandler_type* dnshandler);
/**
* Start dns handler.
* \param[in] dnshandler_type* dns handler
*
*/
void dnshandler_start(dnshandler_type* dnshandler);
/**
* Signal dns handler.
* \param[in] dnshandler_type* dns handler
*
*/
void dnshandler_signal(dnshandler_type* dnshandler);
/**
* Forward notify to zone transfer handler.
* \param[in] dnshandler_type* dns handler
* \param[in] pkt notify packet
* \param[in] len packet length
*
*/
void dnshandler_fwd_notify(dnshandler_type* dnshandler,
uint8_t* pkt, size_t len);
/**
* Cleanup dns handler.
* \param[in] dnshandler_type* dns handler
*
*/
void dnshandler_cleanup(dnshandler_type* dnshandler);
#endif /* DAEMON_DNSHANDLER_H */
opendnssec-1.4.3/signer/src/daemon/dnshandler.c 0000664 0001750 0001750 00000023100 12073770157 016417 0000000 0000000 /*
* $Id: dnshandler.c 4518 2011-02-24 15:39:09Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* DNS handler.
*
*/
#include "config.h"
#include "daemon/dnshandler.h"
#include "daemon/engine.h"
#include "shared/status.h"
#include "wire/buffer.h"
#include
#include
static const char* dnsh_str = "dnshandler";
static void dnshandler_handle_xfr(netio_type* netio,
netio_handler_type* handler, netio_events_type event_types);
/**
* Create dns handler.
*
*/
dnshandler_type*
dnshandler_create(allocator_type* allocator, listener_type* interfaces)
{
dnshandler_type* dnsh = NULL;
if (!allocator || !interfaces || interfaces->count <= 0) {
return NULL;
}
dnsh = (dnshandler_type*) allocator_alloc(allocator,
sizeof(dnshandler_type));
if (!dnsh) {
ods_log_error("[%s] unable to create dnshandler: "
"allocator_alloc() failed", dnsh_str);
return NULL;
}
dnsh->allocator = allocator;
dnsh->need_to_exit = 0;
dnsh->engine = NULL;
dnsh->interfaces = interfaces;
dnsh->socklist = NULL;
dnsh->netio = NULL;
dnsh->query = NULL;
/* setup */
dnsh->socklist = (socklist_type*) allocator_alloc(allocator,
sizeof(socklist_type));
if (!dnsh->socklist) {
ods_log_error("[%s] unable to create socklist: "
"allocator_alloc() failed", dnsh_str);
dnshandler_cleanup(dnsh);
return NULL;
}
dnsh->netio = netio_create(allocator);
if (!dnsh->netio) {
ods_log_error("[%s] unable to create dnshandler: "
"netio_create() failed", dnsh_str);
dnshandler_cleanup(dnsh);
return NULL;
}
dnsh->query = query_create();
if (!dnsh->query) {
ods_log_error("[%s] unable to create dnshandler: "
"query_create() failed", dnsh_str);
dnshandler_cleanup(dnsh);
return NULL;
}
dnsh->xfrhandler.fd = -1;
dnsh->xfrhandler.user_data = (void*) dnsh;
dnsh->xfrhandler.timeout = 0;
dnsh->xfrhandler.event_types = NETIO_EVENT_READ;
dnsh->xfrhandler.event_handler = dnshandler_handle_xfr;
return dnsh;
}
/**
* Start dns handler listener.
*
*/
ods_status
dnshandler_listen(dnshandler_type* dnshandler)
{
ods_status status = ODS_STATUS_OK;
ods_log_assert(dnshandler);
status = sock_listen(dnshandler->socklist, dnshandler->interfaces);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] unable to start: sock_listen() "
"failed (%s)", dnsh_str, ods_status2str(status));
dnshandler->thread_id = 0;
}
return status;
}
/**
* Start dns handler.
*
*/
void
dnshandler_start(dnshandler_type* dnshandler)
{
size_t i = 0;
engine_type* engine = NULL;
netio_handler_type* tcp_accept_handlers = NULL;
ods_log_assert(dnshandler);
ods_log_assert(dnshandler->engine);
ods_log_debug("[%s] start", dnsh_str);
/* udp */
for (i=0; i < dnshandler->interfaces->count; i++) {
struct udp_data* data = NULL;
netio_handler_type* handler = NULL;
data = (struct udp_data*) allocator_alloc(dnshandler->allocator,
sizeof(struct udp_data));
if (!data) {
ods_log_error("[%s] unable to start: allocator_alloc() "
"failed", dnsh_str);
dnshandler->thread_id = 0;
engine->need_to_exit = 1;
break;
}
data->query = dnshandler->query;
data->engine = dnshandler->engine;
data->socket = &dnshandler->socklist->udp[i];
handler = (netio_handler_type*) allocator_alloc(
dnshandler->allocator, sizeof(netio_handler_type));
if (!handler) {
ods_log_error("[%s] unable to start: allocator_alloc() "
"failed", dnsh_str);
allocator_deallocate(dnshandler->allocator, (void*)data);
dnshandler->thread_id = 0;
engine->need_to_exit = 1;
break;
}
handler->fd = dnshandler->socklist->udp[i].s;
handler->timeout = NULL;
handler->user_data = data;
handler->event_types = NETIO_EVENT_READ;
handler->event_handler = sock_handle_udp;
ods_log_debug("[%s] add udp network handler fd %u", dnsh_str,
(unsigned) handler->fd);
netio_add_handler(dnshandler->netio, handler);
}
/* tcp */
tcp_accept_handlers = (netio_handler_type*) allocator_alloc(
dnshandler->allocator,
dnshandler->interfaces->count * sizeof(netio_handler_type));
for (i=0; i < dnshandler->interfaces->count; i++) {
struct tcp_accept_data* data = NULL;
netio_handler_type* handler = NULL;
data = (struct tcp_accept_data*) allocator_alloc(
dnshandler->allocator, sizeof(struct tcp_accept_data));
if (!data) {
ods_log_error("[%s] unable to start: allocator_alloc() "
"failed", dnsh_str);
dnshandler->thread_id = 0;
engine->need_to_exit = 1;
return;
}
data->engine = dnshandler->engine;
data->socket = &dnshandler->socklist->udp[i];
data->tcp_accept_handler_count = dnshandler->interfaces->count;
data->tcp_accept_handlers = tcp_accept_handlers;
handler = &tcp_accept_handlers[i];
handler->fd = dnshandler->socklist->tcp[i].s;
handler->timeout = NULL;
handler->user_data = data;
handler->event_types = NETIO_EVENT_READ;
handler->event_handler = sock_handle_tcp_accept;
ods_log_debug("[%s] add tcp network handler fd %u", dnsh_str,
(unsigned) handler->fd);
netio_add_handler(dnshandler->netio, handler);
}
/* service */
while (dnshandler->need_to_exit == 0) {
ods_log_deeebug("[%s] netio dispatch", dnsh_str);
if (netio_dispatch(dnshandler->netio, NULL, NULL) == -1) {
if (errno != EINTR) {
ods_log_error("[%s] unable to dispatch netio: %s", dnsh_str,
strerror(errno));
break;
}
}
}
/* shutdown */
ods_log_debug("[%s] shutdown", dnsh_str);
for (i=0; i < dnshandler->interfaces->count; i++) {
if (dnshandler->socklist->udp[i].s != -1) {
close(dnshandler->socklist->udp[i].s);
freeaddrinfo((void*)dnshandler->socklist->udp[i].addr);
}
if (dnshandler->socklist->tcp[i].s != -1) {
close(dnshandler->socklist->tcp[i].s);
freeaddrinfo((void*)dnshandler->socklist->tcp[i].addr);
}
}
return;
}
/**
* Signal dns handler.
*
*/
void
dnshandler_signal(dnshandler_type* dnshandler)
{
if (dnshandler && dnshandler->thread_id) {
ods_thread_kill(dnshandler->thread_id, SIGHUP);
}
return;
}
/**
* Forward notify to zone transfer handler.
*
*/
void
dnshandler_fwd_notify(dnshandler_type* dnshandler, uint8_t* pkt, size_t len)
{
ssize_t nb = 0;
ods_log_assert(dnshandler);
ods_log_assert(pkt);
nb = send(dnshandler->xfrhandler.fd, (const void*) pkt, len, 0);
if (nb < 0) {
ods_log_error("[%s] unable to forward notify: send() failed (%s)",
dnsh_str, strerror(errno));
} else {
ods_log_debug("[%s] forwarded notify: %u bytes sent", dnsh_str, nb);
}
return;
}
/**
* Handle forwarded dns packets.
*
*/
static void
dnshandler_handle_xfr(netio_type* ATTR_UNUSED(netio),
netio_handler_type* handler, netio_events_type event_types)
{
dnshandler_type* dnshandler = NULL;
uint8_t buf[MAX_PACKET_SIZE];
ssize_t received = 0;
if (!handler) {
return;
}
dnshandler = (dnshandler_type*) handler->user_data;
ods_log_assert(event_types & NETIO_EVENT_READ);
ods_log_debug("[%s] read forwarded xfr packet", dnsh_str);
received = read(dnshandler->xfrhandler.fd, &buf, MAX_PACKET_SIZE);
if (received == -1) {
ods_log_debug("[%s] unable to forward xfr packet: %s", dnsh_str,
strerror(errno));
}
return;
}
/**
* Cleanup dns handler.
*
*/
void
dnshandler_cleanup(dnshandler_type* dnshandler)
{
allocator_type* allocator = NULL;
if (!dnshandler) {
return;
}
allocator = dnshandler->allocator;
netio_cleanup(dnshandler->netio);
query_cleanup(dnshandler->query);
allocator_deallocate(allocator, (void*) dnshandler->socklist);
allocator_deallocate(allocator, (void*) dnshandler);
return;
}
opendnssec-1.4.3/signer/src/daemon/xfrhandler.h 0000664 0001750 0001750 00000006313 11750500440 016431 0000000 0000000 /*
* $Id: xfrhandler.h 4518 2011-02-24 15:39:09Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Zone transfer handler.
*
*/
#ifndef DAEMON_XFRHANDLER_H
#define DAEMON_XFRHANDLER_H
#include "config.h"
#include "shared/allocator.h"
#include "shared/locks.h"
#include "wire/buffer.h"
#include "wire/netio.h"
#include "wire/notify.h"
#include "wire/tcpset.h"
#include "wire/xfrd.h"
/**
* Zone transfer handler.
*
*/
typedef struct xfrhandler_struct xfrhandler_type;
struct xfrhandler_struct {
allocator_type* allocator;
/* Engine reference */
ods_thread_type thread_id;
void* engine;
/* Start time */
time_t start_time;
time_t current_time;
/* Network support */
netio_type* netio;
tcp_set_type* tcp_set;
buffer_type* packet;
xfrd_type* udp_waiting_first;
xfrd_type* udp_waiting_last;
size_t udp_use_num;
notify_type* notify_waiting_first;
notify_type* notify_waiting_last;
int notify_udp_num;
netio_handler_type dnshandler;
unsigned got_time : 1;
unsigned need_to_exit : 1;
unsigned started : 1;
};
/**
* Create zone transfer handler.
* \param[in] allocator memory allocator
* \return xfrhandler_type* created zoned transfer handler
*
*/
xfrhandler_type* xfrhandler_create(allocator_type* allocator);
/**
* Start zone transfer handler.
* \param[in] xfrhandler_type* zone transfer handler
*
*/
void xfrhandler_start(xfrhandler_type* xfrhandler);
/**
* Get current time from the zone transfer handler.
* \param[in] xfrhandler_type* zone transfer handler
* \return time_t current time
*
*/
time_t xfrhandler_time(xfrhandler_type* xfrhandler);
/**
* Signal zone transfer handler.
* \param[in] xfrhandler_type* zone transfer handler
*
*/
void xfrhandler_signal(xfrhandler_type* xfrhandler);
/**
* Cleanup zone transfer handler.
* \param[in] xfrhandler_type* zone transfer handler
*
*/
void xfrhandler_cleanup(xfrhandler_type* xfrhandler);
#endif /* DAEMON_XFRHANDLER_H */
opendnssec-1.4.3/signer/src/daemon/cfg.h 0000664 0001750 0001750 00000006053 11665414566 015056 0000000 0000000 /*
* $Id: cfg.h 5945 2011-11-30 11:54:30Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Signer engine configuration.
*
*/
#ifndef DAEMON_CONFIG_H
#define DAEMON_CONFIG_H
#include "config.h"
#include "shared/allocator.h"
#include "shared/locks.h"
#include "shared/status.h"
#include "wire/listener.h"
#include
/**
* Engine configuration.
*
*/
typedef struct engineconfig_struct engineconfig_type;
struct engineconfig_struct {
allocator_type* allocator;
listener_type* interfaces;
const char* cfg_filename;
const char* zonelist_filename;
const char* log_filename;
const char* pid_filename;
const char* notify_command;
const char* clisock_filename;
const char* working_dir;
const char* username;
const char* group;
const char* chroot;
int use_syslog;
int num_worker_threads;
int num_signer_threads;
int verbosity;
};
/**
* Configure engine.
* \param[in] allocator memory allocator
* \param[in] cfgfile config file
* \param[in] cmdline_verbosity log level
* \return engineconfig_type* engine configuration
*
*/
engineconfig_type* engine_config(allocator_type* allocator,
const char* cfgfile, int cmdline_verbosity);
/**
* Check configuration.
* \param[in] config engine configuration
* \return ods_status status
* ODS_STATUS_OK: configuration settings ok
* else: error in configuration settings
*
*/
ods_status engine_config_check(engineconfig_type* config);
/**
* Print engine configuration.
* \param[in] out output file descriptor
* \param[in] config engine configuration
*
*/
void engine_config_print(FILE* out, engineconfig_type* config);
/**
* Clean up config.
* \param[in] config engine configuration
*
*/
void engine_config_cleanup(engineconfig_type* config);
#endif /* DAEMON_CONFIG_H */
opendnssec-1.4.3/signer/src/daemon/cmdhandler.c 0000664 0001750 0001750 00000076616 12243342572 016415 0000000 0000000 /*
* $Id: cmdhandler.c 7416 2013-11-21 08:34:02Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Command handler.
*
*/
#include "daemon/cmdhandler.h"
#include "daemon/engine.h"
#include "shared/allocator.h"
#include "shared/file.h"
#include "shared/locks.h"
#include "shared/log.h"
#include "shared/status.h"
#include "shared/util.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifdef HAVE_SYS_TYPES_H
# include
#endif
#include
/* According to earlier standards: select() sys/time.h sys/types.h unistd.h */
#include
#include
#define SE_CMDH_CMDLEN 7
#ifndef SUN_LEN
#define SUN_LEN(su) (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
#endif
static int count = 0;
static char* cmdh_str = "cmdhandler";
/**
* Handle the 'help' command.
*
*/
static void
cmdhandler_handle_cmd_help(int sockfd)
{
char buf[ODS_SE_MAXLINE];
(void) snprintf(buf, ODS_SE_MAXLINE,
"Commands:\n"
"zones Show the currently known zones.\n"
"sign [--serial ] Read zone and schedule for immediate "
"(re-)sign.\n"
" If a serial is given, that serial is used "
"in the output zone.\n"
"sign --all Read all zones and schedule all for "
"immediate (re-)sign.\n"
);
ods_writen(sockfd, buf, strlen(buf));
(void) snprintf(buf, ODS_SE_MAXLINE,
"clear Delete the internal storage of this "
"zone.\n"
" All signatures will be regenerated "
"on the next re-sign.\n"
"queue Show the current task queue.\n"
"flush Execute all scheduled tasks "
"immediately.\n"
);
ods_writen(sockfd, buf, strlen(buf));
(void) snprintf(buf, ODS_SE_MAXLINE,
"update Update this zone signer "
"configurations.\n"
"update [--all] Update zone list and all signer "
"configurations.\n"
"start Start the engine.\n"
"running Check if the engine is running.\n"
"reload Reload the engine.\n"
"stop Stop the engine.\n"
"verbosity Set verbosity.\n"
);
ods_writen(sockfd, buf, strlen(buf));
return;
}
/**
* Handle the 'zones' command.
*
*/
static void
cmdhandler_handle_cmd_zones(int sockfd, cmdhandler_type* cmdc)
{
engine_type* engine = NULL;
char buf[ODS_SE_MAXLINE];
size_t i;
ldns_rbnode_t* node = LDNS_RBTREE_NULL;
zone_type* zone = NULL;
ods_log_assert(cmdc);
ods_log_assert(cmdc->engine);
engine = (engine_type*) cmdc->engine;
if (!engine->zonelist || !engine->zonelist->zones) {
(void)snprintf(buf, ODS_SE_MAXLINE, "I have no zones configured\n");
ods_writen(sockfd, buf, strlen(buf));
return;
}
/* how many zones */
lock_basic_lock(&engine->zonelist->zl_lock);
(void)snprintf(buf, ODS_SE_MAXLINE, "I have %i zones configured\n",
(int) engine->zonelist->zones->count);
ods_writen(sockfd, buf, strlen(buf));
/* list zones */
node = ldns_rbtree_first(engine->zonelist->zones);
while (node && node != LDNS_RBTREE_NULL) {
zone = (zone_type*) node->data;
for (i=0; i < ODS_SE_MAXLINE; i++) {
buf[i] = 0;
}
(void)snprintf(buf, ODS_SE_MAXLINE, "- %s\n", zone->name);
ods_writen(sockfd, buf, strlen(buf));
node = ldns_rbtree_next(node);
}
lock_basic_unlock(&engine->zonelist->zl_lock);
return;
}
/**
* Handle the 'update' command.
*
*/
static void
cmdhandler_handle_cmd_update(int sockfd, cmdhandler_type* cmdc,
const char* tbd)
{
engine_type* engine = NULL;
char buf[ODS_SE_MAXLINE];
ods_status status = ODS_STATUS_OK;
zone_type* zone = NULL;
ods_status zl_changed = ODS_STATUS_OK;
ods_log_assert(tbd);
ods_log_assert(cmdc);
ods_log_assert(cmdc->engine);
engine = (engine_type*) cmdc->engine;
ods_log_assert(engine->taskq);
if (ods_strcmp(tbd, "--all") == 0) {
lock_basic_lock(&engine->zonelist->zl_lock);
zl_changed = zonelist_update(engine->zonelist,
engine->config->zonelist_filename);
if (zl_changed == ODS_STATUS_UNCHANGED) {
(void)snprintf(buf, ODS_SE_MAXLINE, "Zone list has not changed."
" Signer configurations updated.\n");
ods_writen(sockfd, buf, strlen(buf));
} else if (zl_changed == ODS_STATUS_OK) {
(void)snprintf(buf, ODS_SE_MAXLINE, "Zone list updated: %i "
"removed, %i added, %i updated.\n",
engine->zonelist->just_removed,
engine->zonelist->just_added,
engine->zonelist->just_updated);
ods_writen(sockfd, buf, strlen(buf));
} else {
lock_basic_unlock(&engine->zonelist->zl_lock);
(void)snprintf(buf, ODS_SE_MAXLINE, "Zone list has errors.\n");
ods_writen(sockfd, buf, strlen(buf));
}
if (zl_changed == ODS_STATUS_OK ||
zl_changed == ODS_STATUS_UNCHANGED) {
engine->zonelist->just_removed = 0;
engine->zonelist->just_added = 0;
engine->zonelist->just_updated = 0;
lock_basic_unlock(&engine->zonelist->zl_lock);
/**
* Always update the signconf for zones, even if zonelist has
* not changed: ODS_STATUS_OK.
*/
engine_update_zones(engine, ODS_STATUS_OK);
}
return;
} else {
/* look up zone */
lock_basic_lock(&engine->zonelist->zl_lock);
zone = zonelist_lookup_zone_by_name(engine->zonelist, tbd,
LDNS_RR_CLASS_IN);
/* If this zone is just added, don't update (it might not have a
* task yet) */
if (zone && zone->zl_status == ZONE_ZL_ADDED) {
zone = NULL;
}
lock_basic_unlock(&engine->zonelist->zl_lock);
if (!zone) {
(void)snprintf(buf, ODS_SE_MAXLINE, "Error: Zone %s not found.\n",
tbd);
ods_writen(sockfd, buf, strlen(buf));
/* update all */
cmdhandler_handle_cmd_update(sockfd, cmdc, "--all");
return;
}
lock_basic_lock(&zone->zone_lock);
status = zone_reschedule_task(zone, engine->taskq, TASK_SIGNCONF);
lock_basic_unlock(&zone->zone_lock);
if (status != ODS_STATUS_OK) {
(void)snprintf(buf, ODS_SE_MAXLINE, "Error: Unable to reschedule "
"task for zone %s.\n", tbd);
ods_writen(sockfd, buf, strlen(buf));
ods_log_crit("[%s] unable to reschedule task for zone %s: %s",
cmdh_str, zone->name, ods_status2str(status));
} else {
(void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s config being updated.\n",
tbd);
ods_writen(sockfd, buf, strlen(buf));
ods_log_verbose("[%s] zone %s scheduled for immediate update signconf",
cmdh_str, tbd);
engine_wakeup_workers(engine);
}
}
return;
}
static uint32_t
max(uint32_t a, uint32_t b)
{
return (aengine);
engine = (engine_type*) cmdc->engine;
ods_log_assert(engine->taskq);
if (ods_strcmp(tbd, "--all") == 0) {
lock_basic_lock(&engine->taskq->schedule_lock);
schedule_flush(engine->taskq, TASK_READ);
lock_basic_unlock(&engine->taskq->schedule_lock);
engine_wakeup_workers(engine);
(void)snprintf(buf, ODS_SE_MAXLINE, "All zones scheduled for "
"immediate re-sign.\n");
ods_writen(sockfd, buf, strlen(buf));
ods_log_verbose("[%s] all zones scheduled for immediate re-sign",
cmdh_str);
return;
} else {
char* delim1 = strchr(tbd, ' ');
char* delim2 = NULL;
int force_serial = 0;
uint32_t serial = 0;
if (delim1) {
char* end = NULL;
/** Some trailing text, could it be --serial? */
if (strncmp(delim1+1, "--serial ", 9) != 0) {
(void)snprintf(buf, ODS_SE_MAXLINE, "Error: Expecting "
"--serial , got %s.\n", tbd);
ods_writen(sockfd, buf, strlen(buf));
return;
}
delim2 = strchr(delim1+1, ' ');
if (!delim2) {
(void)snprintf(buf, ODS_SE_MAXLINE, "Error: Expecting serial.\n");
ods_writen(sockfd, buf, strlen(buf));
return;
}
serial = (uint32_t) strtol(delim2+1, &end, 10);
if (*end != '\0') {
(void)snprintf(buf, ODS_SE_MAXLINE, "Error: Expecting serial, "
"got %s.\n", delim2+1);
ods_writen(sockfd, buf, strlen(buf));
return;
}
force_serial = 1;
*delim1 = '\0';
}
lock_basic_lock(&engine->zonelist->zl_lock);
zone = zonelist_lookup_zone_by_name(engine->zonelist, tbd,
LDNS_RR_CLASS_IN);
/* If this zone is just added, don't update (it might not have a task
* yet).
*/
if (zone && zone->zl_status == ZONE_ZL_ADDED) {
zone = NULL;
}
lock_basic_unlock(&engine->zonelist->zl_lock);
if (!zone) {
(void)snprintf(buf, ODS_SE_MAXLINE, "Error: Zone %s not found.\n",
tbd);
ods_writen(sockfd, buf, strlen(buf));
return;
}
lock_basic_lock(&zone->zone_lock);
if (force_serial) {
ods_log_assert(zone->db);
if (!util_serial_gt(serial, max(zone->db->outserial,
zone->db->inbserial))) {
lock_basic_unlock(&zone->zone_lock);
(void)snprintf(buf, ODS_SE_MAXLINE, "Error: Unable to enforce "
"serial %u for zone %s.\n", serial, tbd);
ods_writen(sockfd, buf, strlen(buf));
return;
}
zone->db->altserial = serial;
zone->db->force_serial = 1;
}
status = zone_reschedule_task(zone, engine->taskq, TASK_READ);
lock_basic_unlock(&zone->zone_lock);
if (status != ODS_STATUS_OK) {
(void)snprintf(buf, ODS_SE_MAXLINE, "Error: Unable to reschedule "
"task for zone %s.\n", tbd);
ods_writen(sockfd, buf, strlen(buf));
ods_log_crit("[%s] unable to reschedule task for zone %s: %s",
cmdh_str, zone->name, ods_status2str(status));
} else {
(void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s scheduled for "
"immediate re-sign.\n", tbd);
ods_writen(sockfd, buf, strlen(buf));
ods_log_verbose("[%s] zone %s scheduled for immediate re-sign",
cmdh_str, tbd);
engine_wakeup_workers(engine);
}
}
return;
}
/**
* Unlink backup file.
*
*/
static void
unlink_backup_file(const char* filename, const char* extension)
{
char* tmpname = ods_build_path(filename, extension, 0, 1);
if (tmpname) {
ods_log_debug("[%s] unlink file %s", cmdh_str, tmpname);
unlink(tmpname);
free((void*)tmpname);
}
return;
}
/**
* Handle the 'clear' command.
*
*/
static void
cmdhandler_handle_cmd_clear(int sockfd, cmdhandler_type* cmdc, const char* tbd)
{
ods_status status = ODS_STATUS_OK;
engine_type* engine = NULL;
char buf[ODS_SE_MAXLINE];
zone_type* zone = NULL;
task_type* task = NULL;
uint32_t inbserial = 0;
uint32_t intserial = 0;
uint32_t outserial = 0;
ods_log_assert(tbd);
ods_log_assert(cmdc);
ods_log_assert(cmdc->engine);
engine = (engine_type*) cmdc->engine;
unlink_backup_file(tbd, ".inbound");
unlink_backup_file(tbd, ".backup");
unlink_backup_file(tbd, ".axfr");
unlink_backup_file(tbd, ".ixfr");
lock_basic_lock(&engine->zonelist->zl_lock);
zone = zonelist_lookup_zone_by_name(engine->zonelist, tbd,
LDNS_RR_CLASS_IN);
lock_basic_unlock(&engine->zonelist->zl_lock);
if (zone) {
lock_basic_lock(&zone->zone_lock);
inbserial = zone->db->inbserial;
intserial = zone->db->intserial;
outserial = zone->db->outserial;
namedb_cleanup(zone->db);
ixfr_cleanup(zone->ixfr);
signconf_cleanup(zone->signconf);
zone->db = namedb_create((void*)zone);
zone->ixfr = ixfr_create((void*)zone);
zone->signconf = signconf_create();
if (!zone->signconf || !zone->ixfr || !zone->db) {
ods_fatal_exit("[%s] unable to clear zone %s: failed to recreate"
"signconf, ixfr of db structure (out of memory?)", cmdh_str, tbd);
return;
}
/* restore serial management */
zone->db->inbserial = inbserial;
zone->db->intserial = intserial;
zone->db->outserial = outserial;
zone->db->have_serial = 1;
status = zone_reschedule_task(zone, engine->taskq, TASK_SIGNCONF);
lock_basic_unlock(&zone->zone_lock);
if (status != ODS_STATUS_OK) {
(void)snprintf(buf, ODS_SE_MAXLINE, "Error: Unable to reschedule "
"task for zone %s.\n", tbd);
ods_log_crit("[%s] unable to reschedule task for zone %s: %s",
cmdh_str, zone->name, ods_status2str(status));
} else {
(void)snprintf(buf, ODS_SE_MAXLINE, "Internal zone information about "
"%s cleared", tbd?tbd:"(null)");
ods_log_info("[%s] internal zone information about %s cleared",
cmdh_str, tbd?tbd:"(null)");
}
} else {
(void)snprintf(buf, ODS_SE_MAXLINE, "Cannot clear zone %s, zone not "
"found", tbd?tbd:"(null)");
ods_log_warning("[%s] cannot clear zone %s, zone not found",
cmdh_str, tbd?tbd:"(null)");
}
ods_writen(sockfd, buf, strlen(buf));
return;
}
/**
* Handle the 'queue' command.
*
*/
static void
cmdhandler_handle_cmd_queue(int sockfd, cmdhandler_type* cmdc)
{
engine_type* engine = NULL;
char* strtime = NULL;
char buf[ODS_SE_MAXLINE];
size_t i = 0;
time_t now = 0;
ldns_rbnode_t* node = LDNS_RBTREE_NULL;
task_type* task = NULL;
ods_log_assert(cmdc);
ods_log_assert(cmdc->engine);
engine = (engine_type*) cmdc->engine;
if (!engine->taskq || !engine->taskq->tasks) {
(void)snprintf(buf, ODS_SE_MAXLINE, "I have no tasks scheduled.\n");
ods_writen(sockfd, buf, strlen(buf));
return;
}
/* current time */
now = time_now();
strtime = ctime(&now);
(void)snprintf(buf, ODS_SE_MAXLINE, "It is now %s",
strtime?strtime:"(null)");
ods_writen(sockfd, buf, strlen(buf));
/* current work */
lock_basic_lock(&engine->taskq->schedule_lock);
for (i=0; i < (size_t) engine->config->num_worker_threads; i++) {
task = engine->workers[i]->task;
if (task) {
(void)snprintf(buf, ODS_SE_MAXLINE, "Working with task %s on "
"zone %s\n",
task_what2str(engine->workers[i]->working_with),
task_who2str(task));
ods_writen(sockfd, buf, strlen(buf));
}
}
/* how many tasks */
(void)snprintf(buf, ODS_SE_MAXLINE, "\nI have %i tasks scheduled.\n",
(int) engine->taskq->tasks->count);
ods_writen(sockfd, buf, strlen(buf));
/* list tasks */
node = ldns_rbtree_first(engine->taskq->tasks);
while (node && node != LDNS_RBTREE_NULL) {
task = (task_type*) node->data;
for (i=0; i < ODS_SE_MAXLINE; i++) {
buf[i] = 0;
}
(void)task2str(task, (char*) &buf[0]);
ods_writen(sockfd, buf, strlen(buf));
node = ldns_rbtree_next(node);
}
lock_basic_unlock(&engine->taskq->schedule_lock);
return;
}
/**
* Handle the 'flush' command.
*
*/
static void
cmdhandler_handle_cmd_flush(int sockfd, cmdhandler_type* cmdc)
{
engine_type* engine = NULL;
char buf[ODS_SE_MAXLINE];
ods_log_assert(cmdc);
ods_log_assert(cmdc->engine);
engine = (engine_type*) cmdc->engine;
ods_log_assert(engine->taskq);
lock_basic_lock(&engine->taskq->schedule_lock);
schedule_flush(engine->taskq, TASK_NONE);
lock_basic_unlock(&engine->taskq->schedule_lock);
engine_wakeup_workers(engine);
(void)snprintf(buf, ODS_SE_MAXLINE, "All tasks scheduled immediately.\n");
ods_writen(sockfd, buf, strlen(buf));
ods_log_verbose("[%s] all tasks scheduled immediately", cmdh_str);
return;
}
/**
* Handle the 'reload' command.
*
*/
static void
cmdhandler_handle_cmd_reload(int sockfd, cmdhandler_type* cmdc)
{
engine_type* engine = NULL;
char buf[ODS_SE_MAXLINE];
ods_log_assert(cmdc);
ods_log_assert(cmdc->engine);
engine = (engine_type*) cmdc->engine;
engine->need_to_reload = 1;
lock_basic_lock(&engine->signal_lock);
lock_basic_alarm(&engine->signal_cond);
lock_basic_unlock(&engine->signal_lock);
(void)snprintf(buf, ODS_SE_MAXLINE, "Reloading engine.\n");
ods_writen(sockfd, buf, strlen(buf));
return;
}
/**
* Handle the 'stop' command.
*
*/
static void
cmdhandler_handle_cmd_stop(int sockfd, cmdhandler_type* cmdc)
{
engine_type* engine = NULL;
char buf[ODS_SE_MAXLINE];
ods_log_assert(cmdc);
ods_log_assert(cmdc->engine);
engine = (engine_type*) cmdc->engine;
engine->need_to_exit = 1;
lock_basic_lock(&engine->signal_lock);
lock_basic_alarm(&engine->signal_cond);
lock_basic_unlock(&engine->signal_lock);
(void)snprintf(buf, ODS_SE_MAXLINE, ODS_SE_STOP_RESPONSE);
ods_writen(sockfd, buf, strlen(buf));
return;
}
/**
* Handle the 'start' command.
*
*/
static void
cmdhandler_handle_cmd_start(int sockfd)
{
char buf[ODS_SE_MAXLINE];
(void)snprintf(buf, ODS_SE_MAXLINE, "Engine already running.\n");
ods_writen(sockfd, buf, strlen(buf));
return;
}
/**
* Handle the 'running' command.
*
*/
static void
cmdhandler_handle_cmd_running(int sockfd)
{
char buf[ODS_SE_MAXLINE];
(void)snprintf(buf, ODS_SE_MAXLINE, "Engine running.\n");
ods_writen(sockfd, buf, strlen(buf));
return;
}
/**
* Handle the 'verbosity' command.
*
*/
static void
cmdhandler_handle_cmd_verbosity(int sockfd, cmdhandler_type* cmdc, int val)
{
engine_type* engine = NULL;
char buf[ODS_SE_MAXLINE];
ods_log_assert(cmdc);
ods_log_assert(cmdc->engine);
engine = (engine_type*) cmdc->engine;
ods_log_assert(engine->config);
ods_log_init(engine->config->log_filename, engine->config->use_syslog,
val);
(void)snprintf(buf, ODS_SE_MAXLINE, "Verbosity level set to %i.\n", val);
ods_writen(sockfd, buf, strlen(buf));
return;
}
/**
* Handle erroneous command.
*
*/
static void
cmdhandler_handle_cmd_error(int sockfd, const char* str)
{
char buf[ODS_SE_MAXLINE];
(void)snprintf(buf, ODS_SE_MAXLINE, "Error: %s.\n", str?str:"(null)");
ods_writen(sockfd, buf, strlen(buf));
return;
}
/**
* Handle unknown command.
*
*/
static void
cmdhandler_handle_cmd_unknown(int sockfd, const char* str)
{
char buf[ODS_SE_MAXLINE];
(void)snprintf(buf, ODS_SE_MAXLINE, "Unknown command %s.\n",
str?str:"(null)");
ods_writen(sockfd, buf, strlen(buf));
return;
}
/**
* Handle not implemented.
*
static void
cmdhandler_handle_cmd_notimpl(int sockfd, const char* str)
{
char buf[ODS_SE_MAXLINE];
(void)snprintf(buf, ODS_SE_MAXLINE, "Command %s not implemented.\n", str);
ods_writen(sockfd, buf, strlen(buf));
return;
}
*/
/**
* Handle client command.
*
*/
static void
cmdhandler_handle_cmd(cmdhandler_type* cmdc)
{
ssize_t n = 0;
int sockfd = 0;
char buf[ODS_SE_MAXLINE];
ods_log_assert(cmdc);
sockfd = cmdc->client_fd;
again:
while ((n = read(sockfd, buf, ODS_SE_MAXLINE)) > 0) {
/* what if this number is smaller than the number of bytes requested? */
buf[n-1] = '\0';
n--;
ods_log_verbose("[%s] received command %s[%i]", cmdh_str, buf, n);
ods_str_trim(buf);
n = strlen(buf);
if (n == 4 && strncmp(buf, "help", n) == 0) {
ods_log_debug("[%s] help command", cmdh_str);
cmdhandler_handle_cmd_help(sockfd);
} else if (n == 5 && strncmp(buf, "zones", n) == 0) {
ods_log_debug("[%s] list zones command", cmdh_str);
cmdhandler_handle_cmd_zones(sockfd, cmdc);
} else if (n >= 4 && strncmp(buf, "sign", 4) == 0) {
ods_log_debug("[%s] sign zone command", cmdh_str);
if (buf[4] == '\0') {
/* NOTE: wouldn't it be nice that we default to --all? */
cmdhandler_handle_cmd_error(sockfd, "sign command needs "
"an argument (either '--all' or a zone name)");
} else if (buf[4] != ' ') {
cmdhandler_handle_cmd_unknown(sockfd, buf);
} else {
cmdhandler_handle_cmd_sign(sockfd, cmdc, &buf[5]);
}
} else if (n >= 5 && strncmp(buf, "clear", 5) == 0) {
ods_log_debug("[%s] clear zone command", cmdh_str);
if (buf[5] == '\0') {
cmdhandler_handle_cmd_error(sockfd, "clear command needs "
"a zone name");
} else if (buf[5] != ' ') {
cmdhandler_handle_cmd_unknown(sockfd, buf);
} else {
cmdhandler_handle_cmd_clear(sockfd, cmdc, &buf[6]);
}
} else if (n == 5 && strncmp(buf, "queue", n) == 0) {
ods_log_debug("[%s] list tasks command", cmdh_str);
cmdhandler_handle_cmd_queue(sockfd, cmdc);
} else if (n == 5 && strncmp(buf, "flush", n) == 0) {
ods_log_debug("[%s] flush tasks command", cmdh_str);
cmdhandler_handle_cmd_flush(sockfd, cmdc);
} else if (n >= 6 && strncmp(buf, "update", 6) == 0) {
ods_log_debug("[%s] update command", cmdh_str);
if (buf[6] == '\0') {
cmdhandler_handle_cmd_update(sockfd, cmdc, "--all");
} else if (buf[6] != ' ') {
cmdhandler_handle_cmd_unknown(sockfd, buf);
} else {
cmdhandler_handle_cmd_update(sockfd, cmdc, &buf[7]);
}
} else if (n == 4 && strncmp(buf, "stop", n) == 0) {
ods_log_debug("[%s] shutdown command", cmdh_str);
cmdhandler_handle_cmd_stop(sockfd, cmdc);
return;
} else if (n == 5 && strncmp(buf, "start", n) == 0) {
ods_log_debug("[%s] start command", cmdh_str);
cmdhandler_handle_cmd_start(sockfd);
} else if (n == 6 && strncmp(buf, "reload", n) == 0) {
ods_log_debug("[%s] reload command", cmdh_str);
cmdhandler_handle_cmd_reload(sockfd, cmdc);
} else if (n == 7 && strncmp(buf, "running", n) == 0) {
ods_log_debug("[%s] running command", cmdh_str);
cmdhandler_handle_cmd_running(sockfd);
} else if (n >= 9 && strncmp(buf, "verbosity", 9) == 0) {
ods_log_debug("[%s] verbosity command", cmdh_str);
if (buf[9] == '\0') {
cmdhandler_handle_cmd_error(sockfd, "verbosity command "
"an argument (verbosity level)");
} else if (buf[9] != ' ') {
cmdhandler_handle_cmd_unknown(sockfd, buf);
} else {
cmdhandler_handle_cmd_verbosity(sockfd, cmdc, atoi(&buf[10]));
}
} else if (n > 0) {
ods_log_debug("[%s] unknown command", cmdh_str);
cmdhandler_handle_cmd_unknown(sockfd, buf);
}
ods_log_debug("[%s] done handling command %s[%i]", cmdh_str, buf, n);
(void)snprintf(buf, SE_CMDH_CMDLEN, "\ncmd> ");
ods_writen(sockfd, buf, strlen(buf));
}
if (n < 0 && (errno == EINTR || errno == EWOULDBLOCK || errno == EAGAIN) ) {
goto again;
} else if (n < 0 && errno == ECONNRESET) {
ods_log_debug("[%s] done handling client: %s", cmdh_str,
strerror(errno));
} else if (n < 0 ) {
ods_log_error("[%s] read error: %s", cmdh_str, strerror(errno));
}
return;
}
/**
* Accept client.
*
*/
static void*
cmdhandler_accept_client(void* arg)
{
cmdhandler_type* cmdc = (cmdhandler_type*) arg;
ods_thread_blocksigs();
ods_thread_detach(cmdc->thread_id);
ods_log_debug("[%s] accept client %i", cmdh_str, cmdc->client_fd);
cmdhandler_handle_cmd(cmdc);
if (cmdc->client_fd) {
shutdown(cmdc->client_fd, SHUT_RDWR);
close(cmdc->client_fd);
}
free(cmdc);
count--;
return NULL;
}
/**
* Create command handler.
*
*/
cmdhandler_type*
cmdhandler_create(allocator_type* allocator, const char* filename)
{
cmdhandler_type* cmdh = NULL;
struct sockaddr_un servaddr;
int listenfd = 0;
int flags = 0;
int ret = 0;
if (!allocator || !filename) {
return NULL;
}
/* new socket */
ods_log_debug("[%s] create socket %s", cmdh_str, filename);
listenfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (listenfd < 0) {
ods_log_error("[%s] unable to create cmdhandler: "
"socket() failed (%s)", cmdh_str, strerror(errno));
return NULL;
}
/* set it to non-blocking */
flags = fcntl(listenfd, F_GETFL, 0);
if (flags < 0) {
ods_log_error("[%s] unable to create cmdhandler: "
"fcntl(F_GETFL) failed (%s)", cmdh_str, strerror(errno));
close(listenfd);
return NULL;
}
flags |= O_NONBLOCK;
if (fcntl(listenfd, F_SETFL, flags) < 0) {
ods_log_error("[%s] unable to create cmdhandler: "
"fcntl(F_SETFL) failed (%s)", cmdh_str, strerror(errno));
close(listenfd);
return NULL;
}
/* no surprises so far */
if (filename) {
(void)unlink(filename);
}
bzero(&servaddr, sizeof(servaddr));
servaddr.sun_family = AF_UNIX;
strncpy(servaddr.sun_path, filename, sizeof(servaddr.sun_path) - 1);
#ifdef HAVE_SOCKADDR_SUN_LEN
servaddr.sun_len = strlen(servaddr.sun_path);
#endif
/* bind and listen... */
ret = bind(listenfd, (const struct sockaddr*) &servaddr,
SUN_LEN(&servaddr));
if (ret != 0) {
ods_log_error("[%s] unable to create cmdhandler: "
"bind() failed (%s)", cmdh_str, strerror(errno));
close(listenfd);
return NULL;
}
ret = listen(listenfd, ODS_SE_MAX_HANDLERS);
if (ret != 0) {
ods_log_error("[%s] unable to create cmdhandler: "
"listen() failed (%s)", cmdh_str, strerror(errno));
close(listenfd);
return NULL;
}
/* all ok */
cmdh = (cmdhandler_type*) allocator_alloc(allocator,
sizeof(cmdhandler_type));
if (!cmdh) {
ods_log_error("[%s] unable to create cmdhandler: "
"allocator_alloc() failed", cmdh_str);
close(listenfd);
return NULL;
}
cmdh->allocator = allocator;
cmdh->listen_fd = listenfd;
cmdh->listen_addr = servaddr;
cmdh->need_to_exit = 0;
return cmdh;
}
/**
* Start command handler.
*
*/
void
cmdhandler_start(cmdhandler_type* cmdhandler)
{
struct sockaddr_un cliaddr;
socklen_t clilen;
cmdhandler_type* cmdc = NULL;
engine_type* engine = NULL;
fd_set rset;
int connfd = 0;
int ret = 0;
ods_log_assert(cmdhandler);
ods_log_assert(cmdhandler->engine);
ods_log_debug("[%s] start", cmdh_str);
engine = (engine_type*) cmdhandler->engine;
ods_thread_detach(cmdhandler->thread_id);
FD_ZERO(&rset);
while (cmdhandler->need_to_exit == 0) {
clilen = sizeof(cliaddr);
FD_SET(cmdhandler->listen_fd, &rset);
ret = select(cmdhandler->listen_fd+1, &rset, NULL, NULL, NULL);
if (ret < 0) {
if (errno != EINTR && errno != EWOULDBLOCK) {
ods_log_warning("[%s] select() error: %s", cmdh_str,
strerror(errno));
}
continue;
}
if (FD_ISSET(cmdhandler->listen_fd, &rset)) {
connfd = accept(cmdhandler->listen_fd,
(struct sockaddr *) &cliaddr, &clilen);
if (connfd < 0) {
if (errno != EINTR && errno != EWOULDBLOCK) {
ods_log_warning("[%s] accept() error: %s", cmdh_str,
strerror(errno));
}
continue;
}
/* client accepted, create new thread */
cmdc = (cmdhandler_type*) malloc(sizeof(cmdhandler_type));
if (!cmdc) {
ods_log_crit("[%s] unable to create thread for client: "
"malloc() failed", cmdh_str);
cmdhandler->need_to_exit = 1;
break;
}
cmdc->listen_fd = cmdhandler->listen_fd;
cmdc->client_fd = connfd;
cmdc->listen_addr = cmdhandler->listen_addr;
cmdc->engine = cmdhandler->engine;
cmdc->need_to_exit = cmdhandler->need_to_exit;
ods_thread_create(&cmdc->thread_id, &cmdhandler_accept_client,
(void*) cmdc);
count++;
ods_log_debug("[%s] %i clients in progress...", cmdh_str, count);
}
}
ods_log_debug("[%s] shutdown", cmdh_str);
engine = cmdhandler->engine;
engine->cmdhandler_done = 1;
return;
}
/**
* Cleanup command handler.
*
*/
void
cmdhandler_cleanup(cmdhandler_type* cmdhandler)
{
allocator_type* allocator = NULL;
if (!cmdhandler) {
return;
}
allocator = cmdhandler->allocator;
allocator_deallocate(allocator, (void*) cmdhandler);
return;
}
opendnssec-1.4.3/signer/src/daemon/engine.h 0000664 0001750 0001750 00000006605 12120054051 015537 0000000 0000000 /*
* $Id: engine.h 7068 2013-03-13 10:42:49Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* The engine.
*
*/
#ifndef DAEMON_ENGINE_H
#define DAEMON_ENGINE_H
#include "config.h"
#include "daemon/cfg.h"
#include "daemon/cmdhandler.h"
#include "daemon/dnshandler.h"
#include "daemon/xfrhandler.h"
#include "daemon/worker.h"
#include "scheduler/fifoq.h"
#include "scheduler/schedule.h"
#include "shared/allocator.h"
#include "shared/locks.h"
#include "signer/zonelist.h"
#include "wire/edns.h"
#include
/**
* Engine stuff.
*
*/
typedef struct engine_struct engine_type;
struct engine_struct {
allocator_type* allocator;
engineconfig_type* config;
worker_type** workers;
worker_type** drudgers;
zonelist_type* zonelist;
schedule_type* taskq;
fifoq_type* signq;
cmdhandler_type* cmdhandler;
dnshandler_type* dnshandler;
xfrhandler_type* xfrhandler;
edns_data_type edns;
int cmdhandler_done;
pid_t pid;
uid_t uid;
gid_t gid;
int daemonize;
int need_to_exit;
int need_to_reload;
sig_atomic_t signal;
cond_basic_type signal_cond;
lock_basic_type signal_lock;
};
/**
* Start engine.
* \param[in] cfgfile configuration file
* \param[in] cmdline_verbosity how many -v on the command line
* \param[in] daemonize to run as daemon or not
* \param[in] info print info and exit
* \param[in] single_run run once
*
*/
void engine_start(const char* cfgfile, int cmdline_verbosity,
int daemonize, int info, int single_run);
/**
* Start drudgers.
* \param[in] engine engine
*
*/
void engine_start_drudgers(engine_type* engine);
/**
* Stop drudgers.
* \param[in] engine engine
*
*/
void engine_stop_drudgers(engine_type* engine);
/**
* Wake up workers.
* \param[in] engine engine
*
*/
void engine_wakeup_workers(engine_type* engine);
/**
* Update zones.
* \param[in] engine engine
* \param[in] zl_changed whether the zonelist has changed or not
*
*/
void engine_update_zones(engine_type* engine, ods_status zl_changed);
/**
* Clean up engine.
* \param[in] engine engine
*
*/
void engine_cleanup(engine_type* engine);
#endif /* DAEMON_ENGINE_H */
opendnssec-1.4.3/signer/src/daemon/signal.c 0000664 0001750 0001750 00000006154 11631156305 015554 0000000 0000000 /*
* $Id: signal.c 5548 2011-09-05 14:29:25Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Signal handling.
*
*/
#include "config.h"
#include "daemon/engine.h"
#include "daemon/signal.h"
#include "shared/locks.h"
#include "shared/log.h"
#include
static int signal_hup_recvd = 0;
static int signal_term_recvd = 0;
static engine_type* signal_engine = NULL;
static const char* signal_str = "signal";
/**
* Set corresponding engine.
*
*/
void
signal_set_engine(void* engine)
{
signal_engine = (engine_type*) engine;
return;
}
/**
* Handle signals.
*
*/
void
signal_handler(sig_atomic_t sig)
{
switch (sig) {
case SIGHUP:
ods_log_debug("[%s] SIGHUP received", signal_str);
signal_hup_recvd++;
if (signal_engine) {
lock_basic_lock(&signal_engine->signal_lock);
/* [LOCK] signal */
lock_basic_alarm(&signal_engine->signal_cond);
/* [UNLOCK] signal */
lock_basic_unlock(&signal_engine->signal_lock);
}
break;
case SIGTERM:
ods_log_debug("[%s] SIGTERM received", signal_str);
signal_term_recvd++;
if (signal_engine) {
lock_basic_lock(&signal_engine->signal_lock);
/* [LOCK] signal */
lock_basic_alarm(&signal_engine->signal_cond);
/* [UNLOCK] signal */
lock_basic_unlock(&signal_engine->signal_lock);
}
break;
default:
break;
}
return;
}
/**
* Capture signal.
*
*/
sig_atomic_t
signal_capture(sig_atomic_t dflsig)
{
if (signal_term_recvd) {
signal_term_recvd = 0;
return SIGNAL_SHUTDOWN;
} else if (signal_hup_recvd) {
signal_hup_recvd = 0;
return SIGNAL_RELOAD;
}
return dflsig;
}
opendnssec-1.4.3/signer/src/daemon/cmdhandler.h 0000664 0001750 0001750 00000004573 11665414566 016425 0000000 0000000 /*
* $Id: cmdhandler.h 5945 2011-11-30 11:54:30Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Command handler.
*
*/
#ifndef DAEMON_CMDHANDLER_H
#define DAEMON_CMDHANDLER_H
#include "config.h"
#include "shared/allocator.h"
#include "shared/locks.h"
#include
#define ODS_SE_MAX_HANDLERS 5
typedef struct cmdhandler_struct cmdhandler_type;
struct cmdhandler_struct {
allocator_type* allocator;
void* engine;
struct sockaddr_un listen_addr;
ods_thread_type thread_id;
int listen_fd;
int client_fd;
int need_to_exit;
};
/**
* Create command handler.
* \param[in] allocator memory allocator
* \param[in] filename socket file name
* \return cmdhandler_type* created command handler
*
*/
cmdhandler_type* cmdhandler_create(allocator_type* allocator,
const char* filename);
/**
* Start command handler.
* \param[in] cmdhandler_type* command handler
*
*/
void cmdhandler_start(cmdhandler_type* cmdhandler);
/**
* Cleanup command handler.
* \param[in] cmdhandler_type* command handler
*
*/
void cmdhandler_cleanup(cmdhandler_type* cmdhandler);
#endif /* DAEMON_CMDHANDLER_H */
opendnssec-1.4.3/signer/src/daemon/cfg.c 0000664 0001750 0001750 00000022255 12127027127 015036 0000000 0000000 /*
* $Id: cfg.c 7083 2013-04-03 13:27:51Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Signer engine configuration.
*
*/
#include "config.h"
#include "daemon/cfg.h"
#include "parser/confparser.h"
#include "shared/allocator.h"
#include "shared/file.h"
#include "shared/log.h"
#include "shared/status.h"
#include
#include
#include
static const char* conf_str = "config";
/**
* Configure engine.
*
*/
engineconfig_type*
engine_config(allocator_type* allocator, const char* cfgfile,
int cmdline_verbosity)
{
engineconfig_type* ecfg;
const char* rngfile = ODS_SE_RNGDIR "/conf.rng";
FILE* cfgfd = NULL;
if (!allocator || !cfgfile) {
return NULL;
}
/* check syntax (slows down parsing configuration file) */
if (parse_file_check(cfgfile, rngfile) != ODS_STATUS_OK) {
ods_log_error("[%s] unable to create config: parse error in %s",
conf_str, cfgfile);
return NULL;
}
/* open cfgfile */
cfgfd = ods_fopen(cfgfile, NULL, "r");
if (cfgfd) {
ods_log_verbose("[%s] read cfgfile: %s", conf_str, cfgfile);
/* create config */
ecfg = (engineconfig_type*) allocator_alloc(allocator,
sizeof(engineconfig_type));
if (!ecfg) {
ods_log_error("[%s] unable to create config: allocator_alloc() "
"failed", conf_str);
ods_fclose(cfgfd);
return NULL;
}
ecfg->allocator = allocator;
/* get values */
ecfg->cfg_filename = allocator_strdup(allocator, cfgfile);
ecfg->zonelist_filename = parse_conf_zonelist_filename(allocator,
cfgfile);
ecfg->log_filename = parse_conf_log_filename(allocator, cfgfile);
ecfg->pid_filename = parse_conf_pid_filename(allocator, cfgfile);
ecfg->notify_command = parse_conf_notify_command(allocator, cfgfile);
ecfg->clisock_filename = parse_conf_clisock_filename(allocator,
cfgfile);
ecfg->working_dir = parse_conf_working_dir(allocator, cfgfile);
ecfg->username = parse_conf_username(allocator, cfgfile);
ecfg->group = parse_conf_group(allocator, cfgfile);
ecfg->chroot = parse_conf_chroot(allocator, cfgfile);
ecfg->use_syslog = parse_conf_use_syslog(cfgfile);
ecfg->num_worker_threads = parse_conf_worker_threads(cfgfile);
ecfg->num_signer_threads = parse_conf_signer_threads(cfgfile);
/* If any verbosity has been specified at cmd line we will use that */
if (cmdline_verbosity > 0) {
ecfg->verbosity = cmdline_verbosity;
}
else {
ecfg->verbosity = parse_conf_verbosity(cfgfile);
}
ecfg->interfaces = parse_conf_listener(allocator, cfgfile);
/* done */
ods_fclose(cfgfd);
return ecfg;
}
ods_log_error("[%s] unable to create config: failed to open file %s",
conf_str, cfgfile);
return NULL;
}
/**
* Check configuration.
*
*/
ods_status
engine_config_check(engineconfig_type* config)
{
if (!config) {
ods_log_error("[%s] config-check failed: no config", conf_str);
return ODS_STATUS_CFG_ERR;
}
if (!config->cfg_filename) {
ods_log_error("[%s] config-check failed: no config filename",
conf_str);
return ODS_STATUS_CFG_ERR;
}
if (!config->zonelist_filename) {
ods_log_error("[%s] config-check failed: no zonelist filename",
conf_str);
return ODS_STATUS_CFG_ERR;
}
if (!config->clisock_filename) {
ods_log_error("[%s] config-check failed: no socket filename",
conf_str);
return ODS_STATUS_CFG_ERR;
}
if (!config->interfaces) {
ods_log_error("[%s] config-check failed: no listener",
conf_str);
return ODS_STATUS_CFG_ERR;
}
/* [TODO] room for more checks here */
return ODS_STATUS_OK;
}
/**
* Print configuration.
*
*/
void
engine_config_print(FILE* out, engineconfig_type* config)
{
if (!out) {
return;
}
fprintf(out, "\n");
if (config) {
fprintf(out, "\n");
/* Common */
fprintf(out, "\t\n");
if (config->use_syslog && config->log_filename) {
fprintf(out, "\t\t\n");
fprintf(out, "\t\t\t\n");
fprintf(out, "\t\t\t\t%s\n",
config->log_filename);
fprintf(out, "\t\t\t\n");
fprintf(out, "\t\t\n");
} else if (config->log_filename) {
fprintf(out, "\t\t\n");
fprintf(out, "\t\t\t\n");
fprintf(out, "\t\t\t\t%s\n",
config->log_filename);
fprintf(out, "\t\t\t\n");
fprintf(out, "\t\t\n");
}
fprintf(out, "\t\t%s\n",
config->zonelist_filename);
fprintf(out, "\t\n");
/* Signer */
fprintf(out, "\t\n");
if (config->username || config->group || config->chroot) {
fprintf(out, "\t\t\n");
if (config->username) {
fprintf(out, "\t\t%s\n", config->username);
}
if (config->group) {
fprintf(out, "\t\t%s\n", config->group);
}
if (config->chroot) {
fprintf(out, "\t\t%s\n",
config->chroot);
}
fprintf(out, "\t\t\n");
}
if (config->interfaces) {
size_t i = 0;
fprintf(out, "\t\t\n");
for (i=0; i < config->interfaces->count; i++) {
fprintf(out, "\t\t\t");
if (config->interfaces->interfaces[i].address) {
fprintf(out, "%s",
config->interfaces->interfaces[i].address);
}
if (config->interfaces->interfaces[i].port) {
fprintf(out, "%s",
config->interfaces->interfaces[i].port);
}
fprintf(out, "\n");
}
fprintf(out, "\t\t\n");
}
fprintf(out, "\t\t%s\n",
config->working_dir);
fprintf(out, "\t\t%i\n",
config->num_worker_threads);
fprintf(out, "\t\t%i\n",
config->num_signer_threads);
if (config->notify_command) {
fprintf(out, "\t\t%s\n",
config->notify_command);
}
fprintf(out, "\t\n");
fprintf(out, "\n");
/* make configurable:
- pid_filename
- clisock_filename
*/
}
return;
}
/**
* Clean up config.
*
*/
void
engine_config_cleanup(engineconfig_type* config)
{
allocator_type* allocator = NULL;
if (!config) {
return;
}
allocator = config->allocator;
listener_cleanup(config->interfaces);
allocator_deallocate(allocator, (void*) config->notify_command);
allocator_deallocate(allocator, (void*) config->cfg_filename);
allocator_deallocate(allocator, (void*) config->zonelist_filename);
allocator_deallocate(allocator, (void*) config->log_filename);
allocator_deallocate(allocator, (void*) config->pid_filename);
allocator_deallocate(allocator, (void*) config->clisock_filename);
allocator_deallocate(allocator, (void*) config->working_dir);
allocator_deallocate(allocator, (void*) config->username);
allocator_deallocate(allocator, (void*) config->group);
allocator_deallocate(allocator, (void*) config->chroot);
allocator_deallocate(allocator, (void*) config);
return;
}
opendnssec-1.4.3/signer/src/daemon/worker.c 0000664 0001750 0001750 00000070562 12225214721 015611 0000000 0000000 /*
* $Id: worker.c 7342 2013-10-09 08:54:41Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* The hard workers.
*
*/
#include "daemon/engine.h"
#include "daemon/worker.h"
#include "shared/allocator.h"
#include "shared/duration.h"
#include "shared/hsm.h"
#include "shared/locks.h"
#include "shared/log.h"
#include "shared/status.h"
#include "signer/tools.h"
#include "signer/zone.h"
#include /* time() */
ods_lookup_table worker_str[] = {
{ WORKER_WORKER, "worker" },
{ WORKER_DRUDGER, "drudger" },
{ 0, NULL }
};
/**
* Convert worker type to string.
*
*/
static const char*
worker2str(worker_id type)
{
ods_lookup_table *lt = ods_lookup_by_id(worker_str, type);
if (lt) {
return lt->name;
}
return NULL;
}
/**
* Create worker.
*
*/
worker_type*
worker_create(allocator_type* allocator, int num, worker_id type)
{
worker_type* worker;
if (!allocator) {
return NULL;
}
worker = (worker_type*) allocator_alloc(allocator, sizeof(worker_type));
if (!worker) {
return NULL;
}
ods_log_debug("[%s[%i]] create", worker2str(type), num+1);
lock_basic_init(&worker->worker_lock);
lock_basic_set(&worker->worker_alarm);
lock_basic_lock(&worker->worker_lock);
worker->allocator = allocator;
worker->thread_num = num +1;
worker->engine = NULL;
worker->task = NULL;
worker->working_with = TASK_NONE;
worker->need_to_exit = 0;
worker->type = type;
worker->clock_in = 0;
worker->jobs_appointed = 0;
worker->jobs_completed = 0;
worker->jobs_failed = 0;
worker->sleeping = 0;
worker->waiting = 0;
lock_basic_unlock(&worker->worker_lock);
return worker;
}
/**
* Worker working with...
*
*/
static void
worker_working_with(worker_type* worker, task_id with, task_id next,
const char* str, const char* name, task_id* what, time_t* when)
{
worker->working_with = with;
ods_log_verbose("[%s[%i]] %s zone %s", worker2str(worker->type),
worker->thread_num, str, name);
*what = next;
*when = time_now();
return;
}
/**
* Has this worker measured up to all appointed jobs?
*
*/
static int
worker_fulfilled(worker_type* worker)
{
int ret = 0;
ret = (worker->jobs_completed + worker->jobs_failed) ==
worker->jobs_appointed;
return ret;
}
/**
* Clear jobs.
*
*/
static void
worker_clear_jobs(worker_type* worker)
{
ods_log_assert(worker);
lock_basic_lock(&worker->worker_lock);
worker->jobs_appointed = 0;
worker->jobs_completed = 0;
worker->jobs_failed = 0;
lock_basic_unlock(&worker->worker_lock);
return;
}
/**
* Queue RRset for signing.
*
*/
static void
worker_queue_rrset(worker_type* worker, fifoq_type* q, rrset_type* rrset)
{
ods_status status = ODS_STATUS_UNCHANGED;
int tries = 0;
ods_log_assert(worker);
ods_log_assert(q);
ods_log_assert(rrset);
lock_basic_lock(&q->q_lock);
status = fifoq_push(q, (void*) rrset, worker, &tries);
while (status == ODS_STATUS_UNCHANGED) {
tries++;
if (worker->need_to_exit) {
lock_basic_unlock(&q->q_lock);
return;
}
/**
* Apparently the queue is full. Lets take a small break to not hog CPU.
* The worker will release the signq lock while sleeping and will
* automatically grab the lock when the queue is nonfull.
* Queue is nonfull at 10% of the queue size.
*/
lock_basic_sleep(&q->q_nonfull, &q->q_lock, 5);
status = fifoq_push(q, (void*) rrset, worker, &tries);
}
lock_basic_unlock(&q->q_lock);
ods_log_assert(status == ODS_STATUS_OK);
lock_basic_lock(&worker->worker_lock);
worker->jobs_appointed += 1;
lock_basic_unlock(&worker->worker_lock);
return;
}
/**
* Queue domain for signing.
*
*/
static void
worker_queue_domain(worker_type* worker, fifoq_type* q, domain_type* domain)
{
rrset_type* rrset = NULL;
denial_type* denial = NULL;
ods_log_assert(worker);
ods_log_assert(q);
ods_log_assert(domain);
rrset = domain->rrsets;
while (rrset) {
worker_queue_rrset(worker, q, rrset);
rrset = rrset->next;
}
denial = (denial_type*) domain->denial;
if (denial && denial->rrset) {
worker_queue_rrset(worker, q, denial->rrset);
}
return;
}
/**
* Queue zone for signing.
*
*/
static void
worker_queue_zone(worker_type* worker, fifoq_type* q, zone_type* zone)
{
ldns_rbnode_t* node = LDNS_RBTREE_NULL;
domain_type* domain = NULL;
ods_log_assert(worker);
ods_log_assert(q);
ods_log_assert(zone);
worker_clear_jobs(worker);
if (!zone->db || !zone->db->domains) {
return;
}
if (zone->db->domains->root != LDNS_RBTREE_NULL) {
node = ldns_rbtree_first(zone->db->domains);
}
while (node && node != LDNS_RBTREE_NULL) {
domain = (domain_type*) node->data;
worker_queue_domain(worker, q, domain);
node = ldns_rbtree_next(node);
}
return;
}
/**
* Make sure that no appointed jobs have failed.
*
*/
static ods_status
worker_check_jobs(worker_type* worker, task_type* task)
{
ods_log_assert(worker);
ods_log_assert(task);
lock_basic_lock(&worker->worker_lock);
if (worker->jobs_failed) {
ods_log_error("[%s[%i]] sign zone %s failed: %u RRsets failed",
worker2str(worker->type), worker->thread_num,
task_who2str(task), worker->jobs_failed);
lock_basic_unlock(&worker->worker_lock);
return ODS_STATUS_ERR;
} else if (worker->jobs_completed != worker->jobs_appointed) {
ods_log_error("[%s[%i]] sign zone %s failed: processed %u of %u "
"RRsets", worker2str(worker->type), worker->thread_num,
task_who2str(task), worker->jobs_completed,
worker->jobs_appointed);
lock_basic_unlock(&worker->worker_lock);
return ODS_STATUS_ERR;
} else if (worker->need_to_exit) {
ods_log_debug("[%s[%i]] sign zone %s failed: worker needs to exit",
worker2str(worker->type), worker->thread_num, task_who2str(task));
lock_basic_unlock(&worker->worker_lock);
return ODS_STATUS_ERR;
} else {
ods_log_debug("[%s[%i]] sign zone %s ok: %u of %u RRsets "
"succeeded", worker2str(worker->type), worker->thread_num,
task_who2str(task), worker->jobs_completed,
worker->jobs_appointed);
ods_log_assert(worker->jobs_appointed == worker->jobs_completed);
}
lock_basic_unlock(&worker->worker_lock);
return ODS_STATUS_OK;
}
/**
* Perform task.
*
*/
static void
worker_perform_task(worker_type* worker)
{
engine_type* engine = NULL;
zone_type* zone = NULL;
task_type* task = NULL;
task_id what = TASK_NONE;
time_t when = 0;
time_t never = (3600*24*365);
ods_status status = ODS_STATUS_OK;
int backup = 0;
time_t start = 0;
time_t end = 0;
if (!worker || !worker->task || !worker->task->zone || !worker->engine) {
return;
}
engine = (engine_type*) worker->engine;
task = (task_type*) worker->task;
zone = (zone_type*) worker->task->zone;
ods_log_debug("[%s[%i]] perform task %s for zone %s at %u",
worker2str(worker->type), worker->thread_num, task_what2str(task->what),
task_who2str(task), (uint32_t) worker->clock_in);
/* do what you have been told to do */
switch (task->what) {
case TASK_SIGNCONF:
/* perform 'load signconf' task */
worker_working_with(worker, TASK_SIGNCONF, TASK_READ,
"configure", task_who2str(task), &what, &when);
status = tools_signconf(zone);
if (status == ODS_STATUS_UNCHANGED) {
if (!zone->signconf->last_modified) {
ods_log_debug("[%s[%i]] no signconf.xml for zone %s yet",
worker2str(worker->type), worker->thread_num,
task_who2str(task));
status = ODS_STATUS_ERR;
}
}
if (status == ODS_STATUS_UNCHANGED) {
if (task->halted != TASK_NONE && task->halted != TASK_SIGNCONF) {
goto task_perform_continue;
}
status = ODS_STATUS_OK;
} else if (status == ODS_STATUS_OK) {
task->interrupt = TASK_NONE;
task->halted = TASK_NONE;
} else {
if (task->halted == TASK_NONE) {
goto task_perform_fail;
}
goto task_perform_continue;
}
/* break; */
case TASK_READ:
/* perform 'read input adapter' task */
worker_working_with(worker, TASK_READ, TASK_SIGN,
"read", task_who2str(task), &what, &when);
task->what = TASK_READ;
if (!zone->signconf->last_modified) {
ods_log_debug("[%s[%i]] no signconf.xml for zone %s yet",
worker2str(worker->type), worker->thread_num,
task_who2str(task));
status = ODS_STATUS_ERR;
} else {
lhsm_check_connection((void*)engine);
status = tools_input(zone);
}
if (status == ODS_STATUS_UNCHANGED) {
ods_log_verbose("[%s[%i]] zone %s unsigned data not changed, "
"continue", worker2str(worker->type), worker->thread_num,
task_who2str(task));
status = ODS_STATUS_OK;
}
if (status == ODS_STATUS_OK) {
if (task->interrupt > TASK_SIGNCONF) {
task->interrupt = TASK_NONE;
task->halted = TASK_NONE;
}
} else {
if (task->halted == TASK_NONE) {
goto task_perform_fail;
}
goto task_perform_continue;
}
/* break; */
case TASK_SIGN:
/* perform 'sign' task */
worker_working_with(worker, TASK_SIGN, TASK_WRITE,
"sign", task_who2str(task), &what, &when);
task->what = TASK_SIGN;
status = zone_update_serial(zone);
if (status == ODS_STATUS_OK) {
if (task->interrupt > TASK_SIGNCONF) {
task->interrupt = TASK_NONE;
task->halted = TASK_NONE;
}
} else {
ods_log_error("[%s[%i]] unable to sign zone %s: "
"failed to increment serial",
worker2str(worker->type), worker->thread_num,
task_who2str(task));
if (task->halted == TASK_NONE) {
goto task_perform_fail;
}
goto task_perform_continue;
}
/* start timer */
start = time(NULL);
if (zone->stats) {
lock_basic_lock(&zone->stats->stats_lock);
if (!zone->stats->start_time) {
zone->stats->start_time = start;
}
zone->stats->sig_count = 0;
zone->stats->sig_soa_count = 0;
zone->stats->sig_reuse = 0;
zone->stats->sig_time = 0;
lock_basic_unlock(&zone->stats->stats_lock);
}
/* check the HSM connection before queuing sign operations */
lhsm_check_connection((void*)engine);
/* prepare keys */
status = zone_prepare_keys(zone);
if (status == ODS_STATUS_OK) {
/* queue menial, hard signing work */
worker_queue_zone(worker, engine->signq, zone);
ods_log_deeebug("[%s[%i]] wait until drudgers are finished "
"signing zone %s", worker2str(worker->type),
worker->thread_num, task_who2str(task));
/* sleep until work is done */
worker_sleep_unless(worker, 0);
}
/* stop timer */
end = time(NULL);
/* check status and jobs */
if (status == ODS_STATUS_OK) {
status = worker_check_jobs(worker, task);
}
worker_clear_jobs(worker);
if (status == ODS_STATUS_OK && zone->stats) {
lock_basic_lock(&zone->stats->stats_lock);
zone->stats->sig_time = (end-start);
lock_basic_unlock(&zone->stats->stats_lock);
}
if (status != ODS_STATUS_OK) {
if (task->halted == TASK_NONE) {
goto task_perform_fail;
}
goto task_perform_continue;
} else {
if (task->interrupt > TASK_SIGNCONF) {
task->interrupt = TASK_NONE;
task->halted = TASK_NONE;
}
}
/* break; */
case TASK_WRITE:
/* perform 'write to output adapter' task */
worker_working_with(worker, TASK_WRITE, TASK_SIGN,
"write", task_who2str(task), &what, &when);
task->what = TASK_WRITE;
status = tools_output(zone, engine);
if (status == ODS_STATUS_OK) {
if (task->interrupt > TASK_SIGNCONF) {
task->interrupt = TASK_NONE;
task->halted = TASK_NONE;
}
} else {
/* clear signatures? */
if (task->halted == TASK_NONE) {
goto task_perform_fail;
}
goto task_perform_continue;
}
zone->db->is_processed = 1;
if (zone->signconf &&
duration2time(zone->signconf->sig_resign_interval)) {
what = TASK_SIGN;
when = worker->clock_in +
duration2time(zone->signconf->sig_resign_interval);
} else {
ods_log_error("[%s[%i]] unable to retrieve resign interval "
"for zone %s: duration2time() failed",
worker2str(worker->type), worker->thread_num,
task_who2str(task));
ods_log_info("[%s[%i]] defaulting to 1H resign interval for "
"zone %s", worker2str(worker->type), worker->thread_num,
task_who2str(task));
what = TASK_SIGN;
when = worker->clock_in + 3600;
}
backup = 1;
break;
case TASK_NONE:
worker->working_with = TASK_NONE;
/* no task */
ods_log_warning("[%s[%i]] none task for zone %s",
worker2str(worker->type), worker->thread_num,
task_who2str(task));
when = time_now() + never;
break;
default:
worker->working_with = TASK_NONE;
/* unknown task */
ods_log_warning("[%s[%i]] unknown task, trying full sign zone %s",
worker2str(worker->type), worker->thread_num,
task_who2str(task));
what = TASK_SIGNCONF;
when = time_now();
break;
}
/* no error */
task->backoff = 0;
if (task->interrupt != TASK_NONE && task->interrupt != what) {
ods_log_debug("[%s[%i]] interrupt task %s for zone %s",
worker2str(worker->type), worker->thread_num,
task_what2str(what), task_who2str(task));
task->halted = what;
task->halted_when = when;
task->what = task->interrupt;
task->when = time_now();
} else {
ods_log_debug("[%s[%i]] next task %s for zone %s",
worker2str(worker->type), worker->thread_num,
task_what2str(what), task_who2str(task));
task->what = what;
task->when = when;
task->interrupt = TASK_NONE;
task->halted = TASK_NONE;
task->halted_when = 0;
}
/* backup the last successful run */
if (backup) {
status = zone_backup2(zone);
if (status != ODS_STATUS_OK) {
ods_log_warning("[%s[%i]] unable to backup zone %s: %s",
worker2str(worker->type), worker->thread_num,
task_who2str(task), ods_status2str(status));
/* just a warning */
status = ODS_STATUS_OK;
}
backup = 0;
}
return;
task_perform_fail:
if (status != ODS_STATUS_XFR_NOT_READY) {
/* other statuses is critical, and we know it is not ODS_STATUS_OK */
ods_log_crit("[%s[%i]] CRITICAL: failed to sign zone %s: %s",
worker2str(worker->type), worker->thread_num,
task_who2str(task), ods_status2str(status));
}
/* in case of failure, also mark zone processed (for single run usage) */
zone->db->is_processed = 1;
if (task->backoff) {
task->backoff *= 2;
} else {
task->backoff = 60;
}
if (task->backoff > ODS_SE_MAX_BACKOFF) {
task->backoff = ODS_SE_MAX_BACKOFF;
}
ods_log_info("[%s[%i]] backoff task %s for zone %s with %u seconds",
worker2str(worker->type), worker->thread_num,
task_what2str(task->what), task_who2str(task), task->backoff);
task->when = time_now() + task->backoff;
return;
task_perform_continue:
ods_log_info("[%s[%i]] continue task %s for zone %s",
worker2str(worker->type), worker->thread_num,
task_what2str(task->halted), task_who2str(task));
task->what = task->halted;
task->when = task->halted_when;
task->interrupt = TASK_NONE;
task->halted = TASK_NONE;
task->halted_when = 0;
return;
}
/**
* Work.
*
*/
static void
worker_work(worker_type* worker)
{
time_t now = 0;
time_t timeout = 1;
engine_type* engine = NULL;
zone_type* zone = NULL;
ods_status status = ODS_STATUS_OK;
ods_log_assert(worker);
ods_log_assert(worker->type == WORKER_WORKER);
engine = (engine_type*) worker->engine;
while (worker->need_to_exit == 0) {
ods_log_debug("[%s[%i]] report for duty", worker2str(worker->type),
worker->thread_num);
now = time_now();
lock_basic_lock(&engine->taskq->schedule_lock);
worker->task = schedule_pop_task(engine->taskq);
if (worker->task) {
worker->working_with = worker->task->what;
lock_basic_unlock(&engine->taskq->schedule_lock);
zone = (zone_type*) worker->task->zone;
lock_basic_lock(&zone->zone_lock);
ods_log_debug("[%s[%i]] start working on zone %s",
worker2str(worker->type), worker->thread_num, zone->name);
worker->clock_in = time(NULL);
worker_perform_task(worker);
zone->task = worker->task;
ods_log_debug("[%s[%i]] finished working on zone %s",
worker2str(worker->type), worker->thread_num, zone->name);
lock_basic_lock(&engine->taskq->schedule_lock);
worker->task = NULL;
worker->working_with = TASK_NONE;
status = schedule_task(engine->taskq, zone->task, 1);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s[%i]] unable to schedule task for zone %s: "
"%s", worker2str(worker->type), worker->thread_num,
zone->name, ods_status2str(status));
}
lock_basic_unlock(&engine->taskq->schedule_lock);
lock_basic_unlock(&zone->zone_lock);
timeout = 1;
/** Do we need to tell the engine that we require a reload? */
lock_basic_lock(&engine->signal_lock);
if (engine->need_to_reload) {
lock_basic_alarm(&engine->signal_cond);
}
lock_basic_unlock(&engine->signal_lock);
} else {
ods_log_debug("[%s[%i]] nothing to do", worker2str(worker->type),
worker->thread_num);
worker->task = schedule_get_first_task(engine->taskq);
lock_basic_unlock(&engine->taskq->schedule_lock);
if (worker->task && !engine->taskq->loading) {
timeout = (worker->task->when - now);
} else {
timeout *= 2;
}
if (timeout > ODS_SE_MAX_BACKOFF) {
timeout = ODS_SE_MAX_BACKOFF;
}
worker->task = NULL;
worker_sleep(worker, timeout);
}
}
return;
}
/**
* Drudge.
*
*/
static void
worker_drudge(worker_type* worker)
{
engine_type* engine = NULL;
zone_type* zone = NULL;
task_type* task = NULL;
rrset_type* rrset = NULL;
ods_status status = ODS_STATUS_OK;
worker_type* superior = NULL;
hsm_ctx_t* ctx = NULL;
ods_log_assert(worker);
ods_log_assert(worker->engine);
ods_log_assert(worker->type == WORKER_DRUDGER);
engine = (engine_type*) worker->engine;
while (worker->need_to_exit == 0) {
ods_log_deeebug("[%s[%i]] report for duty", worker2str(worker->type),
worker->thread_num);
/* initialize */
superior = NULL;
zone = NULL;
task = NULL;
/* get item */
lock_basic_lock(&engine->signq->q_lock);
rrset = (rrset_type*) fifoq_pop(engine->signq, &superior);
if (!rrset) {
ods_log_deeebug("[%s[%i]] nothing to do, wait",
worker2str(worker->type), worker->thread_num);
/**
* Apparently the queue is empty. Wait until new work is queued.
* The drudger will release the signq lock while sleeping and
* will automatically grab the lock when the threshold is reached.
* Threshold is at 1 and MAX (after a number of tries).
*/
lock_basic_sleep(&engine->signq->q_threshold,
&engine->signq->q_lock, 0);
rrset = (rrset_type*) fifoq_pop(engine->signq, &superior);
}
lock_basic_unlock(&engine->signq->q_lock);
/* do some work */
if (rrset) {
ods_log_assert(superior);
if (!ctx) {
ods_log_debug("[%s[%i]] create hsm context",
worker2str(worker->type), worker->thread_num);
ctx = hsm_create_context();
}
if (!ctx) {
ods_log_crit("[%s[%i]] error creating libhsm context",
worker2str(worker->type), worker->thread_num);
engine->need_to_reload = 1;
lock_basic_lock(&superior->worker_lock);
superior->jobs_failed++;
lock_basic_unlock(&superior->worker_lock);
} else {
ods_log_assert(ctx);
lock_basic_lock(&superior->worker_lock);
task = superior->task;
ods_log_assert(task);
zone = task->zone;
lock_basic_unlock(&superior->worker_lock);
ods_log_assert(zone);
ods_log_assert(zone->apex);
ods_log_assert(zone->signconf);
worker->clock_in = time(NULL);
status = rrset_sign(ctx, rrset, superior->clock_in);
lock_basic_lock(&superior->worker_lock);
if (status == ODS_STATUS_OK) {
superior->jobs_completed++;
} else {
superior->jobs_failed++;
}
lock_basic_unlock(&superior->worker_lock);
}
if (worker_fulfilled(superior) && superior->sleeping) {
ods_log_deeebug("[%s[%i]] wake up superior[%u], work is "
"done", worker2str(worker->type), worker->thread_num,
superior->thread_num);
worker_wakeup(superior);
}
superior = NULL;
rrset = NULL;
}
/* done work */
}
/* wake up superior */
if (superior && superior->sleeping) {
ods_log_deeebug("[%s[%i]] wake up superior[%u], i am exiting",
worker2str(worker->type), worker->thread_num, superior->thread_num);
worker_wakeup(superior);
}
/* cleanup open HSM sessions */
if (ctx) {
hsm_destroy_context(ctx);
}
return;
}
/**
* Start worker.
*
*/
void
worker_start(worker_type* worker)
{
ods_log_assert(worker);
switch (worker->type) {
case WORKER_DRUDGER:
worker_drudge(worker);
break;
case WORKER_WORKER:
worker_work(worker);
break;
default:
ods_log_error("[worker] illegal worker (id=%i)", worker->type);
break;
}
return;
}
/**
* Put worker to sleep.
*
*/
void
worker_sleep(worker_type* worker, time_t timeout)
{
ods_log_assert(worker);
lock_basic_lock(&worker->worker_lock);
worker->sleeping = 1;
lock_basic_sleep(&worker->worker_alarm, &worker->worker_lock,
timeout);
lock_basic_unlock(&worker->worker_lock);
return;
}
/**
* Put worker to sleep unless worker has measured up to all appointed jobs.
*
*/
void
worker_sleep_unless(worker_type* worker, time_t timeout)
{
ods_log_assert(worker);
lock_basic_lock(&worker->worker_lock);
while (!worker->need_to_exit && !worker_fulfilled(worker)) {
worker->sleeping = 1;
lock_basic_sleep(&worker->worker_alarm, &worker->worker_lock,
timeout);
ods_log_debug("[%s[%i]] somebody poked me, check completed jobs %u "
"appointed, %u completed, %u failed", worker2str(worker->type),
worker->thread_num, worker->jobs_appointed, worker->jobs_completed,
worker->jobs_failed);
}
lock_basic_unlock(&worker->worker_lock);
return;
}
/**
* Wake up worker.
*
*/
void
worker_wakeup(worker_type* worker)
{
ods_log_assert(worker);
if (worker && worker->sleeping && !worker->waiting) {
ods_log_debug("[%s[%i]] wake up", worker2str(worker->type),
worker->thread_num);
lock_basic_lock(&worker->worker_lock);
lock_basic_alarm(&worker->worker_alarm);
worker->sleeping = 0;
lock_basic_unlock(&worker->worker_lock);
}
return;
}
/**
* Worker waiting.
*
*/
void
worker_wait_timeout(lock_basic_type* lock, cond_basic_type* condition,
time_t timeout)
{
lock_basic_lock(lock);
lock_basic_sleep(condition, lock, timeout);
lock_basic_unlock(lock);
return;
}
/**
* Worker waiting.
*
*/
void
worker_wait(lock_basic_type* lock, cond_basic_type* condition)
{
worker_wait_timeout(lock, condition, 0);
return;
}
/**
* Notify a worker.
*
*/
void
worker_notify(lock_basic_type* lock, cond_basic_type* condition)
{
lock_basic_lock(lock);
lock_basic_alarm(condition);
lock_basic_unlock(lock);
return;
}
/**
* Notify all workers.
*
*/
void
worker_notify_all(lock_basic_type* lock, cond_basic_type* condition)
{
lock_basic_lock(lock);
lock_basic_broadcast(condition);
lock_basic_unlock(lock);
return;
}
/**
* Clean up worker.
*
*/
void
worker_cleanup(worker_type* worker)
{
allocator_type* allocator;
cond_basic_type worker_cond;
lock_basic_type worker_lock;
if (!worker) {
return;
}
allocator = worker->allocator;
worker_cond = worker->worker_alarm;
worker_lock = worker->worker_lock;
allocator_deallocate(allocator, (void*) worker);
lock_basic_destroy(&worker_lock);
lock_basic_off(&worker_cond);
return;
}
opendnssec-1.4.3/signer/src/daemon/signal.h 0000664 0001750 0001750 00000003725 11631156305 015562 0000000 0000000 /*
* $Id: signal.h 5548 2011-09-05 14:29:25Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Signal handling.
*
*/
#ifndef DAEMON_SIGNAL_H
#define DAEMON_SIGNAL_H
#include "config.h"
#include
#define SIGNAL_RUN 0
#define SIGNAL_INIT 1
#define SIGNAL_RELOAD 2
#define SIGNAL_SHUTDOWN 3
/**
* Set corresponding engine.
* \param[in] engine corresponding engine
*
*/
void signal_set_engine(void* engine);
/**
* Handle signals.
* \param[in] sig signal to handle
*
*/
void signal_handler(sig_atomic_t sig);
/**
* Capture signal.
* \param[in] dflsig default signal
* \return sig_atomic_t captured signal
*
*/
sig_atomic_t signal_capture(sig_atomic_t dflsig);
#endif /* DAEMON_SIGNAL_H */
opendnssec-1.4.3/signer/src/daemon/worker.h 0000664 0001750 0001750 00000010020 12062112715 015574 0000000 0000000 /*
* $Id: worker.h 6890 2012-12-12 14:33:49Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* The hard workers.
*
*/
#ifndef DAEMON_WORKER_H
#define DAEMON_WORKER_H
#include "scheduler/task.h"
#include "shared/allocator.h"
#include "shared/locks.h"
#include
enum worker_enum {
WORKER_NONE = 0,
WORKER_WORKER = 1,
WORKER_DRUDGER
};
typedef enum worker_enum worker_id;
typedef struct worker_struct worker_type;
struct worker_struct {
allocator_type* allocator;
int thread_num;
ods_thread_type thread_id;
void* engine;
task_type* task;
task_id working_with;
worker_id type;
time_t clock_in;
size_t jobs_appointed;
size_t jobs_completed;
size_t jobs_failed;
cond_basic_type worker_alarm;
lock_basic_type worker_lock;
unsigned sleeping : 1;
unsigned waiting : 1;
unsigned need_to_exit : 1;
};
/**
* Create worker.
* \param[in] allocator memory allocator
* \param[in] num thread number
* \param[in] type type of worker
* \return worker_type* created worker
*
*/
worker_type* worker_create(allocator_type* allocator, int num,
worker_id type);
/**
* Start working.
* \param[in] worker worker to start working
*
*/
void worker_start(worker_type* worker);
/**
* Put worker to sleep.
* \param[in] worker put this worker to sleep
* \param[in] timeout time before alarm clock is going off,
* 0 means no alarm clock is set.
*
*/
void worker_sleep(worker_type* worker, time_t timeout);
/**
* Put worker to sleep unless the worker has measured up to all
* appointed jobs.
* \param[in] worker put this worker to sleep
* \param[in] timeout time before alarm clock is going off,
* 0 means no alarm clock is set.
*
*/
void worker_sleep_unless(worker_type* worker, time_t timeout);
/**
* Wake up worker.
* \param[in] worker wake up this worker
*
*/
void worker_wakeup(worker_type* worker);
/**
* Let worker wait.
* \param[in] lock lock to use
* \param[in] condition condition to be met
*
*/
void worker_wait(lock_basic_type* lock, cond_basic_type* condition);
/**
* Let worker wait.
* \param[in] lock lock to use
* \param[in] condition condition to be met
*
*/
void worker_wait_timeout(lock_basic_type* lock, cond_basic_type* condition,
time_t timeout);
/**
* Notify a worker.
* \param[in] lock lock to use
* \param[in] condition condition that has been met
*
*/
void worker_notify(lock_basic_type* lock, cond_basic_type* condition);
/**
* Notify all workers.
* \param[in] lock lock to use
* \param[in] condition condition that has been met
*
*/
void worker_notify_all(lock_basic_type* lock, cond_basic_type* condition);
/**
* Clean up worker.
* \param[in] worker worker to clean up
*
*/
void worker_cleanup(worker_type* worker);
#endif /* DAEMON_WORKER_H */
opendnssec-1.4.3/signer/src/daemon/xfrhandler.c 0000664 0001750 0001750 00000014333 12040226115 016422 0000000 0000000 /*
* $Id: xfrhandler.c 4518 2011-02-24 15:39:09Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Zone transfer handler.
*
*/
#include "config.h"
#include "daemon/engine.h"
#include "daemon/xfrhandler.h"
#include "shared/duration.h"
#include "shared/status.h"
#include
#include
static const char* xfrh_str = "xfrhandler";
static void xfrhandler_handle_dns(netio_type* netio,
netio_handler_type* handler, netio_events_type event_types);
/**
* Create zone transfer handler.
*
*/
xfrhandler_type*
xfrhandler_create(allocator_type* allocator)
{
xfrhandler_type* xfrh = NULL;
if (!allocator) {
return NULL;
}
xfrh = (xfrhandler_type*) allocator_alloc(allocator,
sizeof(xfrhandler_type));
if (!xfrh) {
ods_log_error("[%s] unable to create xfrhandler: "
"allocator_alloc() failed", xfrh_str);
return NULL;
}
xfrh->allocator = allocator;
xfrh->engine = NULL;
xfrh->packet = NULL;
xfrh->netio = NULL;
xfrh->tcp_set = NULL;
xfrh->udp_waiting_first = NULL;
xfrh->udp_waiting_last = NULL;
xfrh->udp_use_num = 0;
xfrh->start_time = 0;
xfrh->current_time = 0;
xfrh->got_time = 0;
xfrh->need_to_exit = 0;
xfrh->started = 0;
/* notify */
xfrh->notify_waiting_first = NULL;
xfrh->notify_waiting_last = NULL;
xfrh->notify_udp_num = 0;
/* setup */
xfrh->netio = netio_create(allocator);
if (!xfrh->netio) {
ods_log_error("[%s] unable to create xfrhandler: "
"netio_create() failed", xfrh_str);
xfrhandler_cleanup(xfrh);
return NULL;
}
xfrh->packet = buffer_create(allocator, PACKET_BUFFER_SIZE);
if (!xfrh->packet) {
ods_log_error("[%s] unable to create xfrhandler: "
"buffer_create() failed", xfrh_str);
xfrhandler_cleanup(xfrh);
return NULL;
}
xfrh->tcp_set = tcp_set_create(allocator);
if (!xfrh->tcp_set) {
ods_log_error("[%s] unable to create xfrhandler: "
"tcp_set_create() failed", xfrh_str);
xfrhandler_cleanup(xfrh);
return NULL;
}
xfrh->dnshandler.fd = -1;
xfrh->dnshandler.user_data = (void*) xfrh;
xfrh->dnshandler.timeout = 0;
xfrh->dnshandler.event_types = NETIO_EVENT_READ;
xfrh->dnshandler.event_handler = xfrhandler_handle_dns;
return xfrh;
}
/**
* Start zone transfer handler.
*
*/
void
xfrhandler_start(xfrhandler_type* xfrhandler)
{
ods_log_assert(xfrhandler);
ods_log_assert(xfrhandler->engine);
ods_log_debug("[%s] start", xfrh_str);
/* setup */
xfrhandler->start_time = time_now();
/* handlers */
netio_add_handler(xfrhandler->netio, &xfrhandler->dnshandler);
/* service */
while (xfrhandler->need_to_exit == 0) {
/* dispatch may block for a longer period, so current is gone */
xfrhandler->got_time = 0;
ods_log_deeebug("[%s] netio dispatch", xfrh_str);
if (netio_dispatch(xfrhandler->netio, NULL, NULL) == -1) {
if (errno != EINTR) {
ods_log_error("[%s] unable to dispatch netio: %s", xfrh_str,
strerror(errno));
}
}
}
/* shutdown */
ods_log_debug("[%s] shutdown", xfrh_str);
return;
/*
xfrd_write_state(xfrd);
*/
/* close tcp sockets */
/* close udp sockets */
}
/**
* Get current time from zone transfer handler.
*
*/
time_t
xfrhandler_time(xfrhandler_type* xfrhandler)
{
if (!xfrhandler) {
return 0;
}
if (!xfrhandler->got_time) {
xfrhandler->current_time = time_now();
xfrhandler->got_time = 1;
}
return xfrhandler->current_time;
}
/**
* Signal zone transfer handler.
*
*/
void
xfrhandler_signal(xfrhandler_type* xfrhandler)
{
if (xfrhandler && xfrhandler->started) {
ods_thread_kill(xfrhandler->thread_id, SIGHUP);
}
return;
}
/**
* Handle forwarded dns packets.
*
*/
static void
xfrhandler_handle_dns(netio_type* ATTR_UNUSED(netio),
netio_handler_type* handler, netio_events_type event_types)
{
xfrhandler_type* xfrhandler = NULL;
uint8_t buf[MAX_PACKET_SIZE];
ssize_t received = 0;
if (!handler) {
return;
}
xfrhandler = (xfrhandler_type*) handler->user_data;
ods_log_assert(event_types & NETIO_EVENT_READ);
ods_log_debug("[%s] read forwarded dns packet", xfrh_str);
received = read(xfrhandler->dnshandler.fd, &buf, MAX_PACKET_SIZE);
if (received == -1) {
ods_log_error("[%s] unable to forward dns packet: %s", xfrh_str,
strerror(errno));
}
return;
}
/**
* Cleanup zone transfer handler.
*
*/
void
xfrhandler_cleanup(xfrhandler_type* xfrhandler)
{
allocator_type* allocator = NULL;
if (!xfrhandler) {
return;
}
allocator = xfrhandler->allocator;
netio_cleanup(xfrhandler->netio);
buffer_cleanup(xfrhandler->packet, allocator);
tcp_set_cleanup(xfrhandler->tcp_set, allocator);
allocator_deallocate(allocator, (void*) xfrhandler);
return;
}
opendnssec-1.4.3/signer/src/ods-signer.c 0000664 0001750 0001750 00000027061 12210147232 015077 0000000 0000000 /*
* $Id: ods-signer.c 7254 2013-08-30 16:55:54Z sara $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* OpenDNSSEC signer engine client.
*
*/
#include "config.h"
#include "shared/allocator.h"
#include "shared/file.h"
#include "shared/log.h"
#include
#include /* fcntl() */
#include /* fprintf() */
#include /* strerror(), strncmp(), strlen(), strcpy(), strncat() */
#include /* bzero() */
#include /* select(), FD_ZERO(), FD_SET(), FD_ISSET(), FD_CLR() */
#include /* socket(), connect(), shutdown() */
#include
#include /* exit(), read(), write() */
/* According to earlier standards, we need sys/time.h, sys/types.h, unistd.h for select() */
#include
#include
#define SE_CLI_CMDLEN 6
static const char* cli_str = "client";
/**
* Prints usage.
*
*/
static void
usage(FILE* out)
{
fprintf(out, "Usage: %s []\n", "ods-signer");
fprintf(out, "Simple command line interface to control the signer "
"engine daemon.\nIf no cmd is given, the tool is going "
"into interactive mode.\n");
fprintf(out, "\nBSD licensed, see LICENSE in source package for "
"details.\n");
fprintf(out, "Version %s. Report bugs to <%s>.\n",
PACKAGE_VERSION, PACKAGE_BUGREPORT);
}
/**
* Return largest value.
*
*/
static int
max(int a, int b)
{
return a= SE_CLI_CMDLEN : and so it is safe to do buffer
manipulations below. */
if (strncmp(buf+n-SE_CLI_CMDLEN,"\ncmd> ",SE_CLI_CMDLEN) == 0) {
/* we have the full response */
n -= SE_CLI_CMDLEN;
buf[n] = '\0';
cmd_response = 1;
}
} else {
/* always null terminate string */
buf[n] = '\0';
}
/* n > 0 : when we get to this line... */
for (written=0; written < n; written += ret) {
/* write what we got to stdout */
ret = (int) write(fileno(stdout), &buf[written], n-written);
/* error and shutdown handling */
if (ret == 0) {
fprintf(stderr, "no write\n");
break;
}
if (ret < 0) {
if (errno == EINTR || errno == EWOULDBLOCK) {
ret = 0;
continue; /* try again... */
}
fprintf(stderr, "\n\nwrite error: %s\n", strerror(errno));
break;
}
/* ret > 0 : when we get here... */
if (written+ret > n) {
fprintf(stderr, "\n\nwrite error: more bytes (%d) written "
"than required (%d)\n",
written+ret, n);
break;
}
/* written+ret < n : means partial write, requires us to loop... */
}
if (ods_strcmp(buf, ODS_SE_STOP_RESPONSE) == 0 || cmd_response) {
fprintf(stdout, "\n");
return 0;
}
}
if (FD_ISSET(fileno(fp), &rset)) {
/* input is readable */
if (cmd && cmd_written) {
/* passive mode */
stdineof = 1;
ret = shutdown(sockfd, SHUT_WR);
if (ret != 0) {
fprintf(stderr, "shutdown failed: %s\n",
strerror(errno));
return 1;
}
FD_CLR(fileno(fp), &rset);
continue;
}
/* clear buffer */
for (i=0; i< ODS_SE_MAXLINE; i++) {
buf[i] = 0;
}
/* interactive mode */
if ((n = read(fileno(fp), buf, ODS_SE_MAXLINE)) == 0) {
stdineof = 1;
ret = shutdown(sockfd, SHUT_WR);
if (ret != 0) {
fprintf(stderr, "shutdown failed: %s\n",
strerror(errno));
return 1;
}
FD_CLR(fileno(fp), &rset);
continue;
}
buf[ODS_SE_MAXLINE-1] = '\0';
if (strncmp(buf, "exit", 4) == 0 ||
strncmp(buf, "quit", 4) == 0) {
return 0;
}
ods_str_trim(buf);
n = strlen(buf);
ods_writen(sockfd, buf, n);
}
}
return 0;
}
/**
* Start interface.
*
*/
static int
interface_start(char* cmd)
{
int sockfd, ret, flags;
struct sockaddr_un servaddr;
const char* servsock_filename = ODS_SE_SOCKFILE;
ods_log_init(NULL, 0, 0);
/* new socket */
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sockfd < 0) {
fprintf(stderr, "Unable to connect to engine. "
"socket() failed: %s\n", strerror(errno));
return 1;
}
/* no suprises */
bzero(&servaddr, sizeof(servaddr));
servaddr.sun_family = AF_UNIX;
strncpy(servaddr.sun_path, servsock_filename,
sizeof(servaddr.sun_path) - 1);
/* connect */
ret = connect(sockfd, (const struct sockaddr*) &servaddr,
sizeof(servaddr));
if (ret != 0) {
if (cmd && ods_strcmp(cmd, "start\n") == 0) {
return system(ODS_SE_ENGINE);
}
if (cmd && ods_strcmp(cmd, "running\n") == 0) {
fprintf(stderr, "Engine not running.\n");
} else {
fprintf(stderr, "Unable to connect to engine: "
"connect() failed: %s\n", strerror(errno));
}
close(sockfd);
return 1;
}
/* set socket to non-blocking */
flags = fcntl(sockfd, F_GETFL, 0);
if (flags < 0) {
ods_log_error("[%s] unable to start interface, fcntl(F_GETFL) "
"failed: %s", cli_str, strerror(errno));
close(sockfd);
return 1;
}
flags |= O_NONBLOCK;
if (fcntl(sockfd, F_SETFL, flags) < 0) {
ods_log_error("[%s] unable to start interface, fcntl(F_SETFL) "
"failed: %s", cli_str, strerror(errno));
close(sockfd);
return 1;
}
/* some sort of interface */
if (!cmd) {
fprintf(stderr, "cmd> ");
}
/* run */
ret = interface_run(stdin, sockfd, cmd);
close(sockfd);
return ret;
}
/**
* Main. start interface tool.
*
*/
int
main(int argc, char* argv[])
{
int c;
int options_size = 0;
const char* options[5];
char* cmd = NULL;
int ret = 0;
allocator_type* clialloc = allocator_create(malloc, free);
if (!clialloc) {
fprintf(stderr,"error, malloc failed for client\n");
exit(1);
}
if (argc > 5) {
fprintf(stderr,"error, too many arguments (%d)\n", argc);
exit(1);
}
/* command line options */
for (c = 0; c < argc; c++) {
options[c] = argv[c];
if (c > 0) {
options_size += strlen(argv[c]) + 1;
}
}
if (argc > 1) {
cmd = (char*) allocator_alloc(clialloc, (options_size+2)*sizeof(char));
if (!cmd) {
fprintf(stderr, "memory allocation failed\n");
exit(1);
}
(void)strncpy(cmd, "", 1);
for (c = 1; c < argc; c++) {
(void)strncat(cmd, options[c], strlen(options[c]));
(void)strncat(cmd, " ", 1);
}
cmd[options_size-1] = '\n';
}
/* main stuff */
if (cmd && ods_strcmp(cmd, "-h\n") == 0) {
usage(stdout);
ret = 1;
} else if (cmd && ods_strcmp(cmd, "--help\n") == 0) {
usage(stdout);
ret = 1;
} else {
ret = interface_start(cmd);
}
/* done */
allocator_deallocate(clialloc, (void*) cmd);
allocator_cleanup(clialloc);
return ret;
}
opendnssec-1.4.3/signer/src/shared/ 0000775 0001750 0001750 00000000000 12247571206 014215 5 0000000 0000000 opendnssec-1.4.3/signer/src/shared/duration.h 0000664 0001750 0001750 00000007443 11521551545 016141 0000000 0000000 /*
* $Id: duration.h 4341 2011-01-31 15:21:09Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
*
* Durations.
*/
#ifndef UTIL_DURATION_H
#define UTIL_DURATION_H
#include "config.h"
#include "shared/allocator.h"
#include
#include
/**
* Duration.
*
*/
typedef struct duration_struct duration_type;
struct duration_struct
{
allocator_type* allocator;
time_t years;
time_t months;
time_t weeks;
time_t days;
time_t hours;
time_t minutes;
time_t seconds;
};
/**
* Create a new 'instant' duration.
* \return duration_type* created duration
*
*/
duration_type* duration_create(void);
/**
* Compare durations.
* \param[in] d1 one duration
* \param[in] d2 another duration
* \return int 0 if equal, -1 if d1 < d2, 1 if d2 < d1
*
*/
int duration_compare(duration_type* d1, duration_type* d2);
/**
* Create a duration from string.
* \param[in] str string-format duration
* \return duration_type* created duration
*
*/
duration_type* duration_create_from_string(const char* str);
/**
* Convert a duration to a string.
* \param[in] duration duration to be converted
* \return char* string-format duration
*
*/
char* duration2string(duration_type* duration);
/**
* Convert a duration to a time.
* \param[in] duration duration to be converted
* \return time_t time-format duration
*
*/
time_t duration2time(duration_type* duration);
/**
* Return a random time.
* \param[in] mod modulo
* \return time_t random time
*
*/
time_t ods_rand(time_t mod);
/**
* Return the shortest time.
* \param[in] a one time
* \param[in] b another time
* \return time_t the shortest time
*
*/
time_t time_minimum(time_t a, time_t b);
/**
* Return the longest time.
* \param[in] a one time
* \param[in] b another time
* \return time_t the shortest time
*
*/
time_t time_maximum(time_t a, time_t b);
/**
* Convert time into string.
* \param[in] n time
* \param[in] s string
*
*/
void time_itoa(time_t n, char* s);
/**
* Return time in datestamp.
* \param[in] tt time
* \param[in] format stamp format
* \param[out] str store string
* \return uint32_t integer based datestamp.
*
*/
uint32_t time_datestamp(time_t tt, const char* format, char** str);
/**
* Return the time since Epoch, measured in seconds.
* If the timeshift is enabled, return the environment variable.
* \return time_t now (or timeshift).
*
*/
time_t time_now(void);
/**
* Clean up duration.
* \param[in] duration duration to be cleaned up
*
*/
void duration_cleanup(duration_type* duration);
#endif /* UTIL_DURATION_H */
opendnssec-1.4.3/signer/src/shared/file.c 0000664 0001750 0001750 00000032706 12164766744 015243 0000000 0000000 /*
* $Id: file.c 7180 2013-07-03 09:24:52Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
*
* File access.
*/
#include "config.h"
#include "shared/file.h"
#include "shared/log.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define BUFFER_SIZE (16 * 1024) /* use 16K buffers */
static const char* file_str = "file";
static unsigned int file_count = 0;
/**
* Convert file mode to readable string.
*
*/
const char*
ods_file_mode2str(const char* mode)
{
if (!mode) {
return "no mode";
}
if (ods_strcmp(mode, "a") == 0) {
return "appending";
} else if (ods_strcmp(mode, "r") == 0) {
return "reading";
} else if (ods_strcmp(mode, "w") == 0) {
return "writing";
}
return "unknown mode";
}
/**
* Get next char.
*
*/
int
ods_fgetc(FILE* fd, unsigned int* line_nr)
{
int c;
ods_log_assert(fd);
ods_log_assert(line_nr);
c = fgetc(fd);
if (c == '\n') {
(*line_nr)++;
}
if (c == EOF && errno != 0) {
ods_log_crit("[%s] fgetc() failed, enough memory? (%s)",
file_str, strerror(errno));
}
return c;
}
/**
* Skip white space.
*
*/
int
ods_skip_whitespace(FILE* fd, unsigned int* line_nr)
{
int c;
ods_log_assert(fd);
ods_log_assert(line_nr);
while ((c=ods_fgetc(fd, line_nr)) != EOF) {
if (c == ' ' || c == '\t' || c == '\r') {
continue;
}
return c;
}
return EOF;
}
/**
* Construct file name. (StrAppend?, snprintf?)
*
*/
char*
ods_build_path(const char* file, const char* suffix, int dir, int no_slash)
{
size_t len_file = 0;
size_t len_suffix = 0;
size_t len_total = 0;
char* openf = NULL;
if (file) {
len_file = strlen(file);
if (suffix) {
len_suffix = strlen(suffix);
}
len_total = len_suffix + len_file;
if (dir) {
len_total++;
}
if (len_total > 0) {
openf = (char*) malloc(sizeof(char)*(len_total + 1));
if (!openf) {
ods_log_crit("[%s] build path failed: malloc failed", file_str);
return NULL;
}
strncpy(openf, file, len_file);
openf[len_file] = '\0';
if (no_slash) {
size_t i = 0;
for (i=0; i 0) {
openf = (char*) malloc(sizeof(char)*(len_total + 1));
if (!openf) {
ods_log_error("[%s] unable to open file %s%s%s for %s: malloc() "
"failed", file_str, (dir?dir:""), (dir?"/":""),
(file?file:"(null)"), ods_file_mode2str(mode));
return NULL;
}
if (dir) {
strncpy(openf, dir, len_dir);
openf[len_dir] = '\0';
if (file) {
strncat(openf, file, len_file);
}
} else if (file) {
strncpy(openf, file, len_file);
}
openf[len_total] = '\0';
if (len_file) {
fd = fopen(openf, mode);
if (!fd) {
ods_log_debug("[%s] unable to open file %s for %s: %s",
file_str, openf?openf:"(null)",
ods_file_mode2str(mode), strerror(errno));
} else {
file_count++;
ods_log_debug("[%s] openfile %s count %u", file_str, openf?openf:"(null)", file_count);
}
}
free((void*) openf);
}
return fd;
}
/**
* Close a file.
*
*/
void
ods_fclose(FILE* fd)
{
if (fd) {
file_count--;
fclose(fd);
}
return;
}
/**
* Write to file descriptor.
*
*/
ssize_t
ods_writen(int fd, const void* vptr, size_t n)
{
size_t nleft;
ssize_t nwritten;
const char* ptr;
ptr = vptr;
nleft = n;
while (nleft > 0) {
if ((nwritten = write(fd, ptr, nleft)) <= 0) {
if (nwritten < 0 && errno == EINTR) {
nwritten = 0; /* and call write again */
} else {
return -1; /* error */
}
}
nleft -= nwritten;
ptr += nwritten;
}
return n;
}
/**
* Get file last modified.
*
*/
time_t
ods_file_lastmodified(const char* file)
{
int ret;
struct stat buf;
FILE* fd;
ods_log_assert(file);
if ((fd = ods_fopen(file, NULL, "r")) != NULL) {
ret = stat(file, &buf);
if (ret == -1) {
ods_log_error("[%s] unable to stat file %s: %s", file_str,
file, strerror(errno));
}
ods_fclose(fd);
return buf.st_mtime;
} else {
ods_log_error("[%s] unable to stat file %s: ods_fopen() failed",
file_str, file);
}
return 0;
}
/**
* Compare strings.
*
*/
int
ods_strcmp(const char* s1, const char* s2)
{
if (!s1 && !s2) {
return 0;
} else if (!s1) {
return -1;
} else if (!s2) {
return -1;
} else if (strlen(s1) != strlen(s2)) {
if (strncmp(s1, s2, strlen(s1)) == 0) {
return strlen(s1) - strlen(s2);
}
}
return strncmp(s1, s2, strlen(s1));
}
/**
* Compare a string lowercased
*
*/
int
ods_strlowercmp(const char* str1, const char* str2)
{
while (str1 && str2 && *str1 != '\0' && *str2 != '\0') {
if (tolower((int)*str1) != tolower((int)*str2)) {
if (tolower((int)*str1) < tolower((int)*str2)) {
return -1;
}
return 1;
}
str1++;
str2++;
}
if (str1 && str2) {
if (*str1 == *str2) {
return 0;
} else if (*str1 == '\0') {
return -1;
}
} else if (!str1 && !str2) {
return 0;
} else if (!str1 && str2) {
return -1;
}
return 1;
}
/**
* Replace a substring in string.
*
*/
const char*
ods_replace(const char *str, const char *oldstr, const char *newstr)
{
char* buffer = NULL;
char* ch = NULL;
size_t part1_len = 0;
size_t part2_len = 0;
size_t part3_len = 0;
if (!str) {
return NULL;
}
if (!oldstr || !newstr) {
return str;
}
if (!(ch = strstr(str, oldstr))) {
buffer = strdup(str);
return buffer;
}
part1_len = ch-str;
part2_len = strlen(newstr);
part3_len = strlen(ch+strlen(oldstr));
buffer = calloc(part1_len+part2_len+part3_len+1, sizeof(char));
if (!buffer) {
return NULL;
}
if (part1_len) {
strncpy(buffer, str, part1_len);
buffer[part1_len] = '\0';
if (part2_len) {
strncat(buffer, str, part2_len);
buffer[part1_len+part2_len] = '\0';
}
} else {
strncpy(buffer, newstr, part2_len);
buffer[part2_len] = '\0';
}
if (part3_len) {
strncat(buffer, ch+strlen(oldstr), part3_len);
buffer[part1_len+part2_len+part3_len] = '\0';
}
buffer[ch-str] = '\0';
snprintf(buffer+(ch-str), SYSTEM_MAXLEN, "%s%s", newstr, ch+strlen(oldstr));
return buffer;
}
/**
* File copy.
*
*/
ods_status
ods_file_copy(const char* file1, const char* file2)
{
char buf[BUFFER_SIZE];
int fin = 0;
int fout = 0;
int read_size = 0;
if (!file1 || !file2) {
return ODS_STATUS_ASSERT_ERR;
}
if ((fin = open(file1, O_RDONLY|O_NONBLOCK)) < 0) {
return ODS_STATUS_FOPEN_ERR;
}
if ((fout = open(file2, O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0) {
close(fin);
return ODS_STATUS_FOPEN_ERR;
}
while (1) {
read_size = read(fin, buf, sizeof(buf));
if (read_size == 0) {
break;
}
if (read_size < 0) {
close(fin);
close(fout);
return ODS_STATUS_FREAD_ERR;
}
if (write(fout, buf, (unsigned int) read_size) < 0) {
close(fin);
close(fout);
return ODS_STATUS_FWRITE_ERR;
}
}
close(fin);
close(fout);
return ODS_STATUS_OK;
}
/**
* Get directory part of filename.
*
*/
char*
ods_dir_name(const char* file) {
int l = strlen(file);
char* dir = NULL;
ods_log_assert(file);
/* find seperator */
while (l>0 && strncmp(file + (l-1), "/", 1) != 0) {
l--;
}
/* now strip off (multiple seperators) */
while (l>0 && strncmp(file + (l-1), "/", 1) == 0) {
l--;
}
if (l) {
dir = (char*) calloc(l+1, sizeof(char));
if (dir) {
dir = strncpy(dir, file, l);
}
return dir;
}
return NULL;
}
/**
* (Create) and change ownership of directories
*
*/
void
ods_chown(const char* file, uid_t uid, gid_t gid, int getdir)
{
char* dir = NULL;
if (!file) {
ods_log_warning("[%s] no filename given for chown()", file_str);
return;
}
if (!getdir) {
ods_log_debug("[%s] create and chown %s with user=%ld group=%ld",
file_str, file, (signed long) uid, (signed long) gid);
if (chown(file, uid, gid) != 0) {
ods_log_error("[%s] chown() %s failed: %s", file_str, file,
strerror(errno));
}
} else if ((dir = ods_dir_name(file)) != NULL) {
ods_log_debug("[%s] create and chown %s with user=%ld group=%ld",
file_str, dir, (signed long) uid, (signed long) gid);
if (chown(dir, uid, gid) != 0) {
ods_log_error("[%s] chown() %s failed: %s", file_str,
dir, strerror(errno));
}
free((void*) dir);
} else {
ods_log_warning("[%s] use of relative path: %s", file_str, file);
}
return;
}
/**
* Remove leading and trailing whitespace.
*
*/
void
ods_str_trim(char* str)
{
int i = strlen(str), nl = 0;
/* trailing */
while (i>0) {
--i;
if (str[i] == '\n') {
nl = 1;
}
if (str[i] == ' ' || str[i] == '\t' || str[i] == '\n') {
str[i] = '\0';
} else {
break;
}
}
if (nl) {
str[++i] = '\n';
}
/* leading */
i = 0;
while (str[i] == ' ' || str[i] == '\t') {
i++;
}
while (*(str+i) != '\0') {
*str = *(str+i);
str++;
}
*str = '\0';
return;
}
/**
* Add a string to a list of strings. Taken from ods-enforcer.
*
*/
void
ods_str_list_add(char*** list, char* str)
{
char** old = NULL;
size_t count = 0;
if (*list) {
for (count=0; (*list)[count]; ++count) {
;
}
old = *list;
*list = (char**) calloc(sizeof(char*), count+2);
if (!*list) {
ods_fatal_exit("[%s] fatal ods_str_list_add(): calloc() failed",
file_str);
}
if (old) {
memcpy(*list, old, count * sizeof(char*));
}
free(old);
(*list)[count] = str;
(*list)[count+1] = NULL;
} else {
/** List is NULL, allocate new */
*list = calloc(sizeof(char*), 2);
if (!*list) {
ods_fatal_exit("[%s] fatal ods_str_list_add(): calloc() failed",
file_str);
}
(*list)[0] = str;
}
return;
}
opendnssec-1.4.3/signer/src/shared/file.h 0000664 0001750 0001750 00000011267 12007720723 015226 0000000 0000000 /*
* $Id: file.h 6501 2012-08-06 10:52:03Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
*
* File access wrapper.
*/
#ifndef SHARED_FILE_H
#define SHARED_FILE_H
#include "config.h"
#include "shared/status.h"
#include
#include
#include
#ifdef HAVE_SYS_TYPES_H
# include
#endif
#ifdef HAVE_UNISTD_H
# include
#endif
#define SYSTEM_MAXLEN 1024
/**
* Convert file mode to readable string.
* \param[in] mode file mode
* \return const char* string
*
*/
const char* ods_file_mode2str(const char* mode);
/**
* Get next character.
* \param[in] fd file descriptor
* \param[in] line_nr line number
* \return int next character.
*
*/
int ods_fgetc(FILE* fd, unsigned int* line_nr);
/**
* Skip white space.
* \param[in] fd file descriptor
* \param[in] line_nr line number
* \return int first encountered non-whitespace character
*
*/
int ods_skip_whitespace(FILE* fd, unsigned int* line_nr);
/**
* Construct file or directory name.
* \param[in] file filename without extension
* \param[in] suffix extension.
* \param[in] dir directory or not
* \param[in] no_slash no forward slashes and such characters allowed
* \return char* concatenation of file and suffix
*
*/
char* ods_build_path(const char* file, const char* suffix, int dir,
int no_slash);
/**
* Open a file.
* \param[in] file filename.
* \param[in] dir directory.
* \param[in] mode file mode
* \return FILE* file descriptor
*
*/
FILE* ods_fopen(const char* file, const char* dir, const char* mode);
/**
* Close a file.
* \param[in] fd the file descriptor
*
*/
void ods_fclose(FILE* fd);
/**
* Write to file descriptor.
* \param[in] fd file descriptor
* \param[in] vptr pointer to data
* \param[in] n size of data
*
*/
ssize_t ods_writen(int fd, const void* vptr, size_t n);
/**
* Get file status.
* \param[in] file file name
* \return time_t last modified
*
*/
time_t ods_file_lastmodified(const char* file);
/**
* Compare strings.
* \param[in] s1 one string
* \param[in] s2 another string
* \return -1, 0 or 1
*
*/
int ods_strcmp(const char* s1, const char* s2);
/**
* Compare strings lowercased.
* \param[in] s1 one string
* \param[in] s2 another string
* \return -1, 0 or 1
*
*/
int ods_strlowercmp(const char* s1, const char* s2);
/**
* Replace a substring in string.
* \param[in] str The string
* \param[in] oldstr old substring
* \param[in] newstr new substring
* \return char* the substituted string.
*
*/
const char* ods_replace(const char *str, const char *oldstr,
const char *newstr);
/**
* Get directory part of filename.
* \param[in] file file name
* \return char* directory part
*
*/
char* ods_dir_name(const char* file);
/**
* Copy file.
* \param[in] file1 from file name
* \param[in] file2 to file name
* \return ods_status
*
*/
ods_status ods_file_copy(const char* file1, const char* file2);
/**
* (Create) and change ownership of directories.
* \param[in] file file name
* \param[in] uid user id
* \param[in] gid group id
* \param[in] getdir fetch directory part
*
*/
void ods_chown(const char* file, uid_t uid, gid_t gid, int getdir);
/**
* Remove leading and trailing whitespace.
* \param[in] str string to trim
*
*/
void ods_str_trim(char* str);
/**
* Add a string to a list of strings. Taken from ods-enforcer.
* \param[out] list string list
* \param[in] str string to add
*
*/
void ods_str_list_add(char*** list, char* str);
#endif /* SHARED_FILE_H */
opendnssec-1.4.3/signer/src/shared/locks.c 0000664 0001750 0001750 00000011447 12107366547 015430 0000000 0000000 /*
* $Id: locks.c 7039 2013-02-15 08:10:15Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Threading and locking.
*
*/
#include "config.h"
#include "shared/locks.h"
#include "shared/log.h"
#include
#include /* sigfillset(), sigprocmask() */
#include /* strerror() */
#ifdef HAVE_SYS_TIME_H
#include /* gettimeofday() */
#endif
#ifdef HAVE_TIME_H
#include /* gettimeofday() */
#endif
static const char* lock_str = "lock";
#if !defined(HAVE_PTHREAD)
#include /* waitpid() */
#include /* getpid(), waitpid() */
#include /* fork(), getpid() */
/**
* No threading available: fork a new process.
* This means no shared data structure, and no locking.
* Only the main thread ever returns. Exits on errors.
* @param thr: the location where to store the thread-id.
* @param func: function body of the thread. Return value of func is lost.
* @param arg: user argument to func.
*/
void
ods_thr_fork_create(ods_thread_type* thr, void* (*func)(void*), void* arg)
{
pid_t pid = fork();
switch (pid) {
case 0: /* child */
*thr = (ods_thread_type)getpid();
(void)(*func)(arg);
exit(0);
case -1: /* error */
ods_fatal_exit("[%s] unable to fork thread: %s", lock_str,
strerror(errno));
default: /* main */
*thr = (ods_thread_type)pid;
return;
}
return;
}
/**
* There is no threading. Wait for a process to terminate.
* Note that ub_thread_t is defined as pid_t.
* @param thread: the process id to wait for.
*/
void ods_thr_fork_wait(ods_thread_type thread)
{
int status = 0;
if (waitpid((pid_t)thread, &status, 0) == -1) {
ods_log_error("[%s] waitpid(%d): %s", lock_str, (int)thread,
strerror(errno));
}
if (status != 0) {
ods_log_warning("[%s] process %d abnormal exit with status %d",
lock_str, (int)thread, status);
}
return;
}
#else /* defined(HAVE_PTHREAD) */
int
ods_thread_wait(cond_basic_type* cond, lock_basic_type* lock, time_t wait)
{
struct timespec ts;
int ret = 0;
/* If timeshift is enabled, we don't care about threads. No need
* to take the timeshift into account here */
#ifndef HAVE_CLOCK_GETTIME
struct timeval tv;
if (gettimeofday(&tv, NULL) != 0) {
ods_log_error("[%s] clock_gettime() error: %s", lock_str,
strerror(errno));
return 1;
}
ts.tv_sec = tv.tv_sec;
ts.tv_nsec = (tv.tv_usec/1000);
#else /* HAVE_CLOCK_GETTIME */
if (clock_gettime(CLOCK_REALTIME, &ts) < 0) {
ods_log_error("[%s] clock_gettime() error: %s", lock_str,
strerror(errno));
return 1;
}
#endif /* !HAVE_CLOCK_GETTIME */
if (wait > 0) {
ts.tv_sec = ts.tv_sec + wait;
ret = pthread_cond_timedwait(cond, lock, &ts);
} else {
ret = pthread_cond_wait(cond, lock);
}
if (ret == ETIMEDOUT) {
return 0;
}
return ret;
}
#endif /* defined(HAVE_PTHREAD) */
void
ods_thread_blocksigs(void)
{
#ifndef HAVE_PTHREAD
int err = 0;
#endif
sigset_t sigset;
sigfillset(&sigset);
#ifndef HAVE_PTHREAD
if((err=pthread_sigmask(SIG_SETMASK, &sigset, NULL)))
ods_fatal_exit("[%s] pthread_sigmask: %s", lock_str, strerror(err));
#else /* !HAVE_PTHREAD */
/* have nothing, do single process signal mask */
if(sigprocmask(SIG_SETMASK, &sigset, NULL) != 0)
ods_fatal_exit("[%s] sigprocmask: %s", lock_str, strerror(errno));
#endif /* HAVE_PTHREAD */
}
opendnssec-1.4.3/signer/src/shared/util.c 0000664 0001750 0001750 00000025467 12024053460 015262 0000000 0000000 /*
* $Id: util.c 6660 2012-09-12 09:34:40Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
*
* Utility tools.
*/
#include "config.h"
#include "shared/file.h"
#include "shared/log.h"
#include "shared/util.h"
#include
#include
#include
#include
#include
#include
#include
static const char* util_str = "util";
/**
* Check if a RR is a DNSSEC RR (RRSIG, NSEC, NSEC3 or NSEC3PARAMS).
*
*/
int
util_is_dnssec_rr(ldns_rr* rr)
{
ldns_rr_type type = 0;
if (!rr) {
return 0;
}
type = ldns_rr_get_type(rr);
return (type == LDNS_RR_TYPE_RRSIG ||
type == LDNS_RR_TYPE_NSEC ||
type == LDNS_RR_TYPE_NSEC3 ||
type == LDNS_RR_TYPE_NSEC3PARAMS);
}
/**
* Compare SERIALs.
*
*/
int
util_serial_gt(uint32_t serial_new, uint32_t serial_old)
{
return DNS_SERIAL_GT(serial_new, serial_old);
}
/**
* Compare SOA RDATAs.
*
*/
int
util_soa_compare_rdata(ldns_rr* rr1, ldns_rr* rr2)
{
size_t i = 0;
size_t rdata_count = SE_SOA_RDATA_MINIMUM;
for (i = 0; i <= rdata_count; i++) {
if (i != SE_SOA_RDATA_SERIAL &&
ldns_rdf_compare(ldns_rr_rdf(rr1, i), ldns_rr_rdf(rr2, i)) != 0) {
return 1;
}
}
return 0;
}
/**
* Compare SOA RRs.
*
*/
int
util_soa_compare(ldns_rr* rr1, ldns_rr* rr2)
{
size_t rr1_len = 0;
size_t rr2_len = 0;
size_t offset = 0;
if (!rr1 || !rr2) {
return 1;
}
rr1_len = ldns_rr_uncompressed_size(rr1);
rr2_len = ldns_rr_uncompressed_size(rr2);
if (ldns_dname_compare(ldns_rr_owner(rr1), ldns_rr_owner(rr2)) != 0) {
return 1;
}
if (ldns_rr_get_class(rr1) != ldns_rr_get_class(rr2)) {
return 1;
}
if (ldns_rr_get_type(rr1) != LDNS_RR_TYPE_SOA) {
return 1;
}
if (ldns_rr_get_type(rr1) != ldns_rr_get_type(rr2)) {
return 1;
}
if (offset > rr1_len || offset > rr2_len) {
if (rr1_len == rr2_len) {
return util_soa_compare_rdata(rr1, rr2);
}
return 1;
}
return util_soa_compare_rdata(rr1, rr2);
}
/**
* Compare RRs only on RDATA.
*
*/
ldns_status
util_dnssec_rrs_compare(ldns_rr* rr1, ldns_rr* rr2, int* cmp)
{
ldns_status status = LDNS_STATUS_OK;
size_t rr1_len;
size_t rr2_len;
ldns_buffer* rr1_buf;
ldns_buffer* rr2_buf;
if (!rr1 || !rr2) {
return LDNS_STATUS_ERR;
}
rr1_len = ldns_rr_uncompressed_size(rr1);
rr2_len = ldns_rr_uncompressed_size(rr2);
rr1_buf = ldns_buffer_new(rr1_len);
rr2_buf = ldns_buffer_new(rr2_len);
/* name, class and type should already be equal */
status = ldns_rr2buffer_wire_canonical(rr1_buf, rr1, LDNS_SECTION_ANY);
if (status != LDNS_STATUS_OK) {
ldns_buffer_free(rr1_buf);
ldns_buffer_free(rr2_buf);
/* critical */
return status;
}
status = ldns_rr2buffer_wire_canonical(rr2_buf, rr2, LDNS_SECTION_ANY);
if (status != LDNS_STATUS_OK) {
ldns_buffer_free(rr1_buf);
ldns_buffer_free(rr2_buf);
/* critical */
return status;
}
*cmp = ldns_rr_compare_wire(rr1_buf, rr2_buf);
ldns_buffer_free(rr1_buf);
ldns_buffer_free(rr2_buf);
return LDNS_STATUS_OK;
}
/**
* A more efficient ldns_dnssec_rrs_add_rr(), get rid of ldns_rr_compare().
*
*/
ldns_status
util_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr)
{
int cmp = 0;
ldns_dnssec_rrs *new_rrs = NULL;
ldns_status status = LDNS_STATUS_OK;
uint32_t rr_ttl = 0;
uint32_t default_ttl = 0;
if (!rrs || !rrs->rr || !rr) {
return LDNS_STATUS_ERR;
}
rr_ttl = ldns_rr_ttl(rr);
status = util_dnssec_rrs_compare(rrs->rr, rr, &cmp);
if (status != LDNS_STATUS_OK) {
/* critical */
return status;
}
if (cmp < 0) {
if (rrs->next) {
return util_dnssec_rrs_add_rr(rrs->next, rr);
} else {
new_rrs = ldns_dnssec_rrs_new();
new_rrs->rr = rr;
rrs->next = new_rrs;
default_ttl = ldns_rr_ttl(rrs->rr);
if (rr_ttl < default_ttl) {
ldns_rr_set_ttl(rrs->rr, rr_ttl);
} else {
ldns_rr_set_ttl(new_rrs->rr, default_ttl);
}
return LDNS_STATUS_OK;
}
} else if (cmp > 0) {
/* put the current old rr in the new next, put the new
rr in the current container */
new_rrs = ldns_dnssec_rrs_new();
new_rrs->rr = rrs->rr;
new_rrs->next = rrs->next;
rrs->rr = rr;
rrs->next = new_rrs;
default_ttl = ldns_rr_ttl(new_rrs->rr);
if (rr_ttl < default_ttl) {
ldns_rr_set_ttl(new_rrs->rr, rr_ttl);
} else {
ldns_rr_set_ttl(rrs->rr, default_ttl);
}
return LDNS_STATUS_OK;
} else {
/* should we error on equal? or free memory of rr */
ods_log_warning("[%s] adding duplicate RR?", util_str);
return LDNS_STATUS_NO_DATA;
}
return LDNS_STATUS_OK;
}
/**
* Read process id from file.
*
*/
static pid_t
util_read_pidfile(const char* file)
{
int fd;
pid_t pid;
char pidbuf[32];
char *t;
int l;
if ((fd = open(file, O_RDONLY)) == -1) {
return -1;
}
if (((l = read(fd, pidbuf, sizeof(pidbuf)))) == -1) {
close(fd);
return -1;
}
close(fd);
/* Empty pidfile means no pidfile... */
if (l == 0) {
errno = ENOENT;
return -1;
}
pid = (pid_t) strtol(pidbuf, &t, 10);
if (*t && *t != '\n') {
return -1;
}
return pid;
}
/**
* Check process id file.
*
*/
int
util_check_pidfile(const char* pidfile)
{
pid_t oldpid;
struct stat stat_ret;
/**
* If the file exists then either we didn't shutdown cleanly or
* a signer daemon is already running: in either case shutdown.
*/
if (stat(pidfile, &stat_ret) != 0) {
if (errno != ENOENT) {
ods_log_error("[%s] cannot stat pidfile %s: %s", util_str, pidfile,
strerror(errno));
} /* else: file does not exist: carry on */
} else {
if (S_ISREG(stat_ret.st_mode)) {
/** The pidfile exists already */
if ((oldpid = util_read_pidfile(pidfile)) == -1) {
/** Consider stale pidfile */
if (errno != ENOENT) {
ods_log_error("[%s] cannot read pidfile %s: %s", util_str,
pidfile, strerror(errno));
}
} else {
if (kill(oldpid, 0) == 0 || errno == EPERM) {
ods_log_crit("[%s] pidfile %s already exists, "
"a process with pid %u is already running. "
"If no ods-signerd process is running, a previous "
"instance didn't shutdown cleanly, please remove this "
"file and try again.", util_str, pidfile, oldpid);
return 0;
} else {
/** Consider state pidfile */
ods_log_warning("[%s] pidfile %s already exists, "
"but no process with pid %u is running. "
"A previous instance didn't shutdown cleanly, this "
"pidfile is stale.", util_str, pidfile, oldpid);
}
}
}
}
/** All good, carry on */
return 1;
}
/**
* Write process id to file.
*
*/
int
util_write_pidfile(const char* pidfile, pid_t pid)
{
FILE* fd;
char pidbuf[32];
size_t result = 0, size = 0;
ods_log_assert(pidfile);
ods_log_assert(pid);
ods_log_debug("[%s] writing pid %lu to pidfile %s", util_str,
(unsigned long) pid, pidfile);
snprintf(pidbuf, sizeof(pidbuf), "%lu\n", (unsigned long) pid);
fd = ods_fopen(pidfile, NULL, "w");
if (!fd) {
return -1;
}
size = strlen(pidbuf);
if (size == 0) {
result = 1;
} else {
result = fwrite((const void*) pidbuf, 1, size, fd);
}
if (result == 0) {
ods_log_error("[%s] write to pidfile %s failed: %s", util_str,
pidfile, strerror(errno));
} else if (result < size) {
ods_log_error("[%s] short write to pidfile %s: disk full?", util_str,
pidfile);
result = 0;
} else {
result = 1;
}
ods_fclose(fd);
if (!result) {
return -1;
}
return 0;
}
/**
* Print an LDNS RR, check status.
*
*/
ods_status
util_rr_print(FILE* fd, const ldns_rr* rr)
{
char* result = NULL;
ldns_buffer* tmp_buffer = NULL;
ods_status status = ODS_STATUS_OK;
if (!fd || !rr) {
return ODS_STATUS_ASSERT_ERR;
}
tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN);
if (!tmp_buffer) {
return ODS_STATUS_MALLOC_ERR;
}
if (ldns_rr2buffer_str_fmt(tmp_buffer, NULL, rr)
== LDNS_STATUS_OK) {
/* export and return string, destroy rest */
result = ldns_buffer2str(tmp_buffer);
if (result) {
fprintf(fd, "%s", result);
status = ODS_STATUS_OK;
LDNS_FREE(result);
} else {
fprintf(fd, "; Unable to convert rr to string\n");
status = ODS_STATUS_FWRITE_ERR;
}
} else {
status = ODS_STATUS_FWRITE_ERR;
}
ldns_buffer_free(tmp_buffer);
return status;
}
/**
* Calculates the size needed to store the result of b64_pton.
*
*/
size_t
util_b64_pton_calculate_size(size_t srcsize)
{
return (((((srcsize + 3) / 4) * 3)) + 1);
}
opendnssec-1.4.3/signer/src/shared/status.h 0000664 0001750 0001750 00000006336 12205607427 015640 0000000 0000000 /*
* $Id$
*
* Copyright (c) 2010-2011 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
*
* Status.
*/
#ifndef UTIL_STATUS_H
#define UTIL_STATUS_H
#include "config.h"
enum ods_enum_status {
ODS_STATUS_OK,
ODS_STATUS_EOF,
ODS_STATUS_NOTIMPL,
ODS_STATUS_UPTODATE,
ODS_STATUS_ASSERT_ERR,
ODS_STATUS_CFG_ERR,
ODS_STATUS_CHDIR_ERR,
ODS_STATUS_CHROOT_ERR,
ODS_STATUS_CMDHANDLER_ERR,
ODS_STATUS_XFRHANDLER_ERR,
ODS_STATUS_CONFLICT_ERR,
ODS_STATUS_ERR,
ODS_STATUS_FOPEN_ERR,
ODS_STATUS_FORK_ERR,
ODS_STATUS_FREAD_ERR,
ODS_STATUS_FWRITE_ERR,
ODS_STATUS_HSM_ERR,
ODS_STATUS_INSECURE,
ODS_STATUS_MALLOC_ERR,
ODS_STATUS_RENAME_ERR,
ODS_STATUS_UNLINK_ERR,
ODS_STATUS_SOCK_BIND,
ODS_STATUS_SOCK_FCNTL_NONBLOCK,
ODS_STATUS_SOCK_GETADDRINFO,
ODS_STATUS_SOCK_LISTEN,
ODS_STATUS_SOCK_SETSOCKOPT_V6ONLY,
ODS_STATUS_SOCK_SOCKET_UDP,
ODS_STATUS_SOCK_SOCKET_TCP,
ODS_STATUS_ACL_SUBNET_BAD_RANGE,
ODS_STATUS_ACL_SUBNET_OUT_RANGE,
ODS_STATUS_PARSE_ERR,
ODS_STATUS_PRIVDROP_ERR,
ODS_STATUS_RNG_ERR,
ODS_STATUS_SETSID_ERR,
ODS_STATUS_UNCHANGED,
ODS_STATUS_WRITE_PIDFILE_ERR,
ODS_STATUS_XML_ERR,
ODS_STATUS_XFR_NOT_READY,
ODS_STATUS_SKIPDNAME,
ODS_STATUS_BUFAVAIL,
ODS_STATUS_PARSESOA,
ODS_STATUS_REQAXFR,
ODS_STATUS_INSERIAL,
ODS_STATUS_XFRBADFORM,
ODS_STATUS_XFRINCOMPLETE
};
typedef enum ods_enum_status ods_status;
typedef struct ods_struct_lookup_table ods_lookup_table;
struct ods_struct_lookup_table {
int id;
const char* name;
};
extern ods_lookup_table ods_status_str[];
/**
* Look up item in table.
* \param[in] table table
* \param[in] id identifier
*
*/
ods_lookup_table* ods_lookup_by_id(ods_lookup_table *table, int id);
/**
* Look up a descriptive text by each status.
* \param[in] status status identifierr
* \return const char* corresponding descriptive text
*
*/
const char *ods_status2str(ods_status status);
#endif /* UTIL_STATUS_H */
opendnssec-1.4.3/signer/src/shared/locks.h 0000664 0001750 0001750 00000010311 11665414630 015415 0000000 0000000 /*
* $Id: locks.h 5946 2011-11-30 11:55:04Z matthijs $
*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* Threading and locking.
*
*/
#ifndef SCHEDULER_LOCKS_H
#define SCHEDULER_LOCKS_H
#include "config.h"
#include "shared/log.h"
#include
#include
#define LOCKRET(func) do { \
int err; \
if ( (err=(func)) != 0) \
ods_log_error("%s at %d could not " #func ": %s", \
__FILE__, __LINE__, strerror(err)); \
} while(0)
#if defined(HAVE_PTHREAD)
#include