opendnssec-2.1.13/0000755000077000001440000000000014446272546010753 500000000000000opendnssec-2.1.13/m4/0000755000077000001440000000000014446272544011271 500000000000000opendnssec-2.1.13/m4/ltoptions.m40000644000077000001440000003426214446272525013514 00000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2015 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 8 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_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _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_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _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=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-2.1.13/m4/opendnssec_common.m40000644000077000001440000001715214446272525015171 00000000000000AC_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/signer 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_ENGINE=$OPENDNSSEC_SBIN_DIR/ods-enforcerd OPENDNSSEC_ENFORCER_CONTROL=$OPENDNSSEC_SBIN_DIR/ods-control OPENDNSSEC_ENFORCER_WORKINGDIR=$OPENDNSSEC_STATE_DIR/enforcer OPENDNSSEC_ENFORCER_ZONELIST=zones.xml AC_DEFINE_UNQUOTED(ODS_EN_ENGINE, ["$OPENDNSSEC_ENFORCER_ENGINE"], [Path to the OpenDNSSEC enforcer engine binary]) AC_DEFINE_UNQUOTED(ODS_EN_CONTROL, ["$OPENDNSSEC_ENFORCER_CONTROL enforcer "], [Path to the OpenDNSSEC ods-control binary]) AC_DEFINE_UNQUOTED(ODS_EN_START_RESPONSE, ["Engine already running."], [Start message for enforcer client]) OPENDNSSEC_ENFORCER_SOCKETFILE=$OPENDNSSEC_PID_DIR/enforcer.sock AC_SUBST([OPENDNSSEC_ENFORCER_SOCKETFILE]) AC_DEFINE_UNQUOTED(OPENDNSSEC_ENFORCER_SOCKETFILE, "$OPENDNSSEC_ENFORCER_SOCKETFILE", [Path to the OpenDNSSEC enforcer socket]) AC_DEFINE_UNQUOTED(OPENDNSSEC_ENFORCER_WORKINGDIR, "$OPENDNSSEC_ENFORCER_WORKINGDIR", [Path to the OpenDNSSEC enforcer engine working directory]) AC_DEFINE_UNQUOTED(OPENDNSSEC_ENFORCER_ZONELIST, "$OPENDNSSEC_ENFORCER_ZONELIST", [Path to the OpenDNSSEC internal zone list]) AC_DEFINE(OPENDNSSEC_ENFORCER_WORKERTHREADS, 4, [Number of worker threads for the enforcer]) OPENDNSSEC_ENFORCER_KASPCHECK=$OPENDNSSEC_BIN_DIR/ods-kaspcheck AC_DEFINE_UNQUOTED(ODS_EN_VERBOSITY, [3], [Default verbosity]) 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]) AC_DEFINE_UNQUOTED(ODS_EN_FILE_MAGIC, [";ODSSE2"], [File magic for storing backups from the OpenDNSSEC enforcer]) ]) opendnssec-2.1.13/m4/acx_rt.m40000644000077000001440000000070314446272525012732 00000000000000AC_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-2.1.13/m4/acx_libxml2.m40000644000077000001440000000165514446272525013665 00000000000000AC_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-2.1.13/m4/lt~obsolete.m40000644000077000001440000001377414446272525014040 00000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 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-2.1.13/m4/ax_compiler_vendor.m40000644000077000001440000001027014446272525015331 00000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html # =========================================================================== # # SYNOPSIS # # AX_COMPILER_VENDOR # # DESCRIPTION # # Determine the vendor of the C, C++ or Fortran compiler. The vendor is # returned in the cache variable $ax_cv_c_compiler_vendor for C, # $ax_cv_cxx_compiler_vendor for C++ or $ax_cv_fc_compiler_vendor for # (modern) Fortran. The value is one of "intel", "ibm", "pathscale", # "clang" (LLVM), "cray", "fujitsu", "sdcc", "sx", "portland" (PGI), "gnu" # (GCC), "sun" (Oracle Developer Studio), "hp", "dec", "borland", # "comeau", "kai", "lcc", "sgi", "microsoft", "metrowerks", "watcom", # "tcc" (Tiny CC) or "unknown" (if the compiler cannot be determined). # # To check for a Fortran compiler, you must first call AC_FC_PP_SRCEXT # with an appropriate preprocessor-enabled extension. For example: # # AC_LANG_PUSH([Fortran]) # AC_PROG_FC # AC_FC_PP_SRCEXT([F]) # AX_COMPILER_VENDOR # AC_LANG_POP([Fortran]) # # LICENSE # # Copyright (c) 2008 Steven G. Johnson # Copyright (c) 2008 Matteo Frigo # Copyright (c) 2018-19 John Zaitseff # # 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 30 AC_DEFUN([AX_COMPILER_VENDOR], [dnl AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [dnl dnl If you modify this list of vendors, please add similar support dnl to ax_compiler_version.m4 if at all possible. dnl dnl Note: Do NOT check for GCC first since some other compilers dnl define __GNUC__ to remain compatible with it. Compilers that dnl are very slow to start (such as Intel) are listed first. vendors=" intel: __ICC,__ECC,__INTEL_COMPILER ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__,__ibmxl__ pathscale: __PATHCC__,__PATHSCALE__ clang: __clang__ cray: _CRAYC fujitsu: __FUJITSU sdcc: SDCC,__SDCC sx: _SX portland: __PGI gnu: __GNUC__ sun: __SUNPRO_C,__SUNPRO_CC,__SUNPRO_F90,__SUNPRO_F95 hp: __HP_cc,__HP_aCC dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland: __BORLANDC__,__CODEGEARC__,__TURBOC__ comeau: __COMO__ kai: __KCC lcc: __LCC__ sgi: __sgi,sgi microsoft: _MSC_VER metrowerks: __MWERKS__ watcom: __WATCOMC__ tcc: __TINYC__ unknown: UNKNOWN " for ventest in $vendors; do case $ventest in *:) vendor=$ventest continue ;; *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; esac AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ #if !($vencpp) thisisanerror; #endif ]])], [break]) done ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1` ]) ])dnl opendnssec-2.1.13/m4/acx_rpath.m40000644000077000001440000000162214446272525013424 00000000000000dnl 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-2.1.13/m4/ax_compiler_flags_cflags.m40000644000077000001440000001323114446272525016447 00000000000000# ============================================================================= # https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cflags.html # ============================================================================= # # SYNOPSIS # # AX_COMPILER_FLAGS_CFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS]) # # DESCRIPTION # # Add warning flags for the C compiler to VARIABLE, which defaults to # WARN_CFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be # manually added to the CFLAGS variable for each target in the code base. # # This macro depends on the environment set up by AX_COMPILER_FLAGS. # Specifically, it uses the value of $ax_enable_compile_warnings to decide # which flags to enable. # # LICENSE # # Copyright (c) 2014, 2015 Philip Withnall # Copyright (c) 2017, 2018 Reini Urban # # 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 17 AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[ AC_REQUIRE([AC_PROG_SED]) AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS]) AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) # Variable names m4_define([ax_warn_cflags_variable], [m4_normalize(ifelse([$1],,[WARN_CFLAGS],[$1]))]) AC_LANG_PUSH([C]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ [#ifndef __cplusplus #error "no C++" #endif]])], [ax_compiler_cxx=yes;], [ax_compiler_cxx=no;]) # Always pass -Werror=unknown-warning-option to get Clang to fail on bad # flags, otherwise they are always appended to the warn_cflags variable, and # Clang warns on them for every compilation unit. # If this is passed to GCC, it will explode, so the flag must be enabled # conditionally. AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[ ax_compiler_flags_test="-Werror=unknown-warning-option" ],[ ax_compiler_flags_test="" ]) # Check that -Wno-suggest-attribute=format is supported AX_CHECK_COMPILE_FLAG([-Wno-suggest-attribute=format],[ ax_compiler_no_suggest_attribute_flags="-Wno-suggest-attribute=format" ],[ ax_compiler_no_suggest_attribute_flags="" ]) # Base flags AX_APPEND_COMPILE_FLAGS([ dnl -fno-strict-aliasing dnl $3 dnl ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) AS_IF([test "$ax_enable_compile_warnings" != "no"],[ if test "$ax_compiler_cxx" = "no" ; then # C-only flags. Warn in C++ AX_APPEND_COMPILE_FLAGS([ dnl -Wnested-externs dnl -Wmissing-prototypes dnl -Wstrict-prototypes dnl -Wdeclaration-after-statement dnl -Wimplicit-function-declaration dnl -Wold-style-definition dnl -Wjump-misses-init dnl ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) fi # "yes" flags AX_APPEND_COMPILE_FLAGS([ dnl -Wall dnl -Wextra dnl -Wundef dnl -Wwrite-strings dnl -Wpointer-arith dnl -Wmissing-declarations dnl -Wredundant-decls dnl -Wno-unused-parameter dnl -Wno-missing-field-initializers dnl -Wformat=2 dnl -Wcast-align dnl -Wformat-nonliteral dnl -Wformat-security dnl -Wsign-compare dnl -Wstrict-aliasing dnl -Wshadow dnl -Winline dnl -Wpacked dnl -Wmissing-format-attribute dnl -Wmissing-noreturn dnl -Winit-self dnl -Wredundant-decls dnl -Wmissing-include-dirs dnl -Wunused-but-set-variable dnl -Warray-bounds dnl -Wreturn-type dnl -Wswitch-enum dnl -Wswitch-default dnl -Wduplicated-cond dnl -Wduplicated-branches dnl -Wlogical-op dnl -Wrestrict dnl -Wnull-dereference dnl -Wdouble-promotion dnl $4 dnl $5 dnl $6 dnl $7 dnl ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) ]) AS_IF([test "$ax_enable_compile_warnings" = "error"],[ # "error" flags; -Werror has to be appended unconditionally because # it's not possible to test for # # suggest-attribute=format is disabled because it gives too many false # positives AX_APPEND_FLAG([-Werror],ax_warn_cflags_variable) AX_APPEND_COMPILE_FLAGS([ dnl [$ax_compiler_no_suggest_attribute_flags] dnl ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) ]) # In the flags below, when disabling specific flags, always add *both* # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example) # we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall, # which effectively turns that flag back on again as an error. for flag in $ax_warn_cflags_variable; do AS_CASE([$flag], [-Wno-*=*],[], [-Wno-*],[ AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')], ax_warn_cflags_variable, [$ax_compiler_flags_test]) ]) done AC_LANG_POP([C]) # Substitute the variables AC_SUBST(ax_warn_cflags_variable) ])dnl AX_COMPILER_FLAGS opendnssec-2.1.13/m4/acx_pkcs11_modules.m40000644000077000001440000000351514446272525015143 00000000000000AC_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/libsofthsm2.so)]), [ pkcs11_softhsm_module="$withval" ], [ pkcs11_softhsm_module="$full_libdir/softhsm/libsofthsm2.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-2.1.13/m4/libtool.m40000644000077000001440000112507314446272525013127 00000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2015 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) 2014 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. # 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 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 this program. If not, see . ]) # serial 58 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.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK 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_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _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 m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that 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 set != "${COLLECT_NAMES+set}"; 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\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) 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\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) 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 0 = "$lt_write_fail" && 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 yes = "$silent" && 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 that 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 # Generated automatically by $as_me ($PACKAGE) $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. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _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 set != "${COLLECT_NAMES+set}"; 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) 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' 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 0 = "$_lt_result"; 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 0 = "$_lt_result" && $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 yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; 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 no = "$lt_cv_ld_force_load"; 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 yes = "$lt_cv_ld_force_load"; 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*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; 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 yes != "$lt_cv_apple_cc_single_mod"; 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 set = "${lt_cv_aix_libpath+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 that will find a shell with a builtin # printf (that 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], [AS_HELP_STRING([--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 yes = "$GCC"; 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 where 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 no = "$enable_libtool_lock" || 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 what ABI is being produced by ac_compile, and set mode # options accordingly. 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 what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; 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* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. 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*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; 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" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; 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 yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. 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*|x86_64-*-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 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; 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 bitrig* | 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" ## exclude from sc_useless_quotes_in_assignment # 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 yes = "[$]$2"; 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 yes = "[$]$2"; 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; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # 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" && \ test undefined != "$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 17 != "$i" # 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 yes = "$cross_compiling"; 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 -fvisibility=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 yes != "$enable_dlopen"; 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 ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) 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 no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && 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 yes = "$lt_cv_dlopen_self"; 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 no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; 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 no = "$hard_links"; 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 where 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 yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; 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 relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; 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_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _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 m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; 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` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac 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" elif test -n "$lt_multi_os_dir"; then 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 AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) 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 ia64 = "$host_cpu"; 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 # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # 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' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # 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' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac 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%'\''`; $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$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' 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 ;; 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=no 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 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; 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 yes = "$lt_cv_prog_gnu_ld"; 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 ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # 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 dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | 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 # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) 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' ;; 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* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi 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 shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec 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' ;; 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 yes = "$with_gnu_ld"; 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=sco 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 yes = "$with_gnu_ld"; 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 no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _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], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that 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 that 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 no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; 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 yes = "$with_gnu_ld"; 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 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/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 ;; 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 | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) 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* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; 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 ;; os2*) 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 # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) 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 no != "$lt_cv_path_NM"; 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 -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) 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 one 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 yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # 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 yes = "$GCC"; 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 ia64 = "$host_cpu"; 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 if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # 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"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$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"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/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, # D for any global variable and I for any imported 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};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,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 can'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* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$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 yes = "$pipe_works"; 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_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _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_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _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 yes = "$GXX"; 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 ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; 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']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; 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 ia64 = "$host_cpu"; 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 ia64 != "$host_cpu"; 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 | 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*) ;; *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 yes = "$GCC"; 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 ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; 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']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; 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 ia64 = "$host_cpu"; 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 ;; 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' case $cc_basename in 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' ;; esac ;; 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']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; 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 | 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' ;; tcc*) # Fabrice Bellard et al's Tiny 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)='-static' ;; 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 that 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 GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. 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) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | 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 ;; *) _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 yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=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 yes = "$with_gnu_ld"; 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 yes = "$lt_use_gnu_ld_interface"; 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 | $SED -e 's/([^)]\+)\s\+//' 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 ia64 != "$host_cpu"; 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, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); 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 ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $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 linux-dietlibc = "$host_os"; 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 no = "$tmp_diet" 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' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-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 yes = "$supports_anon_versioning"; 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 tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; 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 yes = "$supports_anon_versioning"; 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*) 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 cannot *** 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 no = "$_LT_TAGVAR(ld_shlibs, $1)"; 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 yes = "$GCC" && 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 ia64 = "$host_cpu"; 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 GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. 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) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | 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 # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; 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,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; 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 yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' 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,yes = "$with_aix_soname,$aix_use_runtimelinking"; 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 -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; 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 yes = "$with_gnu_ld"; 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 _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' 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,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $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 yes = "$GCC"; 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 "x$output_objdir/$soname" = "x$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 "x$output_objdir/$soname" = "x$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 yes,no = "$GCC,$with_gnu_ld"; 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 no = "$with_gnu_ld"; 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 yes,no = "$GCC,$with_gnu_ld"; 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 no = "$with_gnu_ld"; 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 yes = "$GCC"; 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 yes = "$lt_cv_irix_exported_symbol"; 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 ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) 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* | bitrig*) 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__`"; 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 _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' 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 shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) if test yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 sequent = "$host_vendor"; 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 yes = "$GCC"; 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 CANNOT 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 yes = "$GCC"; 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 sni = "$host_vendor"; 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 no = "$_LT_TAGVAR(ld_shlibs, $1)" && 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 yes,yes = "$GCC,$enable_shared"; 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 what 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac 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 yes = "$enable_shared" || 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 no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); 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 yes != "$_lt_caught_CXX_error"; 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 yes = "$GXX"; 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 yes = "$GXX"; 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 yes = "$with_gnu_ld"; 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 ia64 = "$host_cpu"; 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 # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive 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 if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; 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,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; 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 yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' 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,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # 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 -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; 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 yes = "$with_gnu_ld"; 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 _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' 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,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $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, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); 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) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; 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 ;; 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 "x$output_objdir/$soname" = "x$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 yes = "$GXX"; 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 "x$output_objdir/$soname" = "x$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 no = "$with_gnu_ld"; 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 yes = "$GXX"; then if test no = "$with_gnu_ld"; 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 yes = "$GXX"; then if test no = "$with_gnu_ld"; 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 | 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 yes = "$supports_anon_versioning"; 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 ;; openbsd* | bitrig*) 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__`"; 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 yes,no = "$GXX,$with_gnu_ld"; 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 yes,no = "$GXX,$with_gnu_ld"; 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 $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 $wl-h $wl$soname -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 $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 $wl-h $wl$soname -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 CANNOT 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 no = "$_LT_TAGVAR(ld_shlibs, $1)" && 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 yes != "$_lt_caught_CXX_error" 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 @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@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 x-L = "$p" || test x-R = "$p"; 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 no = "$pre_test_object_deps_done"; 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 no = "$pre_test_object_deps_done"; 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)= ;; 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 no = "$F77"; 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 yes != "$_lt_disable_F77"; 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac 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 yes = "$enable_shared" || 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 yes != "$_lt_disable_F77" 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 no = "$FC"; 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 yes != "$_lt_disable_FC"; 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac 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 yes = "$enable_shared" || 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 yes != "$_lt_disable_FC" 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 set = "${GCJFLAGS+set}" || 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 10 -lt "$lt_ac_count" && 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], [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_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what 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-2.1.13/m4/acx_libreadline.m40000644000077000001440000000067714446272525014571 00000000000000AC_DEFUN([ACX_LIBREADLINE],[ AC_ARG_WITH(readline, [ --with-readline compile with the system readline library], [if test x"${withval}" != no; then AC_CHECK_LIB(readline, readline, if test x"${ac_cv_lib_readline_readline}" = xno; then AC_MSG_ERROR(libreadline not found) fi AC_SUBST(READLINE_LIBS, "-lreadline") AC_DEFINE([HAVE_READLINE], [1], [Define to 1 if readline libraries are available]) ,) fi]) ]) opendnssec-2.1.13/m4/ax_append_compile_flags.m40000644000077000001440000000334514446272525016302 00000000000000# ============================================================================ # https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html # ============================================================================ # # SYNOPSIS # # AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # # For every FLAG1, FLAG2 it is checked whether the compiler works with the # flag. If it does, the flag is added FLAGS-VARIABLE # # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. # CFLAGS) is used. During the check the flag is always added to the # current language's flags. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # INPUT gives an alternative input source to AC_COMPILE_IFELSE. # # NOTE: This macro depends on the AX_APPEND_FLAG and # AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with # AX_APPEND_LINK_FLAGS. # # LICENSE # # Copyright (c) 2011 Maarten Bosmans # # 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 7 AC_DEFUN([AX_APPEND_COMPILE_FLAGS], [AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) for flag in $1; do AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) done ])dnl AX_APPEND_COMPILE_FLAGS opendnssec-2.1.13/m4/acx_dlopen.m40000644000077000001440000000112414446272525013564 00000000000000AC_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_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]],[[LoadLibrary(NULL);]])], [AC_DEFINE([HAVE_LOADLIBRARY], [1], [Define if you have LoadLibrary])], []) fi ]) opendnssec-2.1.13/m4/acx_cunit.m40000644000077000001440000000152214446272525013427 00000000000000AC_DEFUN([ACX_CUNIT],[ AC_ARG_WITH(cunit, [AS_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-2.1.13/m4/acx_prefixhack.m40000644000077000001440000000114314446272525014430 00000000000000# 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-2.1.13/m4/ax_pthread.m40000644000077000001440000005404614446272525013602 00000000000000# =========================================================================== # https://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 and PTHREAD_CXX to any special C compiler that is # needed for multi-threaded programs (defaults to the value of CC # respectively CXX otherwise). (This is necessary on e.g. AIX to use the # special cc_r/CC_r compiler alias.) # # NOTE: You are assumed to not only compile your program with these flags, # but also to link with them as well. For example, you might link with # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS # $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS # # If you are only building threaded programs, you may wish to use these # variables in your default LIBS, CFLAGS, and CC: # # LIBS="$PTHREAD_LIBS $LIBS" # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" # CC="$PTHREAD_CC" # CXX="$PTHREAD_CXX" # # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant # has a nonstandard name, this macro 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. # Copyright (c) 2019 Marc Stevens # # 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 30 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_TARGET]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_SED]) 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 Tru64 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_CFLAGS$PTHREAD_LIBS" != "x"; then ax_pthread_save_CC="$CC" ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"]) CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) AC_LINK_IFELSE([AC_LANG_CALL([], [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 CC="$ax_pthread_save_CC" CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" 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 with a "," contain both # C compiler flags (before ",") and linker flags (after ","). Other items # starting with a "-" are C compiler flags, and remaining 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 -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) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 # (Note: HP C rejects this with "bad form for `-t' option") # -pthreads: Solaris/gcc (Note: HP C also rejects) # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads and # -D_REENTRANT too), HP C (must be checked before -lpthread, which # is present but should not be used directly; and before -mthreads, # because the compiler interprets this as "-mt" + "-hreads") # -mthreads: Mingw32/gcc, Lynx/gcc # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case $target_os in freebsd*) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) ax_pthread_flags="-kthread lthread $ax_pthread_flags" ;; hpux*) # From the cc(1) man page: "[-mt] Sets various -D flags to enable # multi-threading and also sets -lpthread." ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" ;; openedition*) # IBM z/OS requires a feature-test macro to be defined in order to # enable POSIX threads at all, so give the user a hint if this is # not set. (We don't define these ourselves, as they can affect # other portions of the system API in unpredictable ways.) AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], [ # if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) AX_PTHREAD_ZOS_MISSING # endif ], [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) ;; 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. (N.B.: 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 check first for the # standard Solaris way of linking pthreads (-mt -lpthread). ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" ;; esac # Are we compiling with Clang? AC_CACHE_CHECK([whether $CC is Clang], [ax_cv_PTHREAD_CLANG], [ax_cv_PTHREAD_CLANG=no # Note that Autoconf sets GCC=yes for Clang as well as GCC if test "x$GCC" = "xyes"; then AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ # if defined(__clang__) && defined(__llvm__) AX_PTHREAD_CC_IS_CLANG # endif ], [ax_cv_PTHREAD_CLANG=yes]) fi ]) ax_pthread_clang="$ax_cv_PTHREAD_CLANG" # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) # Note that for GCC and Clang -pthread generally implies -lpthread, # except when -nostdlib is passed. # This is problematic using libtool to build C++ shared libraries with pthread: # [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 # [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 # [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 # To solve this, first try -pthread together with -lpthread for GCC AS_IF([test "x$GCC" = "xyes"], [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"]) # Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first AS_IF([test "x$ax_pthread_clang" = "xyes"], [ax_pthread_flags="-pthread,-lpthread -pthread"]) # The presence of a feature test macro requesting re-entrant function # definitions is, on some systems, a strong hint that pthreads support is # correctly enabled case $target_os in darwin* | hpux* | linux* | osf* | solaris*) ax_pthread_check_macro="_REENTRANT" ;; aix*) ax_pthread_check_macro="_THREAD_SAFE" ;; *) ax_pthread_check_macro="--" ;; esac AS_IF([test "x$ax_pthread_check_macro" = "x--"], [ax_pthread_check_cond=0], [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) if test "x$ax_pthread_ok" = "xno"; then for ax_pthread_try_flag in $ax_pthread_flags; do case $ax_pthread_try_flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; *,*) PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) PTHREAD_CFLAGS="$ax_pthread_try_flag" ;; pthread-config) AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) PTHREAD_LIBS="-l$ax_pthread_try_flag" ;; esac ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" # 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 # if $ax_pthread_check_cond # error "$ax_pthread_check_macro must be defined" # endif static void *some_global = NULL; static void routine(void *a) { /* To avoid any unused-parameter or unused-but-set-parameter warning. */ some_global = a; } 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], []) CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" AC_MSG_RESULT([$ax_pthread_ok]) AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Clang needs special handling, because older versions handle the -pthread # option in a rather... idiosyncratic way if test "x$ax_pthread_clang" = "xyes"; then # Clang takes -pthread; it has never supported any other flag # (Note 1: This will need to be revisited if a system that Clang # supports has POSIX threads in a separate library. This tends not # to be the way of modern systems, but it's conceivable.) # (Note 2: On some systems, notably Darwin, -pthread is not needed # to get POSIX threads support; the API is always present and # active. We could reasonably leave PTHREAD_CFLAGS empty. But # -pthread does define _REENTRANT, and while the Darwin headers # ignore this macro, third-party headers might not.) # However, older versions of Clang make a point of warning the user # that, in an invocation where only linking and no compilation is # taking place, the -pthread option has no effect ("argument unused # during compilation"). They expect -pthread to be passed in only # when source code is being compiled. # # Problem is, this is at odds with the way Automake and most other # C build frameworks function, which is that the same flags used in # compilation (CFLAGS) are also used in linking. Many systems # supported by AX_PTHREAD require exactly this for POSIX threads # support, and in fact it is often not straightforward to specify a # flag that is used only in the compilation phase and not in # linking. Such a scenario is extremely rare in practice. # # Even though use of the -pthread flag in linking would only print # a warning, this can be a nuisance for well-run software projects # that build with -Werror. So if the active version of Clang has # this misfeature, we search for an option to squash it. AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown # Create an alternate version of $ac_link that compiles and # links in two steps (.c -> .o, .o -> exe) instead of one # (.c -> exe), because the warning occurs only in the second # step ax_pthread_save_ac_link="$ac_link" ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"` ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" ax_pthread_save_CFLAGS="$CFLAGS" for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" ac_link="$ax_pthread_save_ac_link" AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], [ac_link="$ax_pthread_2step_ac_link" AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], [break]) ]) done ac_link="$ax_pthread_save_ac_link" CFLAGS="$ax_pthread_save_CFLAGS" AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" ]) case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in no | unknown) ;; *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; esac fi # $ax_pthread_clang = yes # Various other checks: if test "x$ax_pthread_ok" = "xyes"; then ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. AC_CACHE_CHECK([for joinable pthread attribute], [ax_cv_PTHREAD_JOINABLE_ATTR], [ax_cv_PTHREAD_JOINABLE_ATTR=unknown for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [int attr = $ax_pthread_attr; return attr /* ; */])], [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], []) done ]) AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ test "x$ax_pthread_joinable_attr_defined" != "xyes"], [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$ax_cv_PTHREAD_JOINABLE_ATTR], [Define to necessary symbol if this constant uses a non-standard name on your system.]) ax_pthread_joinable_attr_defined=yes ]) AC_CACHE_CHECK([whether more special flags are required for pthreads], [ax_cv_PTHREAD_SPECIAL_FLAGS], [ax_cv_PTHREAD_SPECIAL_FLAGS=no case $target_os in solaris*) ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" ;; esac ]) AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ test "x$ax_pthread_special_flags_added" != "xyes"], [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" ax_pthread_special_flags_added=yes]) AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], [ax_cv_PTHREAD_PRIO_INHERIT], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[int i = PTHREAD_PRIO_INHERIT; return i;]])], [ax_cv_PTHREAD_PRIO_INHERIT=yes], [ax_cv_PTHREAD_PRIO_INHERIT=no]) ]) AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ test "x$ax_pthread_prio_inherit_defined" != "xyes"], [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) ax_pthread_prio_inherit_defined=yes ]) CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" # More AIX lossage: compile with *_r variant if test "x$GCC" != "xyes"; then case $target_os in aix*) AS_CASE(["x/$CC"], [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], [#handle absolute path differently from PATH based program lookup AS_CASE(["x$CC"], [x/*], [ AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"]) AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])]) ], [ AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC]) AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])]) ] ) ]) ;; esac fi fi test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" AC_SUBST([PTHREAD_LIBS]) AC_SUBST([PTHREAD_CFLAGS]) AC_SUBST([PTHREAD_CC]) AC_SUBST([PTHREAD_CXX]) # 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-2.1.13/m4/ax_check_compile_flag.m40000644000077000001440000000407014446272525015721 00000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's compiler # or gives an error. (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # INPUT gives an alternative input source to AC_COMPILE_IFELSE. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # 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 6 AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_VAR_IF(CACHEVAR,yes, [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS opendnssec-2.1.13/m4/acx_check_strptime.m40000644000077000001440000000123314446272525015310 00000000000000AC_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-2.1.13/m4/acx_ldns.m40000644000077000001440000000565114446272525013254 00000000000000AC_DEFUN([ACX_LDNS],[ AC_ARG_WITH(ldns, [AS_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, [AS_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-2.1.13/m4/ax_require_defined.m40000644000077000001440000000230214446272525015271 00000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_require_defined.html # =========================================================================== # # SYNOPSIS # # AX_REQUIRE_DEFINED(MACRO) # # DESCRIPTION # # AX_REQUIRE_DEFINED is a simple helper for making sure other macros have # been defined and thus are available for use. This avoids random issues # where a macro isn't expanded. Instead the configure script emits a # non-fatal: # # ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found # # It's like AC_REQUIRE except it doesn't expand the required macro. # # Here's an example: # # AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) # # LICENSE # # Copyright (c) 2014 Mike Frysinger # # 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 2 AC_DEFUN([AX_REQUIRE_DEFINED], [dnl m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) ])dnl AX_REQUIRE_DEFINED opendnssec-2.1.13/m4/ltsugar.m40000644000077000001440000001044014446272525013132 00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 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-2.1.13/m4/ax_append_flag.m40000644000077000001440000000302014446272525014375 00000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_append_flag.html # =========================================================================== # # SYNOPSIS # # AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) # # DESCRIPTION # # FLAG is appended to the FLAGS-VARIABLE shell variable, with a space # added in between. # # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. # CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains # FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly # FLAG. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # 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 8 AC_DEFUN([AX_APPEND_FLAG], [dnl AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) AS_VAR_SET_IF(FLAGS,[ AS_CASE([" AS_VAR_GET(FLAGS) "], [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], [ AS_VAR_APPEND(FLAGS,[" $1"]) AC_RUN_LOG([: FLAGS="$FLAGS"]) ]) ], [ AS_VAR_SET(FLAGS,[$1]) AC_RUN_LOG([: FLAGS="$FLAGS"]) ]) AS_VAR_POPDEF([FLAGS])dnl ])dnl AX_APPEND_FLAG opendnssec-2.1.13/m4/ax_cflags_warn_all.m40000644000077000001440000001351114446272525015261 00000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html # =========================================================================== # # SYNOPSIS # # AX_CFLAGS_WARN_ALL [(shellvar[, default[, action-if-found[, action-if-not-found]]])] # AX_CXXFLAGS_WARN_ALL [(shellvar[, default[, action-if-found[, action-if-not-found]]])] # AX_FCFLAGS_WARN_ALL [(shellvar[, default[, action-if-found[, action-if-not-found]]])] # # DESCRIPTION # # Specify compiler options that enable most reasonable warnings. For the # GNU Compiler Collection (GCC), for example, it will be "-Wall". The # result is added to shellvar, one of CFLAGS, CXXFLAGS or FCFLAGS if the # first parameter is not specified. # # Each of these macros accepts the following optional arguments: # # - $1 - shellvar # shell variable to use (CFLAGS, CXXFLAGS or FCFLAGS if not # specified, depending on macro) # # - $2 - default # value to use for flags if compiler vendor cannot be determined (by # default, "") # # - $3 - action-if-found # action to take if the compiler vendor has been successfully # determined (by default, add the appropriate compiler flags to # shellvar) # # - $4 - action-if-not-found # action to take if the compiler vendor has not been determined or # is unknown (by default, add the default flags, or "" if not # specified, to shellvar) # # These macros use AX_COMPILER_VENDOR to determine which flags should be # returned for a given compiler. Not all compilers currently have flags # defined for them; patches are welcome. If need be, compiler flags may # be made language-dependent: use a construct like the following: # # [vendor_name], [m4_if(_AC_LANG_PREFIX,[C], VAR="--relevant-c-flags",dnl # m4_if(_AC_LANG_PREFIX,[CXX], VAR="--relevant-c++-flags",dnl # m4_if(_AC_LANG_PREFIX,[FC], VAR="--relevant-fortran-flags",dnl # VAR="$2"; FOUND="no")))], # # Note: These macros also depend on AX_PREPEND_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2010 Rhys Ulerich # Copyright (c) 2018 John Zaitseff # # 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 25 AC_DEFUN([AX_FLAGS_WARN_ALL], [ AX_REQUIRE_DEFINED([AX_PREPEND_FLAG])dnl AC_REQUIRE([AX_COMPILER_VENDOR])dnl AS_VAR_PUSHDEF([FLAGS], [m4_default($1,_AC_LANG_PREFIX[]FLAGS)])dnl AS_VAR_PUSHDEF([VAR], [ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl AS_VAR_PUSHDEF([FOUND], [ac_save_[]_AC_LANG_ABBREV[]flags_warn_all_found])dnl AC_CACHE_CHECK([FLAGS for most reasonable warnings], VAR, [ VAR="" FOUND="yes" dnl Cases are listed in the order found in ax_compiler_vendor.m4 AS_CASE("$ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor", [intel], [VAR="-w2"], [ibm], [VAR="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd"], [pathscale], [], [clang], [VAR="-Wall"], [cray], [VAR="-h msglevel 2"], [fujitsu], [], [sdcc], [], [sx], [VAR="-pvctl[,]fullmsg"], [portland], [], [gnu], [VAR="-Wall"], [sun], [VAR="-v"], [hp], [VAR="+w1"], [dec], [VAR="-verbose -w0 -warnprotos"], [borland], [], [comeau], [], [kai], [], [lcc], [], [sgi], [VAR="-fullwarn"], [microsoft], [], [metrowerks], [], [watcom], [], [tcc], [], [unknown], [ VAR="$2" FOUND="no" ], [ AC_MSG_WARN([Unknown compiler vendor returned by [AX_COMPILER_VENDOR]]) VAR="$2" FOUND="no" ] ) AS_IF([test "x$FOUND" = "xyes"], [dnl m4_default($3, [AS_IF([test "x$VAR" != "x"], [AX_PREPEND_FLAG([$VAR], [FLAGS])])]) ], [dnl m4_default($4, [m4_ifval($2, [AX_PREPEND_FLAG([$VAR], [FLAGS])], [true])]) ])dnl ])dnl AS_VAR_POPDEF([FOUND])dnl AS_VAR_POPDEF([VAR])dnl AS_VAR_POPDEF([FLAGS])dnl ])dnl AX_FLAGS_WARN_ALL AC_DEFUN([AX_CFLAGS_WARN_ALL], [dnl AC_LANG_PUSH([C]) AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) AC_LANG_POP([C]) ])dnl AC_DEFUN([AX_CXXFLAGS_WARN_ALL], [dnl AC_LANG_PUSH([C++]) AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) AC_LANG_POP([C++]) ])dnl AC_DEFUN([AX_FCFLAGS_WARN_ALL], [dnl AC_LANG_PUSH([Fortran]) AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) AC_LANG_POP([Fortran]) ])dnl opendnssec-2.1.13/m4/ltversion.m40000644000077000001440000000127314446272525013502 00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2015 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 4179 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.6]) m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) opendnssec-2.1.13/m4/acx_pedantic.m40000644000077000001440000000043214446272525014073 00000000000000AC_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-2.1.13/m4/ax_lib_mysql.m40000644000077000001440000001073514446272525014143 00000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_lib_mysql.html # =========================================================================== # # SYNOPSIS # # AX_LIB_MYSQL([MINIMUM-VERSION]) # # DESCRIPTION # # This macro provides tests of availability of MySQL client library of # particular version or newer. # # AX_LIB_MYSQL macro takes only one argument which is optional. If there # is no required version passed, then macro does not run version test. # # The --with-mysql option takes one of three possible values: # # no - do not check for MySQL client library # # yes - do check for MySQL library in standard locations (mysql_config # should be in the PATH) # # path - complete path to mysql_config utility, use this option if # mysql_config can't be found in the PATH # # This macro calls: # # AC_SUBST(MYSQL_CFLAGS) # AC_SUBST(MYSQL_LDFLAGS) # AC_SUBST(MYSQL_VERSION) # # And sets: # # HAVE_MYSQL # # LICENSE # # Copyright (c) 2008 Mateusz Loskot # # 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 13 AC_DEFUN([AX_LIB_MYSQL], [ AC_ARG_WITH([mysql], AS_HELP_STRING([--with-mysql=@<:@ARG@:>@], [use MySQL client library @<:@default=yes@:>@, optionally specify path to mysql_config] ), [ if test "$withval" = "no"; then want_mysql="no" elif test "$withval" = "yes"; then want_mysql="yes" else want_mysql="yes" MYSQL_CONFIG="$withval" fi ], [want_mysql="yes"] ) AC_ARG_VAR([MYSQL_CONFIG], [Full path to mysql_config program]) MYSQL_CFLAGS="" MYSQL_LDFLAGS="" MYSQL_VERSION="" dnl dnl Check MySQL libraries dnl if test "$want_mysql" = "yes"; then if test -z "$MYSQL_CONFIG" ; then AC_PATH_PROGS([MYSQL_CONFIG], [mysql_config mysql_config5], [no]) fi if test "$MYSQL_CONFIG" != "no"; then MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`" MYSQL_LDFLAGS="`$MYSQL_CONFIG --libs`" MYSQL_VERSION=`$MYSQL_CONFIG --version` found_mysql="yes" else found_mysql="no" fi fi dnl dnl Check if required version of MySQL is available dnl mysql_version_req=ifelse([$1], [], [], [$1]) if test "$found_mysql" = "yes" -a -n "$mysql_version_req"; then AC_MSG_CHECKING([if MySQL version is >= $mysql_version_req]) dnl Decompose required version string of MySQL dnl and calculate its number representation mysql_version_req_major=`expr $mysql_version_req : '\([[0-9]]*\)'` mysql_version_req_minor=`expr $mysql_version_req : '[[0-9]]*\.\([[0-9]]*\)'` mysql_version_req_micro=`expr $mysql_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$mysql_version_req_micro" = "x"; then mysql_version_req_micro="0" fi mysql_version_req_number=`expr $mysql_version_req_major \* 1000000 \ \+ $mysql_version_req_minor \* 1000 \ \+ $mysql_version_req_micro` dnl Decompose version string of installed MySQL dnl and calculate its number representation mysql_version_major=`expr $MYSQL_VERSION : '\([[0-9]]*\)'` mysql_version_minor=`expr $MYSQL_VERSION : '[[0-9]]*\.\([[0-9]]*\)'` mysql_version_micro=`expr $MYSQL_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$mysql_version_micro" = "x"; then mysql_version_micro="0" fi mysql_version_number=`expr $mysql_version_major \* 1000000 \ \+ $mysql_version_minor \* 1000 \ \+ $mysql_version_micro` mysql_version_check=`expr $mysql_version_number \>\= $mysql_version_req_number` if test "$mysql_version_check" = "1"; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi fi if test "$found_mysql" = "yes" ; then AC_DEFINE([HAVE_MYSQL], [1], [Define to 1 if MySQL libraries are available]) fi AC_SUBST([MYSQL_VERSION]) AC_SUBST([MYSQL_CFLAGS]) AC_SUBST([MYSQL_LDFLAGS]) ]) opendnssec-2.1.13/m4/acx_enforcer_database.m40000644000077000001440000000703014446272525015734 00000000000000AC_DEFUN([ACX_ENFORCER_DATABASE],[ AC_ARG_WITH(enforcer-database, AS_HELP_STRING([--with-enforcer-database=BACKEND], [Select database backend: sqlite3 (default), mysql]), [database_backend="${withval}"], [database_backend="sqlite3"]) AC_ARG_WITH([enforcer-database-test-host], AS_HELP_STRING([--with-enforcer-database-test-host=HOST], [Host to use when testing the Enforcer database backend]), [database_host="${withval}"], [database_host=""] ) AC_ARG_WITH([enforcer-database-test-port], AS_HELP_STRING([--with-enforcer-database-test-port=PORT], [Port to use when testing the Enforcer database backend]), [database_port="${withval}"], [database_port="0"] ) AC_ARG_WITH([enforcer-database-test-database], AS_HELP_STRING([--with-enforcer-database-test-database=DATABASE], [Database to use when testing the Enforcer database backend]), [database_database="${withval}"], [database_database=""] ) AC_ARG_WITH([enforcer-database-test-username], AS_HELP_STRING([--with-enforcer-database-test-username=USERNAME], [Username to use when testing the Enforcer database backend]), [database_username="${withval}"], [database_username=""] ) AC_ARG_WITH([enforcer-database-test-password], AS_HELP_STRING([--with-enforcer-database-test-password=PASSWORD], [Password to use when testing the Enforcer database backend]), [database_password="${withval}"], [database_password=""] ) AC_MSG_CHECKING(for database backend) if test "x${database_backend}" = "xsqlite3"; then AC_MSG_RESULT(SQLite3) AX_LIB_SQLITE3 ENFORCER_DB_INCLUDES=$SQLITE3_CFLAGS ENFORCER_DB_LIBS=$SQLITE3_LDFLAGS AC_DEFINE_UNQUOTED(ENFORCER_DATABASE_SQLITE3, 1, [Using SQLite3 for database backend]) AM_CONDITIONAL(USE_SQLITE, true) AM_CONDITIONAL(USE_MYSQL, false) elif test "x${database_backend}" = "xmysql"; then AC_MSG_RESULT(MySQL) AX_LIB_MYSQL(5.0.0) if test "$found_mysql" != "yes"; then AC_MSG_ERROR([MySQL is missing.]) fi ENFORCER_DB_INCLUDES=$MYSQL_CFLAGS ENFORCER_DB_LIBS=$MYSQL_LDFLAGS AC_DEFINE_UNQUOTED(ENFORCER_DATABASE_MYSQL, 1, [Using MySQL for database backend]) AM_CONDITIONAL(USE_SQLITE, false) AM_CONDITIONAL(USE_MYSQL, true) else AC_MSG_RESULT(Unknown) AC_MSG_ERROR([Database backend ${database_backend} not supported.]) fi AC_SUBST(ENFORCER_DB_INCLUDES) AC_SUBST(ENFORCER_DB_LIBS) ENFORCER_DB_HOST="$database_host" ENFORCER_DB_PORT=$database_port ENFORCER_DB_PORT_TEXT="$database_port" ENFORCER_DB_DATABASE="$database_database" ENFORCER_DB_USERNAME="$database_username" ENFORCER_DB_PASSWORD="$database_password" AC_SUBST(ENFORCER_DB_HOST) AC_SUBST(ENFORCER_DB_PORT) AC_SUBST(ENFORCER_DB_PORT_TEXT) AC_SUBST(ENFORCER_DB_DATABASE) AC_SUBST(ENFORCER_DB_USERNAME) AC_SUBST(ENFORCER_DB_PASSWORD) AC_DEFINE_UNQUOTED(ENFORCER_DB_HOST, ["$database_host"], [Host to use when testing the Enforcer database backend]) AC_DEFINE_UNQUOTED(ENFORCER_DB_PORT, [$database_port], [Port to use when testing the Enforcer database backend]) AC_DEFINE_UNQUOTED(ENFORCER_DB_PORT_TEXT, ["$database_port"], [Port to use when testing the Enforcer database backend]) AC_DEFINE_UNQUOTED(ENFORCER_DB_DATABASE, ["$database_database"], [Database to use when testing the Enforcer database backend]) AC_DEFINE_UNQUOTED(ENFORCER_DB_USERNAME, ["$database_username"], [Username to use when testing the Enforcer database backend]) AC_DEFINE_UNQUOTED(ENFORCER_DB_PASSWORD, ["$database_password"], [Password to use when testing the Enforcer database backend]) ]) opendnssec-2.1.13/m4/ax_lib_sqlite3.m40000644000077000001440000001200514446272525014352 00000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_lib_sqlite3.html # =========================================================================== # # SYNOPSIS # # AX_LIB_SQLITE3([MINIMUM-VERSION]) # # DESCRIPTION # # Test for the SQLite 3 library of a particular version (or newer) # # This macro takes only one optional argument, required version of SQLite # 3 library. If required version is not passed, 3.0.0 is used in the test # of existence of SQLite 3. # # If no installation prefix to the installed SQLite library is given the # macro searches under /usr, /usr/local, and /opt. # # This macro calls: # # AC_SUBST(SQLITE3_CFLAGS) # AC_SUBST(SQLITE3_LDFLAGS) # AC_SUBST(SQLITE3_VERSION) # # And sets: # # HAVE_SQLITE3 # # LICENSE # # Copyright (c) 2008 Mateusz Loskot # # 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 19 AC_DEFUN([AX_LIB_SQLITE3], [ AC_ARG_WITH([sqlite3], AS_HELP_STRING( [--with-sqlite3=@<:@ARG@:>@], [use SQLite 3 library @<:@default=yes@:>@, optionally specify the prefix for sqlite3 library] ), [ if test "$withval" = "no"; then WANT_SQLITE3="no" elif test "$withval" = "yes"; then WANT_SQLITE3="yes" ac_sqlite3_path="" else WANT_SQLITE3="yes" ac_sqlite3_path="$withval" fi ], [WANT_SQLITE3="yes"] ) SQLITE3_CFLAGS="" SQLITE3_LDFLAGS="" SQLITE3_VERSION="" if test "x$WANT_SQLITE3" = "xyes"; then ac_sqlite3_header="sqlite3.h" sqlite3_version_req=ifelse([$1], [], [3.0.0], [$1]) sqlite3_version_req_shorten=`expr $sqlite3_version_req : '\([[0-9]]*\.[[0-9]]*\)'` sqlite3_version_req_major=`expr $sqlite3_version_req : '\([[0-9]]*\)'` sqlite3_version_req_minor=`expr $sqlite3_version_req : '[[0-9]]*\.\([[0-9]]*\)'` sqlite3_version_req_micro=`expr $sqlite3_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$sqlite3_version_req_micro" = "x" ; then sqlite3_version_req_micro="0" fi sqlite3_version_req_number=`expr $sqlite3_version_req_major \* 1000000 \ \+ $sqlite3_version_req_minor \* 1000 \ \+ $sqlite3_version_req_micro` AC_MSG_CHECKING([for SQLite3 library >= $sqlite3_version_req]) if test "x$ac_sqlite3_path" != "x"; then ac_sqlite3_ldflags="-L$ac_sqlite3_path/lib" ac_sqlite3_cppflags="-I$ac_sqlite3_path/include" else for ac_sqlite3_path_tmp in /usr /usr/local /opt ; do if test -f "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header" \ && test -r "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header"; then ac_sqlite3_path=$ac_sqlite3_path_tmp ac_sqlite3_cppflags="-I$ac_sqlite3_path_tmp/include" ac_sqlite3_ldflags="-L$ac_sqlite3_path_tmp/lib" break; fi done fi ac_sqlite3_ldflags="$ac_sqlite3_ldflags -lsqlite3" saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $ac_sqlite3_cppflags" AC_LANG_PUSH(C) AC_COMPILE_IFELSE( [ AC_LANG_PROGRAM([[@%:@include ]], [[ #if (SQLITE_VERSION_NUMBER >= $sqlite3_version_req_number) /* Everything is okay */ #else # error SQLite version is too old #endif ]] ) ], [ AC_MSG_RESULT([yes]) success="yes" ], [ AC_MSG_RESULT([not found]) success="no" ] ) AC_LANG_POP(C) CPPFLAGS="$saved_CPPFLAGS" if test "$success" = "yes"; then SQLITE3_CFLAGS="$ac_sqlite3_cppflags" SQLITE3_LDFLAGS="$ac_sqlite3_ldflags" ac_sqlite3_header_path="$ac_sqlite3_path/include/$ac_sqlite3_header" dnl Retrieve SQLite release version if test "x$ac_sqlite3_header_path" != "x"; then ac_sqlite3_version=`cat $ac_sqlite3_header_path \ | grep '#define.*SQLITE_VERSION.*\"' | sed -e 's/.* "//' \ | sed -e 's/"//'` if test "x$ac_sqlite3_version" != "x"; then SQLITE3_VERSION=$ac_sqlite3_version else AC_MSG_WARN([Cannot find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!]) fi fi AC_SUBST(SQLITE3_CFLAGS) AC_SUBST(SQLITE3_LDFLAGS) AC_SUBST(SQLITE3_VERSION) AC_DEFINE([HAVE_SQLITE3], [], [Have the SQLITE3 library]) fi fi ]) opendnssec-2.1.13/m4/ax_c___attribute__.m40000644000077000001440000000477114446272525015254 00000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_c___attribute__.html # =========================================================================== # # SYNOPSIS # # AX_C___ATTRIBUTE__ # # DESCRIPTION # # Provides a test for the compiler support of __attribute__ extensions. # Defines HAVE___ATTRIBUTE__ if it is found. # # LICENSE # # Copyright (c) 2008 Stepan Kasal # Copyright (c) 2008 Christian Haggstrom # Copyright (c) 2008 Ryan McCabe # # 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 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, 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 9 AC_DEFUN([AX_C___ATTRIBUTE__], [ AC_CACHE_CHECK([for __attribute__], [ax_cv___attribute__], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include static void foo(void) __attribute__ ((unused)); static void foo(void) { exit(1); } ]], [])], [ax_cv___attribute__=yes], [ax_cv___attribute__=no] ) ]) if test "$ax_cv___attribute__" = "yes"; then AC_DEFINE([HAVE___ATTRIBUTE__], 1, [define if your compiler has __attribute__]) fi ]) opendnssec-2.1.13/m4/acx_ssl.m40000644000077000001440000000427014446272525013111 00000000000000# 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, AS_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 save_LIBS=$LIBS AC_CHECK_LIB(crypto, HMAC_CTX_reset, [ AC_DEFINE_UNQUOTED([HAVE_SSL_NEW_HMAC], [], [Define if you have the SSL libraries with new HMAC related functions.]) ], [ AC_CHECK_LIB(crypto, HMAC_CTX_init,, [ AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) ]) ] ) SSL_LIBS="$SSL_LIBS -lcrypto"; LIBS="$SSL_LIBS $LIBS" AC_CHECK_FUNCS([EVP_sha1 EVP_sha256]) LIBS=$saveLIBS fi AC_SUBST(HAVE_SSL) AC_SUBST(HAVE_SSL_NEW_HMAC) AC_SUBST(SSL_INCLUDES) AC_SUBST(SSL_LIBS) fi ])dnl opendnssec-2.1.13/m4/ax_prog_doxygen.m40000644000077000001440000005002214446272525014645 00000000000000# =========================================================================== # https://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 separate .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 '$(srcdir)/Doxyfile', the same as Doxygen's default), and an # optional output directory name (the default is 'doxygen-doc'). To run # doxygen multiple times for different configuration files and output # directories provide more parameters: the second, forth, sixth, etc # parameter are configuration file names and the third, fifth, seventh, # etc parameter are output directories. No checking is done to catch # duplicates. # # Automake Support # # The DX_RULES substitution can be used to add all needed rules to the # Makefile. Note that this is a substitution without being a variable: # only the @DX_RULES@ syntax will work. # # 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). # # 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. # # LICENSE # # Copyright (c) 2009 Oren Ben-Kiki # Copyright (c) 2015 Olaf Mandel # # 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 24 ## ----------## ## Defaults. ## ## ----------## DX_ENV="" AC_DEFUN([DX_FEATURE_doc], ON) AC_DEFUN([DX_FEATURE_dot], OFF) 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 and add it # as a substitution (but not a Makefile variable). The substitution # is skipped if the variable name is VERSION. AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])dnl m4_if([$1], [VERSION], [], [AC_SUBST([$1], [$2])dnl AM_SUBST_NOTMAKE([$1])])dnl ]) # 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-$1]) ]) # 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 $6 : else $7 : fi ]) ## -------------- ## ## Public macros. ## ## -------------- ## # DX_XXX_FEATURE(DEFAULT_STATE) # ----------------------------- AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])]) AC_DEFUN([DX_DOT_FEATURE], [AC_DEFUN([DX_FEATURE_dot], [$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 "$(srcdir)/Doxyfile" and OUTPUT-DOC-DIR is # "doxygen-doc". # More arguments are interpreted as interleaved CONFIG-FILE and # OUTPUT-DOC-DIR values. AC_DEFUN([DX_INIT_DOXYGEN], [ # Files: AC_SUBST([DX_PROJECT], [$1]) AC_SUBST([DX_CONFIG], ['ifelse([$2], [], [$(srcdir)/Doxyfile], [$2])']) AC_SUBST([DX_DOCDIR], ['ifelse([$3], [], [doxygen-doc], [$3])']) m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 4, m4_count($@), 2, [AC_SUBST([DX_CONFIG]m4_eval(DX_i[/2]), 'm4_default_nblank_quoted(m4_argn(DX_i, $@), [$(srcdir)/Doxyfile])')])])dnl m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 5, m4_count($@,), 2, [AC_SUBST([DX_DOCDIR]m4_eval([(]DX_i[-1)/2]), 'm4_default_nblank_quoted(m4_argn(DX_i, $@), [doxygen-doc])')])])dnl m4_define([DX_loop], m4_dquote(m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 4, m4_count($@), 2, [, m4_eval(DX_i[/2])])], [])))dnl # Environment variables used inside doxygen.cfg: DX_ENV_APPEND(SRCDIR, $srcdir) DX_ENV_APPEND(PROJECT, $DX_PROJECT) 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)]) # Separate CHI file generation. DX_ARG_ABLE(chi, [generate doxygen separate 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 DX_ENV_APPEND(GENERATE_LATEX, YES) else 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 # Rules: AS_IF([[test $DX_FLAG_html -eq 1]], [[DX_SNIPPET_html="## ------------------------------- ## ## Rules specific for HTML output. ## ## ------------------------------- ## DX_CLEAN_HTML = \$(DX_DOCDIR)/html]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/html]])[ "]], [[DX_SNIPPET_html=""]]) AS_IF([[test $DX_FLAG_chi -eq 1]], [[DX_SNIPPET_chi=" DX_CLEAN_CHI = \$(DX_DOCDIR)/\$(PACKAGE).chi]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).chi]])["]], [[DX_SNIPPET_chi=""]]) AS_IF([[test $DX_FLAG_chm -eq 1]], [[DX_SNIPPET_chm="## ------------------------------ ## ## Rules specific for CHM output. ## ## ------------------------------ ## DX_CLEAN_CHM = \$(DX_DOCDIR)/chm]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/chm]])[\ ${DX_SNIPPET_chi} "]], [[DX_SNIPPET_chm=""]]) AS_IF([[test $DX_FLAG_man -eq 1]], [[DX_SNIPPET_man="## ------------------------------ ## ## Rules specific for MAN output. ## ## ------------------------------ ## DX_CLEAN_MAN = \$(DX_DOCDIR)/man]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/man]])[ "]], [[DX_SNIPPET_man=""]]) AS_IF([[test $DX_FLAG_rtf -eq 1]], [[DX_SNIPPET_rtf="## ------------------------------ ## ## Rules specific for RTF output. ## ## ------------------------------ ## DX_CLEAN_RTF = \$(DX_DOCDIR)/rtf]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/rtf]])[ "]], [[DX_SNIPPET_rtf=""]]) AS_IF([[test $DX_FLAG_xml -eq 1]], [[DX_SNIPPET_xml="## ------------------------------ ## ## Rules specific for XML output. ## ## ------------------------------ ## DX_CLEAN_XML = \$(DX_DOCDIR)/xml]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/xml]])[ "]], [[DX_SNIPPET_xml=""]]) AS_IF([[test $DX_FLAG_ps -eq 1]], [[DX_SNIPPET_ps="## ----------------------------- ## ## Rules specific for PS output. ## ## ----------------------------- ## DX_CLEAN_PS = \$(DX_DOCDIR)/\$(PACKAGE).ps]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).ps]])[ DX_PS_GOAL = doxygen-ps doxygen-ps: \$(DX_CLEAN_PS) ]m4_foreach([DX_i], [DX_loop], [[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).ps: \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag \$(DX_V_LATEX)cd \$(DX_DOCDIR]DX_i[)/latex; \\ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\ \$(DX_LATEX) refman.tex; \\ \$(DX_MAKEINDEX) 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 ]])["]], [[DX_SNIPPET_ps=""]]) AS_IF([[test $DX_FLAG_pdf -eq 1]], [[DX_SNIPPET_pdf="## ------------------------------ ## ## Rules specific for PDF output. ## ## ------------------------------ ## DX_CLEAN_PDF = \$(DX_DOCDIR)/\$(PACKAGE).pdf]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).pdf]])[ DX_PDF_GOAL = doxygen-pdf doxygen-pdf: \$(DX_CLEAN_PDF) ]m4_foreach([DX_i], [DX_loop], [[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).pdf: \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag \$(DX_V_LATEX)cd \$(DX_DOCDIR]DX_i[)/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 ]])["]], [[DX_SNIPPET_pdf=""]]) AS_IF([[test $DX_FLAG_ps -eq 1 -o $DX_FLAG_pdf -eq 1]], [[DX_SNIPPET_latex="## ------------------------------------------------- ## ## Rules specific for LaTeX (shared for PS and PDF). ## ## ------------------------------------------------- ## DX_V_LATEX = \$(_DX_v_LATEX_\$(V)) _DX_v_LATEX_ = \$(_DX_v_LATEX_\$(AM_DEFAULT_VERBOSITY)) _DX_v_LATEX_0 = @echo \" LATEX \" \$][@; DX_CLEAN_LATEX = \$(DX_DOCDIR)/latex]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/latex]])[ "]], [[DX_SNIPPET_latex=""]]) AS_IF([[test $DX_FLAG_doc -eq 1]], [[DX_SNIPPET_doc="## --------------------------------- ## ## Format-independent Doxygen rules. ## ## --------------------------------- ## ${DX_SNIPPET_html}\ ${DX_SNIPPET_chm}\ ${DX_SNIPPET_man}\ ${DX_SNIPPET_rtf}\ ${DX_SNIPPET_xml}\ ${DX_SNIPPET_ps}\ ${DX_SNIPPET_pdf}\ ${DX_SNIPPET_latex}\ DX_V_DXGEN = \$(_DX_v_DXGEN_\$(V)) _DX_v_DXGEN_ = \$(_DX_v_DXGEN_\$(AM_DEFAULT_VERBOSITY)) _DX_v_DXGEN_0 = @echo \" DXGEN \" \$<; .PHONY: doxygen-run doxygen-doc \$(DX_PS_GOAL) \$(DX_PDF_GOAL) .INTERMEDIATE: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL) doxygen-run:]m4_foreach([DX_i], [DX_loop], [[ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag]])[ doxygen-doc: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL) ]m4_foreach([DX_i], [DX_loop], [[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag: \$(DX_CONFIG]DX_i[) \$(pkginclude_HEADERS) \$(A""M_V_at)rm -rf \$(DX_DOCDIR]DX_i[) \$(DX_V_DXGEN)\$(DX_ENV) DOCDIR=\$(DX_DOCDIR]DX_i[) \$(DX_DOXYGEN) \$(DX_CONFIG]DX_i[) \$(A""M_V_at)echo Timestamp >\$][@ ]])dnl [DX_CLEANFILES = \\] m4_foreach([DX_i], [DX_loop], [[ \$(DX_DOCDIR]DX_i[)/doxygen_sqlite3.db \\ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag \\ ]])dnl [ -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)"]], [[DX_SNIPPET_doc=""]]) AC_SUBST([DX_RULES], ["${DX_SNIPPET_doc}"])dnl AM_SUBST_NOTMAKE([DX_RULES]) #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-2.1.13/m4/acx_libc.m40000644000077000001440000000013314446272525013213 00000000000000AC_DEFUN([ACX_LIBC],[ C_LIBS="-lc" # some checks could go in here AC_SUBST(C_LIBS) ]) opendnssec-2.1.13/m4/ax_prepend_flag.m40000644000077000001440000000311114446272525014564 00000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_prepend_flag.html # =========================================================================== # # SYNOPSIS # # AX_PREPEND_FLAG(FLAG, [FLAGS-VARIABLE]) # # DESCRIPTION # # FLAG is added to the front of the FLAGS-VARIABLE shell variable, with a # space added in between. # # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. # CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains # FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly # FLAG. # # NOTE: Implementation based on AX_APPEND_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # Copyright (c) 2018 John Zaitseff # # 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 2 AC_DEFUN([AX_PREPEND_FLAG], [dnl AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) AS_VAR_SET_IF(FLAGS,[ AS_CASE([" AS_VAR_GET(FLAGS) "], [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], [ FLAGS="$1 $FLAGS" AC_RUN_LOG([: FLAGS="$FLAGS"]) ]) ], [ AS_VAR_SET(FLAGS,[$1]) AC_RUN_LOG([: FLAGS="$FLAGS"]) ]) AS_VAR_POPDEF([FLAGS])dnl ])dnl AX_PREPEND_FLAG opendnssec-2.1.13/m4/acx_broken_setres.m40000644000077000001440000000165614446272525015162 00000000000000AC_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-2.1.13/m4/pkg.m40000644000077000001440000002400714446272525012236 00000000000000# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 12 (pkg-config-0.29.2) dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a dnl configuration script generated by Autoconf, you may include it under dnl the same distribution terms that you use for the rest of that dnl program. dnl PKG_PREREQ(MIN-VERSION) dnl ----------------------- dnl Since: 0.29 dnl dnl Verify that the version of the pkg-config macros are at least dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's dnl installed version of pkg-config, this checks the developer's version dnl of pkg.m4 when generating configure. dnl dnl To ensure that this macro is defined, also add: dnl m4_ifndef([PKG_PREREQ], dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], [m4_define([PKG_MACROS_VERSION], [0.29.2]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) dnl ---------------------------------- dnl Since: 0.16 dnl dnl Search for the pkg-config tool and set the PKG_CONFIG variable to dnl first found in the path. Checks that the version of pkg-config found dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is dnl used since that's the first version where most current features of dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])dnl PKG_PROG_PKG_CONFIG dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------------------------------- dnl Since: 0.18 dnl dnl Check to see whether a particular set of modules exists. Similar to dnl PKG_CHECK_MODULES(), but does not set variables or print errors. dnl dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) dnl only at the first occurence in configure.ac, so if the first place dnl it's called might be skipped (such as if it is within an "if", you dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) dnl --------------------------------------------- dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])dnl _PKG_CONFIG dnl _PKG_SHORT_ERRORS_SUPPORTED dnl --------------------------- dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])dnl _PKG_SHORT_ERRORS_SUPPORTED dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl -------------------------------------------------------------- dnl Since: 0.4.0 dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES might not happen, you should be sure to include an dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])dnl PKG_CHECK_MODULES dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl --------------------------------------------------------------------- dnl Since: 0.29 dnl dnl Checks for existence of MODULES and gathers its build flags with dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags dnl and VARIABLE-PREFIX_LIBS from --libs. dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to dnl include an explicit call to PKG_PROG_PKG_CONFIG in your dnl configure.ac. AC_DEFUN([PKG_CHECK_MODULES_STATIC], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl _save_PKG_CONFIG=$PKG_CONFIG PKG_CONFIG="$PKG_CONFIG --static" PKG_CHECK_MODULES($@) PKG_CONFIG=$_save_PKG_CONFIG[]dnl ])dnl PKG_CHECK_MODULES_STATIC dnl PKG_INSTALLDIR([DIRECTORY]) dnl ------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable pkgconfigdir as the location where a module dnl should install pkg-config .pc files. By default the directory is dnl $libdir/pkgconfig, but the default can be changed by passing dnl DIRECTORY. The user can override through the --with-pkgconfigdir dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_INSTALLDIR dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) dnl -------------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable noarch_pkgconfigdir as the location where a dnl module should install arch-independent pkg-config .pc files. By dnl default the directory is $datadir/pkgconfig, but the default can be dnl changed by passing DIRECTORY. The user can override through the dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_NOARCH_INSTALLDIR dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------- dnl Since: 0.28 dnl dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR opendnssec-2.1.13/missing0000755000077000001440000001533614446272532012275 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2020 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # 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 2, 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. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: opendnssec-2.1.13/contrib/0000755000077000001440000000000014446272544012411 500000000000000opendnssec-2.1.13/contrib/ods-sequencer/0000755000077000001440000000000014446272544015166 500000000000000opendnssec-2.1.13/contrib/ods-sequencer/ods-sequencer0000755000077000001440000003135114446272525017613 00000000000000#!/bin/env perl ############################################################################## # # These parameters intended to be changed # my $INSTALL_ROOT = "/"; my $SYSTEM_LOG = "/var/log/messages"; my $LOG_FILE = "/var/opendnssec/ods-sequencer.log"; my $ZONE_NAME = "example.com"; my $verbose = 0; ############################################################################## # # The implementation below should not be needed to be changed. # use strict; use warnings; use MIME::Base64; use XML::LibXML qw( ); use IO::Handle; use IO::Select; use Symbol qw(qualify_to_ref); use File::Copy qw(copy); use Date::Parse; use Cwd 'abs_path'; use POSIX qw(strftime); sub sysreadline(*;$) { my($handle, $timeout) = @_; $handle = qualify_to_ref($handle, caller( )); my $infinitely_patient = (@_ = 1 || $timeout < 0); my $start_time = time( ); my $selector = IO::Select->new( ); $selector->add($handle); my $line = ""; SLEEP: until (at_eol($line)) { unless ($infinitely_patient) { return $line if time( ) > ($start_time + $timeout); } # sleep only 1 second before checking again next SLEEP unless $selector->can_read(1.0); INPUT_READY: while ($selector->can_read(0.0)) { my $was_blocking = $handle->blocking(0); CHAR: while (sysread($handle, my $nextbyte, 1)) { $line .= $nextbyte; last CHAR if $nextbyte eq "\n"; } $handle->blocking($was_blocking); # if incomplete line, keep trying next SLEEP unless at_eol($line); last INPUT_READY; } } return $line; } sub at_eol($) { $_[0] =~ /\n\z/ } my $matchmonitorlogfound; sub startmonitorlog() { open(LOG, "tail -f " . $SYSTEM_LOG . " |"); $matchmonitorlogfound=0; } sub matchmonitorlog() { my $line; return 1 if($matchmonitorlogfound); do { $line = sysreadline(LOG, 0); if($line =~ /STATS/) { $matchmonitorlogfound = 1; return 1; } } while(at_eol($line)); return 0; } sub endmonitorlog() { close(LOG); } sub makeannotatedsignconf { my $inputsignconf = $_[0]; my $backupfile = $_[1]; my $outputsignconf = $_[2]; # Read in zone file my $parser = XML::LibXML->new(); my $document = XML::LibXML->load_xml(location => $inputsignconf); # for each KSK key look up entry in backup file of Key field and # actual DNSKEY field. Then add ResourceRecord entity to KSK key entry # of parsed signconf XML. foreach my $keyNode ($document->findnodes('//SignerConfiguration/Zone/Keys/Key')) { my $flagsValue = $keyNode->findvalue('Flags/text()'); if($flagsValue eq "257") { my $locatorNode = $keyNode->find('Locator')->get_node(1); my $locatorValue = $keyNode->findvalue('Locator/text()'); my $resourcerecord = ""; my $keytag = "skip"; open(FILE, $backupfile); while() { if(m/;;Key: locator $locatorValue algorithm \d+ flags 257 publish \d+ ksk \d+ zsk \d+ keytag (\d+)/) { $keytag=$1; } if(m/^(.* .* IN DNSKEY 257 \d+ \d+ .*) ;{id = $keytag \(ksk\), size .*}$/) { $resourcerecord = encode_base64($1); } } close(FILE); foreach my $locatorNode ($keyNode->findnodes('Locator')) { $keyNode->removeChild($locatorNode); } my $resourceNode = XML::LibXML::Element->new('ResourceRecord'); $resourceNode->appendText($resourcerecord); $keyNode->appendChild($resourceNode); } } # also retrieve any signatures over the DNSKEY entries and add a SignatureRecordRecord for them my $resourcerecord = ""; open(FILE, $backupfile); while() { if(m/^(.* .* IN RRSIG DNSKEY \d+ \d+ \d+ \d+ \d+ \d+ .* .*); {locator .* flags 257}$/) { my $resourceNode = XML::LibXML::Element->new('SignatureResourceRecord'); $resourceNode->appendText(encode_base64($1)); $document->find('//SignerConfiguration/Zone/Keys')->get_node(1)->appendChild($resourceNode);; } } close(FILE); # Output the signconf open(FILE, "| xmllint --format - > " . $outputsignconf); print FILE $document->toString(); close(FILE); } sub enforcerinfo() { my $busy; my $timenow=0; my $timenext=0; my @dsseenkeys; do { $busy=0; sleep(3); open(FILE, "./sbin/ods-enforcer queue 2>>$LOG_FILE |"); while() { $busy=1 if(m/^Next task scheduled immediately/); $busy=1 if(m/^Working with/); if(m/^It is now.*\(([0-9][0-9]*)[^)]*\).*$/) { $timenow=$1; } if(m/^Next task scheduled.*\(([0-9][0-9]*)[^)]*\).*$/) { $timenext=$1; } } close(FILE); } while($busy); die "ERROR: enforcer not running properly\n" if($timenow==0); open(FILE, "./sbin/ods-enforcer 2>>$LOG_FILE key list --verbose |"); while() { if(m/^(\S+).*\s+waiting for ds-seen\s+\d+\s+\d+\s+([0-9a-fA-F]+)\s*.*$/) { push(@dsseenkeys, $2); } } close(FILE); return ($timenow, $timenext, @dsseenkeys); } sub enforceridle() { my $busy; do { $busy=0; sleep(3); open(FILE, "./sbin/ods-enforcer queue 2>>$LOG_FILE |"); while() { $busy=1 if(m/^Next task scheduled immediately/); $busy=1 if(m/^Working with/); } close(FILE); } while($busy); } sub makesignedzone { my $timenow; my $timenext; my @dsseenkeys; my $timecurrent = $_[0]; startmonitorlog(); print " ..signing zone\n" if($verbose); system("./sbin/ods-signerd 2>>$LOG_FILE >>$LOG_FILE --set-time " . $timecurrent); sleep(10); system("./sbin/ods-signer 2>>$LOG_FILE >>$LOG_FILE sign --all"); print " ..waiting for signed zone\n" if($verbose); while(!matchmonitorlog()) { sleep(1); } print " ..stopping signer\n" if($verbose); system("./sbin/ods-signer 2>>$LOG_FILE >>$LOG_FILE stop"); print " ..annotating signconf\n" if($verbose); makeannotatedsignconf("var/opendnssec/signconf/" . $ZONE_NAME . ".xml", "var/opendnssec/signer/" . $ZONE_NAME . ".backup2", "var/opendnssec/sequences/" . $timecurrent . "-" . $ZONE_NAME . ".xml"); unlink("var/opendnssec/signed/" . $ZONE_NAME); unlink("var/opendnssec/signer/" . $ZONE_NAME . ".backup2"); copy("var/opendnssec/kasp.db", "var/opendnssec/sequences/" . $timecurrent . "-kasp.db"); endmonitorlog(); } sub makesequence { my $currenttime = $_[0]; print " ..generating sequence\n" if($verbose); system("./sbin/ods-enforcer 2>>$LOG_FILE >>$LOG_FILE signconf"); enforceridle(); system("./sbin/ods-enforcer 2>>$LOG_FILE >>$LOG_FILE stop"); makesignedzone($currenttime); system("./sbin/ods-enforcerd 2>>$LOG_FILE >>$LOG_FILE --set-time " . $currenttime); } ############################################################################## $LOG_FILE=abs_path($LOG_FILE); chdir $INSTALL_ROOT; die "Sequencing directory not set up or misconfigured.\n" unless -d "var/opendnssec/sequences"; my $sequence; my @sequences; opendir DIR, "var/opendnssec/sequences" or die; @sequences = readdir(DIR) or die; closedir(DIR); @sequences = grep { s/^(\d+)-$ZONE_NAME.xml$/$1/ } @sequences; @sequences = sort { $a <=> $b } @sequences; my $targettime; my $currenttime; my $timenow; my $timenext; my @dsseenkeys; my $key; my @dssubmitfiles; my $dssubmitfile; if($#ARGV == 0 && $ARGV[0] eq "update") { $currenttime = time(); undef $timenow; undef $targettime; PLAY: foreach $timenext (@sequences) { if($timenext > $currenttime) { $targettime = $timenext; last PLAY; } $timenow = $timenext; print "Updated configuration to " . (strftime('%Y-%m-%d-%H:%M:%S',localtime($timenow))) . "\n"; if(-f "var/opendnssec/sequences/" . $timenow . "-kasp.db", "var/opendnssec/kasp.db") { copy("var/opendnssec/sequences/" . $timenow . "-kasp.db", "var/opendnssec/kasp.db") or die "Unable to update enforcer configuration: $!\n"; unlink("var/opendnssec/sequences/" . $timenow . "-kasp.db", "var/opendnssec/kasp.db"); } copy("var/opendnssec/sequences/" . $timenow . "-" . $ZONE_NAME . ".xml", "var/opendnssec/signconf/" . $ZONE_NAME . ".xml") or die "Unable to update signer configuration\n"; unlink("var/opendnssec/sequences/" . $timenow . "-" . $ZONE_NAME . ".xml"); } if(defined($timenow)) { print "Notifying signer\n"; system("./sbin/ods-signer update --all"); } if(defined($targettime)) { print "Next configuration update due " . (strftime('%Y-%m-%d-%H:%M:%S',localtime($targettime))) . ".\n" if($verbose); } else { if(defined($timenow)) { print "Last signer configuration update performed.\n"; } else { die "No more signer configuration updates.\n"; } } } elsif($#ARGV == 1 && $ARGV[0] eq "scenario") { $targettime = str2time($ARGV[1]); die "Unrecognized target time" if(!defined $targettime); if($#sequences < 0) { $currenttime = time(); print "generating sequences from scratch starting now at " . localtime($currenttime) . "\n"; system("./sbin/ods-enforcerd 2>>$LOG_FILE >>$LOG_FILE --set-time " . $currenttime); print " ..waiting for information and enforcer idle\n" if($verbose); sleep(10); ($timenow, $timenext, @dsseenkeys) = enforcerinfo(); makesequence($currenttime); } else { $currenttime = $sequences[$#sequences]; print "generating sequences picking up from " . localtime($currenttime) . "\n"; copy("var/opendnssec/sequences/" . $currenttime . "-kasp.db", "var/opendnssec/kasp.db"); system("./sbin/ods-enforcerd 2>>$LOG_FILE >>$LOG_FILE --set-time " . $currenttime); sleep(10); ($timenow, $timenext, @dsseenkeys) = enforcerinfo(); } while($currenttime <= $targettime) { print "determining what to do on " . (strftime('%Y-%m-%d-%H:%M:%S',localtime($currenttime))) . "\n" if($verbose); if($#dsseenkeys < 0) { if($timenext <= $targettime) { print " leaping to " . (strftime('%Y-%m-%d-%H:%M:%S',localtime($timenext))) . "\n" if($verbose); system("./sbin/ods-enforcer 2>>$LOG_FILE >>$LOG_FILE time leap --time " . (strftime('%Y-%m-%d-%H:%M:%S',localtime($timenext)))); sleep(10); enforceridle(); ($timenow, $timenext, @dsseenkeys) = enforcerinfo(); $currenttime = $timenow; makesequence($currenttime); print "signer configuration for " . (strftime('%Y-%m-%d-%H:%M:%S',localtime($currenttime))) . "\n"; } else { $currenttime = $timenext; } } else { print " publishing ds keys " . $#dsseenkeys . "\t" . @dsseenkeys . "\n" if($verbose); foreach $key (@dsseenkeys) { print " ..publishing cka_id " . $key if($verbose); print "ds seen given for " . $key . "\n" if(!$verbose); system("./sbin/ods-enforcer 2>>$LOG_FILE >>$LOG_FILE key ds-seen --zone " . $ZONE_NAME . " --cka_id " . $key); } ($timenow, $timenext, @dsseenkeys) = enforcerinfo(); $currenttime = $timenow; makesequence($currenttime); } } system("./sbin/ods-enforcer 2>>$LOG_FILE >>$LOG_FILE stop"); # As a reminder to the operator, at the end write out the DS records # that need to be explicitly submitted to the parent zone opendir DIR, "var/opendnssec/sequences" or die; @sequences = readdir(DIR) or die; closedir(DIR); @sequences = grep { s/^(\d+)-dssubmit$/$1/ } @sequences; @sequences = sort { $a <=> $b } @sequences; foreach $sequence (@sequences) { print "On " . strftime('%Y-%m-%d-%H:%M:%S',localtime($sequence)) . " submit " . $sequence . "-dssubmit\n"; } } else { print "\n"; print "Usage: ods-sequencer update\n"; print " Intended to be run periodically, updates an environment without\n"; print " enforcer to a prerecorded enforcer scenario\n"; print "Or: ods-sequencer scenario \n"; print " Record a sequence of signer configurations starting from the\n"; print " latest recorded state towards the given runtime parameter\n"; print "\n"; die "Unrecognized usage.\n"; } ############################################################################## opendnssec-2.1.13/contrib/ods-sequencer/ods-sequencer.md0000644000077000001440000004004014446272525020202 00000000000000Off-line KSK environments using ods-sequencer ============================================= # Rationale There may be organizations which have strict guidelines on the security of key material. Specifically, there may be a requirement that specifies that KSK private key material may only be present of a machine that is not connected to any other machine. The actual zone file needs frequent updates and signing and therefor needs to be interconnected. This means the KSK RR and signed key set need to be integrated from the secured zone file. This solution still assumes this is in a single controlling organization. Other more complex solutions with exchange of signing requests are more applicable where multiple organizations are involved. # Introduction This tools allows you to run a signer instance that keeps a zone file signed even with key-roll overs by replaying signer configurations that have been pre-prepared earlier. In this set-up, the function of OpenDNSSEC will essentially be divided into two parts. One secure environment (the "bunker") that has full knowledge of the keys, will sign the keyset and control the key roll-over. This is primary the roll of the enforcer in OpenDNSSEC, but there needs a signer from OpenDNSSEC as well in order to sign the keyset of the zone. Otherwise this bunker environment does not contain the real zone data. The actual zone signing is performed on the operational environment. This environment needs access to the zone signing keys, but gets other key information, amongst which the signed keyset from the bunker. The same information will also control how and when to perform key roll-overs. This information does not need to be transferred life from bunker to operational side, but can be preprepared in advance for a period of time, and then a series of such signer configurations can be placed on the operational side to be "played" out over the real passing of time. The main installation of the bunker and operational environments is the same as on a normal installation, there are only slight differences. # Description The set-up consist of two functional sites. The operational site, which role it is to: - keep a full zone file signed using an available ZSK key pair; - receiving updates on the zone file and sending out notifications when signed; - incorporating an already signed key set from the other functional site; The bunker, which role it is to: - produce key pairs (both KSK and ZSK); - sign key sets (a selection of public keys) using the KSK private key; - generate a script to perform key roll-overs for any selected period of time; The scripted scenario replaces the roll of the enforcer on the operational site. The script describes a set of actions to be taken at specific times regarding the keys and key sets in use on the operational site. OpenDNSSEC is normally used in a re-active manner. Performing actions when it sees fit according to described and observed propagation delays of its actions. The enforcer of this key roll-over procedure does work according to a fixed schedule, but determines a next step time and time again. This allow the operator to tune delays and even do a simultaneous roll-over even though a roll-over procedure is already happening. The enforcer will give out instructions on each step on how to perform a roll- over procedure (such as introducing a new key, or starting to use a key for signing purposes). However the timing of these steps is not fixed due to the ability to change tactics in the roll-over as well as small variations in timings. Although not really a procedure, it is possible to capture these instructions from the enforcer and thus describe the steps to be taken and create a scripted scenario for this, if we would fast-forward the enforcer into time. This is already possible with the enforcer, and we can capture the transitions from the enforcer for a simulated future period of time. It is in principle also possible to restore the enforcer back from state and re-continue to make a script. This might be handy in case parameters may need changing or an emergency roll-over would need to take place. In such a case we want to break into a pre-recorded scenario and half-way a scenario re-record the steps to be taken with changed parameters. Note however that when resuming such a scenario, there might be small variations in the described steps to be made, as the enforcer might decide to swap tasks that could happen at the same time for instance. ## Mode of operation in the bunker In the bunker there will not be a continuous process, but at occasions there will be a on user demand generation of a scripted scenario. This script is composed of a number of steps. Each step is an input that the signer on the operational side should incorporate at a specific moment in time. The enforcer-tooling in the bunker can also use such a step to restore itself at a specific moment in time and re-generate a new script from that point of time. The tooling around the enforcer will then fast-forward the enforcer recording the changes and instructions made by the enforcer. This tooling is just a relative simple control script to start the enforcer with the right options, performs time increments and at each time increment takes a snapshot of the enforcer state by copying the relevant database tables, description to signer and will export the keys from the HSM and places it in a proper bundled package such that it can be shipped to the operational side. ## Mode of operation on the operational side On the operational side there is a signer running as usual for OpenDNSSEC, but instead of an enforcer, there will be a replacement tool that will take the shipped file from the bunder and unpacks and imports the right contents at the appropriate time. Note however that since there is no interaction between signer and enforcer, it is vital that the scenario is really played as is. The operator is responsible to make sure the right scenario file is in place and manual steps, like the ds-seen command in OpenDNSSEC is given within the time window allowed by the parameters in the kasp.xml. # Shortcomings - Current script integrates too tightly with internal format of signer storage. This is not a format that can be relied upon for future usage and this scripting should get better integration in OpenDNSSEC. - The script currently only allows for a single zone file to be treated in this manner, but there are no fundamental problems in extending this. - It is assumed that publishing the DS record takes no time. Normally a delay is introduced by requiring the operator to validate the DS record is seen in the parent zone (and giving a "ds seen" command). This is now implicitly immediately performed as soon as OpenDNSSEC allows for it. There is still a TTL respected. We assume this is not a problem since with this set-up the DS records are in fact available long in advance and can be submitted far earlier. - The validity of ZSK signatures must be set to be at least that of the lifetime of the ZSKs themselves. This set-up does not yet allow for re-signing keysets. When setting the validity of ZSK signatures so short, that access to the KSK is needed before next signing instruction. Note that this means that a ZSK never needs resigning, which is a limitation. However we probably would not want to set all signatures to the same validity period in this case. The signatures on ZSKs are provided using the KSK, while those on normal records by ZSK which have different strengths. This is a change from the current OpenDNSSEC workings, where there is no distinction between signatures generated using a KSK or ZSK. # Installation First, you need from the source distribution the program "plugins/ods-sequencer". This is a special script that will take care of the recording and play-back of signing scenarios. Install it on both bunker and operational environments in a suitable location such as "/usr/sbin". On both sides create directory "/var/opendnssec/sequences", this directory will contain the future scenarios. This directory should be writable by the user that will control OpenDNSSEC. You should not place any files of your own here, the filenames in this directory will have meaning. On the operational side you probably later on will want to install a periodic running call to ods-sequencer program to keep your signing configuration up to date. We suggest that you place it in the crontab of the user controlling OpenDNSSEC. We suggest running it every 10 minutes or so. It is not heavy program unless there are a lot of scenarios to play. */10 * * * * /usr/sbin/ods-sequencer update # Configuration The KSK and ZSK will normally be distributed over two different HSMs / PKCS#11 providers or stored in separate slots. Within the bunker this means that you need to define at least two Repository tags. One for the ZSKs and one for the KSKs. As normal the TokenLabel and PIN should mirror those when setting up the slots in your PKCS#11 environment. The name attribute of each repository tags does not really matter, but should be the same as later referred to in the kasp.xml configuration file. Example: /usr/lib/softhsm/libsofthsm.so KSKs 1234 /usr/lib/softhsm/libsofthsm2.so ZSKs 1234 The bunker environment needs some changes to the kasp.xml configuration file as well. Although the operational environment does not use the kasp.xml configuration file at this time, we advice to keep configurations in sync as much as possible. There are two changes necessary. One is the addition of a Keyset element in KASP/Policy/Signatures/Validity/Keyset. The validity elements here define how long the signatures for normal RRs are valid, and how long the validity of NSEC or NSEC3 RRs are valid. These should be larger then the TTLs for these type of records in your zone. By default the DNSKEY RR (the keyset) has the same validity period as specified by the Default entry, but this set-up requires the validity period of DNSKEY set records to be at least as large as the ZSK lifetime. This because DNSKEY RR will not get re-signed in the bunker. For example: ... ... P1D P3D P2M ... ... 7 P1Y KSKs 7 P1M ZSKs Also notice the Repository tags define the separate repositories for KSKs and ZSKs as specified in the conf.xml configuration file. # Setting up both environments You should not attempt to run the enforcer on the operational side. Disabling /usr/sbin/ods-enforcerd by removing it or disabling execution may be a good idea. It is therefor also not needed to run "ods-enforcer-db-setup" on the operational side. Within the bunker environment now prepare the OpenDNSSEC environment to sign your zone by adding it after heaving started the OpenDNSSEC daemons using ods-control. The best way to do this would be to execute: ods-enforcer zone add -z example.com -p default See the OpenDNSSEC wiki for details. The ods-enforcer used to be called ods-ksmutil, but its workings are essentially the same. One major difference it that the enforcer daemon needs to be running before attempting to call ods-enforcer. In case of new zones this will be all steps necessary, in case of existing zones you need to transfer the zone keys into the HSM and bootstrap the zone state further. The installed ods-sequencer program needs a few modifiable parameters to be checked. Edit this script program and set the entry ZONE_NAME to the zone name that you have added to the system. At this time the script can only handle one zone at the time. This should be done in both bunker and operational environments. At this time the bunker is ready for use. Stop the OpenDNSSEC daemons. Since we will now be playing out future scenarios, we should not use ods-control start/stop at this time no more. It is therefor necessary not to include OpenDNSSEC in any auto startup sequence of the bunker environment. On the operational side you do want to include a start-up of the signer daemon in the start up sequence. Since enforcer should not be started, you can use a call to "ods-signer start" in stead of "ods-control start". At this time the bunker environment is ready to use. The operational environment also needs to get information on the zones present. Transfer the file /var/opendnssec/enforcer/zones.xml from the bunker environment to the operational environment. The normal unsigned zone file (in case of file based zone files) would normally go into /var/opendnssec/unsigned/example.com, but this is part of the normal set-up of OpenDNSSEC. This concludes the set-up of both environments. # Using ods-sequencer. The operational environment is not yet able to sign the zones, it needs instructions which keys are necessary for signing the zone. In order to prepare a future set of signing instructions for the operational environment, you should log into the bunker environment. You can now use the command "ods-sequencer scenario" to generate a set of signing scenarios. It will take one additional argument which instructs the program to generate scripts upto the specified time. For example: ods-sequencer scenario 2020-01-01 Will generate (a lot) of signing scenarios upto the beginning of year 2020. These signing configurations (signconf's) are placed in /var/opendnssec/sequences. When running this command for the first time, it will use the current time as starting point. When having created previous snapshots, it will take off from the last generated signing configuration. You will notice the signing configurations generated in /var/opendnssec/sequences are prefixed with a unix timestamp. If you delete a series of signing configurations at the end of this time-line, you can force the signer to re-create a set of signing instructions. This can be useful in case of an emergency roll over, where you need to intervene and abort a current scenario. Transfer the /var/opendnssec/sequences directory from the bunker environment to the operational environment and place it in the same location. Also replicate the ZSK PKCS#11 key repository from the bunker environment to the operational environment. It suffices to only replicate the final key repository from a period to the operational side. Run the program: ods-sequencer update once and how start the OpenDNSSEC signer daemon using: ods-signer start And it will have picked up the first signing configuration for your zone. Now periodically run: ods-sequencer update in order to keep the signing configuration up to date. # Getting clear indication when to submit DS records Since this setup prepares a list of future scenarios, this also includes the assumption that you submit the proper DS record in time to the parent zone. Not doing so will get your zone to become invalid (bogus). By adding a delegation signer submit command to the OpenDNSSEC conf.xml configuration, you can get a proper listing after running ods-sequencer scenario command when you will have to submit the DS records to the parent zone. You can add the following item to the Enforcer section of the conf.xml: /sbin/ods-sequencer-submit.sh --cka_id Make sure the path to the ods-sequencer-submit.sh is correct. A sample ods-sequencer-submit.sh is included. After running ods-sequencer scenario you will get a listing of the DS records that need to be submitted when. opendnssec-2.1.13/contrib/ods-sequencer/ods-sequencer-submit.sh0000755000077000001440000000026614446272525021526 00000000000000#!/bin/bash now=`../../../sbin/ods-enforcer queue 2>&1 | sed -e 's/^It is now.*(\([0-9][0-9]*\)[^)]*).*$/\1/p' -e 'd'` cat > ../../../var/opendnssec/sequences/$now-dssubmit exit 0 opendnssec-2.1.13/contrib/simple-dnskey-mailer/0000755000077000001440000000000014446272544016444 500000000000000opendnssec-2.1.13/contrib/simple-dnskey-mailer/simple-dnskey-mailer.sh0000644000077000001440000000347514446272525022763 00000000000000#!/bin/bash # # Copyright (c) 2010 .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. # # *********************************************************************** # * # * This script sends keys from OpenDNSSEC to the address specified below # * # * Set this up by specifying the path for this script in conf.xml # * using the tag. # * # *********************************************************************** # define and uncomment recipient below #RECIPIENT=user@example.com if [ -n "$RECIPIENT" ]; then cat | mail -s "New keys from OpenDNSSEC" $RECIPIENT else fi opendnssec-2.1.13/contrib/ods-migratekeytool/0000755000077000001440000000000014446272544016233 500000000000000opendnssec-2.1.13/contrib/ods-migratekeytool/ods-migratekeytool.md0000644000077000001440000000075214446272525022322 00000000000000OpenDNSSEC HSM Migration tool tool ================================== This tool can be used to migrate from one instance to another, where both you migrate to a new OpenDNSSEC instance AND you migrate to a new HSM instance without the ability to migrate the keys to the new environment. This requires a special kind of DS roll-over where the public key material is being transfered between environments but the private keys are not. More details on this tool will follow in a blog post. opendnssec-2.1.13/contrib/ods-migratekeytool/ods-migratekeytool.py0000755000077000001440000003226214446272525022356 00000000000000#! /usr/bin/env python3 __author__ = "Berry van Halderen" __date__ = "$$" import os import sys import getopt import yaml import re import pkcs11 import base64 import binascii import xml.dom.minidom '''' Limitations: - Only one PKCS#11 token for exporting public keys supported at any one time - Hardware PKCS#11 token should be specified as first repository, SoftHSM based token as second repository. - Only migrates RSA public keys - Token PIN must be specified in the configuration file ''' tokenmodule = "/usr/local/lib/softhsm/libsofthsm2.so" tokenlabel = "SoftHSM" tokenpin = "1234" signconffname = None def main(): try: if sys.argv[1] == "export": readconf(sys.argv[2], sys.argv[3], 0) lib = pkcs11.lib(tokenmodule) token = lib.get_token(token_label=tokenlabel) session = token.open(user_pin=tokenpin, rw=False) ( signconf, keys ) = readsignconf(signconffname) exportkeys(session, keys) session.close() patchsignconf(signconf, keys) writesignconf(signconf, signconffname, "pseudo") elif sys.argv[1] == "import": readconf(sys.argv[2], sys.argv[3], 1) lib = pkcs11.lib(tokenmodule) token = lib.get_token(token_label=tokenlabel) session = token.open(user_pin=tokenpin, rw=True) ( signconf, keys ) = readsignconf(signconffname, "pseudo") importkeys(session, keys) newsignconf = mergesignconf(signconf, keys, signconffname) writesignconf(newsignconf, signconffname, "new") session.close() except pkcs11.exceptions.NoSuchToken: print("Unable to access token", file=sys.stderr) sys.exit(1) class KeyNotFound(Exception): message = None def __init__(self, message): self.message = message def readconf(conffname, zonename, repoindex=None): global tokenmodule global tokenlabel global tokenpin global signconffname confdoc = xml.dom.minidom.parse(conffname) count = 0 if repoindex != None: for reponode in getxpath(confdoc, ['Configuration', 'RepositoryList']).getElementsByTagName('Repository'): if count == repoindex: tokenmodule = getxpath(reponode, ['Module', None]) tokenlabel = getxpath(reponode, ['TokenLabel', None]) tokenpin = getxpath(reponode, ['PIN', None]) count = count + 1 zonelistfile = getxpath(confdoc, ['Configuration', 'Enforcer', 'WorkingDirectory', None], "") + "/" + "zones.xml" if not os.path.exists(zonelistfile): zonelistfile = getxpath(confdoc, ['Configuration', 'Common', 'ZoneListFile', None]) zonelistdoc = xml.dom.minidom.parse(zonelistfile) signconffname = None for zonenode in getxpath(zonelistdoc, ['ZoneList']).getElementsByTagName('Zone'): if zonenode.getAttribute('name') == zonename: signconffname = getxpath(zonenode, ['SignerConfiguration', None]) def importkey(session, keyname, modulus, exponent): attrs = { } attrs[pkcs11.constants.Attribute.ID] = binascii.a2b_hex(keyname) for handle in session.get_objects(attrs): if isinstance(handle, pkcs11.PublicKey): print("Found public key") return False elif isinstance(handle, pkcs11.PrivateKey): print("Found private key") return False flags = pkcs11.constants.MechanismFlag.SIGN | pkcs11.constants.MechanismFlag.VERIFY flags |= pkcs11.constants.MechanismFlag.WRAP | pkcs11.constants.MechanismFlag.ENCRYPT flags |= pkcs11.constants.MechanismFlag.UNWRAP | pkcs11.constants.MechanismFlag.DECRYPT flags |= pkcs11.constants.MechanismFlag.HW | pkcs11.constants.MechanismFlag.DIGEST template = { pkcs11.constants.Attribute.TOKEN: True, pkcs11.constants.Attribute.PRIVATE: False } template[pkcs11.constants.Attribute.LABEL] = keyname template[pkcs11.constants.Attribute.ID] = binascii.a2b_hex(keyname) template[pkcs11.constants.Attribute.CLASS] = pkcs11.ObjectClass.PUBLIC_KEY template[pkcs11.constants.Attribute.KEY_TYPE] = pkcs11.KeyType.RSA template[pkcs11.constants.Attribute.TOKEN] = True template[pkcs11.constants.Attribute.PRIVATE] = True template[pkcs11.constants.Attribute.ENCRYPT] = True template[pkcs11.constants.Attribute.VERIFY] = True template[pkcs11.constants.Attribute.VERIFY_RECOVER] = True template[pkcs11.constants.Attribute.WRAP] = True template[pkcs11.constants.Attribute.MODULUS] = modulus template[pkcs11.constants.Attribute.PUBLIC_EXPONENT] = exponent key = session.create_object(template) template = { pkcs11.constants.Attribute.TOKEN: True, pkcs11.constants.Attribute.PRIVATE: False } template[pkcs11.constants.Attribute.LABEL] = keyname template[pkcs11.constants.Attribute.ID] = binascii.a2b_hex(keyname) template[pkcs11.constants.Attribute.CLASS] = pkcs11.ObjectClass.PRIVATE_KEY template[pkcs11.constants.Attribute.KEY_TYPE] = pkcs11.KeyType.RSA template[pkcs11.constants.Attribute.TOKEN] = True template[pkcs11.constants.Attribute.PRIVATE] = True template[pkcs11.constants.Attribute.DECRYPT] = True template[pkcs11.constants.Attribute.SIGN] = True template[pkcs11.constants.Attribute.SIGN_RECOVER] = True template[pkcs11.constants.Attribute.UNWRAP] = True template[pkcs11.constants.Attribute.MODULUS] = modulus template[pkcs11.constants.Attribute.PRIVATE_EXPONENT] = exponent key = session.create_object(template) return True def importkeys(session, keys): for keyname in keys.keys(): if 'keydata' in keys[keyname].keys(): keydata = base64.b64decode(keys[keyname]['keydata']) ( modulus, exponent ) = decomposekeydata(keydata) imported = importkey(session, keyname, modulus, exponent) if imported: print("imported key " + keyname) def exportkey(session, keyname): attrs = { } attrs[pkcs11.constants.Attribute.ID] = binascii.a2b_hex(keyname) modulus = False exponent = False for handle in session.get_objects(attrs): if isinstance(handle, pkcs11.PublicKey): modulus = handle[pkcs11.constants.Attribute.MODULUS] exponent = handle[pkcs11.constants.Attribute.PUBLIC_EXPONENT] return ( modulus, exponent ) elif isinstance(handle, pkcs11.PrivateKey): modulus = handle[pkcs11.constants.Attribute.MODULUS] exponent = handle[pkcs11.constants.Attribute.PUBLIC_EXPONENT] if modulus == False: raise KeyNotFound(keyname) return ( modulus, exponent ) def exportkeys(session, keys): for keyname in keys.keys(): try: ( modulus, exponent ) = exportkey(session, keyname) keys[keyname] = { 'modulus': modulus, 'exponent': exponent, 'keydata': composekeydata(modulus, exponent) } except KeyNotFound: print("key "+keyname+" not found") pass def composekeydata(modulus, exponent): modulus_skip = 0 while modulus_skip < len(modulus) and modulus[modulus_skip] == 0: ++modulus_skip exponent_skip = 0 while exponent_skip < len(exponent) and exponent[exponent_skip] == 0: ++exponent_skip if len(exponent) - exponent_skip > 65535: raise Burned("len exponent longer than allowed ("+len(exponent)+")") elif len(exponent) - exponent_skip > 255: buffer = bytearray() buffer.append(0) buffer.append((len(exponent) - exponent_skip) >> 8) buffer.append((len(exponent) - exponent_skip) & 0xff) buffer.extend(exponent[exponent_skip:]) buffer.extend(modulus[modulus_skip:]) else: buffer = bytearray() buffer.append(len(exponent) - exponent_skip) buffer.extend(exponent[exponent_skip:]) buffer.extend(modulus[modulus_skip:]) return buffer def decomposekeydata(buffer): if buffer[0] == 0: exponent_len = buffer[1] << 8 | buffer[2] exponent = buffer[3:exponent_len+3] modulus = buffer[exponent_len+3:] else: exponent_len = buffer[0] exponent = buffer[1:exponent_len+1] modulus = buffer[exponent_len+1:] return ( modulus, exponent ) def processkeys(keys): for keyname in keys: key = keys[keyname] if 'modulus' in key: key['keydata'] = composekeydata(key['modulus'], key['exponent']) def readsignconf(signconf, prefix=None): signconfkeys = { } if prefix == None: fname = signconf else: fname = os.path.join(os.path.dirname(signconf), prefix + "-" + os.path.basename(signconf)) doc = xml.dom.minidom.parse(fname) for keynode in doc.getElementsByTagName('Key'): keyname = getxpath(keynode, ['Locator', None]) signconfkeys[keyname] = { } signconfkeys[keyname]['keynode'] = keynode keydata = getxpath(keynode, ['PublicKeyData', None]) signconfkeys[keyname]['keydata'] = keydata return ( doc, signconfkeys ) def getxpath(node, path, defaultValue=None): for p in path: next = None for n in node.childNodes: if p == None: return n.data elif n.localName == p: next = n break if next == None: return defaultValue else: node = next return node def mergesignconf(signconf, keys, fname, prefix=None): if prefix != None: fname = os.path.join(os.path.dirname(signconf), prefix + "-" + os.path.basename(signconf)) doc = xml.dom.minidom.parse(fname) keysnode = getxpath(doc, ['SignerConfiguration', 'Zone', 'Keys']) for key in keys: keynode = keys[key]['keynode'] locator = getxpath(keynode, ["Locator"]) if locator in keys: keysnode.removeChild(keynode) for key in keys: mergekeyrolenum = getxpath(keys[key]['keynode'], ['Flags', None]) mergekeyalgonum = getxpath(keys[key]['keynode'], ['Algorithm', None]) mergekeylocator = getxpath(keys[key]['keynode'], ['Locator', None]) #mergekeyksk = getxpath(keys[key]['keynode'], ['KSK']) #mergekeyzsk = getxpath(keys[key]['keynode'], ['ZSK']) mergekeypublish = getxpath(keys[key]['keynode'], ['Publish']) keynode = doc.createElement("Key") keynode.appendChild(doc.createTextNode("\n\t\t\t\t")) node = doc.createElement("Flags") node.appendChild(doc.createTextNode(str(mergekeyrolenum))) keynode.appendChild(node) keynode.appendChild(doc.createTextNode("\n\t\t\t\t")) node = doc.createElement("Algorithm") node.appendChild(doc.createTextNode(str(mergekeyalgonum))) keynode.appendChild(doc.createTextNode("\n\t\t\t\t")) keynode.appendChild(node) node = doc.createElement("Locator") node.appendChild(doc.createTextNode(str(mergekeylocator))) keynode.appendChild(node) #if mergekeyksk != None: # node = doc.createElement("KSK") # keynode.appendChild(node) # keynode.appendChild(doc.createTextNode("\n ")) #if mergekeyzsk != None: # node = doc.createElement("ZSK") # keynode.appendChild(node) # keynode.appendChild(doc.createTextNode("\n\t\t\t\t")) if mergekeypublish != None: node = doc.createElement("Publish") keynode.appendChild(doc.createTextNode("\n\t\t\t\t")) keynode.appendChild(node) keynode.appendChild(doc.createTextNode("\n\t\t\t")) keysnode.appendChild(doc.createTextNode("\t")) keysnode.appendChild(keynode) keysnode.appendChild(doc.createTextNode("\n\t\t")) return doc def writesignconf(doc, signconf, prefix=None): if prefix == None: fname = signconf else: fname = os.path.join(os.path.dirname(signconf), prefix + "-" + os.path.basename(signconf)) with open(fname, "w") as f: print(doc.toprettyxml(newl="",indent=""), file=f) def patchsignconf(doc, signconfkeys): for keys in doc.getElementsByTagName('Keys'): for key in keys.getElementsByTagName('Key'): for locator in key.getElementsByTagName('Locator'): keyname = locator.childNodes[0].data if keyname in signconfkeys and 'keydata' in signconfkeys[keyname]: keydata = base64.b64encode(signconfkeys[keyname]['keydata']) # del signconfkeys[keyname] node = doc.createElement("PublicKeyData") node.appendChild(doc.createTextNode(keydata.decode('ascii'))) key.appendChild(doc.createTextNode(" ")) key.appendChild(node) key.appendChild(doc.createTextNode("\n ")) else: keys.removeChild(key) break ''' Main program, In principe this module could be used from another program in which case no action is taken unless a method is explicitly called. ''' if __name__ == "__main__": result = main() if result != 0: sys.exit(result) opendnssec-2.1.13/README.md0000644000077000001440000000222514446272525012150 00000000000000# OpenDNSSEC ## Introduction OpenDNSSEC was created as an open-source turn-key solution for DNSSEC. It secures zone data just before it is published in an authoritative name server. ## More Information More informnation can be found at the project website available at http://www.opendnssec.org/ and on the development WIKI at http://wiki.opendnssec.org/. Information about announcements, bug reporting and mailing lists can be found at http://www.opendnssec.org/support/. ## Dependencies OpenDNSSEC depends on a number of external packages: - libxml2 (including xmllint) - LDNS - SQLite3 To run OpenDNSSEC, one must have at least one crypto module providing a PKCS#11 library, e.g. SoftHSM (http://www.opendnssec.org/softHSM) When building from the source code repository, the following dependencies are also needed: - A Java runtime environment (JRE/JDK) ## Building from the source code respository If the code is downloaded directly from the source code respository (git), you have to prepare the configuration scripts before continuing with build: 1. Install automake, autoconf and libtool. 2. Run the command autogen.sh to build configure scripts etc. opendnssec-2.1.13/config.sub0000755000077000001440000007557114446272532012670 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2020 Free Software Foundation, Inc. timestamp='2020-01-01' # 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 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 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -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.sub ($timestamp) Copyright 1992-2020 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 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 os=$maybe_os ;; android-linux) basic_machine=$field1-unknown os=linux-android ;; *) basic_machine=$field1-$field2 os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 os= ;; *) basic_machine=$field1 os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc os=bsd ;; a29khif) basic_machine=a29k-amd os=udi ;; adobe68k) basic_machine=m68010-adobe os=scout ;; alliant) basic_machine=fx80-alliant os= ;; altos | altos3068) basic_machine=m68k-altos os= ;; am29k) basic_machine=a29k-none os=bsd ;; amdahl) basic_machine=580-amdahl os=sysv ;; amiga) basic_machine=m68k-unknown os= ;; amigaos | amigados) basic_machine=m68k-unknown os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=sysv4 ;; apollo68) basic_machine=m68k-apollo os=sysv ;; apollo68bsd) basic_machine=m68k-apollo os=bsd ;; aros) basic_machine=i386-pc os=aros ;; aux) basic_machine=m68k-apple os=aux ;; balance) basic_machine=ns32k-sequent os=dynix ;; blackfin) basic_machine=bfin-unknown os=linux ;; cegcc) basic_machine=arm-unknown os=cegcc ;; convex-c1) basic_machine=c1-convex os=bsd ;; convex-c2) basic_machine=c2-convex os=bsd ;; convex-c32) basic_machine=c32-convex os=bsd ;; convex-c34) basic_machine=c34-convex os=bsd ;; convex-c38) basic_machine=c38-convex os=bsd ;; cray) basic_machine=j90-cray os=unicos ;; crds | unos) basic_machine=m68k-crds os= ;; da30) basic_machine=m68k-da30 os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec os= ;; delta88) basic_machine=m88k-motorola os=sysv3 ;; dicos) basic_machine=i686-pc os=dicos ;; djgpp) basic_machine=i586-pc os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=ose ;; gmicro) basic_machine=tron-gmicro os=sysv ;; go32) basic_machine=i386-pc os=go32 ;; h8300hms) basic_machine=h8300-hitachi os=hms ;; h8300xray) basic_machine=h8300-hitachi os=xray ;; h8500hms) basic_machine=h8500-hitachi os=hms ;; harris) basic_machine=m88k-harris os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp os=hpux ;; hp300bsd) basic_machine=m68k-hp os=bsd ;; hppaosf) basic_machine=hppa1.1-hp os=osf ;; hppro) basic_machine=hppa1.1-hp os=proelf ;; i386mach) basic_machine=i386-mach os=mach ;; isi68 | isi) basic_machine=m68k-isi os=sysv ;; m68knommu) basic_machine=m68k-unknown os=linux ;; magnum | m3230) basic_machine=mips-mips os=sysv ;; merlin) basic_machine=ns32k-utek os=sysv ;; mingw64) basic_machine=x86_64-pc os=mingw64 ;; mingw32) basic_machine=i686-pc os=mingw32 ;; mingw32ce) basic_machine=arm-unknown os=mingw32ce ;; monitor) basic_machine=m68k-rom68k os=coff ;; morphos) basic_machine=powerpc-unknown os=morphos ;; moxiebox) basic_machine=moxie-unknown os=moxiebox ;; msdos) basic_machine=i386-pc os=msdos ;; msys) basic_machine=i686-pc os=msys ;; mvs) basic_machine=i370-ibm os=mvs ;; nacl) basic_machine=le32-unknown os=nacl ;; ncr3000) basic_machine=i486-ncr os=sysv4 ;; netbsd386) basic_machine=i386-pc os=netbsd ;; netwinder) basic_machine=armv4l-rebel os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=newsos ;; news1000) basic_machine=m68030-sony os=newsos ;; necv70) basic_machine=v70-nec os=sysv ;; nh3000) basic_machine=m68k-harris os=cxux ;; nh[45]000) basic_machine=m88k-harris os=cxux ;; nindy960) basic_machine=i960-intel os=nindy ;; mon960) basic_machine=i960-intel os=mon960 ;; nonstopux) basic_machine=mips-compaq os=nonstopux ;; os400) basic_machine=powerpc-ibm os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=ose ;; os68k) basic_machine=m68k-none os=os68k ;; paragon) basic_machine=i860-intel os=osf ;; parisc) basic_machine=hppa-unknown os=linux ;; pw32) basic_machine=i586-unknown os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=rdos ;; rdos32) basic_machine=i386-pc os=rdos ;; rom68k) basic_machine=m68k-rom68k os=coff ;; sa29200) basic_machine=a29k-amd os=udi ;; sei) basic_machine=mips-sei os=seiux ;; sequent) basic_machine=i386-sequent os= ;; sps7) basic_machine=m68k-bull os=sysv2 ;; st2000) basic_machine=m68k-tandem os= ;; stratus) basic_machine=i860-stratus os=sysv4 ;; sun2) basic_machine=m68000-sun os= ;; sun2os3) basic_machine=m68000-sun os=sunos3 ;; sun2os4) basic_machine=m68000-sun os=sunos4 ;; sun3) basic_machine=m68k-sun os= ;; sun3os3) basic_machine=m68k-sun os=sunos3 ;; sun3os4) basic_machine=m68k-sun os=sunos4 ;; sun4) basic_machine=sparc-sun os= ;; sun4os3) basic_machine=sparc-sun os=sunos3 ;; sun4os4) basic_machine=sparc-sun os=sunos4 ;; sun4sol2) basic_machine=sparc-sun os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun os= ;; sv1) basic_machine=sv1-cray os=unicos ;; symmetry) basic_machine=i386-sequent os=dynix ;; t3e) basic_machine=alphaev5-cray os=unicos ;; t90) basic_machine=t90-cray os=unicos ;; toad1) basic_machine=pdp10-xkl os=tops20 ;; tpf) basic_machine=s390x-ibm os=tpf ;; udi29k) basic_machine=a29k-amd os=udi ;; ultra3) basic_machine=a29k-nyu os=sym1 ;; v810 | necv810) basic_machine=v810-nec os=none ;; vaxv) basic_machine=vax-dec os=sysv ;; vms) basic_machine=vax-dec os=vms ;; vsta) basic_machine=i386-pc os=vsta ;; vxworks960) basic_machine=i960-wrs os=vxworks ;; vxworks68) basic_machine=m68k-wrs os=vxworks ;; vxworks29k) basic_machine=a29k-wrs os=vxworks ;; xbox) basic_machine=i686-pc os=mingw32 ;; ymp) basic_machine=ymp-cray os=unicos ;; *) basic_machine=$1 os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi os=${os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray os=${os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $os in irix*) ;; *) os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony os=newsos ;; next | m*-next) cpu=m68k vendor=next case $os in openstep*) ;; nextstep*) ;; ns2*) os=nextstep2 ;; *) os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde os=${os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) # shellcheck disable=SC2162 IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x$os != x ] then case $os in # First match some system type aliases that might get confused # with valid system types. # solaris* is a basic system type, with this one exception. auroraux) os=auroraux ;; bluegene*) os=cnk ;; solaris1 | solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; solaris) os=solaris2 ;; unixware*) os=sysv4.2uw ;; gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) es1800*) os=ose ;; # Some version numbers need modification chorusos*) os=chorusos ;; isc) os=isc2.2 ;; sco6) os=sco5v6 ;; sco5) os=sco3.2v5 ;; sco4) os=sco3.2v4 ;; sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` ;; sco3.2v[4-9]* | sco5v6*) # Don't forget version if it is 3.2v4 or newer. ;; scout) # Don't match below ;; sco*) os=sco3.2v2 ;; psos*) os=psos ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # sysv* is not here because it comes later, after sysvr4. gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | kopensolaris* | plan9* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* | twizzler* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ | knetbsd* | mirbsd* | netbsd* \ | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \ | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ | chorusrdb* | cegcc* | glidix* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ | linux-newlib* | linux-musl* | linux-uclibc* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \ | interix* | uwin* | mks* | rhapsody* | darwin* \ | openstep* | oskit* | conix* | pw32* | nonstopux* \ | storm-chaos* | tops10* | tenex* | tops20* | its* \ | os2* | vos* | palmos* | uclinux* | nucleus* \ | morphos* | superux* | rtmk* | windiss* \ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | nsk* | powerunix) # Remember, each alternative MUST END IN *, to match a version number. ;; qnx*) case $cpu in x86 | i*86) ;; *) os=nto-$os ;; esac ;; hiux*) os=hiuxwe2 ;; nto-qnx*) ;; nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; sim | xray | os68k* | v88r* \ | windows* | osx | abug | netware* | os9* \ | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) ;; linux-dietlibc) os=linux-dietlibc ;; linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; lynx*178) os=lynxos178 ;; lynx*5) os=lynxos5 ;; lynx*) os=lynxos ;; mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; opened*) os=openedition ;; os400*) os=os400 ;; sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; wince*) os=wince ;; utek*) os=bsd ;; dynix*) os=bsd ;; acis*) os=aos ;; atheos*) os=atheos ;; syllable*) os=syllable ;; 386bsd) os=bsd ;; ctix* | uts*) os=sysv ;; nova*) os=rtmk-nova ;; ns2) os=nextstep2 ;; # Preserve the version number of sinix5. sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; sinix*) os=sysv4 ;; tpf*) os=tpf ;; triton*) os=sysv3 ;; oss*) os=sysv3 ;; svr4*) os=sysv4 ;; svr3) os=sysv3 ;; sysvr4) os=sysv4 ;; # This must come after sysvr4. sysv*) ;; ose*) os=ose ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) os=mint ;; zvmoe) os=zvmoe ;; dicos*) os=dicos ;; pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $cpu in arm*) os=eabi ;; *) os=elf ;; esac ;; nacl*) ;; ios) ;; none) ;; *-eabi) ;; *) echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $cpu-$vendor in score-*) os=elf ;; spu-*) os=elf ;; *-acorn) os=riscix1.2 ;; arm*-rebel) os=linux ;; arm*-semi) os=aout ;; c4x-* | tic4x-*) os=coff ;; c8051-*) os=elf ;; clipper-intergraph) os=clix ;; hexagon-*) os=elf ;; tic54x-*) os=coff ;; tic55x-*) os=coff ;; tic6x-*) os=coff ;; # This must come before the *-dec entry. pdp10-*) os=tops20 ;; pdp11-*) os=none ;; *-dec | vax-*) os=ultrix4.2 ;; m68*-apollo) os=domain ;; i386-sun) os=sunos4.0.2 ;; m68000-sun) os=sunos3 ;; m68*-cisco) os=aout ;; mep-*) os=elf ;; mips*-cisco) os=elf ;; mips*-*) os=elf ;; or32-*) os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=sysv3 ;; sparc-* | *-sun) os=sunos4.1.1 ;; pru-*) os=elf ;; *-be) os=beos ;; *-ibm) os=aix ;; *-knuth) os=mmixware ;; *-wec) os=proelf ;; *-winbond) os=proelf ;; *-oki) os=proelf ;; *-hp) os=hpux ;; *-hitachi) os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=sysv ;; *-cbm) os=amigaos ;; *-dg) os=dgux ;; *-dolphin) os=sysv3 ;; m68k-ccur) os=rtu ;; m88k-omron*) os=luna ;; *-next) os=nextstep ;; *-sequent) os=ptx ;; *-crds) os=unos ;; *-ns) os=genix ;; i370-*) os=mvs ;; *-gould) os=sysv ;; *-highlevel) os=bsd ;; *-encore) os=bsd ;; *-sgi) os=irix ;; *-siemens) os=sysv4 ;; *-masscomp) os=rtu ;; f30[01]-fujitsu | f700-fujitsu) os=uxpv ;; *-rom68k) os=coff ;; *-*bug) os=coff ;; *-apple) os=macos ;; *-atari*) os=mint ;; *-wrs) os=vxworks ;; *) os=none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $os in riscix*) vendor=acorn ;; sunos*) vendor=sun ;; cnk*|-aix*) vendor=ibm ;; beos*) vendor=be ;; hpux*) vendor=hp ;; mpeix*) vendor=hp ;; hiux*) vendor=hitachi ;; unos*) vendor=crds ;; dgux*) vendor=dg ;; luna*) vendor=omron ;; genix*) vendor=ns ;; clix*) vendor=intergraph ;; mvs* | opened*) vendor=ibm ;; os400*) vendor=ibm ;; ptx*) vendor=sequent ;; tpf*) vendor=ibm ;; vxsim* | vxworks* | windiss*) vendor=wrs ;; aux*) vendor=apple ;; hms*) vendor=hitachi ;; mpw* | macos*) vendor=apple ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) vendor=atari ;; vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: opendnssec-2.1.13/libhsm/0000755000077000001440000000000014446272545012230 500000000000000opendnssec-2.1.13/libhsm/checks/0000755000077000001440000000000014446272545013470 500000000000000opendnssec-2.1.13/libhsm/checks/conf-opensc.xml0000644000077000001440000000041314446272544016341 00000000000000 /usr/lib/pkcs11/opensc-pkcs11.so OpenDNSSEC 1234 opendnssec-2.1.13/libhsm/checks/conf-sca6000.xml.in0000644000077000001440000000040714446272525016535 00000000000000 @pkcs11_sca6000_module@ OpenDNSSEC test:1234 opendnssec-2.1.13/libhsm/checks/hsmcheck.c0000644000077000001440000001520014446272525015335 00000000000000/* * 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 "libhsm.h" #include extern char *optarg; char *progname = NULL; extern hsm_repository_t* parse_conf_repositories(const char* cfgfile); static void usage () { fprintf(stderr, "usage: %s [-c config] [-gsdr]\n", progname); } int main (int argc, char *argv[]) { int result; hsm_ctx_t *ctx; libhsm_key_t **keys; libhsm_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_open2(parse_conf_repositories(config), hsm_prompt_pin); if (result != HSM_OK) { char* error = hsm_get_error(NULL); if (error != NULL) { fprintf(stderr,"%s\n", error); free(error); } } fprintf(stdout, "hsm_open result: %d\n", result); /* * Create HSM context */ ctx = hsm_create_context(); 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(ctx,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("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(ctx,keys[i]); id = hsm_get_key_id(ctx, keys[i]); if (id) { printf("Using key ID: %s\n", id); 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"); } libhsm_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(ctx,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(ctx, key); /* res = hsm_remove_key(ctx, key); */ res = hsm_remove_key(ctx, key); printf("Deleted key. Result: %d\n", res); printf("\n"); } 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 */ hsm_destroy_context(ctx); /* * Close HSM library */ hsm_close(); fprintf(stdout, "all done! hsm_close result: %d\n", 0); if (config) free(config); return 0; } opendnssec-2.1.13/libhsm/checks/conf-multi.xml.in0000644000077000001440000000062214446272525016612 00000000000000 @pkcs11_softhsm_module@ softHSM 123456 @pkcs11_softhsm_module@ xyzzy 123456 opendnssec-2.1.13/libhsm/checks/conf-etoken.xml.in0000644000077000001440000000044114446272525016744 00000000000000 @pkcs11_etoken_module@ OpenDNSSEC test.1234 10 opendnssec-2.1.13/libhsm/checks/conf-softhsm.xml0000644000077000001440000000041014446272544016532 00000000000000 /usr/lib/softhsm/libsofthsm.so softHSM 123456 opendnssec-2.1.13/libhsm/checks/conf-opensc.xml.in0000644000077000001440000000040114446272525016742 00000000000000 @pkcs11_opensc_module@ OpenDNSSEC 1234 opendnssec-2.1.13/libhsm/checks/Makefile.in0000644000077000001440000006261114446272532015457 00000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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@ target_triplet = @target@ noinst_PROGRAMS = hsmcheck$(EXEEXT) subdir = libhsm/checks 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_dlopen.m4 \ $(top_srcdir)/m4/acx_enforcer_database.m4 \ $(top_srcdir)/m4/acx_ldns.m4 $(top_srcdir)/m4/acx_libc.m4 \ $(top_srcdir)/m4/acx_libreadline.m4 \ $(top_srcdir)/m4/acx_libxml2.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_ssl.m4 \ $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 \ $(top_srcdir)/m4/ax_lib_sqlite3.m4 \ $(top_srcdir)/m4/ax_prepend_flag.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.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)/m4/pkg.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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) am_hsmcheck_OBJECTS = hsmcheck.$(OBJEXT) confparser.$(OBJEXT) hsmcheck_OBJECTS = $(am_hsmcheck_OBJECTS) hsmcheck_DEPENDENCIES = ../src/lib/libhsm.a $(LIBCOMPAT) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = hsmcheck_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(hsmcheck_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/confparser.Po \ ./$(DEPDIR)/hsmcheck.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(hsmcheck_SOURCES) DIST_SOURCES = $(hsmcheck_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(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 $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CP = @CP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CUNIT_INCLUDES = @CUNIT_INCLUDES@ CUNIT_LIBS = @CUNIT_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ C_LIBS = @C_LIBS@ 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@ ENFORCER_DB_DATABASE = @ENFORCER_DB_DATABASE@ ENFORCER_DB_HOST = @ENFORCER_DB_HOST@ ENFORCER_DB_INCLUDES = @ENFORCER_DB_INCLUDES@ ENFORCER_DB_LIBS = @ENFORCER_DB_LIBS@ ENFORCER_DB_PASSWORD = @ENFORCER_DB_PASSWORD@ ENFORCER_DB_PORT = @ENFORCER_DB_PORT@ ENFORCER_DB_PORT_TEXT = @ENFORCER_DB_PORT_TEXT@ ENFORCER_DB_USERNAME = @ENFORCER_DB_USERNAME@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_SSL = @HAVE_SSL@ HAVE_SSL_NEW_HMAC = @HAVE_SSL_NEW_HMAC@ INSTALL = @INSTALL@ INSTALLATIONCOND = @INSTALLATIONCOND@ INSTALLATIONGROUP = @INSTALLATIONGROUP@ INSTALLATIONGROUPARG = @INSTALLATIONGROUPARG@ INSTALLATIONUSER = @INSTALLATIONUSER@ INSTALLATIONUSERARG = @INSTALLATIONUSERARG@ 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@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MYSQL_CFLAGS = @MYSQL_CFLAGS@ MYSQL_CONFIG = @MYSQL_CONFIG@ MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ MYSQL_VERSION = @MYSQL_VERSION@ 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_ENFORCER_SOCKETFILE = @OPENDNSSEC_ENFORCER_SOCKETFILE@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ READLINE_LIBS = @READLINE_LIBS@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_VERSION = @SQLITE3_VERSION@ SSL_INCLUDES = @SSL_INCLUDES@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ 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_CXX = @ac_ct_CXX@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ 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_srcdir)/common \ -I$(top_builddir)/common \ -I$(srcdir)/../src/lib \ @LDNS_INCLUDES@ @XML2_INCLUDES@ AM_CFLAGS = -std=c99 EXTRA_DIST = *.xml $(srcdir)/softhsm2.conf hsmcheck_SOURCES = hsmcheck.c confparser.c hsmcheck_LDADD = ../src/lib/libhsm.a @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT) hsmcheck_LDFLAGS = -no-install SOFTHSM_ENV = SOFTHSM2_CONF=$(srcdir)/softhsm2.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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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) $(AM_V_CCLD)$(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)/confparser.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hsmcheck.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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 -f ./$(DEPDIR)/confparser.Po -rm -f ./$(DEPDIR)/hsmcheck.Po -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 -f ./$(DEPDIR)/confparser.Po -rm -f ./$(DEPDIR)/hsmcheck.Po -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 TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \ ctags ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile .PHONY: tokens tokens: rm -rf tokens mkdir tokens env $(SOFTHSM_ENV) \ softhsm2-util --slot 0 --init-token --label softHSM \ --so-pin 12345678 --pin 123456 env $(SOFTHSM_ENV) \ softhsm2-util --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 tokens 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 tokens 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-2.1.13/libhsm/checks/conf-ncipher.xml.in0000644000077000001440000000041014446272525017103 00000000000000 @pkcs11_ncipher_module@ OpenDNSSEC 1234567890 opendnssec-2.1.13/libhsm/checks/conf-sca6000.xml0000644000077000001440000000040514446272544016127 00000000000000 /usr/lib/libpkcs11.so OpenDNSSEC test:1234 opendnssec-2.1.13/libhsm/checks/conf-ncipher.xml0000644000077000001440000000043114446272544016502 00000000000000 /opt/nfast/toolkits/pkcs11/libcknfast.so OpenDNSSEC 1234567890 opendnssec-2.1.13/libhsm/checks/conf-softhsm.xml.in0000644000077000001440000000040114446272525017136 00000000000000 @pkcs11_softhsm_module@ softHSM 123456 opendnssec-2.1.13/libhsm/checks/softhsm2.conf0000644000077000001440000000007114446272525016020 00000000000000directories.tokendir = tokens objectstore.backend = file opendnssec-2.1.13/libhsm/checks/conf-aepkeyper.xml0000644000077000001440000000042114446272544017036 00000000000000 /opt/Keyper/PKCS11Provider/pkcs11.so OpenDNSSEC 123456 opendnssec-2.1.13/libhsm/checks/conf-aepkeyper.xml.in0000644000077000001440000000040614446272525017445 00000000000000 @pkcs11_aepkeyper_module@ OpenDNSSEC 123456 opendnssec-2.1.13/libhsm/checks/confparser.c0000644000077000001440000001232414446272525015716 00000000000000/* * 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 "config.h" #include "compat.h" #include "log.h" #include "status.h" #include #include #include #include #include #include "libhsm.h" static const char* parser_str = "parser"; /** * Parse the repositories. * */ hsm_repository_t* parse_conf_repositories(const char* cfgfile) { xmlDocPtr doc = NULL; xmlXPathContextPtr xpathCtx = NULL; xmlXPathObjectPtr xpathObj = NULL; xmlNode* curNode = NULL; xmlChar* xexpr = NULL; int i; char* name; char* module; char* tokenlabel; char* pin; uint8_t use_pubkey; uint8_t allowextract; int require_backup; hsm_repository_t* rlist = NULL; hsm_repository_t* repo = NULL; /* 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/RepositoryList/Repository"; 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 repositories */ if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) { for (i = 0; i < xpathObj->nodesetval->nodeNr; i++) { repo = NULL; name = NULL; module = NULL; tokenlabel = NULL; pin = NULL; use_pubkey = 1; allowextract = 0; require_backup = 0; curNode = xpathObj->nodesetval->nodeTab[i]->xmlChildrenNode; name = (char *) xmlGetProp(xpathObj->nodesetval->nodeTab[i], (const xmlChar *)"name"); while (curNode) { if (xmlStrEqual(curNode->name, (const xmlChar *)"RequireBackup")) require_backup = 1; if (xmlStrEqual(curNode->name, (const xmlChar *)"Module")) module = (char *) xmlNodeGetContent(curNode); if (xmlStrEqual(curNode->name, (const xmlChar *)"TokenLabel")) tokenlabel = (char *) xmlNodeGetContent(curNode); if (xmlStrEqual(curNode->name, (const xmlChar *)"PIN")) pin = (char *) xmlNodeGetContent(curNode); if (xmlStrEqual(curNode->name, (const xmlChar *)"SkipPublicKey")) use_pubkey = 0; if (xmlStrEqual(curNode->name, (const xmlChar *)"AllowExtraction")) allowextract = 1; curNode = curNode->next; } if (name && module && tokenlabel) { repo = hsm_repository_new(name, module, tokenlabel, pin, use_pubkey, allowextract, require_backup); } if (!repo) { ods_log_error("[%s] unable to add %s repository: " "hsm_repository_new() failed", parser_str, name?name:"-"); } else { repo->next = rlist; rlist = repo; ods_log_debug("[%s] added %s repository to repositorylist", parser_str, name); } free((void*)name); free((void*)module); free((void*)tokenlabel); } } xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathCtx); if (doc) { xmlFreeDoc(doc); } return rlist; } opendnssec-2.1.13/libhsm/checks/conf-etoken.xml0000644000077000001440000000045014446272544016340 00000000000000 /usr/local/lib/libeTPkcs11.so OpenDNSSEC test.1234 10 opendnssec-2.1.13/libhsm/checks/conf-multi.xml0000644000077000001440000000064014446272544016206 00000000000000 /usr/lib/softhsm/libsofthsm.so softHSM 123456 /usr/lib/softhsm/libsofthsm.so xyzzy 123456 opendnssec-2.1.13/libhsm/checks/Makefile.am0000644000077000001440000000266514446272525015453 00000000000000.PHONY: tokens MAINTAINERCLEANFILES = $(srcdir)/Makefile.in CLEANFILES = token.db othertoken.db LIBCOMPAT = ${top_builddir}/common/libcompat.a AM_CPPFLAGS = \ -I$(top_srcdir)/common \ -I$(top_builddir)/common \ -I$(srcdir)/../src/lib \ @LDNS_INCLUDES@ @XML2_INCLUDES@ AM_CFLAGS = -std=c99 EXTRA_DIST = *.xml $(srcdir)/softhsm2.conf noinst_PROGRAMS = hsmcheck hsmcheck_SOURCES = hsmcheck.c confparser.c hsmcheck_LDADD = ../src/lib/libhsm.a @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT) hsmcheck_LDFLAGS = -no-install SOFTHSM_ENV = SOFTHSM2_CONF=$(srcdir)/softhsm2.conf tokens: rm -rf tokens mkdir tokens env $(SOFTHSM_ENV) \ softhsm2-util --slot 0 --init-token --label softHSM \ --so-pin 12345678 --pin 123456 env $(SOFTHSM_ENV) \ softhsm2-util --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 tokens 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 tokens env $(SOFTHSM_ENV) \ ./hsmcheck -c conf-multi.xml -gsdr opendnssec-2.1.13/libhsm/Makefile.in0000644000077000001440000005606614446272532014226 00000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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@ target_triplet = @target@ subdir = libhsm 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_dlopen.m4 \ $(top_srcdir)/m4/acx_enforcer_database.m4 \ $(top_srcdir)/m4/acx_ldns.m4 $(top_srcdir)/m4/acx_libc.m4 \ $(top_srcdir)/m4/acx_libreadline.m4 \ $(top_srcdir)/m4/acx_libxml2.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_ssl.m4 \ $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 \ $(top_srcdir)/m4/ax_lib_sqlite3.m4 \ $(top_srcdir)/m4/ax_prepend_flag.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.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)/m4/pkg.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/common/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in 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@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CP = @CP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CUNIT_INCLUDES = @CUNIT_INCLUDES@ CUNIT_LIBS = @CUNIT_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ C_LIBS = @C_LIBS@ 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@ ENFORCER_DB_DATABASE = @ENFORCER_DB_DATABASE@ ENFORCER_DB_HOST = @ENFORCER_DB_HOST@ ENFORCER_DB_INCLUDES = @ENFORCER_DB_INCLUDES@ ENFORCER_DB_LIBS = @ENFORCER_DB_LIBS@ ENFORCER_DB_PASSWORD = @ENFORCER_DB_PASSWORD@ ENFORCER_DB_PORT = @ENFORCER_DB_PORT@ ENFORCER_DB_PORT_TEXT = @ENFORCER_DB_PORT_TEXT@ ENFORCER_DB_USERNAME = @ENFORCER_DB_USERNAME@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_SSL = @HAVE_SSL@ HAVE_SSL_NEW_HMAC = @HAVE_SSL_NEW_HMAC@ INSTALL = @INSTALL@ INSTALLATIONCOND = @INSTALLATIONCOND@ INSTALLATIONGROUP = @INSTALLATIONGROUP@ INSTALLATIONGROUPARG = @INSTALLATIONGROUPARG@ INSTALLATIONUSER = @INSTALLATIONUSER@ INSTALLATIONUSERARG = @INSTALLATIONUSERARG@ 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@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MYSQL_CFLAGS = @MYSQL_CFLAGS@ MYSQL_CONFIG = @MYSQL_CONFIG@ MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ MYSQL_VERSION = @MYSQL_VERSION@ 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_ENFORCER_SOCKETFILE = @OPENDNSSEC_ENFORCER_SOCKETFILE@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ READLINE_LIBS = @READLINE_LIBS@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_VERSION = @SQLITE3_VERSION@ SSL_INCLUDES = @SSL_INCLUDES@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ 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_CXX = @ac_ct_CXX@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ 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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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 \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ 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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am 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-am uninstall uninstall-am .PRECIOUS: Makefile 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-2.1.13/libhsm/src/0000755000077000001440000000000014446272545013017 500000000000000opendnssec-2.1.13/libhsm/src/bin/0000755000077000001440000000000014446272545013567 500000000000000opendnssec-2.1.13/libhsm/src/bin/hsmtest.h0000644000077000001440000000263514446272525015353 00000000000000/* * 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, hsm_ctx_t* ctx); #endif /* HSMTEST_H */ opendnssec-2.1.13/libhsm/src/bin/hsmtest.c0000644000077000001440000002760614446272525015353 00000000000000/* * 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 "libhsm.h" #include #include "hsmtest.h" static int hsm_test_sign (hsm_ctx_t *ctx, libhsm_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) { 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, hsm_ctx_t* ctx) { int result; const unsigned int rsa_keysizes[] = { 512, 768, 1024, 1536, 2048, 4096 }; const unsigned int dsa_keysizes[] = { 512, 768, 1024 }; unsigned int keysize; const ldns_algorithm ec_curves[] = { LDNS_ECDSAP256SHA256, LDNS_ECDSAP384SHA384 }; #if (LDNS_REVISION >= ((1<<16)|(7<<8)|(0))) const ldns_algorithm ed_curves[] = { LDNS_ED25519, LDNS_ED448, }; #endif ldns_algorithm curve; libhsm_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 %u-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"); } libhsm_key_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 %u-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"); } libhsm_key_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"); } libhsm_key_free(key); printf("\n"); } /* * Test key generation, signing and deletion for a number of key size */ for (i=0; i<(sizeof(ec_curves)/sizeof(ldns_algorithm)); i++) { curve = ec_curves[i]; if (curve == LDNS_ECDSAP256SHA256) { printf("Generating ECDSA Curve P-256 key... "); key = hsm_generate_ecdsa_key(ctx, repository, "P-256"); } else if (curve == LDNS_ECDSAP384SHA384) { printf("Generating ECDSA Curve P-384 key... "); key = hsm_generate_ecdsa_key(ctx, repository, "P-384"); } else { printf("Failed: Unknown ECDSA curve\n"); continue; } 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); if (curve == LDNS_ECDSAP256SHA256) { printf("Signing (ECDSA/SHA256) with key... "); } else if (curve == LDNS_ECDSAP384SHA384) { printf("Signing (ECDSA/SHA384) with key... "); } else { printf("Signing with key... "); } } #if (LDNS_REVISION >= ((1<<16)|(7<<8)|(0))) for (i=0; i<(sizeof(ed_curves)/sizeof(ldns_algorithm)); i++) { curve = ed_curves[i]; switch(curve) { case LDNS_ED25519: printf("Generating ED25519 key... "); key = hsm_generate_eddsa_key(ctx, repository, "edwards25519"); break; case LDNS_ED448: printf("Generating ED448 key... "); key = hsm_generate_eddsa_key(ctx, repository, "edwards448"); break; default: continue; } 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 with key... "); result = hsm_test_sign(ctx, key, curve); 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"); } libhsm_key_free(key); printf("\n"); } #endif if (hsm_test_random(ctx)) { errors++; } return errors; } opendnssec-2.1.13/libhsm/src/bin/ods-hsmutil.1.in0000644000077000001440000000526014446272525016447 00000000000000.TH "ods-hsmutil" "1" "February 2010" "OpenDNSSEC" "OpenDNSSEC ods-hsmutil" .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|dsa|gost|ecdsa\fR [\fIkeysize\fR] Generate a new key with the given \fIkeysize\fR in the \fIrepository\fR. Note that GOST has a fixed key size and that ECDSA has two supported curves, P-256 and P-384. In the case of ECDSA, use 256 or 384 as the \fIkeysize\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 \fItype\fR \fIalgo\fR Create a DNSKEY RR for the given owner \fIname\fR based on the key with this \fIid\fR. The \fItype\fR will indicate if it is a KSK (257) or ZSK (256). Please use the numerical value. The \fIalgo\fR, a value from the IANA repository, must match the algorithm of the key. .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\-control(8), ods\-enforcerd(8), ods\-hsmspeed(1), ods\-kaspcheck(1), ods\-signer(8), ods\-signerd(8), ods\-enforcer(8), ods\-timing(5), ods\-kasp(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-2.1.13/libhsm/src/bin/Makefile.in0000644000077000001440000007171214446272532015560 00000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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@ target_triplet = @target@ bin_PROGRAMS = ods-hsmutil$(EXEEXT) ods-hsmspeed$(EXEEXT) subdir = libhsm/src/bin 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_dlopen.m4 \ $(top_srcdir)/m4/acx_enforcer_database.m4 \ $(top_srcdir)/m4/acx_ldns.m4 $(top_srcdir)/m4/acx_libc.m4 \ $(top_srcdir)/m4/acx_libreadline.m4 \ $(top_srcdir)/m4/acx_libxml2.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_ssl.m4 \ $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 \ $(top_srcdir)/m4/ax_lib_sqlite3.m4 \ $(top_srcdir)/m4/ax_prepend_flag.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.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)/m4/pkg.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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) confparser.$(OBJEXT) ods_hsmspeed_OBJECTS = $(am_ods_hsmspeed_OBJECTS) ods_hsmspeed_DEPENDENCIES = ../lib/libhsm.a $(LIBCOMPAT) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_ods_hsmutil_OBJECTS = hsmutil.$(OBJEXT) hsmtest.$(OBJEXT) \ confparser.$(OBJEXT) ods_hsmutil_OBJECTS = $(am_ods_hsmutil_OBJECTS) ods_hsmutil_DEPENDENCIES = ../lib/libhsm.a $(LIBCOMPAT) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/confparser.Po \ ./$(DEPDIR)/hsmspeed.Po ./$(DEPDIR)/hsmtest.Po \ ./$(DEPDIR)/hsmutil.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(ods_hsmspeed_SOURCES) $(ods_hsmutil_SOURCES) DIST_SOURCES = $(ods_hsmspeed_SOURCES) $(ods_hsmutil_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/ods-hsmspeed.1.in \ $(srcdir)/ods-hsmutil.1.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CP = @CP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CUNIT_INCLUDES = @CUNIT_INCLUDES@ CUNIT_LIBS = @CUNIT_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ C_LIBS = @C_LIBS@ 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@ ENFORCER_DB_DATABASE = @ENFORCER_DB_DATABASE@ ENFORCER_DB_HOST = @ENFORCER_DB_HOST@ ENFORCER_DB_INCLUDES = @ENFORCER_DB_INCLUDES@ ENFORCER_DB_LIBS = @ENFORCER_DB_LIBS@ ENFORCER_DB_PASSWORD = @ENFORCER_DB_PASSWORD@ ENFORCER_DB_PORT = @ENFORCER_DB_PORT@ ENFORCER_DB_PORT_TEXT = @ENFORCER_DB_PORT_TEXT@ ENFORCER_DB_USERNAME = @ENFORCER_DB_USERNAME@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_SSL = @HAVE_SSL@ HAVE_SSL_NEW_HMAC = @HAVE_SSL_NEW_HMAC@ INSTALL = @INSTALL@ INSTALLATIONCOND = @INSTALLATIONCOND@ INSTALLATIONGROUP = @INSTALLATIONGROUP@ INSTALLATIONGROUPARG = @INSTALLATIONGROUPARG@ INSTALLATIONUSER = @INSTALLATIONUSER@ INSTALLATIONUSERARG = @INSTALLATIONUSERARG@ 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@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MYSQL_CFLAGS = @MYSQL_CFLAGS@ MYSQL_CONFIG = @MYSQL_CONFIG@ MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ MYSQL_VERSION = @MYSQL_VERSION@ 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_ENFORCER_SOCKETFILE = @OPENDNSSEC_ENFORCER_SOCKETFILE@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ READLINE_LIBS = @READLINE_LIBS@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_VERSION = @SQLITE3_VERSION@ SSL_INCLUDES = @SSL_INCLUDES@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ 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_CXX = @ac_ct_CXX@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ 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 confparser.c ods_hsmutil_LDADD = ../lib/libhsm.a @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT) ods_hsmspeed_SOURCES = hsmspeed.c confparser.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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ 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) $(AM_V_CCLD)$(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) $(AM_V_CCLD)$(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)/confparser.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hsmspeed.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hsmtest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hsmutil.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man1: $(man1_MANS) @$(NORMAL_INSTALL) @list1='$(man1_MANS)'; \ list2=''; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | 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: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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) $(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 -f ./$(DEPDIR)/confparser.Po -rm -f ./$(DEPDIR)/hsmspeed.Po -rm -f ./$(DEPDIR)/hsmtest.Po -rm -f ./$(DEPDIR)/hsmutil.Po -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 -f ./$(DEPDIR)/confparser.Po -rm -f ./$(DEPDIR)/hsmspeed.Po -rm -f ./$(DEPDIR)/hsmtest.Po -rm -f ./$(DEPDIR)/hsmutil.Po -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 TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am 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 tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 .PRECIOUS: Makefile # 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-2.1.13/libhsm/src/bin/hsmspeed.c0000644000077000001440000002013114446272525015456 00000000000000/* * 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 "libhsm.h" #include extern hsm_repository_t* parse_conf_repositories(const char* cfgfile); #define HSMSPEED_THREADS_MAX 2048 /* Algorithm identifier and name */ ldns_algorithm algorithm = LDNS_RSASHA1; const char *algoname = "RSA/SHA1"; char *progname = NULL; typedef struct { unsigned int id; hsm_ctx_t *ctx; libhsm_key_t *key; unsigned int iterations; } sign_arg_t; static void usage () { fprintf(stderr, "usage: %s " "[-c config] -r repository [-i iterations] [-s keysize] [-t threads]\n", progname); } static void * sign (void *arg) { hsm_ctx_t *ctx = NULL; libhsm_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); return NULL; } int main (int argc, char *argv[]) { int result; hsm_ctx_t *ctx = NULL; libhsm_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[HSMSPEED_THREADS_MAX]; pthread_t thread_array[HSMSPEED_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 (threads > HSMSPEED_THREADS_MAX) { fprintf(stderr, "Number of threads specified over max, force using %d threads!\n", HSMSPEED_THREADS_MAX); threads = HSMSPEED_THREADS_MAX; } #if 0 if (!config) { usage(); exit(1); } #endif /* Open HSM library */ fprintf(stderr, "Opening HSM Library...\n"); result = hsm_open2(parse_conf_repositories(config?config:HSM_DEFAULT_CONFIG), hsm_prompt_pin); if (result != HSM_OK) { char* error = hsm_get_error(NULL); if (error != NULL) { fprintf(stderr,"%s\n", error); free(error); } 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-2.1.13/libhsm/src/bin/hsmutil.c0000644000077000001440000004543714446272525015353 00000000000000/* * 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 "libhsm.h" #include "hsmtest.h" #include extern hsm_repository_t* parse_conf_repositories(const char* cfgfile); extern char *optarg; char *progname = NULL; unsigned int verbose = 0; hsm_ctx_t *ctx = NULL; static void version () { fprintf(stderr, "%s (%s) version %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION); } static void usage () { fprintf(stderr, "usage: %s [-c config] [-vVfh] [command [options]]\n", progname); fprintf(stderr," -h Print this usage information.\n"); fprintf(stderr," -v Increase verbosity.\n"); fprintf(stderr," -V Print version and exit.\n"); fprintf(stderr," -f Force, Assume yes on all questions.\n"); fprintf(stderr," -c Use alternative conf.xml.\n"); fprintf(stderr,"commands\n"); fprintf(stderr," login\n"); fprintf(stderr," logout\n"); fprintf(stderr," list [repository]\n"); fprintf(stderr," generate rsa|dsa|gost|ecdsa [keysize]\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 } static int cmd_login () { printf("The tokens are now logged in.\n"); return 0; } static 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; } #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" static int cmd_list (int argc, char *argv[]) { size_t i; char *repository = NULL; size_t key_count = 0; size_t key_count_valid = 0; libhsm_key_t **keys; const char *key_info_format = "%-20s %-32s %-10s\n"; ctx = hsm_create_context(); if (argc) { repository = 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(ctx, &key_count, repository); } else { fprintf(stdout, "\nListing keys in all repositories.\n"); keys = hsm_list_keys(ctx, &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++) { libhsm_key_info_t *key_info; libhsm_key_t *key = NULL; char key_type[HSM_MAX_ALGONAME + 8]; char const * key_id = NULL; key = keys[i]; if (key == NULL) { /* Skip NULL key for now */ continue; } key_count_valid++; key_info = hsm_get_key_info(ctx, 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->modulename, key_id, key_type); libhsm_key_info_free(key_info); } libhsm_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; } #pragma GCC diagnostic pop static int cmd_generate (int argc, char *argv[]) { const char *repository = NULL; const char *algorithm = NULL; unsigned int keysize = 1024; libhsm_key_t *key = NULL; if (argc < 2 || argc > 3) { usage(); return -1; } repository = argv[0]; /* Check for repository before starting using it */ if (hsm_token_attached(ctx, repository) == 0) { hsm_print_error(ctx); return 1; } algorithm = argv[1]; if (argc == 3) { 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(ctx, repository, keysize); } else if (!strcasecmp(algorithm, "dsa")) { printf("Generating %d bit DSA key in repository: %s\n", keysize, repository); key = hsm_generate_dsa_key(ctx, repository, keysize); } else if (!strcasecmp(algorithm, "gost")) { printf("Generating 512 bit GOST key in repository: %s\n", repository); key = hsm_generate_gost_key(ctx, repository); } else if (!strcasecmp(algorithm, "ecdsa")) { if (keysize == 256) { printf("Generating a P-256 ECDSA key in repository: %s\n", repository); key = hsm_generate_ecdsa_key(ctx, repository, "P-256"); } else if (keysize == 384) { printf("Generating a P-384 ECDSA key in repository: %s\n", repository); key = hsm_generate_ecdsa_key(ctx, repository, "P-384"); } else { printf("Invalid ECDSA key size: %d\n", keysize); printf("Expecting 256 or 384.\n"); return -1; } } else { printf("Unknown algorithm: %s\n", algorithm); return -1; } if (key) { libhsm_key_info_t *key_info; key_info = hsm_get_key_info(ctx, key); printf("Key generation successful: %s\n", key_info ? key_info->id : "NULL"); libhsm_key_info_free(key_info); if (verbose) hsm_print_key(ctx, key); libhsm_key_free(key); } else { printf("Key generation failed.\n"); return -1; } return 0; } static int cmd_remove (int argc, char *argv[]) { char *id; int result; libhsm_key_t *key = NULL; if (argc != 1) { usage(); return -1; } id = argv[0]; key = hsm_find_key_by_id(ctx, id); if (!key) { printf("Key not found: %s\n", id); return -1; } result = hsm_remove_key(ctx, key); if (!result) { printf("Key remove successful.\n"); } else { printf("Key remove failed.\n"); } libhsm_key_free(key); return result; } static int cmd_purge (int argc, char *argv[], int force) { int result; int final_result = 0; char *fresult; size_t i; char *repository = NULL; char confirm[16]; size_t key_count = 0; libhsm_key_t **keys; if (argc != 1) { usage(); return -1; } repository = 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(ctx, &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) { libhsm_key_list_free(keys, key_count); return -1; } if (!force) { 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"); libhsm_key_list_free(keys, key_count); return -1; } } printf("\nStarting purge...\n"); for (i = 0; i < key_count; i++) { libhsm_key_info_t *key_info; libhsm_key_t *key = keys[i]; key_info = hsm_get_key_info(ctx, key); result = hsm_remove_key(ctx, 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++; } libhsm_key_info_free(key_info); } libhsm_key_list_free(keys, key_count); printf("Purge done.\n"); return final_result; } static int cmd_dnskey (int argc, char *argv[]) { char *id; char *name; int type; int algo; libhsm_key_t *key = NULL; ldns_rr *dnskey_rr; hsm_sign_params_t *sign_params; if (argc != 4) { usage(); return -1; } id = strdup(argv[0]); name = strdup(argv[1]); type = atoi(argv[2]); algo = atoi(argv[3]); key = hsm_find_key_by_id(ctx, id); if (!key) { printf("Key not found: %s\n", id); free(name); free(id); return -1; } if (type != LDNS_KEY_ZONE_KEY && type != LDNS_KEY_ZONE_KEY + LDNS_KEY_SEP_KEY) { printf("Invalid key type: %i\n", type); printf("Please use: %i or %i\n", LDNS_KEY_ZONE_KEY, LDNS_KEY_ZONE_KEY + LDNS_KEY_SEP_KEY); free(name); free(id); free(key); return -1; } libhsm_key_info_t *key_info = hsm_get_key_info(ctx, key); switch (algo) { case LDNS_SIGN_RSAMD5: case LDNS_SIGN_RSASHA1: case LDNS_SIGN_RSASHA1_NSEC3: case LDNS_SIGN_RSASHA256: case LDNS_SIGN_RSASHA512: if (strcmp(key_info->algorithm_name, "RSA") != 0) { printf("Not an RSA key, the key is of algorithm %s.\n", key_info->algorithm_name); libhsm_key_info_free(key_info); free(key); free(name); free(id); return -1; } break; case LDNS_SIGN_DSA: case LDNS_SIGN_DSA_NSEC3: if (strcmp(key_info->algorithm_name, "DSA") != 0) { printf("Not a DSA key, the key is of algorithm %s.\n", key_info->algorithm_name); libhsm_key_info_free(key_info); free(key); free(name); free(id); return -1; } break; case LDNS_SIGN_ECC_GOST: if (strcmp(key_info->algorithm_name, "GOST") != 0) { printf("Not a GOST key, the key is of algorithm %s.\n", key_info->algorithm_name); libhsm_key_info_free(key_info); free(key); free(name); free(id); return -1; } break; case LDNS_SIGN_ECDSAP256SHA256: if (strcmp(key_info->algorithm_name, "ECDSA") != 0) { printf("Not an ECDSA key, the key is of algorithm %s.\n", key_info->algorithm_name); libhsm_key_info_free(key_info); free(key); free(name); free(id); return -1; } if (key_info->keysize != 256) { printf("The key is a ECDSA/%lu, expecting ECDSA/256 for this algorithm.\n", key_info->keysize); libhsm_key_info_free(key_info); free(key); free(name); free(id); return -1; } break; case LDNS_SIGN_ECDSAP384SHA384: if (strcmp(key_info->algorithm_name, "ECDSA") != 0) { printf("Not an ECDSA key, the key is of algorithm %s.\n", key_info->algorithm_name); libhsm_key_info_free(key_info); free(key); free(name); free(id); return -1; } if (key_info->keysize != 384) { printf("The key is a ECDSA/%lu, expecting ECDSA/384 for this algorithm.\n", key_info->keysize); libhsm_key_info_free(key_info); free(key); free(name); free(id); return -1; } break; #if (LDNS_REVISION >= ((1<<16)|(7<<8)|(0))) case LDNS_SIGN_ED25519: if (strcmp(key_info->algorithm_name, "EDDSA") != 0) { printf("Not an EDDSA key, the key is of algorithm %s.\n", key_info->algorithm_name); libhsm_key_info_free(key_info); free(key); free(name); free(id); return -1; } if (key_info->keysize != 255) { printf("The key is EDDSA/%lu, expecting EDDSA/255 for this algorithm.\n", key_info->keysize); libhsm_key_info_free(key_info); free(key); free(name); free(id); return -1; } break; case LDNS_SIGN_ED448: if (strcmp(key_info->algorithm_name, "EDDSA") != 0) { printf("Not an EDDSA key, the key is of algorithm %s.\n", key_info->algorithm_name); libhsm_key_info_free(key_info); free(key); free(name); free(id); return -1; } if (key_info->keysize != 448) { printf("The key is EDDSA/%lu, expecting EDDSA/448 for this algorithm.\n", key_info->keysize); libhsm_key_info_free(key_info); free(key); free(name); free(id); return -1; } break; #endif default: printf("Invalid algorithm: %i\n", algo); libhsm_key_info_free(key_info); free(key); free(name); free(id); return -1; } libhsm_key_info_free(key_info); sign_params = hsm_sign_params_new(); sign_params->algorithm = algo; sign_params->flags = type; sign_params->owner = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, name); dnskey_rr = hsm_get_dnskey(ctx, 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); libhsm_key_free(key); free(name); free(id); return 0; } static int cmd_test (int argc, char *argv[], hsm_ctx_t* ctx) { char *repository = NULL; if (argc) { repository = strdup(argv[0]); argc--; argv++; printf("Testing repository: %s\n\n", repository); int rv = hsm_test(repository, ctx); if (repository) free(repository); return rv; } else { usage(); } return 0; } static int cmd_info (hsm_ctx_t* ctx) { hsm_print_tokeninfo(ctx); return 0; } static int cmd_debug (hsm_ctx_t* ctx) { hsm_print_ctx(ctx); return 0; } int main (int argc, char *argv[]) { int result; char *config = NULL; int ch; int force = 0; progname = argv[0]; while ((ch = getopt(argc, argv, "c:vVhf")) != -1) { switch (ch) { case 'c': config = strdup(optarg); break; case 'f': force = 1; 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_open2(parse_conf_repositories(config?config:HSM_DEFAULT_CONFIG), hsm_prompt_pin); if (result != HSM_OK) { char* error = hsm_get_error(NULL); if (error != NULL) { fprintf(stderr,"%s\n", error); free(error); } exit(-1); } ctx = hsm_create_context(); 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, force); } 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, ctx); } else if (!strcasecmp(argv[0], "info")) { argc --; argv ++; result = cmd_info(ctx); } else if (!strcasecmp(argv[0], "debug")) { argc --; argv ++; result = cmd_debug(ctx); } else { usage(); result = -1; } hsm_destroy_context(ctx); hsm_close(); if (config) free(config); closelog(); exit(result); } opendnssec-2.1.13/libhsm/src/bin/confparser.c0000644000077000001440000001232414446272525016015 00000000000000/* * 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 "config.h" #include "compat.h" #include "log.h" #include "status.h" #include #include #include #include #include #include "libhsm.h" static const char* parser_str = "parser"; /** * Parse the repositories. * */ hsm_repository_t* parse_conf_repositories(const char* cfgfile) { xmlDocPtr doc = NULL; xmlXPathContextPtr xpathCtx = NULL; xmlXPathObjectPtr xpathObj = NULL; xmlNode* curNode = NULL; xmlChar* xexpr = NULL; int i; char* name; char* module; char* tokenlabel; char* pin; uint8_t use_pubkey; uint8_t allowextract; int require_backup; hsm_repository_t* rlist = NULL; hsm_repository_t* repo = NULL; /* 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/RepositoryList/Repository"; 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 repositories */ if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) { for (i = 0; i < xpathObj->nodesetval->nodeNr; i++) { repo = NULL; name = NULL; module = NULL; tokenlabel = NULL; pin = NULL; use_pubkey = 1; allowextract = 0; require_backup = 0; curNode = xpathObj->nodesetval->nodeTab[i]->xmlChildrenNode; name = (char *) xmlGetProp(xpathObj->nodesetval->nodeTab[i], (const xmlChar *)"name"); while (curNode) { if (xmlStrEqual(curNode->name, (const xmlChar *)"RequireBackup")) require_backup = 1; if (xmlStrEqual(curNode->name, (const xmlChar *)"Module")) module = (char *) xmlNodeGetContent(curNode); if (xmlStrEqual(curNode->name, (const xmlChar *)"TokenLabel")) tokenlabel = (char *) xmlNodeGetContent(curNode); if (xmlStrEqual(curNode->name, (const xmlChar *)"PIN")) pin = (char *) xmlNodeGetContent(curNode); if (xmlStrEqual(curNode->name, (const xmlChar *)"SkipPublicKey")) use_pubkey = 0; if (xmlStrEqual(curNode->name, (const xmlChar *)"AllowExtraction")) allowextract = 1; curNode = curNode->next; } if (name && module && tokenlabel) { repo = hsm_repository_new(name, module, tokenlabel, pin, use_pubkey, allowextract, require_backup); } if (!repo) { ods_log_error("[%s] unable to add %s repository: " "hsm_repository_new() failed", parser_str, name?name:"-"); } else { repo->next = rlist; rlist = repo; ods_log_debug("[%s] added %s repository to repositorylist", parser_str, name); } free((void*)name); free((void*)module); free((void*)tokenlabel); } } xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathCtx); if (doc) { xmlFreeDoc(doc); } return rlist; } opendnssec-2.1.13/libhsm/src/bin/ods-hsmspeed.1.in0000644000077000001440000000357414446272525016600 00000000000000.TH "ods-hsmspeed" "1" "February 2010" "OpenDNSSEC" "OpenDNSSEC ods-hsmspeed" .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\-control(8), ods\-enforcerd(8), ods\-enforcer(8), ods\-hsmutil(1), ods\-kaspcheck(1), ods\-signer(8), ods\-signerd(8), ods\-timing(5), ods\-kasp(5), ods\-hsmspeed(1), 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-2.1.13/libhsm/src/bin/Makefile.am0000644000077000001440000000112714446272525015542 00000000000000MAINTAINERCLEANFILES = $(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 confparser.c ods_hsmutil_LDADD = ../lib/libhsm.a @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT) ods_hsmspeed_SOURCES = hsmspeed.c confparser.c ods_hsmspeed_LDADD = ../lib/libhsm.a -lpthread @LDNS_LIBS@ @XML2_LIBS@ $(LIBCOMPAT) opendnssec-2.1.13/libhsm/src/Makefile.in0000644000077000001440000005552614446272532015015 00000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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@ target_triplet = @target@ subdir = libhsm/src 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_dlopen.m4 \ $(top_srcdir)/m4/acx_enforcer_database.m4 \ $(top_srcdir)/m4/acx_ldns.m4 $(top_srcdir)/m4/acx_libc.m4 \ $(top_srcdir)/m4/acx_libreadline.m4 \ $(top_srcdir)/m4/acx_libxml2.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_ssl.m4 \ $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 \ $(top_srcdir)/m4/ax_lib_sqlite3.m4 \ $(top_srcdir)/m4/ax_prepend_flag.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.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)/m4/pkg.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/common/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in 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@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CP = @CP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CUNIT_INCLUDES = @CUNIT_INCLUDES@ CUNIT_LIBS = @CUNIT_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ C_LIBS = @C_LIBS@ 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@ ENFORCER_DB_DATABASE = @ENFORCER_DB_DATABASE@ ENFORCER_DB_HOST = @ENFORCER_DB_HOST@ ENFORCER_DB_INCLUDES = @ENFORCER_DB_INCLUDES@ ENFORCER_DB_LIBS = @ENFORCER_DB_LIBS@ ENFORCER_DB_PASSWORD = @ENFORCER_DB_PASSWORD@ ENFORCER_DB_PORT = @ENFORCER_DB_PORT@ ENFORCER_DB_PORT_TEXT = @ENFORCER_DB_PORT_TEXT@ ENFORCER_DB_USERNAME = @ENFORCER_DB_USERNAME@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_SSL = @HAVE_SSL@ HAVE_SSL_NEW_HMAC = @HAVE_SSL_NEW_HMAC@ INSTALL = @INSTALL@ INSTALLATIONCOND = @INSTALLATIONCOND@ INSTALLATIONGROUP = @INSTALLATIONGROUP@ INSTALLATIONGROUPARG = @INSTALLATIONGROUPARG@ INSTALLATIONUSER = @INSTALLATIONUSER@ INSTALLATIONUSERARG = @INSTALLATIONUSERARG@ 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@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MYSQL_CFLAGS = @MYSQL_CFLAGS@ MYSQL_CONFIG = @MYSQL_CONFIG@ MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ MYSQL_VERSION = @MYSQL_VERSION@ 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_ENFORCER_SOCKETFILE = @OPENDNSSEC_ENFORCER_SOCKETFILE@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ READLINE_LIBS = @READLINE_LIBS@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_VERSION = @SQLITE3_VERSION@ SSL_INCLUDES = @SSL_INCLUDES@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ 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_CXX = @ac_ct_CXX@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ 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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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 \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ 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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am 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-am uninstall uninstall-am .PRECIOUS: Makefile # 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-2.1.13/libhsm/src/lib/0000755000077000001440000000000014446272545013565 500000000000000opendnssec-2.1.13/libhsm/src/lib/pin.c0000644000077000001440000003204714446272525014443 00000000000000/* * 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]; static 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; } static 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; } static 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; } static 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; } static 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 ((size_t)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 { arg.val = 0; /* 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-2.1.13/libhsm/src/lib/cryptoki_compat/0000755000077000001440000000000014446272545016774 500000000000000opendnssec-2.1.13/libhsm/src/lib/cryptoki_compat/pkcs11.h0000644000077000001440000012420014446272525020164 00000000000000/* 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_EC_EDWARDS (0x40) #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_GOSTR3411PARAMS (0x251) /* 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_EC_EDWARDS_KEY_PAIR_GEN (0x1055) #define CKM_EDDSA (0x1057) #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 #if defined(__cplusplus) } #endif /* For NULL. */ #include #if defined(__cplusplus) extern "C" { #endif 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-2.1.13/libhsm/src/lib/libhsmdns.h0000644000077000001440000000662714446272525015652 00000000000000/* * 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 */ extern hsm_sign_params_t * hsm_sign_params_new(void); /*! 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 */ extern 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 */ extern ldns_rr* hsm_sign_rrset(hsm_ctx_t *ctx, const ldns_rr_list* rrset, const libhsm_key_t *key, const hsm_sign_params_t *sign_params); /*! 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* */ extern ldns_rr* hsm_get_dnskey(hsm_ctx_t *ctx, const libhsm_key_t *key, const hsm_sign_params_t *sign_params); /** * Calculate keytag * @param loc: Locator of keydata on HSM * @param alg: Algorithm of key * @param sep: 0 for zsk, positive int for ksk|csk (DNSKEY Secure Entry Point) * @param[out] keytag: the calculated keytag * return: non-zero in case of failure */ extern int hsm_keytag(const char* loc, int alg, int sep, uint16_t* keytag); #endif /* HSMDNS_H */ opendnssec-2.1.13/libhsm/src/lib/Makefile.in0000644000077000001440000005527514446272532015564 00000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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@ target_triplet = @target@ subdir = libhsm/src/lib 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_dlopen.m4 \ $(top_srcdir)/m4/acx_enforcer_database.m4 \ $(top_srcdir)/m4/acx_ldns.m4 $(top_srcdir)/m4/acx_libc.m4 \ $(top_srcdir)/m4/acx_libreadline.m4 \ $(top_srcdir)/m4/acx_libxml2.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_ssl.m4 \ $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 \ $(top_srcdir)/m4/ax_lib_sqlite3.m4 \ $(top_srcdir)/m4/ax_prepend_flag.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.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)/m4/pkg.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/common/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libhsm_a_AR = $(AR) $(ARFLAGS) libhsm_a_LIBADD = am_libhsm_a_OBJECTS = libhsm.$(OBJEXT) pin.$(OBJEXT) libhsm_a_OBJECTS = $(am_libhsm_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/libhsm.Po ./$(DEPDIR)/pin.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libhsm_a_SOURCES) DIST_SOURCES = $(libhsm_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CP = @CP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CUNIT_INCLUDES = @CUNIT_INCLUDES@ CUNIT_LIBS = @CUNIT_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ C_LIBS = @C_LIBS@ 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@ ENFORCER_DB_DATABASE = @ENFORCER_DB_DATABASE@ ENFORCER_DB_HOST = @ENFORCER_DB_HOST@ ENFORCER_DB_INCLUDES = @ENFORCER_DB_INCLUDES@ ENFORCER_DB_LIBS = @ENFORCER_DB_LIBS@ ENFORCER_DB_PASSWORD = @ENFORCER_DB_PASSWORD@ ENFORCER_DB_PORT = @ENFORCER_DB_PORT@ ENFORCER_DB_PORT_TEXT = @ENFORCER_DB_PORT_TEXT@ ENFORCER_DB_USERNAME = @ENFORCER_DB_USERNAME@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_SSL = @HAVE_SSL@ HAVE_SSL_NEW_HMAC = @HAVE_SSL_NEW_HMAC@ INSTALL = @INSTALL@ INSTALLATIONCOND = @INSTALLATIONCOND@ INSTALLATIONGROUP = @INSTALLATIONGROUP@ INSTALLATIONGROUPARG = @INSTALLATIONGROUPARG@ INSTALLATIONUSER = @INSTALLATIONUSER@ INSTALLATIONUSERARG = @INSTALLATIONUSERARG@ 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@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MYSQL_CFLAGS = @MYSQL_CFLAGS@ MYSQL_CONFIG = @MYSQL_CONFIG@ MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ MYSQL_VERSION = @MYSQL_VERSION@ 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_ENFORCER_SOCKETFILE = @OPENDNSSEC_ENFORCER_SOCKETFILE@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ READLINE_LIBS = @READLINE_LIBS@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_VERSION = @SQLITE3_VERSION@ SSL_INCLUDES = @SSL_INCLUDES@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ 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_CXX = @ac_ct_CXX@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ 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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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) $(AM_V_at)-rm -f libhsm.a $(AM_V_AR)$(libhsm_a_AR) libhsm.a $(libhsm_a_OBJECTS) $(libhsm_a_LIBADD) $(AM_V_at)$(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@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pin.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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 -f ./$(DEPDIR)/libhsm.Po -rm -f ./$(DEPDIR)/pin.Po -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 -f ./$(DEPDIR)/libhsm.Po -rm -f ./$(DEPDIR)/pin.Po -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 TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLIBRARIES \ cscopelist-am ctags ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile # 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-2.1.13/libhsm/src/lib/libhsm.h0000644000077000001440000004267414446272525015147 00000000000000/* * 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 #include #include #define HSM_MAX_SESSIONS 100 /* * 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 */ unsigned int allow_extract; /*!< Generate CKA_EXTRACTABLE private keys */ } 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 { char *modulename; /*!< name of the module, as in hsm_session_t.module.name */ unsigned long private_key; /*!< private key within module */ unsigned long public_key; /*!< public key within module */ } libhsm_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 */ } libhsm_key_info_t; /*! HSM Repositories */ typedef struct hsm_repository_struct hsm_repository_t; struct hsm_repository_struct { hsm_repository_t* next; /*!< next repository > */ char *name; /*!< name */ char *module; /*!< PKCS#11 module */ char *tokenlabel; /*!< PKCS#11 token label */ char *pin; /*!< PKCS#11 login credentials */ uint8_t require_backup; /*!< require a backup of keys before using new keys */ uint8_t use_pubkey; /*!< use public keys in repository? */ unsigned int allow_extract; /*!< Generate CKA_EXTRACTABLE private keys */ }; /*! 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]; ldns_rbtree_t* keycache; pthread_mutex_t *keycache_lock; } hsm_ctx_t; /*! 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 */ extern void hsm_ctx_set_error(hsm_ctx_t *ctx, int error, const char *action, const char *message, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 4, 5))) #endif ; /*! Open HSM library \param rlist Repository list. \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 HSMs in the repository list, 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. */ extern int hsm_open2(hsm_repository_t* rlist, char *(pin_callback)(unsigned int, const char *, unsigned int)); /*! Create new repository as specified in conf.xml. \param name Repository name. \param module PKCS#11 module. \param tokenlabel PKCS#11 token label. \param pin PKCS#11 login credentials. \param use_pubkey Whether to store the public key in the HSM. \return The created repository. */ hsm_repository_t * hsm_repository_new(char* name, char* module, char* tokenlabel, char* pin, uint8_t use_pubkey, uint8_t allowextract, uint8_t require_backup); /*! Free configured repositories. \param r Repository list. */ void hsm_repository_free(hsm_repository_t* r); /*! 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 */ extern 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 */ extern 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. */ extern int hsm_logout_pin(void); /*! 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. */ extern void hsm_close(void); /*! Create new HSM context Creates a new session for each attached HSM. The returned hsm_ctx_t * can be freed with hsm_destroy_context() */ extern 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 */ extern int hsm_check_context(); /*! Destroy HSM context \param context HSM context Also destroys any associated sessions. */ extern void hsm_destroy_context(hsm_ctx_t *context); extern void libhsm_key_free(libhsm_key_t *key); /*! 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 libhsm_key_list_free() Alternatively, each individual key structure in the list could be freed with libhsm_key_free() \param context HSM context \param count location to store the number of keys found */ extern libhsm_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 libhsm_key_list_free() Alternatively, each individual key structure in the list could be freed with libhsm_key_free() \param context HSM context \param count location to store the number of keys found \param repository repository to list the keys in */ extern libhsm_key_t ** hsm_list_keys_repository(hsm_ctx_t *context, size_t *count, const char *repository); /*! Find a key pair by CKA_ID (as hex string) The returned key structure can be freed with libhsm_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) */ extern libhsm_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 libhsm_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 */ extern libhsm_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 libhsm_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 */ extern libhsm_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 libhsm_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 */ extern libhsm_key_t * hsm_generate_gost_key(hsm_ctx_t *context, const char *repository); /*! 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 libhsm_key_free() \param context HSM context \param repository repository in where to create the key \param curve which curve to use \return return key identifier or NULL if key generation failed */ extern libhsm_key_t * hsm_generate_ecdsa_key(hsm_ctx_t *context, const char *repository, const char *curve); /*! 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 libhsm_key_free() \param context HSM context \param repository repository in where to create the key \param curve which curve to use \return return key identifier or NULL if key generation failed */ libhsm_key_t * hsm_generate_eddsa_key(hsm_ctx_t *context, const char *repository, const char *curve); /*! 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 */ extern int hsm_remove_key(hsm_ctx_t *context, libhsm_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 */ extern void libhsm_key_list_free(libhsm_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 */ extern char * hsm_get_key_id(hsm_ctx_t *context, const libhsm_key_t *key); /*! Get extended key information The returned id is allocated data, and must be freed by the caller With libhsm_key_info_free() \param context HSM context \param key Key pair to get information about \return key information */ extern libhsm_key_info_t * hsm_get_key_info(hsm_ctx_t *context, const libhsm_key_t *key); /*! Frees the libhsm_key_info_t structure \param key_info The structure to free */ extern void libhsm_key_info_free(libhsm_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 */ extern 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 */ extern 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 */ extern 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 */ extern int hsm_attach(const char *repository, const char *token_name, const char *path, const char *pin, const hsm_config_t *config); /*! 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 */ extern 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 */ extern char * hsm_get_error(hsm_ctx_t *gctx); /* a few debug functions for applications */ extern void hsm_print_session(hsm_session_t *session); extern void hsm_print_ctx(hsm_ctx_t *ctx); extern void hsm_print_key(hsm_ctx_t *ctx, libhsm_key_t *key); extern void hsm_print_error(hsm_ctx_t *ctx); extern void hsm_print_tokeninfo(hsm_ctx_t *ctx); /* implementation of a key cache per context, needs changing see * OPENDNSSEC-799. */ extern void keycache_create(hsm_ctx_t* ctx); extern void keycache_destroy(hsm_ctx_t* ctx); extern const libhsm_key_t* keycache_lookup(hsm_ctx_t* ctx, const char* locator); #endif /* HSM_H */ opendnssec-2.1.13/libhsm/src/lib/libhsm.c0000644000077000001440000033554114446272525015140 00000000000000/* * 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 #include #include "libhsm.h" #include "libhsmdns.h" #include "compat.h" #include "duration.h" #include "status.h" #include "utilities.h" #include #include /*! Fixed length from PKCS#11 specification */ #define HSM_TOKEN_LABEL_LENGTH 32 /*! Global (initial) context, with mutex to serialize access to it */ hsm_ctx_t *_hsm_ctx; pthread_mutex_t _hsm_ctx_mutex = PTHREAD_MUTEX_INITIALIZER; /*! General PKCS11 helper functions */ static char const * 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"; /*CKR_VENDOR_DEFINED is not a constant but a macro which expands in to an */ /*expression. Which we are not allowed to use in a switch.*/ /*case CKR_VENDOR_DEFINED:*/ case 0x80000000: 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"; } } 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) { if (handle) { #if defined(HAVE_LOADLIBRARY) /* no idea */ #elif defined(HAVE_DLOPEN) (void) 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) functioncast(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; } hsm_repository_t * hsm_repository_new(char* name, char* module, char* tokenlabel, char* pin, uint8_t use_pubkey, uint8_t allowextract, uint8_t require_backup) { hsm_repository_t* r; if (!name || !module || !tokenlabel) return NULL; r = malloc(sizeof(hsm_repository_t)); if (!r) return NULL; r->next = NULL; r->pin = NULL; r->name = strdup(name); r->module = strdup(module); r->tokenlabel = strdup(tokenlabel); if (!r->name || !r->module || !r->tokenlabel) { hsm_repository_free(r); return NULL; } if (pin) { r->pin = strdup(pin); if (!r->pin) { hsm_repository_free(r); return NULL; } } r->use_pubkey = use_pubkey; r->allow_extract = allowextract; r->require_backup = require_backup; return r; } void hsm_repository_free(hsm_repository_t *r) { if (r) { if (r->next) hsm_repository_free(r->next); if (r->name) free(r->name); if (r->module) free(r->module); if (r->tokenlabel) free(r->tokenlabel); if (r->pin) free(r->pin); } free(r); } static 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; } else if (slotCount > (SIZE_MAX / sizeof(CK_SLOT_ID))) { hsm_ctx_set_error(ctx, HSM_ERROR, "hsm_get_slot_id()", "Too many slots found in HSM"); return HSM_ERROR; } CHECKALLOC(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; CHECKALLOC(module = malloc(sizeof(hsm_module_t))); if (config) { CHECKALLOC(module->config = malloc(sizeof(hsm_config_t))); 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 = dupstr(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; CHECKALLOC(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; config->allow_extract = 0; } /* 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 || rv_login == CKR_USER_ALREADY_LOGGED_IN) { *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; CHECKALLOC(ctx = malloc(sizeof(hsm_ctx_t))); memset(ctx->session, 0, HSM_MAX_SESSIONS * sizeof(hsm_ctx_t*)); 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) { size_t i; if (!ctx) return; for (i = 0; i < ctx->session_count; i++) { hsm_session_close(ctx, ctx->session[i], unload); ctx->session[i] = NULL; } hsm_ctx_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); } new_ctx->keycache = ctx->keycache; new_ctx->keycache_lock = ctx->keycache_lock; } return new_ctx; } static libhsm_key_t * libhsm_key_new() { libhsm_key_t *key; CHECKALLOC(key = malloc(sizeof(libhsm_key_t))); key->modulename = 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 libhsm_key_t *key) { unsigned int i; if (!key || !key->modulename) return NULL; for (i = 0; i < ctx->session_count; i++) { if (ctx->session[i] && !strcmp(ctx->session[i]->module->name, key->modulename)) { 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 libhsm_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 libhsm_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 (key->public_key) { 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 libhsm_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; } /* Returns the DER decoded value of Q for ECDSA key * Byte string with uncompressed form of a curve point, "x | y" */ static unsigned char * hsm_get_key_ecdsa_value(hsm_ctx_t *ctx, const hsm_session_t *session, const libhsm_key_t *key, CK_ULONG *data_len) { CK_RV rv; CK_BYTE_PTR value = NULL; CK_BYTE_PTR data = NULL; CK_ULONG value_len = 0; CK_ULONG header_len = 0; CK_ATTRIBUTE template[] = { {CKA_EC_POINT, NULL, 0}, }; if (!session || !session->module || !key || !data_len) { 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, "C_GetAttributeValue")) { return NULL; } value_len = template[0].ulValueLen; CHECKALLOC(value = template[0].pValue = malloc(value_len)); memset(value, 0, value_len); 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; } if(value_len != template[0].ulValueLen) { hsm_ctx_set_error(ctx, -1, "hsm_get_key_ecdsa_value()", "HSM returned two different length for a same CKA_EC_POINT. " \ "Abnormal behaviour detected."); free(value); return NULL; } /* Check that we have the first two octets */ if (value_len < 2) { hsm_ctx_set_error(ctx, -1, "hsm_get_key_ecdsa_value()", "The DER value is too short"); free(value); return NULL; } /* Check the identifier octet, PKCS#11 requires octet string */ if (value[0] != 0x04) { hsm_ctx_set_error(ctx, -1, "hsm_get_key_ecdsa_value()", "Invalid identifier octet in the DER value"); free(value); return NULL; } header_len++; /* Check the length octets, but we do not validate the length */ if (value[1] <= 0x7F) { header_len++; } else if (value[1] == 0x80) { hsm_ctx_set_error(ctx, -1, "hsm_get_key_ecdsa_value()", "Indefinite length is not supported in DER values"); free(value); return NULL; } else { header_len++; header_len += value[1] & 0x80; } /* Check that we have more data than the header */ if (value_len - header_len < 2) { hsm_ctx_set_error(ctx, -1, "hsm_get_key_ecdsa_value()", "The value is too short"); free(value); return NULL; } /* Check that we have uncompressed data */ /* TODO: Not supporting compressed data */ if (value[header_len] != 0x04) { hsm_ctx_set_error(ctx, -1, "hsm_get_key_ecdsa_value()", "The value is not uncompressed"); free(value); return NULL; } header_len++; *data_len = value_len - header_len; CHECKALLOC(data = malloc(*data_len)); memcpy(data, value + header_len, *data_len); free(value); return data; } /* returns a CK_ULONG with the key size of the given ECDSA key. The * key is not checked for type. For ECDSA, the number of bits in the * value X is the key size */ static CK_ULONG hsm_get_key_size_ecdsa(hsm_ctx_t *ctx, const hsm_session_t *session, const libhsm_key_t *key) { CK_ULONG value_len; unsigned char* value = hsm_get_key_ecdsa_value(ctx, session, key, &value_len); CK_ULONG bits = 0; if (value == NULL) return 0; if( ((CK_ULONG) - 1) / (8/2) < value_len) { free(value); return 0; } /* value = x | y */ bits = value_len * 8 / 2; free(value); return bits; } /* Returns the DER decoded value of the EDDSA public key * Byte string with b-bit public key in little endian order */ static unsigned char * hsm_get_key_eddsa_value(hsm_ctx_t *ctx, const hsm_session_t *session, const libhsm_key_t *key, CK_ULONG *data_len) { CK_RV rv; CK_BYTE_PTR value = NULL; CK_BYTE_PTR data = NULL; CK_ULONG value_len = 0; CK_ULONG header_len = 0; CK_ATTRIBUTE template[] = { {CKA_EC_POINT, NULL, 0}, }; if (!session || !session->module || !key || !data_len) { 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, "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_eddsa_value()", "Error allocating memory for value"); return NULL; } memset(value, 0, value_len); 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; } if(value_len != template[0].ulValueLen) { hsm_ctx_set_error(ctx, -1, "hsm_get_key_eddsa_value()", "HSM returned two different length for the same CKA_EC_POINT. " \ "Abnormal behaviour detected."); free(value); return NULL; } /* Check that we have the first two octets */ if (value_len < 2) { hsm_ctx_set_error(ctx, -1, "hsm_get_key_eddsa_value()", "The DER value is too short"); free(value); return NULL; } /* Check the identifier octet, PKCS#11 requires octet string */ if (value[0] != 0x04) { hsm_ctx_set_error(ctx, -1, "hsm_get_key_eddsa_value()", "Invalid identifier octet in the DER value"); free(value); return NULL; } header_len++; /* Check the length octets, but we do not validate the length */ if (value[1] <= 0x7F) { header_len++; } else if (value[1] == 0x80) { hsm_ctx_set_error(ctx, -1, "hsm_get_key_eddsa_value()", "Indefinite length is not supported in DER values"); free(value); return NULL; } else { header_len++; header_len += value[1] & 0x80; } /* Check that we have more data than the header */ if (value_len - header_len < 2) { hsm_ctx_set_error(ctx, -1, "hsm_get_key_eddsa_value()", "The value is too short"); free(value); return NULL; } *data_len = value_len - header_len; data = malloc(*data_len); if (data == NULL) { hsm_ctx_set_error(ctx, -1, "hsm_get_key_eddsa_value()", "Error allocating memory for data"); free(value); return NULL; } memcpy(data, value + header_len, *data_len); free(value); return data; } /* returns a CK_ULONG with the key size of the given EDDSA key. The * key is not checked for type. For EDDSA, the key size is the number * of bits in the curve not the size of the public key representation, * which is larger. */ static CK_ULONG hsm_get_key_size_eddsa(hsm_ctx_t *ctx, const hsm_session_t *session, const libhsm_key_t *key) { CK_ULONG value_len; unsigned char* value = hsm_get_key_eddsa_value(ctx, session, key, &value_len); CK_ULONG bits = 0; if (value == NULL) return 0; if( ((CK_ULONG) - 1) / 8 < value_len) { free(value); return 0; } bits = value_len * 8; free(value); switch (bits) { // ED25519 keys are 255 bits represented as 256 bits (RFC8080 section 3) case 256: bits = 255; break; // ED448 keys are 448 bits represented as 456 bits (RFC8080 section 3) case 456: bits = 448; break; default: bits = 0; break; } return bits; } /* Wrapper for specific key size functions */ static CK_ULONG hsm_get_key_size(hsm_ctx_t *ctx, const hsm_session_t *session, const libhsm_key_t *key, const unsigned long algorithm) { 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; case CKK_EC: return hsm_get_key_size_ecdsa(ctx, session, key); case CKK_EC_EDWARDS: return hsm_get_key_size_eddsa(ctx, session, key); 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")) { rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_FindObjectsFinal(session->session); hsm_pkcs11_check_error(ctx, rv, "Find objects cleanup"); 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; CHECKALLOC(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; } CHECKALLOC(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 libhsm_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 libhsm_key_t * libhsm_key_new_privkey_object_handle(hsm_ctx_t *ctx, const hsm_session_t *session, CK_OBJECT_HANDLE object) { libhsm_key_t *key; CK_BYTE *id; size_t len; id = hsm_get_id_for_object(ctx, session, object, &len); if (!id) return NULL; key = libhsm_key_new(); key->modulename = strdup(session->module->name); key->private_key = object; key->public_key = hsm_find_object_handle_for_id( ctx, session, CKO_PUBLIC_KEY, id, len); 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 libhsm_key_t ** hsm_list_keys_session_internal(hsm_ctx_t *ctx, const hsm_session_t *session, size_t *count, int store) { libhsm_key_t **keys = NULL; libhsm_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, *new_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")) { goto err; } 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")) { rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_FindObjectsFinal(session->session); hsm_pkcs11_check_error(ctx, rv, "Find objects cleanup"); goto err; } total_count += objectCount; if (objectCount > 0 && store) { if (SIZE_MAX / sizeof(CK_OBJECT_HANDLE) < total_count) { hsm_ctx_set_error(ctx, -1, "hsm_list_keys_session_internal", "Too much object handle returned by HSM to allocate key_handles"); goto err; } new_key_handles = realloc(key_handles, total_count * sizeof(CK_OBJECT_HANDLE)); if (new_key_handles != NULL) { key_handles = new_key_handles; } else { hsm_ctx_set_error(ctx, -1, "hsm_list_keys_session_internal", "Error allocating memory for object handle (OOM)"); goto err; } 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")) { goto err; } if (store) { if(SIZE_MAX / sizeof(libhsm_key_t *) < total_count) { hsm_ctx_set_error(ctx, -1, "hsm_list_keys_session_internal", "Too much object handle returned by HSM to allocate keys"); goto err; } CHECKALLOC(keys = malloc(total_count * sizeof(libhsm_key_t *))); for (i = 0; i < total_count; i++) { key = libhsm_key_new_privkey_object_handle(ctx, session, key_handles[i]); if(!key) { libhsm_key_list_free(keys, i); goto err; } keys[i] = key; } } free(key_handles); *count = total_count; return keys; err: free(key_handles); *count = 0; return NULL; } /* 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 */ static libhsm_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 newly allocated key structure containing the key data * for the given CKA_ID available in the session. Returns NULL if not * found */ static libhsm_key_t * hsm_find_key_by_id_session(hsm_ctx_t *ctx, const hsm_session_t *session, const unsigned char *id, size_t len) { libhsm_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 = libhsm_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 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 libhsm_key_t * hsm_find_key_by_id_bin(hsm_ctx_t *ctx, const unsigned char *id, size_t len) { libhsm_key_t *key; unsigned int i; if (!id) return NULL; /* OPENDNSSEC-955: This procedure is mutexed to prevent a C_Login or * C_OpenSession happening at the same * time as looking up a key with * C_FindObject. Some HSMs like SoftHSM in database backend mode don't * like this. */ pthread_mutex_lock(&_hsm_ctx_mutex); for (i = 0; i < ctx->session_count; i++) { key = hsm_find_key_by_id_session(ctx, ctx->session[i], id, len); if (key) { pthread_mutex_unlock(&_hsm_ctx_mutex); return key; } } pthread_mutex_unlock(&_hsm_ctx_mutex); 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 libhsm_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 (key->public_key) { 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; CHECKALLOC(public_exponent = template[0].pValue = malloc(public_exponent_len)); CHECKALLOC(modulus = template[1].pValue = malloc(modulus_len)); 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 <= 255) { CHECKALLOC(data = malloc(data_size)); 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; CHECKALLOC(data = malloc(data_size)); 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 libhsm_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; CHECKALLOC(prime = template[0].pValue = malloc(prime_len)); CHECKALLOC(subprime = template[1].pValue = malloc(subprime_len)); CHECKALLOC(base = template[2].pValue = malloc(base_len)); CHECKALLOC(value = template[3].pValue = malloc(value_len)); 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; CHECKALLOC(data = malloc(data_size)); 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 libhsm_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; CHECKALLOC(value = template[0].pValue = malloc(value_len)); 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_ecdsa(hsm_ctx_t *ctx, hsm_session_t *session, const libhsm_key_t *key) { CK_ULONG value_len; unsigned char* value = hsm_get_key_ecdsa_value(ctx, session, key, &value_len); if (value == NULL) return NULL; ldns_rdf *rdf = ldns_rdf_new(LDNS_RDF_TYPE_B64, value_len, value); return rdf; } static ldns_rdf * hsm_get_key_rdata_eddsa(hsm_ctx_t *ctx, hsm_session_t *session, const libhsm_key_t *key) { CK_ULONG value_len; unsigned char* value = hsm_get_key_eddsa_value(ctx, session, key, &value_len); if (value == NULL) return NULL; ldns_rdf *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 libhsm_key_t *key) { 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; case CKK_EC: return hsm_get_key_rdata_ecdsa(ctx, session, key); case CKK_EC_EDWARDS: return hsm_get_key_rdata_eddsa(ctx, session, key); 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((ldns_signing_algorithm)algorithm) { case LDNS_SIGN_RSAMD5: *data_size = sizeof(RSA_MD5_ID) + digest_len; CHECKALLOC(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; CHECKALLOC(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; CHECKALLOC(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; CHECKALLOC(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: case LDNS_SIGN_ECDSAP256SHA256: case LDNS_SIGN_ECDSAP384SHA384: *data_size = digest_len; CHECKALLOC(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; CHECKALLOC(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 libhsm_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; int data_direct = 0; // don't pre-create digest, use data directly ldns_rdf *sig_rdf; CK_BYTE *digest = NULL; CK_ULONG digest_len = 0; 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 ((ldns_signing_algorithm)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; CHECKALLOC(digest = malloc(digest_len)); digest = ldns_sha1(ldns_buffer_begin(sign_buf), ldns_buffer_position(sign_buf), digest); break; case LDNS_SIGN_RSASHA256: case LDNS_SIGN_ECDSAP256SHA256: digest_len = LDNS_SHA256_DIGEST_LENGTH; CHECKALLOC(digest = malloc(digest_len)); digest = ldns_sha256(ldns_buffer_begin(sign_buf), ldns_buffer_position(sign_buf), digest); break; case LDNS_SIGN_ECDSAP384SHA384: digest_len = LDNS_SHA384_DIGEST_LENGTH; CHECKALLOC(digest = malloc(digest_len)); digest = ldns_sha384(ldns_buffer_begin(sign_buf), ldns_buffer_position(sign_buf), digest); break; case LDNS_SIGN_RSASHA512: digest_len = LDNS_SHA512_DIGEST_LENGTH; CHECKALLOC(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 = 32; digest = hsm_digest_through_hsm(ctx, session, CKM_GOSTR3411, digest_len, sign_buf); break; #if (LDNS_REVISION >= ((1<<16)|(7<<8)|(0))) case LDNS_SIGN_ED25519: data_direct = 1; break; case LDNS_SIGN_ED448: data_direct = 1; break; #endif default: /* log error? or should we not even get here for * unsupported algorithms? */ return NULL; } if (!data_direct && !digest) { return NULL; } if (data_direct) { data = ldns_buffer_begin(sign_buf); data_len = ldns_buffer_position(sign_buf); } else { /* 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((ldns_signing_algorithm)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; case LDNS_SIGN_ECDSAP256SHA256: case LDNS_SIGN_ECDSAP384SHA384: sign_mechanism.mechanism = CKM_ECDSA; break; #if (LDNS_REVISION >= ((1<<16)|(7<<8)|(0))) case LDNS_SIGN_ED25519: sign_mechanism.mechanism = CKM_EDDSA; break; case LDNS_SIGN_ED448: sign_mechanism.mechanism = CKM_EDDSA; break; #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")) { if (!data_direct) { 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")) { if (!data_direct) { free(data); free(digest); } return NULL; } sig_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, signatureLen, signature); if (!data_direct) { 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_now(); 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_open2(hsm_repository_t* rlist, char *(pin_callback)(unsigned int, const char *, unsigned int)) { hsm_config_t module_config; hsm_repository_t* repo = NULL; char* module_pin = NULL; int result = HSM_OK; int tries; int repositories = 0; pthread_mutex_lock(&_hsm_ctx_mutex); /* create an internal context with an attached session for each * configured HSM. */ if ((_hsm_ctx = hsm_ctx_new())) { keycache_create(_hsm_ctx); } repo = rlist; while (repo) { hsm_config_default(&module_config); module_config.use_pubkey = repo->use_pubkey; module_config.allow_extract = repo->allow_extract; if (repo->name && repo->module && repo->tokenlabel) { if (repo->pin) { result = hsm_attach(repo->name, repo->tokenlabel, repo->module, repo->pin, &module_config); } else { if (pin_callback) { result = HSM_PIN_INCORRECT; tries = 0; while (result == HSM_PIN_INCORRECT && tries < 3) { module_pin = pin_callback(_hsm_ctx->session_count, repo->name, tries?HSM_PIN_RETRY:HSM_PIN_FIRST); if (module_pin == NULL) break; result = hsm_attach(repo->name, repo->tokenlabel, repo->module, module_pin, &module_config); if (result == HSM_OK) { pin_callback(_hsm_ctx->session_count - 1, repo->name, 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_open2()", "No pin or callback function"); result = HSM_ERROR; } } if (result != HSM_OK) { break; } repositories++; } repo = repo->next; } if (result == HSM_OK && repositories == 0) { hsm_ctx_set_error(_hsm_ctx, HSM_NO_REPOSITORIES, "hsm_open2()", "No repositories found"); result = HSM_NO_REPOSITORIES; } pthread_mutex_unlock(&_hsm_ctx_mutex); return result; } void hsm_close() { pthread_mutex_lock(&_hsm_ctx_mutex); keycache_destroy(_hsm_ctx); hsm_ctx_close(_hsm_ctx, 1); _hsm_ctx = NULL; pthread_mutex_unlock(&_hsm_ctx_mutex); } hsm_ctx_t * hsm_create_context() { hsm_ctx_t* newctx; pthread_mutex_lock(&_hsm_ctx_mutex); newctx = hsm_ctx_clone(_hsm_ctx); pthread_mutex_unlock(&_hsm_ctx_mutex); return newctx; } int hsm_check_context() { unsigned int i; hsm_session_t *session; CK_SESSION_INFO info; CK_RV rv; CK_SESSION_HANDLE session_handle; hsm_ctx_t *ctx; pthread_mutex_lock(&_hsm_ctx_mutex); 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")) { pthread_mutex_unlock(&_hsm_ctx_mutex); 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"); pthread_mutex_unlock(&_hsm_ctx_mutex); 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")) { pthread_mutex_unlock(&_hsm_ctx_mutex); 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")) { pthread_mutex_unlock(&_hsm_ctx_mutex); return HSM_ERROR; } } pthread_mutex_unlock(&_hsm_ctx_mutex); 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; CHECKALLOC(params = malloc(sizeof(hsm_sign_params_t))); params->algorithm = LDNS_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); } } void libhsm_key_free(libhsm_key_t *key) { free(key->modulename); free(key); } libhsm_key_t ** hsm_list_keys(hsm_ctx_t *ctx, size_t *count) { libhsm_key_t **keys = NULL; size_t key_count = 0; size_t cur_key_count; libhsm_key_t **session_keys; unsigned int i, j; for (i = 0; i < ctx->session_count; i++) { session_keys = hsm_list_keys_session(ctx, ctx->session[i], &cur_key_count); CHECKALLOC(keys = realloc(keys, (key_count + cur_key_count) * sizeof(libhsm_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; } libhsm_key_t ** hsm_list_keys_repository(hsm_ctx_t *ctx, size_t *count, const char *repository) { hsm_session_t *session; if (!repository) return NULL; session = hsm_find_repository_session(ctx, repository); if (!session) { *count = 0; return NULL; } return hsm_list_keys_session(ctx, session, count); } libhsm_key_t * hsm_find_key_by_id(hsm_ctx_t *ctx, const char *id) { unsigned char *id_bytes; size_t len; libhsm_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; } static void generate_unique_id(hsm_ctx_t *ctx, unsigned char *buf, size_t bufsize) { libhsm_key_t *key; /* check whether this key doesn't happen to exist already */ hsm_random_buffer(ctx, buf, bufsize); while ((key = hsm_find_key_by_id_bin(ctx, buf, bufsize))) { libhsm_key_free(key); hsm_random_buffer(ctx, buf, bufsize); } } libhsm_key_t * hsm_generate_rsa_key(hsm_ctx_t *ctx, const char *repository, unsigned long keysize) { libhsm_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; CK_BBOOL cextractable = CK_FALSE; session = hsm_find_repository_session(ctx, repository); if (!session) return NULL; cextractable = session->module->config->allow_extract ? CK_TRUE : CK_FALSE; generate_unique_id(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, &cextractable, sizeof (cextractable) } }; 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 = libhsm_key_new(); new_key->modulename = strdup(session->module->name); if (session->module->config->use_pubkey) { new_key->public_key = publicKey; } else { /* Destroy the object directly in order to optimize storage in HSM */ /* Ignore return value, it is just a session object and will be destroyed later */ rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_DestroyObject(session->session, publicKey); new_key->public_key = 0; } new_key->private_key = privateKey; return new_key; } libhsm_key_t * hsm_generate_dsa_key(hsm_ctx_t *ctx, const char *repository, unsigned long keysize) { CK_RV rv; libhsm_key_t *new_key; hsm_session_t *session; CK_OBJECT_HANDLE domainPar, publicKey, privateKey; CK_BBOOL ctrue = CK_TRUE; CK_BBOOL cfalse = CK_FALSE; CK_BBOOL cextractable = 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]; session = hsm_find_repository_session(ctx, repository); if (!session) return NULL; cextractable = session->module->config->allow_extract ? CK_TRUE : CK_FALSE; generate_unique_id(ctx, id, 16); /* the CKA_LABEL will contain a hexadecimal string representation * of the id */ hsm_hex_unparse(id_str, id, 16); 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, &cextractable, sizeof (cextractable) } }; cextractable = session->module->config->allow_extract ? CK_TRUE : CK_FALSE; /* 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 = libhsm_key_new(); new_key->modulename = strdup(session->module->name); new_key->public_key = publicKey; new_key->private_key = privateKey; return new_key; } libhsm_key_t * hsm_generate_gost_key(hsm_ctx_t *ctx, const char *repository) { CK_RV rv; libhsm_key_t *new_key; hsm_session_t *session; CK_OBJECT_HANDLE publicKey, privateKey; CK_BBOOL ctrue = CK_TRUE; CK_BBOOL cfalse = CK_FALSE; CK_BBOOL cextractable = 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]; session = hsm_find_repository_session(ctx, repository); if (!session) return NULL; cextractable = session->module->config->allow_extract ? CK_TRUE : CK_FALSE; generate_unique_id(ctx, id, 16); /* the CKA_LABEL will contain a hexadecimal string representation * of the id */ hsm_hex_unparse(id_str, id, 16); CK_KEY_TYPE keyType = CKK_GOSTR3410; CK_MECHANISM mechanism = { CKM_GOSTR3410_KEY_PAIR_GEN, NULL_PTR, 0 }; CK_BYTE oid1[] = { 0x06, 0x07, 0x2A, 0x85, 0x03, 0x02, 0x02, 0x23, 0x01 }; CK_BYTE oid2[] = { 0x06, 0x07, 0x2A, 0x85, 0x03, 0x02, 0x02, 0x1E, 0x01 }; CK_ATTRIBUTE publicKeyTemplate[] = { { CKA_GOSTR3410PARAMS, oid1, sizeof(oid1) }, { CKA_GOSTR3411PARAMS, oid2, sizeof(oid2) }, { 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, &cextractable, sizeof (cextractable) } }; /* Generate key pair */ 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 = libhsm_key_new(); new_key->modulename = strdup(session->module->name); new_key->public_key = publicKey; new_key->private_key = privateKey; return new_key; } libhsm_key_t * hsm_generate_ecdsa_key(hsm_ctx_t *ctx, const char *repository, const char *curve) { CK_RV rv; libhsm_key_t *new_key; hsm_session_t *session; CK_OBJECT_HANDLE publicKey, privateKey; CK_BBOOL ctrue = CK_TRUE; CK_BBOOL cfalse = CK_FALSE; CK_BBOOL cextractable = 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]; session = hsm_find_repository_session(ctx, repository); if (!session) return NULL; cextractable = session->module->config->allow_extract ? CK_TRUE : CK_FALSE; generate_unique_id(ctx, id, 16); /* the CKA_LABEL will contain a hexadecimal string representation * of the id */ hsm_hex_unparse(id_str, id, 16); CK_KEY_TYPE keyType = CKK_EC; CK_MECHANISM mechanism = { CKM_EC_KEY_PAIR_GEN, NULL_PTR, 0 }; CK_BYTE oidP256[] = { 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07 }; CK_BYTE oidP384[] = { 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x22 }; CK_ATTRIBUTE publicKeyTemplate[] = { { CKA_EC_PARAMS, NULL, 0 }, { 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, &cextractable, sizeof (cextractable) } }; /* Select the curve */ if (strcmp(curve, "P-256") == 0) { publicKeyTemplate[0].pValue = oidP256; publicKeyTemplate[0].ulValueLen = sizeof(oidP256); } else if (strcmp(curve, "P-384") == 0) { publicKeyTemplate[0].pValue = oidP384; publicKeyTemplate[0].ulValueLen = sizeof(oidP384); } else { return NULL; } /* Generate key pair */ rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GenerateKeyPair(session->session, &mechanism, publicKeyTemplate, 8, privateKeyTemplate, 10, &publicKey, &privateKey); if (hsm_pkcs11_check_error(ctx, rv, "generate key pair")) { return NULL; } new_key = libhsm_key_new(); new_key->modulename = strdup(session->module->name); new_key->public_key = publicKey; new_key->private_key = privateKey; return new_key; } libhsm_key_t * hsm_generate_eddsa_key(hsm_ctx_t *ctx, const char *repository, const char *curve) { CK_RV rv; libhsm_key_t *new_key; hsm_session_t *session; CK_OBJECT_HANDLE publicKey, privateKey; CK_BBOOL ctrue = CK_TRUE; CK_BBOOL cfalse = CK_FALSE; CK_BBOOL cextractable = 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]; session = hsm_find_repository_session(ctx, repository); if (!session) return NULL; cextractable = session->module->config->allow_extract ? CK_TRUE : CK_FALSE; generate_unique_id(ctx, id, 16); /* the CKA_LABEL will contain a hexadecimal string representation * of the id */ hsm_hex_unparse(id_str, id, 16); CK_KEY_TYPE keyType = CKK_EC_EDWARDS; CK_MECHANISM mechanism = { CKM_EC_EDWARDS_KEY_PAIR_GEN, NULL_PTR, 0 }; CK_BYTE oid25519[] = { 0x06, 0x03, 0x2B, 0x65, 0x70 }; CK_BYTE oid448[] = { 0x06, 0x03, 0x2B, 0x65, 0x71 }; CK_ATTRIBUTE publicKeyTemplate[] = { { CKA_EC_PARAMS, NULL, 0 }, { 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, &cextractable, sizeof (cextractable) } }; /* Select the curve */ if (strcmp(curve, "edwards25519") == 0) { publicKeyTemplate[0].pValue = oid25519; publicKeyTemplate[0].ulValueLen = sizeof(oid25519); } else if (strcmp(curve, "edwards448") == 0) { publicKeyTemplate[0].pValue = oid448; publicKeyTemplate[0].ulValueLen = sizeof(oid448); } else { return NULL; } /* Generate key pair */ rv = ((CK_FUNCTION_LIST_PTR)session->module->sym)->C_GenerateKeyPair(session->session, &mechanism, publicKeyTemplate, 8, privateKeyTemplate, 10, &publicKey, &privateKey); if (hsm_pkcs11_check_error(ctx, rv, "generate key pair")) { return NULL; } new_key = libhsm_key_new(); new_key->modulename = strdup(session->module->name); new_key->public_key = publicKey; new_key->private_key = privateKey; return new_key; } int hsm_remove_key(hsm_ctx_t *ctx, libhsm_key_t *key) { CK_RV rv; hsm_session_t *session; 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 (key->public_key) { 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 libhsm_key_list_free(libhsm_key_t **key_list, size_t count) { size_t i; for (i = 0; i < count; i++) { libhsm_key_free(key_list[i]); } free(key_list); } char * hsm_get_key_id(hsm_ctx_t *ctx, const libhsm_key_t *key) { unsigned char *id; char *id_str; size_t len; hsm_session_t *session; 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 */ CHECKALLOC(id_str = malloc(len * 2 + 1)); hsm_hex_unparse(id_str, id, len); free(id); return id_str; } libhsm_key_info_t * hsm_get_key_info(hsm_ctx_t *ctx, const libhsm_key_t *key) { libhsm_key_info_t *key_info; hsm_session_t *session; session = hsm_find_key_session(ctx, key); if (!session) return NULL; CHECKALLOC(key_info = malloc(sizeof(libhsm_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); 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; case CKK_EC: key_info->algorithm_name = strdup("ECDSA"); break; case CKK_EC_EDWARDS: key_info->algorithm_name = strdup("EDDSA"); break; default: CHECKALLOC(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 libhsm_key_info_free(libhsm_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 libhsm_key_t *key, const hsm_sign_params_t *sign_params) { ldns_rr *signature; ldns_buffer *sign_buf; ldns_rdf *b64_rdf; size_t i; 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 */ ldns_rr_free(signature); 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); ldns_rr_free(signature); 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 */ ldns_rr_free(signature); return NULL; } ldns_rr_rrsig_set_sig(signature, b64_rdf); return signature; } int hsm_keytag(const char* loc, int alg, int sep, uint16_t* keytag) { uint16_t tag; hsm_ctx_t *hsm_ctx; hsm_sign_params_t *sign_params; libhsm_key_t *hsmkey; ldns_rr *dnskey_rr; if (!loc) { return 1; } if (!(hsm_ctx = hsm_create_context())) { return 1; } if (!(sign_params = hsm_sign_params_new())) { hsm_destroy_context(hsm_ctx); return 1; } /* The owner name is not relevant for the keytag calculation. * However, a ldns_rdf_clone down the path will trip over it. */ sign_params->owner = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, "dummy"); sign_params->algorithm = (ldns_algorithm) alg; sign_params->flags = LDNS_KEY_ZONE_KEY; if (sep) sign_params->flags |= LDNS_KEY_SEP_KEY; hsmkey = hsm_find_key_by_id(hsm_ctx, loc); if (!hsmkey) { hsm_sign_params_free(sign_params); hsm_destroy_context(hsm_ctx); return 1; } dnskey_rr = hsm_get_dnskey(hsm_ctx, hsmkey, sign_params); if (!dnskey_rr) { libhsm_key_free(hsmkey); hsm_sign_params_free(sign_params); hsm_destroy_context(hsm_ctx); return 1; } tag = ldns_calc_keytag(dnskey_rr); ldns_rr_free(dnskey_rr); libhsm_key_free(hsmkey); hsm_sign_params_free(sign_params); hsm_destroy_context(hsm_ctx); if (keytag) *keytag = tag; return 0; } ldns_rr * hsm_get_dnskey(hsm_ctx_t *ctx, const libhsm_key_t *key, const hsm_sign_params_t *sign_params) { /* CK_RV rv; */ ldns_rr *dnskey; hsm_session_t *session; ldns_rdf *rdata; 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; /* 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) { result = hsm_ctx_add_session(_hsm_ctx, session); } return result; } int hsm_token_attached(hsm_ctx_t *ctx, const char *repository) { unsigned int i; 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; } 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; CHECKALLOC(message = malloc(HSM_ERROR_MSGSIZE+3)); snprintf(message, HSM_ERROR_MSGSIZE, "%s: %s", ctx->error_action ? ctx->error_action : "unknown()", ctx->error_message[0] ? 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 *ctx) { unsigned int i; 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_ctx_t *ctx, libhsm_key_t *key) { libhsm_key_info_t *key_info; if (key) { key_info = hsm_get_key_info(ctx, key); if (key_info) { printf("key:\n"); printf("\tprivkey handle: %u\n", (unsigned int) key->private_key); if (key->public_key) { printf("\tpubkey handle: %u\n", (unsigned int) key->public_key); } else { printf("\tpubkey handle: %s\n", "NULL"); } printf("\trepository: %s\n", key->modulename); printf("\talgorithm: %s\n", key_info->algorithm_name); printf("\tsize: %lu\n", key_info->keysize); printf("\tid: %s\n", key_info->id); libhsm_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 *ctx) { CK_RV rv; CK_SLOT_ID slot_id; CK_TOKEN_INFO token_info; unsigned int i; hsm_session_t *session; int result; 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"); } } static int keycache_cmpfunc(const void* a, const void* b) { const char* x = (const char*)a; const char* y = (const char*)b; return strcmp(x, y); } static void keycache_delfunc(ldns_rbnode_t* node, void* cargo) { (void)cargo; free((void*)node->key); free(((libhsm_key_t*)node->data)->modulename); free((void*)node->data); free((void*)node); } void keycache_create(hsm_ctx_t* ctx) { ctx->keycache = ldns_rbtree_create(keycache_cmpfunc); CHECKALLOC(_hsm_ctx->keycache_lock = malloc(sizeof (pthread_mutex_t))); pthread_mutex_init(_hsm_ctx->keycache_lock, NULL); } void keycache_destroy(hsm_ctx_t* ctx) { ldns_traverse_postorder(ctx->keycache, keycache_delfunc, NULL); ldns_rbtree_free(ctx->keycache); pthread_mutex_destroy(ctx->keycache_lock); free(ctx->keycache_lock); ctx->keycache_lock = NULL; } const libhsm_key_t* keycache_lookup(hsm_ctx_t* ctx, const char* locator) { ldns_rbnode_t* node; pthread_mutex_lock(ctx->keycache_lock); node = ldns_rbtree_search(ctx->keycache, locator); pthread_mutex_unlock(ctx->keycache_lock); if (node == LDNS_RBTREE_NULL || node == NULL) { libhsm_key_t* key; if ((key = hsm_find_key_by_id(ctx, locator)) == NULL) { node = NULL; } else { CHECKALLOC(node = malloc(sizeof(ldns_rbnode_t))); node->key = strdup(locator); node->data = key; pthread_mutex_lock(ctx->keycache_lock); node = ldns_rbtree_insert(ctx->keycache, node); pthread_mutex_unlock(ctx->keycache_lock); } } if (node == LDNS_RBTREE_NULL || node == NULL) return NULL; else return node->data; } opendnssec-2.1.13/libhsm/src/lib/Makefile.am0000644000077000001440000000050014446272525015532 00000000000000MAINTAINERCLEANFILES = $(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-2.1.13/libhsm/src/Makefile.am0000644000077000001440000000010014446272525014760 00000000000000MAINTAINERCLEANFILES = $(srcdir)/Makefile.in SUBDIRS = lib bin opendnssec-2.1.13/libhsm/Makefile.am0000644000077000001440000000045414446272525014205 00000000000000MAINTAINERCLEANFILES = $(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-2.1.13/common/0000755000077000001440000000000014446272544012241 500000000000000opendnssec-2.1.13/common/longgetopt.h0000644000077000001440000000106514446272525014515 00000000000000#include #ifndef HAVE_GETOPT_LONG struct option { const char* name; int has_arg; int *flag; int val; }; #endif struct longgetopt { int optind; int optopt; char* optarg; const char* _optstring; const struct option* _optarray; int _optend; int _argc; char** _argv; int _optpos; int _permute; }; extern int longgetopt(int argc, char** argv, const char* optstring, const struct option* longopts, int* longindex, struct longgetopt* context); extern int strtoargs(const char* arg, int *argc, char*** argv); opendnssec-2.1.13/common/file.h0000644000077000001440000001200714446272525013250 00000000000000/* * 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 "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); /** * 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); /** * Write string to file descriptor followed by newline * \return bytes written, -1 on failure. * */ ssize_t ods_writeln(int fd, char const *str); /** * Combined error logging and writing to file descriptor. * \param[in] fd file descriptor * \param[in] mod module name to report in the error * \param[in] format pointer to C format string * \param[in] ... parameters to be expanded in format string * */ void ods_log_error_and_printf(int fd, const char *mod, const char *format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 3, 4))) #endif ; /** * 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 * \param[in] startpos starting file position in file1 * \param[in] append whether to append or do a regular copy * \return ods_status * */ ods_status ods_file_copy(const char* file1, const char* file2, long startpos, int append); /** * (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); /** * 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-2.1.13/common/strlcat.c0000644000077000001440000000357414446272525014011 00000000000000/* $OpenBSD: strlcat.c,v 1.11 2005/11/10 05:18:56 dtucker Exp $ */ /* * Copyright (c) 1998 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* OPENBSD ORIGINAL: lib/libc/string/strlcat.c */ #include "config.h" #ifndef HAVE_STRLCAT #include #include /* * Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters * will be copied. Always NULL terminates (unless siz <= strlen(dst)). * Returns strlen(src) + MIN(siz, strlen(initial dst)). * If retval >= siz, truncation occurred. */ size_t strlcat(char *dst, const char *src, size_t siz) { char *d = dst; const char *s = src; size_t n = siz; size_t dlen; /* Find the end of dst and adjust bytes left but don't go past end */ while (n-- != 0 && *d != '\0') d++; dlen = d - dst; n = siz - dlen; if (n == 0) return(dlen + strlen(s)); while (*s != '\0') { if (n != 1) { *d++ = *s; n--; } s++; } *d = '\0'; return(dlen + (s - src)); /* count does not include NUL */ } #endif /* !HAVE_STRLCAT */ opendnssec-2.1.13/common/pselect.c0000644000077000001440000000204514446272525013764 00000000000000/* * Copyright (c) 2001-2011, NLnet Labs. All rights reserved. * * Like select(2) but set the signals to block while waiting in * select. This version is not entirely race condition safe. Only * operating system support can make it so. */ #include #include #include #ifdef HAVE_SYS_SELECT_H #include #endif #include #include int pselect (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, const sigset_t *sigmask) { int result; sigset_t saved_sigmask; struct timeval saved_timeout; if (sigmask && sigprocmask(SIG_SETMASK, sigmask, &saved_sigmask) == -1) return -1; if (timeout) { saved_timeout.tv_sec = timeout->tv_sec; saved_timeout.tv_usec = timeout->tv_nsec / 1000; result = select(n, readfds, writefds, exceptfds, &saved_timeout); } else { result = select(n, readfds, writefds, exceptfds, NULL); } if (sigmask && sigprocmask(SIG_SETMASK, &saved_sigmask, NULL) == -1) return -1; return result; } opendnssec-2.1.13/common/longgetopt.c0000644000077000001440000002420414446272525014510 00000000000000#include "config.h" #include #include #include #include #include #include #include #include "longgetopt.h" static void permute(struct longgetopt* context) { char* swap; size_t count = context->_optend - context->optind; if(count > 0) { swap = context->_argv[context->optind]; memmove(&(context->_argv[context->optind]), &(context->_argv[context->optind + 1]), sizeof(char*) * (context->_argc - context->optind)); context->_optend -= 1; context->_argv[context->_argc-1] = swap; } else if (count == 0) context->_optend -= 1; } static int matchoption(char* s, const char* optstring, const struct option* longopts, int* longindex, struct longgetopt* context) { size_t length; int ch; char* argument = NULL; if(context->_optpos == 0) { if((argument = strchr(&s[2],'=')) || (argument = strchr(&s[2],' ')) || (argument = strchr(&s[2],':'))) { length = argument - &s[2]; argument += 1; } else { length = strlen(&s[2]); } for(int i=0; longopts && longopts[i].name; i++) { if(!strncmp(&s[2], longopts[i].name, length) && length == strlen(longopts[i].name)) { context->optopt = longopts[i].val; context->optarg = argument; if(longindex) *longindex = i; if(longopts[i].has_arg == no_argument && argument != NULL) { return '?'; } else if(longopts[i].has_arg == required_argument && argument == NULL) { if(context->optind < context->_optend) { /* matched option required argument, use next item */ argument = context->_argv[context->optind]; context->optarg = argument; context->optind += 1; } else { return '?'; } } if(longopts[i].flag) { *(longopts[i].flag) = longopts[i].val; return 0; } else { return longopts[i].val; } } } if(length == 1) { context->_optpos = 2; } else { return '?'; } } ch = s[context->_optpos]; if(isgraph(ch) && strchr(":+-;",ch) == NULL) { for(int i=0; optstring[i]; i++) { if(ch == optstring[i]) { if(optstring[i+1]==':') { /* matched option has optional or required argument */ if(s[context->_optpos+1] == '=' || s[context->_optpos+1] == ' ' || s[context->_optpos+1] == ':') { /* option has (optional) argument, and one supplied with separator */ context->optopt = ch; context->optarg = &s[context->_optpos+2]; context->_optpos = strlen(s)-1; return ch; } else if(s[context->_optpos+1] != '\0') { /* option has (optional) argument, and one supplied without separator */ context->optopt = ch; context->optarg = &s[context->_optpos+1]; context->_optpos = strlen(s)-1; return ch; } else if(optstring[i+2]!=':') { if(s[context->_optpos+1] == '\0' && context->optind < context->_optend) { /* matched option required argument, use next item */ argument = context->_argv[context->optind]; context->optind += 1; context->optopt = ch; context->optarg = argument; context->_optpos = 0; return ch; } else { /* match option required argument, but none given */ context->optopt = ch; context->optarg = NULL; return '?'; } } else { /* matched option has optional argument, but none given */ context->optopt = ch; context->optarg = NULL; return ch; } } else { /* matched option that should have no argument */ if(s[context->_optpos+1] == '=' || s[context->_optpos+1] == ' ') { /* matched non-argument option has argument passed*/ context->optopt = ch; context->optarg = &s[context->_optpos+2]; return '?'; } else { /* matched non-argument option with no argument supplied */ context->optopt = ch; context->optarg = NULL; return ch; } } } } /* no short option matched */ context->optopt = '?'; context->optarg = argument; return '?'; } else { context->optopt = '?'; context->optarg = argument; return '?'; } } int longgetopt(int argc, char** argv, const char* optstring, const struct option* longopts, int* longindex, struct longgetopt* context) { if(optstring) { context->_permute = 1; if(getenv("POSIXLY_CORRECT")) context->_permute = 0; if(optstring[0] == '+') { context->_permute = 0; context->_optstring = (optstring[0] == '\0' ? optstring : &optstring[1]); } else context->_optstring = optstring; context->_optarray = longopts; context->_optend = argc; context->_argc = argc; context->_argv = argv; context->optind = 0; context->_optpos = 0; context->optarg = NULL; context->optopt = '?'; } else { argv = context->_argv; } if(context->_optpos > 0) { if(argv[context->optind-1][context->_optpos + 1]) { context->_optpos += 1; return matchoption(argv[context->optind-1], context->_optstring, context->_optarray, longindex, context); } else { context->_optpos = 0; //context->optind += 1; } } while(context->optind < context->_optend && argv[context->optind][0] != '-') { if(context->_permute) { permute(context); } else { return -1; } } if(context->optind >= context->_optend) { context->_optend -= 1; return -1; } if(argv[context->optind][1] == '-') { if(argv[context->optind][2] == '\0') { context->optind += 1; while(context->_optend - context->optind > 1) { permute(context); } return -1; } else { context->optind += 1; return matchoption(argv[context->optind-1], context->_optstring, context->_optarray, longindex, context); } } else { context->_optpos = 1; context->optind += 1; return matchoption(argv[context->optind-1], context->_optstring, context->_optarray, longindex, context); } } int strtoargs(const char* arg, int* argcptr, char*** argvptr) { int groupch; int lastch; char** argv = NULL; int argc; int argi; char* args; argv = NULL; for(int pass=0; pass<2; ++pass) { argc = 0; argi = 0; lastch = '\0'; groupch = '\0'; if(argv) argv[argc] = NULL; for(int i=0; arg[i]; i++) { if(argv != NULL && argv[argc] == NULL) { if(argc>0) { argv[argc] = &argv[argc-1][argi]; } else argv[argc] = args; argi = 0; } switch(arg[i]) { case '\"': case '\'': if(arg[i] == groupch) { groupch = '\0'; } else if(!groupch) { groupch = arg[i]; } else { if(argv) argv[argc][argi] = arg[i]; ++argi; } break; case '\\': if(arg[i+1] && (arg[i+1]=='\'' || arg[i+1]=='\"')) { ++i; } if(argv) argv[argc][argi] = arg[i]; ++argi; break; case ' ': case '\t': case '\n': case '\r': if(groupch) { if(argv) argv[argc][argi] = arg[i]; ++argi; } else { if(lastch!='\0'&&lastch!=' '&&lastch!='\t'&&lastch!='\n'&&lastch!='\r') { if (argv) argv[argc][argi] = '\0'; ++argi; ++argc; if (argv) argv[argc] = NULL; } } break; default: if(argv) argv[argc][argi] = arg[i]; ++argi; } lastch = arg[i]; } if(lastch!='\0'&&lastch!=' '&&lastch!='\t'&&lastch!='\n'&&lastch!='\r') { if (argv) argv[argc][argi] = '\0'; ++argi; ++argc; if (argv) argv[argc] = NULL; } if(pass==0) { args = malloc(sizeof(void*) * (argc+1) + argi); argv = (char**)args; args = &args[sizeof(void*) * (argc+1)]; } } argv[argc] = NULL; *argcptr = argc; *argvptr = argv; return 0; } opendnssec-2.1.13/common/util.c0000644000077000001440000002060614446272525013305 00000000000000/* * Copyright (c) 2009-2018 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 "file.h" #include "log.h" #include "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 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; } /** * 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; } /** * 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); } /** * 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; } /** * Check pidfile * */ int util_pidfile_avail(const char* pidfile) { int fd, available, pid; char pidbuf[32]; ssize_t n; if (!pidfile) return 0; if ((fd = open(pidfile, O_RDONLY)) == -1) { return (errno == ENOENT); /* Does not exist*/ } n = read(fd, pidbuf, 32); if (n == -1) { /* error */ available = 0; } else if (n == 0) { /* EOF */ available = 1; } else { /* PID */ pidbuf[31] = 0; /* atoi can not fail but we must not pass negative values to * kill */ pid = atoi(pidbuf); if (pid > 0) available = (kill(pid, 0) != 0); else available = 1; } (void) close(fd); return available; } opendnssec-2.1.13/common/datastructure.c0000644000077000001440000001473314446272525015226 00000000000000/* * Copyright (c) 2015 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 "status.h" #include "datastructure.h" struct collection_class_struct { FILE* store; void* cargo; int (*member_destroy)(void* cargo, void* member); int (*member_dispose)(void* cargo, void* member, FILE*); int (*member_restore)(void* cargo, void* member, FILE*); }; struct collection_instance_struct { struct collection_class_struct* method; char* array; /** array with members */ size_t size; /** member size */ int iterator; int count; /** number of members in array */ long location; }; static int swapin(collection_t collection) { int i; if(collection->count > 0) { if(fseek(collection->method->store, collection->location, SEEK_SET)) return 1; for(i=0; icount; i++) { if(collection->method->member_restore(collection->method->cargo, collection->array + collection->size * i, collection->method->store)) return 1; } } return 0; } static int swapout(collection_t collection) { int i; if(collection->count > 0) { if(fseek(collection->method->store, 0, SEEK_END)) return 1; collection->location = ftell(collection->method->store); for(i=0; icount; i++) { if(collection->method->member_dispose(collection->method->cargo, collection->array + collection->size * i, collection->method->store)) return 1; } } return 0; } void collection_class_allocated(collection_class* klass, void *cargo, int (*member_destroy)(void* cargo, void* member)) { CHECKALLOC(*klass = malloc(sizeof(struct collection_class_struct))); (*klass)->cargo = cargo; (*klass)->member_destroy = member_destroy; (*klass)->member_dispose = NULL; (*klass)->member_restore = NULL; (*klass)->store = NULL; } void collection_class_backed(collection_class* klass, char* fname, void *cargo, int (*member_destroy)(void* cargo, void* member), int (*member_dispose)(void* cargo, void* member, FILE*), int (*member_restore)(void* cargo, void* member, FILE*)) { CHECKALLOC(*klass = malloc(sizeof(struct collection_class_struct))); (*klass)->cargo = cargo; (*klass)->member_destroy = member_destroy; (*klass)->member_dispose = member_dispose; (*klass)->member_restore = member_restore; (*klass)->store = fopen(fname, "w+"); } void collection_class_destroy(collection_class* klass) { if (klass == NULL) return; free(*klass); *klass = NULL; } void collection_create_array(collection_t* collection, size_t membsize, collection_class klass) { CHECKALLOC(*collection = malloc(sizeof(struct collection_instance_struct))); (*collection)->size = membsize; (*collection)->count = 0; (*collection)->array = NULL; (*collection)->iterator = -1; (*collection)->method = klass; } void collection_destroy(collection_t* collection) { int i; if(collection == NULL) return; for (i=0; i < (*collection)->count; i++) { (*collection)->method->member_destroy((*collection)->method->cargo, &(*collection)->array[(*collection)->size * i]); } if((*collection)->array) free((*collection)->array); free(*collection); *collection = NULL; } void collection_add(collection_t collection, void *data) { void* ptr; if(collection->method->store) swapin(collection); CHECKALLOC(ptr = realloc(collection->array, (collection->count+1)*collection->size)); collection->array = ptr; memcpy(&collection->array[collection->size * collection->count], data, collection->size); collection->count += 1; if(collection->method->store) swapout(collection); } void collection_del_index(collection_t collection, int index) { void* ptr; if (index<0 || index >= collection->count) return; if(collection->method->store) swapin(collection); collection->method->member_destroy(collection->method->cargo, &collection->array[collection->size * index]); collection->count -= 1; memmove(&collection->array[collection->size * index], &collection->array[collection->size * (index + 1)], (collection->count - index) * collection->size); if (collection->count > 0) { CHECKALLOC(ptr = realloc(collection->array, collection->count * collection->size)); collection->array = ptr; } else { free(collection->array); collection->array = NULL; } if(collection->method->store) swapout(collection); } void collection_del_cursor(collection_t collection) { collection_del_index(collection, collection->iterator); } void* collection_iterator(collection_t collection) { if(collection->iterator < 0) { if(collection->method->store) swapin(collection); collection->iterator = collection->count; } collection->iterator -= 1; if(collection->iterator >= 0) { return &collection->array[collection->iterator * collection->size]; } else { if(collection->method->store) swapout(collection); return NULL; } } opendnssec-2.1.13/common/config.h.in0000644000077000001440000004430314446272531014204 00000000000000/* common/config.h.in. Generated from configure.ac by autoheader. */ /* Define if your setregid() is broken */ #undef BROKEN_SETREGID /* Define if your setresgid() is broken */ #undef BROKEN_SETRESGID /* Define if your setresuid() is broken */ #undef BROKEN_SETRESUID /* Define if your setreuid() is broken */ #undef BROKEN_SETREUID /* System cp(3) command */ #undef CP_COMMAND /* Using MySQL for database backend */ #undef ENFORCER_DATABASE_MYSQL /* Using SQLite3 for database backend */ #undef ENFORCER_DATABASE_SQLITE3 /* Database to use when testing the Enforcer database backend */ #undef ENFORCER_DB_DATABASE /* Host to use when testing the Enforcer database backend */ #undef ENFORCER_DB_HOST /* Password to use when testing the Enforcer database backend */ #undef ENFORCER_DB_PASSWORD /* Port to use when testing the Enforcer database backend */ #undef ENFORCER_DB_PORT /* Port to use when testing the Enforcer database backend */ #undef ENFORCER_DB_PORT_TEXT /* Username to use when testing the Enforcer database backend */ #undef ENFORCER_DB_USERNAME /* Define to 1 if you have the `alarm' function. */ #undef HAVE_ALARM /* Define to 1 if you have the `arc4random' function. */ #undef HAVE_ARC4RANDOM /* Define to 1 if you have the `arc4random_uniform' function. */ #undef HAVE_ARC4RANDOM_UNIFORM /* Define to 1 if you have the `atoi' function. */ #undef HAVE_ATOI /* Define to 1 if you have the `b64_ntop' function. */ #undef HAVE_B64_NTOP /* Define to 1 if you have the `b64_pton' function. */ #undef HAVE_B64_PTON /* Define if backtrace supported */ #undef HAVE_BACKTRACE /* Define if backtrace_full supported */ #undef HAVE_BACKTRACE_FULL /* Define to 1 if you have the `bzero' function. */ #undef HAVE_BZERO /* Define to 1 if you have the `calloc' function. */ #undef HAVE_CALLOC /* Define to 1 if your system has a working `chown' function. */ #undef HAVE_CHOWN /* Define to 1 if you have the `chroot' function. */ #undef HAVE_CHROOT /* Define if you have clock_gettime */ #undef HAVE_CLOCK_GETTIME /* Define to 1 if you have the `close' function. */ #undef HAVE_CLOSE /* Define to 1 if you have the `closelog' function. */ #undef HAVE_CLOSELOG /* Define to 1 if you have the `closelog_r' function. */ #undef HAVE_CLOSELOG_R /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define if you have dlopen */ #undef HAVE_DLOPEN /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the `dup2' function. */ #undef HAVE_DUP2 /* Define to 1 if you have the `endpwent' function. */ #undef HAVE_ENDPWENT /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* Define to 1 if you have the `EVP_sha1' function. */ #undef HAVE_EVP_SHA1 /* Define to 1 if you have the `EVP_sha256' function. */ #undef HAVE_EVP_SHA256 /* Define to 1 if you have the `exit' function. */ #undef HAVE_EXIT /* Define to 1 if you have the `fclose' function. */ #undef HAVE_FCLOSE /* Define to 1 if you have the `fcntl' function. */ #undef HAVE_FCNTL /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `ferror' function. */ #undef HAVE_FERROR /* Define to 1 if you have the `fflush' function. */ #undef HAVE_FFLUSH /* Define to 1 if you have the `fgetc' function. */ #undef HAVE_FGETC /* Define to 1 if you have the `fopen' function. */ #undef HAVE_FOPEN /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the `fprintf' function. */ #undef HAVE_FPRINTF /* Define to 1 if you have the `free' function. */ #undef HAVE_FREE /* Define to 1 if you have the `getgroups' function. */ #undef HAVE_GETGROUPS /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the `getopt_long' function. */ #undef HAVE_GETOPT_LONG /* Define to 1 if you have the `getpass' function. */ #undef HAVE_GETPASS /* Define to 1 if you have the `getpassphrase' function. */ #undef HAVE_GETPASSPHRASE /* Define to 1 if you have the `getpid' function. */ #undef HAVE_GETPID /* Define to 1 if you have the `initgroups' function. */ #undef HAVE_INITGROUPS /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `crypto' library (-lcrypto). */ #undef HAVE_LIBCRYPTO /* Define to 1 if you have the `cunit' library (-lcunit). */ #undef HAVE_LIBCUNIT /* Define to 1 if you have the `ldns' library (-lldns). */ #undef HAVE_LIBLDNS /* Define to 1 if you have the `xml2' library (-lxml2). */ #undef HAVE_LIBXML2 /* Define to 1 if you have the header file. */ #undef HAVE_LIBXML_PARSER_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBXML_RELAXNG_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBXML_XMLREADER_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBXML_XPATH_H /* Define to 1 if you have the `listen' function. */ #undef HAVE_LISTEN /* Define if you have LoadLibrary */ #undef HAVE_LOADLIBRARY /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if MySQL libraries are available */ #undef HAVE_MYSQL /* Define to 1 if you have the `openlog' function. */ #undef HAVE_OPENLOG /* Define to 1 if you have the `openlog_r' function. */ #undef HAVE_OPENLOG_R /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD /* Define to 1 if you have the `pthread_barrier_wait' function. */ #undef HAVE_PTHREAD_BARRIER_WAIT /* Define to 1 if you have the `pthread_cond_destroy' function. */ #undef HAVE_PTHREAD_COND_DESTROY /* Define to 1 if you have the `pthread_cond_init' function. */ #undef HAVE_PTHREAD_COND_INIT /* Define to 1 if you have the `pthread_cond_signal' function. */ #undef HAVE_PTHREAD_COND_SIGNAL /* Define to 1 if you have the `pthread_cond_timedwait' function. */ #undef HAVE_PTHREAD_COND_TIMEDWAIT /* Define to 1 if you have the `pthread_cond_wait' function. */ #undef HAVE_PTHREAD_COND_WAIT /* Define to 1 if you have the `pthread_create' function. */ #undef HAVE_PTHREAD_CREATE /* Define to 1 if you have the `pthread_detach' function. */ #undef HAVE_PTHREAD_DETACH /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_H /* Define to 1 if you have the `pthread_join' function. */ #undef HAVE_PTHREAD_JOIN /* Define to 1 if you have the `pthread_mutex_destroy' function. */ #undef HAVE_PTHREAD_MUTEX_DESTROY /* Define to 1 if you have the `pthread_mutex_init' function. */ #undef HAVE_PTHREAD_MUTEX_INIT /* Define to 1 if you have the `pthread_mutex_lock' function. */ #undef HAVE_PTHREAD_MUTEX_LOCK /* Define to 1 if you have the `pthread_mutex_unlock' function. */ #undef HAVE_PTHREAD_MUTEX_UNLOCK /* Have PTHREAD_PRIO_INHERIT. */ #undef HAVE_PTHREAD_PRIO_INHERIT /* Define to 1 if you have the `pthread_self' function. */ #undef HAVE_PTHREAD_SELF /* Define to 1 if you have the `pthread_sigmask' function. */ #undef HAVE_PTHREAD_SIGMASK /* Define to 1 if readline libraries are available */ #undef HAVE_READLINE /* Define to 1 if your system has a GNU libc compatible `realloc' function, and to 0 otherwise. */ #undef HAVE_REALLOC /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `setgroups' function. */ #undef HAVE_SETGROUPS /* Define to 1 if you have the `setregid' function. */ #undef HAVE_SETREGID /* Define to 1 if you have the `setresgid' function. */ #undef HAVE_SETRESGID /* Define to 1 if you have the `setresuid' function. */ #undef HAVE_SETRESUID /* Define to 1 if you have the `setreuid' function. */ #undef HAVE_SETREUID /* Define to 1 if you have the `sigfillset' function. */ #undef HAVE_SIGFILLSET /* Define to 1 if you have the header file. */ #undef HAVE_SIGNAL_H /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Have the sockaddr_un.sun_len member. */ #undef HAVE_SOCKADDR_SUN_LEN /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* Have the SQLITE3 library */ #undef HAVE_SQLITE3 /* Define if you have the SSL libraries installed. */ #undef HAVE_SSL /* Define if you have the SSL libraries with new HMAC related functions. */ #undef HAVE_SSL_NEW_HMAC /* Define to 1 if you have the `stat' function. */ #undef HAVE_STAT /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strlcat' function. */ #undef HAVE_STRLCAT /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY /* Define to 1 if you have the `strlen' function. */ #undef HAVE_STRLEN /* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP /* Define to 1 if you have the `strncat' function. */ #undef HAVE_STRNCAT /* Define to 1 if you have the `strncmp' function. */ #undef HAVE_STRNCMP /* Define to 1 if you have the `strncpy' function. */ #undef HAVE_STRNCPY /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL /* Define to 1 if you have the `syslog' function. */ #undef HAVE_SYSLOG /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the `syslog_r' function. */ #undef HAVE_SYSLOG_R /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the `time' function. */ #undef HAVE_TIME /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H /* union semun is defined */ #undef HAVE_UNION_SEMUN /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `unlink' function. */ #undef HAVE_UNLINK /* Define to 1 if you have the `va_end' function. */ #undef HAVE_VA_END /* Define to 1 if you have the `va_start' function. */ #undef HAVE_VA_START /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define to 1 if you have the `vsyslog_r' function. */ #undef HAVE_VSYSLOG_R /* Define to 1 if you have the `waitpid' function. */ #undef HAVE_WAITPID /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Define to 1 if you have the `xmlCleanupParser' function. */ #undef HAVE_XMLCLEANUPPARSER /* Define to 1 if you have the `xmlCleanupThreads' function. */ #undef HAVE_XMLCLEANUPTHREADS /* Define to 1 if you have the `xmlInitParser' function. */ #undef HAVE_XMLINITPARSER /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* define if your compiler has __attribute__ */ #undef HAVE___ATTRIBUTE__ /* Default configuration file. */ #undef HSM_DEFAULT_CONFIG /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Path to the OpenDNSSEC ods-control binary */ #undef ODS_EN_CONTROL /* Path to the OpenDNSSEC enforcer engine binary */ #undef ODS_EN_ENGINE /* File magic for storing backups from the OpenDNSSEC enforcer */ #undef ODS_EN_FILE_MAGIC /* Path to the OpenDNSSEC kaspcheck binary */ #undef ODS_EN_KASPCHECK /* Command to send a SIGHUP to the ods-enforcerd process */ #undef ODS_EN_NOTIFY /* Start message for enforcer client */ #undef ODS_EN_START_RESPONSE /* Default verbosity */ #undef ODS_EN_VERBOSITY /* Path to the OpenDNSSEC config file */ #undef ODS_SE_CFGFILE /* Path to the OpenDNSSEC signer client binary */ #undef ODS_SE_CLI /* Path to the OpenDNSSEC signer engine binary */ #undef ODS_SE_ENGINE /* File magic for storing backups from the OpenDNSSEC signer engine */ #undef ODS_SE_FILE_MAGIC_V1 /* File magic for storing backups from the OpenDNSSEC signer engine */ #undef ODS_SE_FILE_MAGIC_V2 /* File magic for storing backups from the OpenDNSSEC signer engine */ #undef ODS_SE_FILE_MAGIC_V3 /* Maximum line length that the OpenDNSSEC signer client can handle */ #undef ODS_SE_MAXLINE /* Number of seconds the OpenDNSSEC signer engine should backoff when a task failed */ #undef ODS_SE_MAX_BACKOFF /* Path to the OpenDNSSEC signer engine pid file */ #undef ODS_SE_PIDFILE /* Path to the OpenDNSSEC data files */ #undef ODS_SE_RNGDIR /* Path to the OpenDNSSEC signer engine socket file */ #undef ODS_SE_SOCKFILE /* Shutdown message for the OpenDNSSEC signer client */ #undef ODS_SE_STOP_RESPONSE /* Default verbosity */ #undef ODS_SE_VERBOSITY /* Path to the OpenDNSSEC signer engine working directory */ #undef ODS_SE_WORKDIR /* Default number of worker threads for the OpenDNSSEC signer engine */ #undef ODS_SE_WORKERTHREADS /* Path to the OpenDNSSEC signer engine pid file */ #undef ODS_ZF_PIDFILE /* Path to the OpenDNSSEC configuration files */ #undef OPENDNSSEC_CONFIG_DIR /* Path to the main OpenDNSSEC configuration file */ #undef OPENDNSSEC_CONFIG_FILE /* Path to the OpenDNSSEC enforcer pid file */ #undef OPENDNSSEC_ENFORCER_PIDFILE /* Path to the OpenDNSSEC enforcer socket */ #undef OPENDNSSEC_ENFORCER_SOCKETFILE /* Number of worker threads for the enforcer */ #undef OPENDNSSEC_ENFORCER_WORKERTHREADS /* Path to the OpenDNSSEC enforcer engine working directory */ #undef OPENDNSSEC_ENFORCER_WORKINGDIR /* Path to the OpenDNSSEC internal zone list */ #undef OPENDNSSEC_ENFORCER_ZONELIST /* Path to the OpenDNSSEC zone fetcher pid file */ #undef OPENDNSSEC_FETCH_PIDFILE /* Path to the OpenDNSSEC data files */ #undef OPENDNSSEC_SCHEMA_DIR /* Path to the OpenDNSSEC signer cli */ #undef OPENDNSSEC_SIGNER_CLI /* Path to the OpenDNSSEC signer engine */ #undef OPENDNSSEC_SIGNER_ENGINE /* Path to the OpenDNSSEC signer pid file */ #undef OPENDNSSEC_SIGNER_PIDFILE /* Path to the OpenDNSSEC signer socket */ #undef OPENDNSSEC_SIGNER_SOCKET /* Path to the OpenDNSSEC var directory */ #undef OPENDNSSEC_STATE_DIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE /* Define to the type of arg 1 for `select'. */ #undef SELECT_TYPE_ARG1 /* Define to the type of args 2, 3 and 4 for `select'. */ #undef SELECT_TYPE_ARG234 /* Define to the type of arg 5 for `select'. */ #undef SELECT_TYPE_ARG5 /* Define if your platform breaks doing a seteuid before a setuid */ #undef SETEUID_BREAKS_SETUID /* Path to the OpenDNSSEC signer engine cli */ #undef SIGNER_CLI_UPDATE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* strptime is available from time.h with some defines. */ #undef STRPTIME_NEEDS_DEFINES /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Enable ldns ED25519 support */ #undef USE_ED25519 /* Enable ldns ED448 support */ #undef USE_ED448 /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Version number of package */ #undef VERSION /* Define to 1 if on MINIX. */ #undef _MINIX /* Enable functions on BSD */ #undef _NETBSD_SOURCE /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if doesn't define. */ #undef gid_t /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to `int' if does not define. */ #undef pid_t /* Define to rpl_realloc if the replacement function should be used. */ #undef realloc /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if doesn't define. */ #undef uid_t /* Define to the type of an unsigned integer type of width exactly 16 bits if such a type exists and the standard includes do not define it. */ #undef uint16_t /* Define as `fork' if `vfork' does not work. */ #undef vfork opendnssec-2.1.13/common/janitor.h0000644000077000001440000001030714446272525014000 00000000000000/* * Copyright (c) 2016-2018 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 JANITOR_H #define JANITOR_H #include "config.h" #include struct janitor_thread_struct; typedef struct janitor_thread_struct* janitor_thread_t; typedef void (*janitor_runfn_t)(void *); typedef void (*janitor_alertfn_t)(const char *format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 1, 2))) #endif ; extern void janitor_initialize(janitor_alertfn_t fatalalertfn, janitor_alertfn_t problemalertfn); struct janitor_threadclass_struct; typedef struct janitor_threadclass_struct* janitor_threadclass_t; #define janitor_threadclass_DEFAULT (NULL) extern int janitor_threadclass_create(janitor_threadclass_t* threadclassptr, const char* name); extern char* janitor_threadclass_name(janitor_threadclass_t threadclass); extern void janitor_threadclass_destroy(janitor_threadclass_t threadclass); extern void janitor_threadclass_setdetached(janitor_threadclass_t threadclass); extern void janitor_threadclass_setautorun(janitor_threadclass_t threadclass); extern void janitor_threadclass_setblockedsignals(janitor_threadclass_t threadclass); extern void janitor_threadclass_setminstacksize(janitor_threadclass_t threadclass, size_t minstacksize); extern int janitor_thread_create(janitor_thread_t* thread, janitor_threadclass_t threadclass, janitor_runfn_t func, void*data); extern void janitor_thread_start(janitor_thread_t thread); extern int janitor_thread_join(janitor_thread_t thread); extern int janitor_thread_tryjoinall(janitor_threadclass_t threadclass); extern void janitor_thread_joinall(janitor_threadclass_t threadclass); extern int janitor_disablecoredump(void); extern int janitor_trapsignals(char* argv0); extern void janitor_backtrace(void); extern char* janitor_backtrace_string(void); extern void janitor_backtrace_all(void); extern void janitor_thread_signal(janitor_thread_t thread); /* in case of missing pthread barrier calls */ #ifndef HAVE_PTHREAD_BARRIER_WAIT # ifdef pthread_barrier_init # undef pthread_barrier_init # endif # define pthread_barrier_init janitor_pthread_barrier_init # ifdef pthread_barrier_destroy # undef pthread_barrier_destroy # endif # define pthread_barrier_destroy janitor_pthread_barrier_destroy # ifdef pthread_barrier_wait # undef pthread_barrier_wait # endif # define pthread_barrier_wait janitor_pthread_barrier_wait # ifndef PTHREAD_BARRIER_SERIAL_THREAD # define PTHREAD_BARRIER_SERIAL_THREAD 1 # endif # ifdef pthread_barrier_t # undef pthread_barrier_t # endif # define pthread_barrier_t struct janitor_pthread_barrier_struct* # ifdef pthread_barrierattr_t # undef pthread_barrierattr_t # endif # define pthread_barrierattr_t void* #endif struct janitor_pthread_barrier_struct; extern int janitor_pthread_barrier_init(pthread_barrier_t* barrier, const pthread_barrierattr_t* attr, unsigned int count); extern int janitor_pthread_barrier_destroy(pthread_barrier_t* barrier); extern int janitor_pthread_barrier_wait(pthread_barrier_t* barrier); #endif opendnssec-2.1.13/common/locks.c0000644000077000001440000001677214446272525013454 00000000000000/* * Copyright (c) 2009-2018 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 "locks.h" #include "log.h" #include #include #include #include #include #include #include /* sigfillset(), sigprocmask() */ #include /* strerror() */ #include /* gettimeofday() */ static const char* lock_str = "lock"; int ods_thread_wait(pthread_cond_t* cond, pthread_mutex_t* lock, time_t wait) { struct timespec ts; if (wait <= 0) return pthread_cond_wait(cond, lock); if (clock_gettime(CLOCK_REALTIME, &ts) < 0) { ods_log_error("[%s] clock_gettime() error: %s", lock_str, strerror(errno)); return 1; } ts.tv_sec += wait; return pthread_cond_timedwait(cond, lock, &ts); } janitor_threadclass_t detachedthreadclass; janitor_threadclass_t workerthreadclass; janitor_threadclass_t handlerthreadclass; janitor_threadclass_t cmdhandlerthreadclass; struct alertbuffer_struct { char buffer[1024]; int index; }; static void alert(struct alertbuffer_struct* buffer, const char *format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 2, 3))) #endif ; static void alertsyslog(const char* format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 1, 2))) #endif ; inline static int alertoutput(struct alertbuffer_struct* buffer, int ch) { if (buffer->index < sizeof(buffer->buffer)) { buffer->buffer[buffer->index++] = ch; return 0; } else return -1; } static void alertinteger(struct alertbuffer_struct* buffer, unsigned long value, int base) { char ch; if (value > base - 1) alertinteger(buffer, value / base, base); ch = "0123456789abcdef"[value % base]; alertoutput(buffer, ch); } static void valert(struct alertbuffer_struct* buffer, const char* format, va_list args) { int idx; const char* stringarg; void* pointerarg; int integerarg; long longarg; idx = 0; while (format[idx]) { if (format[idx] == '%') { switch (format[idx + 1]) { case '%': alertoutput(buffer, '%'); idx += 2; break; case 's': stringarg = va_arg(args, char*); if (stringarg == NULL) stringarg = "(null)"; while(*stringarg) if(alertoutput(buffer, *(stringarg++))) break; idx += 2; break; case 'p': pointerarg = va_arg(args, void*); if (pointerarg == NULL) { stringarg = "(null)"; while(stringarg) alertoutput(buffer, *(stringarg++)); } else { alertoutput(buffer, '0'); alertoutput(buffer, 'x'); alertinteger(buffer, (unsigned long) pointerarg, 16); } idx += 2; break; case 'l': switch (format[idx + 2]) { case 'd': longarg = va_arg(args, long); if (longarg < 0) { alertoutput(buffer, '-'); alertinteger(buffer, 1UL + ~((unsigned long) longarg), 10); } else alertinteger(buffer, longarg, 10); idx += 3; break; case '\0': alertoutput(buffer, format[idx++]); break; default: alertoutput(buffer, format[idx++]); alertoutput(buffer, format[idx++]); alertoutput(buffer, format[idx++]); } break; case 'd': integerarg = va_arg(args, int); alertinteger(buffer, (long) integerarg, 10); idx += 2; break; case '\0': alertoutput(buffer, '%'); idx += 1; break; default: alertoutput(buffer, format[idx++]); alertoutput(buffer, format[idx++]); } } else { alertoutput(buffer, format[idx++]); } } } static void alertsyslog(const char* format, ...) { va_list args; struct alertbuffer_struct buffer; va_start(args, format); buffer.index = 0; valert(&buffer, format, args); va_end(args); if (buffer.index < sizeof(buffer.buffer)) { buffer.buffer[buffer.index] = '\0'; } else { strcpy(&buffer.buffer[buffer.index - strlen("...\n") -1], "...\n"); } (void)write(2, buffer.buffer, strlen(buffer.buffer)); syslog(LOG_CRIT, "%s", buffer.buffer); } void ods_janitor_initialize(char*argv0) { janitor_initialize(alertsyslog, ods_log_error); janitor_threadclass_create(&detachedthreadclass, "daemonthreads"); janitor_threadclass_setautorun(detachedthreadclass); janitor_threadclass_setblockedsignals(detachedthreadclass); janitor_threadclass_setdetached(detachedthreadclass); janitor_threadclass_setminstacksize(detachedthreadclass, ODS_MINIMUM_STACKSIZE); janitor_threadclass_create(&workerthreadclass, "workerthreads"); janitor_threadclass_setautorun(workerthreadclass); janitor_threadclass_setblockedsignals(workerthreadclass); janitor_threadclass_setminstacksize(workerthreadclass, ODS_MINIMUM_STACKSIZE); janitor_threadclass_create(&handlerthreadclass, "handlerthreads"); janitor_threadclass_setautorun(handlerthreadclass); janitor_threadclass_setminstacksize(handlerthreadclass, ODS_MINIMUM_STACKSIZE); janitor_threadclass_create(&cmdhandlerthreadclass, "cmdhandlerthreads"); janitor_threadclass_setautorun(cmdhandlerthreadclass); janitor_threadclass_setminstacksize(cmdhandlerthreadclass, ODS_MINIMUM_STACKSIZE); janitor_trapsignals(argv0); } opendnssec-2.1.13/common/duration.h0000644000077000001440000000766414446272525014173 00000000000000/* * Copyright (c) 2009-2018 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 #include /** * Duration. * */ typedef struct duration_struct duration_type; struct duration_struct { 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); /** * Set the duration based on a time_t. * \param[in] duration a duration_type pointer. * \param[in] time a time_t with the time to set. * \return non-zero on error, otherwise success. */ int duration_set_time(duration_type* duration, time_t time); /** * Return a random time. * \param[in] mod modulo * \return time_t random time * */ time_t ods_rand(time_t mod); /** * 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); /** * Set the time_now to a new value. * As long as this new value is later than the real now time * the overriden value is returned when time_now is called. * \param[in] now override for time_now * */ void set_time_now(time_t now); /** * Set the time_now to a new value. * As long as this new value is later than the real now time * the overriden value is returned when time_now is called. * \param[in] now override for time_now in either seconds since * epoch, or the format YYYY-mm-DD-HH:MM. * */ int set_time_now_str(char* now); /** * Return the time since Epoch, measured in seconds. * \return time_t now * */ 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-2.1.13/common/duration.c0000644000077000001440000003054414446272525014157 00000000000000/* * Copyright (c) 2009-2018 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. */ #include "status.h" #include "duration.h" #include "log.h" #include #include #include #include #include static const char* duration_str = "duration"; /** * Create a new 'instant' duration. * */ duration_type* duration_create(void) { duration_type* duration; CHECKALLOC(duration = (duration_type*) malloc(sizeof(duration_type))); duration->years = 0; duration->months = 0; duration->weeks = 0; duration->days = 0; duration->hours = 0; duration->minutes = 0; duration->seconds = 0; return duration; } /** * Compare durations. * */ int duration_compare(duration_type* d1, duration_type* d2) { if (!d1 && !d2) { return 0; } if (!d1 || !d2) { return d1?-1:1; } if (d1->years != d2->years) { return d1->years - d2->years; } if (d1->months != d2->months) { return d1->months - d2->months; } if (d1->weeks != d2->weeks) { return d1->weeks - d2->weeks; } if (d1->days != d2->days) { return d1->days - d2->days; } if (d1->hours != d2->hours) { return d1->hours - d2->hours; } if (d1->minutes != d2->minutes) { return d1->minutes - d2->minutes; } if (d1->seconds != d2->seconds) { return d1->seconds - d2->seconds; } return 0; } /** * Create a duration from string. * */ duration_type* duration_create_from_string(const char* str) { duration_type* duration = duration_create(); char* P, *X, *T, *W; int not_weeks = 0; if (!duration) { ods_log_error("[%s] cannot create from string %s: create failed", duration_str, str); return NULL; } if (!str) { return duration; } P = strchr(str, 'P'); if (!P) { ods_log_error("[%s] cannot create from string %s: P not found", duration_str, str); duration_cleanup(duration); return NULL; } T = strchr(str, 'T'); X = strchr(str, 'Y'); if (X) { duration->years = atoi(str+1); str = X; not_weeks = 1; } X = strchr(str, 'M'); if (X && (!T || (size_t) (X-P) < (size_t) (T-P))) { duration->months = atoi(str+1); str = X; not_weeks = 1; } X = strchr(str, 'D'); if (X) { duration->days = atoi(str+1); str = X; not_weeks = 1; } if (T) { str = T; not_weeks = 1; } X = strchr(str, 'H'); if (X && T) { duration->hours = atoi(str+1); str = X; not_weeks = 1; } X = strrchr(str, 'M'); if (X && T && (size_t) (X-P) > (size_t) (T-P)) { duration->minutes = atoi(str+1); str = X; not_weeks = 1; } X = strchr(str, 'S'); if (X && T) { duration->seconds = atoi(str+1); str = X; not_weeks = 1; } W = strchr(str, 'W'); if (W) { if (not_weeks) { ods_log_error("[%s] cannot create from string: parse error", duration_str); duration_cleanup(duration); return NULL; } else { duration->weeks = atoi(str+1); str = W; } } return duration; } /** * Get the number of digits in a number. * */ static size_t digits_in_number(time_t duration) { uint32_t period = (uint32_t) duration; size_t count = 0; if (!period) { return 1; } while (period > 0) { count++; period /= 10; } return count; } /** * Convert a duration to a string. * */ char* duration2string(duration_type* duration) { char* str = NULL, *num = NULL; size_t count = 2; int T = 0, D = 0; if (!duration) { return NULL; } if (duration->years > 0) { count = count + 1 + digits_in_number(duration->years); D = 1; } if (duration->months > 0) { count = count + 1 + digits_in_number(duration->months); D = 1; } if (duration->weeks > 0) { count = count + 1 + digits_in_number(duration->weeks); D = 1; } if (duration->days > 0) { count = count + 1 + digits_in_number(duration->days); D = 1; } if (duration->hours > 0) { count = count + 1 + digits_in_number(duration->hours); T = 1; } if (duration->minutes > 0) { count = count + 1 + digits_in_number(duration->minutes); T = 1; } if (duration->seconds > 0 || (!D && !duration->hours && !duration->minutes)) { count = count + 1 + digits_in_number(duration->seconds); T = 1; } if (T) { count++; } str = (char*) calloc(count, sizeof(char)); str[0] = 'P'; str[1] = '\0'; if (duration->years > 0) { count = digits_in_number(duration->years); num = (char*) calloc(count+2, sizeof(char)); if (num) { snprintf(num, count+2, "%uY", (uint32_t) duration->years); str = strncat(str, num, count+2); free((void*) num); } else { goto duration2string_num_calloc_failed; } } if (duration->months > 0) { count = digits_in_number(duration->months); num = (char*) calloc(count+2, sizeof(char)); if (num) { snprintf(num, count+2, "%uM", (uint32_t) duration->months); str = strncat(str, num, count+2); free((void*) num); } else { goto duration2string_num_calloc_failed; } } if (duration->weeks > 0) { count = digits_in_number(duration->weeks); num = (char*) calloc(count+2, sizeof(char)); if (num) { snprintf(num, count+2, "%uW", (uint32_t) duration->weeks); str = strncat(str, num, count+2); free((void*) num); } else { goto duration2string_num_calloc_failed; } } if (duration->days > 0) { count = digits_in_number(duration->days); num = (char*) calloc(count+2, sizeof(char)); if (num) { snprintf(num, count+2, "%uD", (uint32_t) duration->days); str = strncat(str, num, count+2); free((void*) num); } else { goto duration2string_num_calloc_failed; } } if (T) { str = strncat(str, "T", 1); } if (duration->hours > 0) { count = digits_in_number(duration->hours); num = (char*) calloc(count+2, sizeof(char)); if (num) { snprintf(num, count+2, "%uH", (uint32_t) duration->hours); str = strncat(str, num, count+2); free((void*) num); } else { goto duration2string_num_calloc_failed; } } if (duration->minutes > 0) { count = digits_in_number(duration->minutes); num = (char*) calloc(count+2, sizeof(char)); if (num) { snprintf(num, count+2, "%uM", (uint32_t) duration->minutes); str = strncat(str, num, count+2); free((void*) num); } else { goto duration2string_num_calloc_failed; } } if (duration->seconds > 0 || (!D && !duration->hours && !duration->minutes)) { count = digits_in_number(duration->seconds); num = (char*) calloc(count+2, sizeof(char)); if (num) { snprintf(num, count+2, "%uS", (uint32_t) duration->seconds); str = strncat(str, num, count+2); free((void*) num); } else { goto duration2string_num_calloc_failed; } } return str; duration2string_num_calloc_failed: ods_log_error("[%s] cannot create string: malloc error", duration_str); free((void*) str); return NULL; } /** * Convert a duration to a time. * */ time_t duration2time(duration_type* duration) { time_t period = 0; char* dstr = NULL; if (duration) { period += (duration->seconds); period += (duration->minutes)*60; period += (duration->hours)*3600; period += (duration->days)*86400; period += (duration->weeks)*86400*7; period += (duration->months)*86400*31; period += (duration->years)*86400*365; if (duration->months || duration->years) { /* [TODO] calculate correct number of days in this month/year */ dstr = duration2string(duration); free((void*) dstr); } } return period; } /** * Set the duration based on a time_t. */ int duration_set_time(duration_type* duration, time_t time) { if (!duration) { return 1; } duration->years = time / (86400*365); time -= duration->years * 86400*365; duration->months = time / (86400*31); time -= duration->months * 86400*31; duration->days = time / 86400; time -= duration->days * 86400; duration->hours = time / 3600; time -= duration->hours * 3600; duration->minutes = time / 60; time -= duration->minutes * 60; duration->seconds = time; duration->weeks = 0; return 0; } /** * Return a random time. * */ time_t ods_rand(time_t mod) { #ifdef HAVE_ARC4RANDOM_UNIFORM return (time_t) (arc4random_uniform((uint32_t) mod+1)); #elif HAVE_ARC4RANDOM return (time_t) (arc4random() % (unsigned) mod+1); #else return (time_t) (random() % (unsigned) mod+1); #endif } static time_t time_now_set = 0; /** * Set the time_now to a new value. * As long as this value is later than the real time now * the overriden value is returned. * */ void set_time_now(time_t now) { time_now_set = now; } int set_time_now_str(char* time_arg) { char* endptr; time_t epoch; struct tm tm; if (time_arg == NULL) { epoch = 0; } else if (strptime(time_arg, "%Y-%m-%d-%H:%M:%S", &tm)) { tm.tm_isdst = -1; /* OS handles daylight savings */ epoch = mktime(&tm); } else { while (isspace(*time_arg)) ++time_arg; epoch = strtol(time_arg, &endptr, 0); if (endptr != time_arg) { while (isspace(*endptr)) ++endptr; if (*endptr != '\0') return -1; } else return -2; } set_time_now(epoch); return 0; } /** * Return the time since Epoch, measured in seconds. * */ time_t time_now(void) { return time_now_set ? time_now_set: time(NULL); } /** * copycode: This code is based on the EXAMPLE in the strftime manual. * */ uint32_t time_datestamp(time_t tt, const char* format, char** str) { time_t t; struct tm datetime; struct tm *tmp; uint32_t ut = 0; char outstr[32]; if (tt) { t = tt; } else { t = time_now(); } tmp = localtime_r(&t,&datetime); if (tmp == NULL) { ods_log_error("[%s] time_datestamp: localtime_r() failed", duration_str); return 0; } if (strftime(outstr, sizeof(outstr), format, tmp) == 0) { ods_log_error("[%s] time_datestamp: strftime() failed", duration_str); return 0; } ut = (uint32_t) strtoul(outstr, NULL, 10); if (str) { *str = strdup(outstr); } return ut; } /** * Clean up duration. * */ void duration_cleanup(duration_type* duration) { if (!duration) { return; } free(duration); } opendnssec-2.1.13/common/utilities.c0000644000077000001440000000536514446272525014350 00000000000000/* * Copyright (c) 2021 A.W. van Halderen * 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 "utilities.h" functioncast_type functioncast(void*generic) { functioncast_type* function = (functioncast_type*)&generic; return *function; } int clamp(int value, int lbnd, int ubnd) { if(value < lbnd) return lbnd; else if(value > ubnd) return ubnd; else return value; } #ifdef __amd64 unsigned long long int rnd(void) { unsigned long long int foo; int cf_error_status; asm("rdrand %%rax; \ mov $1,%%edx; \ cmovae %%rax,%%rdx; \ mov %%edx,%1; \ mov %%rax, %0;":"=r"(foo),"=r"(cf_error_status)::"%rax","%rdx"); return (!cf_error_status ? 0 : foo); } #endif int alloc(void* p, size_t size, int* countptr, int newcount) { char** ptr = (char**)p; char* newptr; if(*ptr == NULL) { *ptr = malloc(size * newcount); if(*ptr) { if(countptr) *countptr = newcount; return 0; } else { if(countptr) *countptr = 0; return -1; } } else { newptr = realloc(*ptr, size * newcount); if(newptr) { if(countptr) { if(newcount > *countptr) memset(&newptr[size*(*countptr)], 0, size * (newcount - *countptr)); *countptr = newcount; } *ptr = newptr; return 0; } else return -1; } } char* dupstr(const char* ptr) { return (ptr ? strdup(ptr) : NULL); } opendnssec-2.1.13/common/file.c0000644000077000001440000003236514446272525013254 00000000000000/* * Copyright (c) 2009-2018 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 "file.h" #include "log.h" #include "clientpipe.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; } /** * 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[0]?openf:"(null)", ods_file_mode2str(mode), strerror(errno)); } else { file_count++; ods_log_debug("[%s] openfile %s count %u", file_str, openf[0]?openf:"(null)", file_count); } } free((void*) openf); } return fd; } /** * Close a file. * */ void ods_fclose(FILE* fd) { if (fd) { file_count--; fclose(fd); } } /** * 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 (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) { nwritten = 0; /* and call write again */ } else { return -1; /* error */ } } nleft -= nwritten; ptr += nwritten; } return n; } ssize_t ods_writeln(int fd, char const *str) { size_t len = strlen(str); if (ods_writen(fd, str, len) == -1 || ods_writen(fd, "\n", 1) == -1) return -1; return len+1; } /** * 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 0; } 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, long startpos, int append) { 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 (append) { fout = open(file2, O_WRONLY|O_APPEND|O_CREAT, 0666); } else { fout = open(file2, O_WRONLY|O_TRUNC|O_CREAT, 0666); } if (fout < 0) { close(fin); return ODS_STATUS_FOPEN_ERR; } ods_log_debug("[%s] lseek file %s pos %ld", file_str, file1, startpos); if (lseek(fin, startpos, SEEK_SET) < 0) { close(fin); close(fout); return ODS_STATUS_FSEEK_ERR; } while (1) { read_size = read(fin, buf, sizeof(buf)); if (read_size == 0) { break; } if (read_size < 0) { ods_log_error("[%s] read file %s error %s", file_str, file1, strerror(errno)); close(fin); close(fout); return ODS_STATUS_FREAD_ERR; } if (write(fout, buf, (unsigned int) read_size) < 0) { ods_log_error("[%s] write file %s error %s", file_str, file1, strerror(errno)); 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); } } /** * 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; } } opendnssec-2.1.13/common/privdrop.h0000644000077000001440000000447714446272525014212 00000000000000/* * 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. * */ /** * * Privileges. */ #ifndef SHARED_PRIVDROP_H #define SHARED_PRIVDROP_H #include #include #include "status.h" /** * Get the group identifier from a group name. * \param[in] groupname group name * \return gid_t group identifier * */ gid_t privgid(const char* groupname); /** * Get the user identifier from a username. * \param[in] username username * \return uid_t user identifier * */ uid_t privuid(const char* username); /** * Drop privileges. * \param[in] username drop priviliges to this user * \param[in] groupname drop priviliges to this group * \param[in] newroot make this the new root directory * \param[out] puid user id * \param[out] pgid group id * \return ods_status status. * */ ods_status privdrop(const char *username, const char *groupname, const char *newroot, uid_t* puid, gid_t* pgid); /** * Close privdrop. * \param[in] username username * \param[in] groupname group name * */ void privclose(const char* username, const char* groupname); #endif /* SHARED_PRIVDROP_H */ opendnssec-2.1.13/common/status.c0000644000077000001440000001056714446272525013660 00000000000000/* * Copyright (c) 2009-2018 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. */ #include "config.h" #include "status.h" #include ods_lookup_table ods_status_str[] = { { ODS_STATUS_OK, "All OK" }, { ODS_STATUS_EOF, "End of file" }, { ODS_STATUS_NOTIMPL, "Not implemented"}, { ODS_STATUS_ASSERT_ERR, "Assertion error"}, { ODS_STATUS_CFG_ERR, "Configuration error"}, { ODS_STATUS_CHDIR_ERR, "Change directory failed"}, { ODS_STATUS_CHROOT_ERR, "Change root failed"}, { ODS_STATUS_CMDHANDLER_ERR, "Command handler error"}, { ODS_STATUS_XFRHANDLER_ERR, "XFR handler error"}, { ODS_STATUS_CONFLICT_ERR, "Conflict detected"}, { ODS_STATUS_ERR, "General error"}, { ODS_STATUS_FOPEN_ERR, "Unable to open file"}, { ODS_STATUS_FSEEK_ERR, "fseek() failed"}, { ODS_STATUS_FORK_ERR, "fork() failed"}, { ODS_STATUS_FREAD_ERR, "Unable to read file"}, { ODS_STATUS_FWRITE_ERR, "Unable to write file"}, { ODS_STATUS_HSM_ERR, "HSM error"}, { ODS_STATUS_INSECURE, "Insecure"}, { ODS_STATUS_MALLOC_ERR, "Memory allocation error"}, { ODS_STATUS_RENAME_ERR, "Unable to rename file"}, { ODS_STATUS_UNLINK_ERR, "Unable to unlink file"}, { ODS_STATUS_SOCK_BIND, "Unable to bind socket"}, { ODS_STATUS_SOCK_FCNTL_NONBLOCK, "Unable to set socket to nonblocking"}, { ODS_STATUS_SOCK_GETADDRINFO, "Unable to retrieve address information"}, { ODS_STATUS_SOCK_LISTEN, "Unable to listen on socket"}, { ODS_STATUS_SOCK_SETSOCKOPT_V6ONLY, "Unable to set socket to v6only"}, { ODS_STATUS_SOCK_SOCKET_UDP, "Unable to create udp socket"}, { ODS_STATUS_SOCK_SOCKET_TCP, "Unable to create tcp socket"}, { ODS_STATUS_ACL_SUBNET_BAD_RANGE, "Bad subnet range"}, { ODS_STATUS_ACL_SUBNET_OUT_RANGE, "Subnet out of range"}, { ODS_STATUS_PARSE_ERR, "Parse error"}, { ODS_STATUS_PRIVDROP_ERR, "Unable to drop privileges"}, { ODS_STATUS_RNG_ERR, "RelaxNG error"}, { ODS_STATUS_SETSID_ERR, "setsid() failed"}, { ODS_STATUS_UNCHANGED, "Status unchanged"}, { ODS_STATUS_WRITE_PIDFILE_ERR, "Unable to write process id to pidfile"}, { ODS_STATUS_XML_ERR, "XML error"}, { ODS_STATUS_XFR_NOT_READY, "Incoming zone transfer not ready"}, { ODS_STATUS_SKIPDNAME, "Failed to skip domain name"}, { ODS_STATUS_BUFAVAIL, "Insufficient space available in buffer"}, { ODS_STATUS_PARSESOA, "Failed to parse SOA RR"}, { ODS_STATUS_REQAXFR, "Got IXFR, but AXFR required"}, { ODS_STATUS_INSERIAL, "Serial mismatch"}, { ODS_STATUS_XFRBADFORM, "XFR bad format"}, { ODS_STATUS_XFRINCOMPLETE, "XFR on disk incomplete (in progress?)"}, { ODS_STATUS_DB_ERR , "Database error"}, { 0, NULL } }; ods_lookup_table* ods_lookup_by_id(ods_lookup_table *table, int id) { while (table->name != NULL) { if (table->id == id) { return table; } table++; } return NULL; } /** * Look up a descriptive text by each status. * */ const char * ods_status2str(ods_status status) { ods_lookup_table *lt; lt = ods_lookup_by_id(ods_status_str, status); if (lt) { return lt->name; } return "(Error code unknown)"; } opendnssec-2.1.13/common/cmdhandler.c0000644000077000001440000005014714446272525014434 00000000000000/* * 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 "config.h" #include #include #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 #include #include "file.h" #include "str.h" #include "locks.h" #include "log.h" #include "status.h" #include "util.h" #include "clientpipe.h" #include "cmdhandler.h" #include "longgetopt.h" static char const * module_str = "cmdhandler"; static struct cmd_func_block* findcommand(const char *arg, int argc, char* argv[], int argi, struct cmd_func_block** commands, void* user) { const char* cmdname; struct cmd_func_block* command = NULL; for(int i=0; commands[i]; i++) { cmdname = commands[i]->name; int match = 1; int ncmdwords = 0; if(commands[i]->handles) { match = commands[i]->handles(arg); } else if(commands[i]->names) { while(match && commands[i]->names[ncmdwords]) { if(strcmp(argv[argi+ncmdwords], commands[i]->names[ncmdwords])) { match = 0; break; } else if(argi+ncmdwords >= argc) { match = 0; break; } else ++ncmdwords; } } else { while(match && *cmdname && argi+ncmdwords < argc) { char* nextcmdname = strchr(cmdname,' '); if(nextcmdname) { if(strncmp(argv[argi+ncmdwords], cmdname, nextcmdname-cmdname) || argv[argi+ncmdwords][nextcmdname-cmdname]==' ') { match = 0; break; } else if(argi+ncmdwords >= argc) { match = 0; break; } else { cmdname = strchr(cmdname,' ') + 1; ++ncmdwords; } } else { if(strcmp(argv[argi+ncmdwords], cmdname)) { match = 0; break; } else { cmdname = ""; ++ncmdwords; } } } if(match && *cmdname) match = 0; } if(match) { command = commands[i]; argi += ncmdwords; break; } } return command; } static struct option genericoptions[] = { { NULL, 0, NULL, 0 } }; static int cmdhandler_perform_command(const char *arg, struct cmdhandler_ctx_struct* context) { struct cmd_func_block** commands = context->cmdhandler->commands; void* user = NULL; char** errormessageptr = NULL; int status = 0; char* statusstr = NULL; int help = 0;; int version = 0; int opt; int longindex; int argc; char** argv; int argi; struct longgetopt optctx; struct cmd_func_block* command = NULL; int verbosity = 0; if (strlen(arg) == 0) return 0; strtoargs(arg, &argc, &argv); for(opt = longgetopt(argc, argv, "+vh", genericoptions, &longindex, &optctx); opt != -1; opt = longgetopt(argc, argv, NULL, genericoptions, &longindex, &optctx)) { switch(opt) { case 'v': ++verbosity; break; case 1: // --verbosity verbosity = atoi(optctx.optarg); break; case 'h': help = 1; break; case 2: // --version version = 1; break; } } argi = optctx.optind; if(!help && !version) { if (argi >= argc) { asprintf(&statusstr, "unknown generic arguments"); } if(!strcmp(argv[argi], "help")) { help = 1; } else if(!strcmp(argv[argi], "version")) { version = 1; } } if(help) { for(int i=0; commands[i]; i++) if(commands[i]->name && !strcmp("help",commands[i]->name)) { command = commands[i]; break; } } else if(version) { for(int i=0; commands[i]; i++) if(commands[i]->name && !strcmp("version",commands[i]->name)) { command = commands[i]; break; } } else { command = findcommand(arg, argc, argv, argi, commands, user); } if(command) { if(command->runargs) { status = command->runargs(context, argc-argi, &argv[argi]); } else { char *buf; if (!(buf = strdup(arg))) { asprintf(&statusstr, "memory error"); return 1; } status = command->runarg(context, buf); if (status == -1) { /* Syntax error, print usage for cmd */ if(!statusstr) asprintf(&statusstr, "Error parsing arguments %s command line %s", command->name, arg); } free(buf); } } else { client_printf_err(context->sockfd, "Unknown command %s\n", argv[argi]); /* Unhandled command, print general error */ if(!strcmp(argv[argi], "help")) { if(argi+1help) { status = 0; client_printf(context->sockfd, "Usage:\n"); command->usage(context->sockfd); client_printf(context->sockfd, "\nHelp:\n"); command->help(context->sockfd); } else if(command->usage) { status = 0; client_printf(context->sockfd, "Usage:\n"); command->usage(context->sockfd); } else { status = 1; asprintf(&statusstr, "no help for command %s.", arg); } } else { client_printf(context->sockfd, "Help: command '%s' unknown. Type 'help' without arguments to get a list of supported commands.\n", argv[argi+1]); } } else { status = 0; for(int i=0; commands[i]; i++) { if(commands[i]->usage) commands[i]->usage(context->sockfd); } } } else { status = 1; asprintf(&statusstr, "Unknown command %s.", arg); for(int i=0; commands[i]; i++) { if(commands[i]->usage) commands[i]->usage(context->sockfd); } } goto exit; } exit: free(argv); if(errormessageptr) { *errormessageptr = statusstr; } else if(statusstr) { fprintf(stderr,"%s\n",statusstr); free(statusstr); } return status; } /** * Consume a message from the buffer * * Read all complete messages in the buffer or until exit code is set. * Messages larger than ODS_SE_MAXLINE can be handled but will be * truncated. On exit pos will indicate new position in buffer. when * returning true an exit code is set. * * \param buf, buffer containing user input. Must not be NULL. * \param[in|out] pos, count of meaningful octets in buf. Must not be * NULL or exceed buflen. * \param buflen, capacity of buf. Must not exceed ODS_SE_MAXLINE. * \param[out] exitcode, exit code for client, only meaningful on * return 1. Must not be NULL. * \param sockfd, pipe to client. * \param engine, central enigine object * \return 0: waiting for more data. 1: exit code is set. */ static int extract_msg(char* buf, int *pos, int buflen, int *exitcode, struct cmdhandler_ctx_struct* context) { char data[ODS_SE_MAXLINE+1], opc; uint16_t datalen; assert(exitcode); assert(buf); assert(pos); assert(*pos <= buflen); assert(ODS_SE_MAXLINE >= buflen); while (1) { if (*pos < 3) return 0; opc = buf[0]; /* Do a memcpy instead of a cast in order to not break memory alignment * requirements on some targets. */ memcpy(&datalen, &buf[1], 2); datalen = ntohs(datalen); if (datalen+3 <= *pos) { /* a complete message */ memset(data, 0, ODS_SE_MAXLINE+1); memcpy(data, buf+3, datalen); *pos -= datalen+3; memmove(buf, buf+datalen+3, *pos); ods_str_trim(data, 0); if (opc == CLIENT_OPC_STDIN) { *exitcode = cmdhandler_perform_command(data, context); return 1; } } else if (datalen+3 > buflen) { /* Message is not going to fit! Discard the data already recvd */ ods_log_error("[%s] Message received to big, truncating.", module_str); datalen -= *pos - 3; /* Do a memcpy instead of a cast in order to not break memory * alignment requirements on some targets. */ datalen = htons(datalen); memcpy(&buf[1], &datalen, 2); *pos = 3; return 0; } else { /* waiting for more data */ return 0; } } } /** * Handle a client command. * \param cmdc, command handler data, must not be NULL */ static void cmdhandler_handle_client_conversation(struct cmdhandler_ctx_struct* context) { char buf[ODS_SE_MAXLINE+4]; /* enough space for hdr and \0 */ int bufpos, r, numread; int exitcode = 0; bufpos = 0; for (;;) { numread = read(context->sockfd, &buf[bufpos], ODS_SE_MAXLINE - bufpos + 3); if (numread == 0) { /* client closed pipe */ break; } else if (numread < 0) { if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) { continue; } else if (errno == ECONNRESET) { ods_log_debug("[%s] done handling client: %s", module_str, strerror(errno)); break; } else { /* error occured */ ods_log_error("[%s] read error: %s", module_str, strerror(errno)); break; } } else { bufpos += numread; r = extract_msg(buf, &bufpos, ODS_SE_MAXLINE, &exitcode, context); if (r == -1) { ods_log_error("[%s] Error receiving message from client.", module_str); break; } else if (r == 1) { if (!client_exit(context->sockfd, exitcode)) { ods_log_error("[%s] Error sending message to client.", module_str); } } } } } /** * Accept client. * */ static void cmdhandler_accept_client(void* arg) { int err; cmdhandler_ctx_type* context = (cmdhandler_ctx_type*) arg; ods_log_debug("[%s] accept client %i", module_str, context->sockfd); if (context->cmdhandler->createlocalcontext) { context->localcontext = context->cmdhandler->createlocalcontext(context->globalcontext); if (!context->localcontext) { client_printf_err(context->sockfd, "Failed to open DB connection.\n"); client_exit(context->sockfd, 1); return; } } cmdhandler_handle_client_conversation(context); if (context->sockfd) { shutdown(context->sockfd, SHUT_RDWR); close(context->sockfd); } if (context->cmdhandler->destroylocalcontext) { context->cmdhandler->destroylocalcontext(context->localcontext); } free(context); } /** * Create command handler. * */ cmdhandler_type* cmdhandler_create(const char* filename, struct cmd_func_block** commands, void* globalcontext, void*(*createlocalcontext)(void*globalcontext),void(*destroylocalcontext)(void*localcontext)) { cmdhandler_type* cmdh = NULL; struct sockaddr_un servaddr; int listenfd = 0; int flags = 0; int ret = 0; if (!filename) { ods_log_error("[%s] unable to create: no socket filename", module_str); return NULL; } /* new socket */ ods_log_debug("[%s] create socket %s", module_str, filename); listenfd = socket(AF_UNIX, SOCK_STREAM, 0); if (listenfd < 0) { ods_log_error("[%s] unable to create cmdhandler: socket() failed: %s", module_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", module_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", module_str, strerror(errno)); close(listenfd); return NULL; } 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, sizeof(struct sockaddr_un)); if (ret != 0) { ods_log_error("[%s] unable to create cmdhandler: bind() failed: %s", module_str, strerror(errno)); close(listenfd); return NULL; } ret = listen(listenfd, 5); if (ret != 0) { ods_log_error("[%s] unable to create cmdhandler: listen() failed: %s", module_str, strerror(errno)); close(listenfd); return NULL; } CHECKALLOC(cmdh = (cmdhandler_type*) malloc(sizeof(cmdhandler_type))); cmdh->listen_fd = listenfd; cmdh->listen_addr = servaddr; cmdh->need_to_exit = 0; cmdh->stopped = 0; cmdh->commands = commands; cmdh->globalcontext = globalcontext; cmdh->createlocalcontext = createlocalcontext; cmdh->destroylocalcontext = destroylocalcontext; return cmdh; } /** * Cleanup command handler. * */ void cmdhandler_cleanup(cmdhandler_type* cmdhandler) { if (cmdhandler) { if (cmdhandler->listen_fd >= 0) close(cmdhandler->listen_fd); free(cmdhandler); } } /** * Start command handler. * */ void cmdhandler_start(cmdhandler_type* cmdhandler) { struct sockaddr_un cliaddr; socklen_t clilen; cmdhandler_ctx_type* cmdclient; janitor_thread_t cmdclientthread; fd_set rset; int flags, connfd = 0, ret = 0; ssize_t i; ods_log_assert(cmdhandler); ods_log_debug("[%s] start", module_str); 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); /* Don't handle new connections when need to exit, this * removes the delay of the self_pipe_trick*/ /* Opportunistic join threads LIFO. */ janitor_thread_tryjoinall(cmdhandlerthreadclass); if (cmdhandler->need_to_exit) break; if (ret < 0) { if (errno != EINTR && errno != EWOULDBLOCK) { ods_log_warning("[%s] select() error: %s", module_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", module_str, strerror(errno)); } continue; } /* Explicitely set to blocking, on BSD they would inherit * O_NONBLOCK from parent */ flags = fcntl(connfd, F_GETFL, 0); if (flags < 0) { ods_log_error("[%s] unable to create, fcntl(F_GETFL) failed: %s", module_str, strerror(errno)); close(connfd); continue; } if (fcntl(connfd, F_SETFL, flags & ~O_NONBLOCK) < 0) { ods_log_error("[%s] unable to create, fcntl(F_SETFL) failed: %s", module_str, strerror(errno)); close(connfd); continue; } /* client accepted, create new thread */ cmdclient = malloc(sizeof(cmdhandler_ctx_type)); cmdclient->cmdhandler = cmdhandler; cmdclient->sockfd = connfd; cmdclient->globalcontext = cmdhandler->globalcontext; cmdclient->localcontext = NULL; janitor_thread_create(&cmdclientthread, cmdhandlerthreadclass, &cmdhandler_accept_client, (void*) cmdclient); } } /* join threads */ janitor_thread_joinall(cmdhandlerthreadclass); ods_log_debug("[%s] done", module_str); cmdhandler->stopped = 1; } /** * Self pipe trick (see Unix Network Programming). * */ static int self_pipe_trick(cmdhandler_type* cmdhandler) { int sockfd, ret; sockfd = socket(AF_UNIX, SOCK_STREAM, 0); if (sockfd < 0) { ods_log_error("[engine] cannot connect to command handler: " "socket() failed: %s\n", strerror(errno)); return 1; } else { ret = connect(sockfd, (const struct sockaddr*) &cmdhandler->listen_addr, sizeof(cmdhandler->listen_addr)); if (ret != 0) { ods_log_error("[engine] cannot connect to command handler: " "connect() failed: %s\n", strerror(errno)); close(sockfd); return 1; } else { /* self-pipe trick */ client_printf(sockfd, ""); close(sockfd); } } return 0; } /** * Stop command handler. * */ void cmdhandler_stop(cmdhandler_type* cmdhandler) { ods_log_debug("[engine] stop command handler"); cmdhandler->need_to_exit = 1; if (self_pipe_trick(cmdhandler) == 0) { while (!cmdhandler->stopped) { ods_log_debug("[engine] waiting for command handler to exit..."); sleep(1); } } else { ods_log_error("[engine] command handler self pipe trick failed, " "unclean shutdown"); } janitor_thread_join(cmdhandler->thread_id); } const char* ods_check_command(const char *cmd, const char *scmd) { size_t ncmd = strlen(scmd); if (strncmp(cmd, scmd, ncmd) != 0 ) return NULL; else if (cmd[ncmd] == '\0') return &cmd[ncmd]; else if (cmd[ncmd] != ' ') return NULL; else return &cmd[ncmd+1]; } opendnssec-2.1.13/common/util.h0000644000077000001440000000671114446272525013313 00000000000000/* * 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. */ #ifndef UTIL_UTIL_H #define UTIL_UTIL_H #include "config.h" #include "status.h" #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_UNISTD_H # include #endif #include #define SE_SOA_RDATA_SERIAL 2 #define SE_SOA_RDATA_EXPIRE 5 #define SE_SOA_RDATA_MINIMUM 6 /* copycode: This define is taken from BIND9 */ #define DNS_SERIAL_GT(a, b) ((int)(((a) - (b)) & 0xFFFFFFFF) > 0) /** * Check if a RR is a DNSSEC RR (RRSIG, NSEC, NSEC3 or NSEC3PARAMS). * \param[in] rr RR * \return int 1 on true, 0 on false * */ int util_is_dnssec_rr(ldns_rr* rr); /** * Compare SERIALs. * \param serial_new new SERIAL value * \param serial_old old SERIAL value * \return int 0 if the new SERIAL <= old SERIAL, non-zero otherwise * */ int util_serial_gt(uint32_t serial_new, uint32_t serial_old); /** * Compare RRs only on RDATA. * \param[in] rr1 RR * \param[in] rr2 another RR * \param[out] cmp compare value * \return status compare status * */ ldns_status util_dnssec_rrs_compare(ldns_rr* rr1, ldns_rr* rr2, int* cmp); /** * Check process id file. * \param[in] pidfile pid filename * \return int status (0 if process id in pidfile is running) * */ int util_check_pidfile(const char* pidfile); /** * Write process id to file. * \param[in] pidfile pid filename * \param[in] pid process id * \return int status * */ int util_write_pidfile(const char* pidfile, pid_t pid); /** * Print an LDNS RR, check status. * \param[in] fd file descriptor * \param[in] rr RR * \return ods_status status * */ ods_status util_rr_print(FILE* fd, const ldns_rr* rr); /** * Calculates the size needed to store the result of b64_pton. * \param[in] len strlen * \return size of b64_pton * */ size_t util_b64_pton_calculate_size(size_t srcsize); /** * Check pidfile * * Try to read PID file to see if an other instance is already running. * If pidfile not found or process is not running exit success. Note: * upon failures reading the file * * \param pidfile: file to check. * \return 1 pidfile does not exist or process not running. 0 otherwise. */ int util_pidfile_avail(const char* pidfile); #endif /* UTIL_UTIL_H */ opendnssec-2.1.13/common/log.h0000644000077000001440000001242514446272525013116 00000000000000/* * 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. * */ /** * Log wrapper. * */ #ifndef SHARED_LOG_H #define SHARED_LOG_H #include "config.h" #include #include #ifdef HAVE_SYSLOG_H #include /* strncasecmp() */ #include /* openlog(), closelog(), syslog() */ #else /* !HAVE_SYSLOG_H */ #define LOG_EMERG 0 /* ods_fatal_exit */ #define LOG_ALERT 1 /* ods_log_alert */ #define LOG_CRIT 2 /* ods_log_crit */ #define LOG_ERR 3 /* ods_log_error */ #define LOG_WARNING 4 /* ods_log_warning */ #define LOG_NOTICE 5 /* ods_log_info */ #define LOG_INFO 6 /* ods_log_verbose */ #define LOG_DEBUG 7 /* ods_log_debug */ #endif /* HAVE_SYSLOG_H */ #define LOG_DEEEBUG 8 /* ods_log_deeebug */ /** * Initialize logging. * \param[in] program_name identifying name used in logging (normally the running program name) * \param[in] use_syslog: use syslog(3) * \param[in] target_name name of the facilty in case of logging through syslog or otherwise a filename * \param[in] verbosity: log level * */ void ods_log_init(const char *program_name, int use_syslog, const char *target_name, int verbosity); /** * Current verbosity * */ int ods_log_verbosity(void); void ods_log_setverbosity(int verbosity); /** * Close logging. * */ void ods_log_close(void); /** * Get the facility by string. * \param[in] facility string based facility * \return int facility * */ int ods_log_get_facility(const char* facility, int* error); /** * Get the log level. * \return int log_level * */ int ods_log_get_level(void); /** * Heavy debug loggin. * \param[in] format printf-style format string, arguments follow * */ void ods_log_deeebug(const char *format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 1, 2))) #endif ; /** * Log debug. * \param[in] format printf-style format string, arguments follow * */ void ods_log_debug(const char *format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 1, 2))) #endif ; /** * Log verbose. * \param[in] format printf-style format string, arguments follow * */ void ods_log_verbose(const char *format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 1, 2))) #endif ; /** * Log informational messages. * \param[in] format printf-style format string, arguments follow * */ void ods_log_info(const char *format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 1, 2))) #endif ; /** * Log warnings. * \param[in] format printf-style format string, arguments follow * */ void ods_log_warning(const char *format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 1, 2))) #endif ; /** * Log errors. * \param[in] format printf-style format string, arguments follow * */ void ods_log_error(const char *format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 1, 2))) #endif ; /** * Log errors. * \param[in] format printf-style format string, arguments follow * \param[in] args list of arguments already started with va_start * */ void ods_log_verror(const char *format, va_list args); /** * Log criticals. * \param[in] format printf-style format string, arguments follow * */ void ods_log_crit(const char *format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 1, 2))) #endif ; /** * Log alerts. * \param[in] format printf-style format string, arguments follow * */ void ods_log_alert(const char *format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 1, 2))) #endif ; /** * Log critical errors and exit. * \param[in] format printf-style format string, arguments follow * */ void ods_fatal_exit(const char *format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 1, 2))) #endif ; /** * Log assertion. * */ #define ODS_LOG_DEBUG 1 #ifdef ODS_LOG_DEBUG #define ods_log_assert(x) \ do { if(!(x)) \ ods_fatal_exit("%s:%d: %s: assertion %s failed", \ __FILE__, __LINE__, __func__, #x); \ } while(0); #else #define ods_log_assert(x) #endif #endif /* SHARED_LOG_H */ opendnssec-2.1.13/common/compat.h0000644000077000001440000000346614446272525013625 00000000000000/* * Copyright (c) 2010 .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" #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_STDINT_H #include #endif #ifndef HAVE_STRLCAT size_t strlcat(char *dst, const char *src, size_t siz); #endif #ifndef HAVE_STRLCPY size_t strlcpy(char *dst, const char *src, size_t siz); #endif #ifndef B64_PTON int b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize); #endif #ifndef B64_NTOP int b64_pton(char const *src, uint8_t *target, size_t targsize); #endif opendnssec-2.1.13/common/Makefile.in0000644000077000001440000007104414446272532014231 00000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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@ target_triplet = @target@ subdir = common 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_dlopen.m4 \ $(top_srcdir)/m4/acx_enforcer_database.m4 \ $(top_srcdir)/m4/acx_ldns.m4 $(top_srcdir)/m4/acx_libc.m4 \ $(top_srcdir)/m4/acx_libreadline.m4 \ $(top_srcdir)/m4/acx_libxml2.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_ssl.m4 \ $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 \ $(top_srcdir)/m4/ax_lib_sqlite3.m4 \ $(top_srcdir)/m4/ax_prepend_flag.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.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)/m4/pkg.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libcompat_a_AR = $(AR) $(ARFLAGS) libcompat_a_LIBADD = am__dirstamp = $(am__leading_dot)dirstamp am_libcompat_a_OBJECTS = b64_ntop.$(OBJEXT) b64_pton.$(OBJEXT) \ clientpipe.$(OBJEXT) duration.$(OBJEXT) file.$(OBJEXT) \ locks.$(OBJEXT) log.$(OBJEXT) privdrop.$(OBJEXT) \ pselect.$(OBJEXT) status.$(OBJEXT) str.$(OBJEXT) \ strlcat.$(OBJEXT) strlcpy.$(OBJEXT) util.$(OBJEXT) \ datastructure.$(OBJEXT) scheduler/schedule.$(OBJEXT) \ scheduler/task.$(OBJEXT) scheduler/fifoq.$(OBJEXT) \ scheduler/worker.$(OBJEXT) scheduler/task.$(OBJEXT) \ utilities.$(OBJEXT) cmdhandler.$(OBJEXT) janitor.$(OBJEXT) \ longgetopt.$(OBJEXT) libcompat_a_OBJECTS = $(am_libcompat_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/b64_ntop.Po ./$(DEPDIR)/b64_pton.Po \ ./$(DEPDIR)/clientpipe.Po ./$(DEPDIR)/cmdhandler.Po \ ./$(DEPDIR)/datastructure.Po ./$(DEPDIR)/duration.Po \ ./$(DEPDIR)/file.Po ./$(DEPDIR)/janitor.Po \ ./$(DEPDIR)/locks.Po ./$(DEPDIR)/log.Po \ ./$(DEPDIR)/longgetopt.Po ./$(DEPDIR)/privdrop.Po \ ./$(DEPDIR)/pselect.Po ./$(DEPDIR)/status.Po \ ./$(DEPDIR)/str.Po ./$(DEPDIR)/strlcat.Po \ ./$(DEPDIR)/strlcpy.Po ./$(DEPDIR)/util.Po \ ./$(DEPDIR)/utilities.Po scheduler/$(DEPDIR)/fifoq.Po \ scheduler/$(DEPDIR)/schedule.Po scheduler/$(DEPDIR)/task.Po \ scheduler/$(DEPDIR)/worker.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcompat_a_SOURCES) DIST_SOURCES = $(libcompat_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CP = @CP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CUNIT_INCLUDES = @CUNIT_INCLUDES@ CUNIT_LIBS = @CUNIT_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ C_LIBS = @C_LIBS@ 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@ ENFORCER_DB_DATABASE = @ENFORCER_DB_DATABASE@ ENFORCER_DB_HOST = @ENFORCER_DB_HOST@ ENFORCER_DB_INCLUDES = @ENFORCER_DB_INCLUDES@ ENFORCER_DB_LIBS = @ENFORCER_DB_LIBS@ ENFORCER_DB_PASSWORD = @ENFORCER_DB_PASSWORD@ ENFORCER_DB_PORT = @ENFORCER_DB_PORT@ ENFORCER_DB_PORT_TEXT = @ENFORCER_DB_PORT_TEXT@ ENFORCER_DB_USERNAME = @ENFORCER_DB_USERNAME@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_SSL = @HAVE_SSL@ HAVE_SSL_NEW_HMAC = @HAVE_SSL_NEW_HMAC@ INSTALL = @INSTALL@ INSTALLATIONCOND = @INSTALLATIONCOND@ INSTALLATIONGROUP = @INSTALLATIONGROUP@ INSTALLATIONGROUPARG = @INSTALLATIONGROUPARG@ INSTALLATIONUSER = @INSTALLATIONUSER@ INSTALLATIONUSERARG = @INSTALLATIONUSERARG@ 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@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MYSQL_CFLAGS = @MYSQL_CFLAGS@ MYSQL_CONFIG = @MYSQL_CONFIG@ MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ MYSQL_VERSION = @MYSQL_VERSION@ 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_ENFORCER_SOCKETFILE = @OPENDNSSEC_ENFORCER_SOCKETFILE@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ READLINE_LIBS = @READLINE_LIBS@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_VERSION = @SQLITE3_VERSION@ SSL_INCLUDES = @SSL_INCLUDES@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ 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_CXX = @ac_ct_CXX@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in AM_CPPFLAGS = \ @LDNS_INCLUDES@ noinst_LIBRARIES = libcompat.a libcompat_a_SOURCES = \ b64_ntop.c b64_pton.c \ clientpipe.c clientpipe.h \ compat.h \ duration.c duration.h \ file.c file.h \ locks.c locks.h \ log.c log.h \ privdrop.c privdrop.h \ pselect.c \ status.c status.h \ str.c str.h strlcat.c strlcpy.c \ util.c util.h \ datastructure.c datastructure.h \ scheduler/schedule.c scheduler/schedule.h \ scheduler/task.c scheduler/task.h \ scheduler/fifoq.c scheduler/fifoq.h \ scheduler/worker.c scheduler/worker.h \ scheduler/task.c scheduler/task.h \ utilities.c utilities.h \ cmdhandler.c cmdhandler.h \ janitor.c janitor.h \ longgetopt.c longgetopt.h all: config.h $(MAKE) $(AM_MAKEFLAGS) 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 common/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign common/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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status common/config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) scheduler/$(am__dirstamp): @$(MKDIR_P) scheduler @: > scheduler/$(am__dirstamp) scheduler/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) scheduler/$(DEPDIR) @: > scheduler/$(DEPDIR)/$(am__dirstamp) scheduler/schedule.$(OBJEXT): scheduler/$(am__dirstamp) \ scheduler/$(DEPDIR)/$(am__dirstamp) scheduler/task.$(OBJEXT): scheduler/$(am__dirstamp) \ scheduler/$(DEPDIR)/$(am__dirstamp) scheduler/fifoq.$(OBJEXT): scheduler/$(am__dirstamp) \ scheduler/$(DEPDIR)/$(am__dirstamp) scheduler/worker.$(OBJEXT): scheduler/$(am__dirstamp) \ scheduler/$(DEPDIR)/$(am__dirstamp) libcompat.a: $(libcompat_a_OBJECTS) $(libcompat_a_DEPENDENCIES) $(EXTRA_libcompat_a_DEPENDENCIES) $(AM_V_at)-rm -f libcompat.a $(AM_V_AR)$(libcompat_a_AR) libcompat.a $(libcompat_a_OBJECTS) $(libcompat_a_LIBADD) $(AM_V_at)$(RANLIB) libcompat.a mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f scheduler/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/b64_ntop.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/b64_pton.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clientpipe.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmdhandler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datastructure.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/duration.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/janitor.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/locks.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/longgetopt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/privdrop.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pselect.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/status.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strlcat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strlcpy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utilities.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@scheduler/$(DEPDIR)/fifoq.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@scheduler/$(DEPDIR)/schedule.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@scheduler/$(DEPDIR)/task.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@scheduler/$(DEPDIR)/worker.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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) config.h 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) -rm -f scheduler/$(DEPDIR)/$(am__dirstamp) -rm -f scheduler/$(am__dirstamp) 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 -f ./$(DEPDIR)/b64_ntop.Po -rm -f ./$(DEPDIR)/b64_pton.Po -rm -f ./$(DEPDIR)/clientpipe.Po -rm -f ./$(DEPDIR)/cmdhandler.Po -rm -f ./$(DEPDIR)/datastructure.Po -rm -f ./$(DEPDIR)/duration.Po -rm -f ./$(DEPDIR)/file.Po -rm -f ./$(DEPDIR)/janitor.Po -rm -f ./$(DEPDIR)/locks.Po -rm -f ./$(DEPDIR)/log.Po -rm -f ./$(DEPDIR)/longgetopt.Po -rm -f ./$(DEPDIR)/privdrop.Po -rm -f ./$(DEPDIR)/pselect.Po -rm -f ./$(DEPDIR)/status.Po -rm -f ./$(DEPDIR)/str.Po -rm -f ./$(DEPDIR)/strlcat.Po -rm -f ./$(DEPDIR)/strlcpy.Po -rm -f ./$(DEPDIR)/util.Po -rm -f ./$(DEPDIR)/utilities.Po -rm -f scheduler/$(DEPDIR)/fifoq.Po -rm -f scheduler/$(DEPDIR)/schedule.Po -rm -f scheduler/$(DEPDIR)/task.Po -rm -f scheduler/$(DEPDIR)/worker.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr 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 -f ./$(DEPDIR)/b64_ntop.Po -rm -f ./$(DEPDIR)/b64_pton.Po -rm -f ./$(DEPDIR)/clientpipe.Po -rm -f ./$(DEPDIR)/cmdhandler.Po -rm -f ./$(DEPDIR)/datastructure.Po -rm -f ./$(DEPDIR)/duration.Po -rm -f ./$(DEPDIR)/file.Po -rm -f ./$(DEPDIR)/janitor.Po -rm -f ./$(DEPDIR)/locks.Po -rm -f ./$(DEPDIR)/log.Po -rm -f ./$(DEPDIR)/longgetopt.Po -rm -f ./$(DEPDIR)/privdrop.Po -rm -f ./$(DEPDIR)/pselect.Po -rm -f ./$(DEPDIR)/status.Po -rm -f ./$(DEPDIR)/str.Po -rm -f ./$(DEPDIR)/strlcat.Po -rm -f ./$(DEPDIR)/strlcpy.Po -rm -f ./$(DEPDIR)/util.Po -rm -f ./$(DEPDIR)/utilities.Po -rm -f scheduler/$(DEPDIR)/fifoq.Po -rm -f scheduler/$(DEPDIR)/schedule.Po -rm -f scheduler/$(DEPDIR)/task.Po -rm -f scheduler/$(DEPDIR)/worker.Po -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: all install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-hdr 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile # 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-2.1.13/common/str.h0000644000077000001440000000477014446272525013151 00000000000000/* * 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. * */ /** * String utilities. * */ #ifndef SHARED_STR_H #define SHARED_STR_H #include "config.h" #include "status.h" #include /** * Concatenate characters without custom allocators. * * Will always allocate at least 1 byte (when catting empty strings) so * result should always be freed by the caller. * * \param[in] argc, number of strings in argv. * \param[in] argv, storage of strings. * \param[in] delim, delimiter used to join the strings. * \return string, may be empty string. */ char *ods_strcat_delim(int argc, char* argv[], char delim); /** * Remove leading and trailing whitespace. * \param[in] str string to trim * \param[in] keep_newline whether to keep a single trailing newline or not * \return the same reference to the string * */ char* ods_str_trim(char* str, int keep_newline); /** * Version of ctime_r that does not feature a trailing '\n' character * * \param[in] buf buffer to write the formatted date/time to * \param[in] nbuf size of buf, including any terminating zero characters. * \param[in] t time_t value to print to buf * \return buf to indicate success or NULL to indicate failure. */ char *ods_ctime_r(char *buf, size_t nbuf, time_t t); #endif /* SHARED_STR_H */ opendnssec-2.1.13/common/strlcpy.c0000644000077000001440000000342714446272525014032 00000000000000/* $OpenBSD: strlcpy.c,v 1.10 2005/11/10 05:26:17 dtucker Exp $ */ /* * Copyright (c) 1998 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* OPENBSD ORIGINAL: lib/libc/string/strlcpy.c */ #include "config.h" #ifndef HAVE_STRLCPY #include #include /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t strlcpy(char *dst, const char *src, size_t siz) { char *d = dst; const char *s = src; size_t n = siz; /* Copy as many bytes as will fit */ if (n != 0 && --n != 0) { do { if ((*d++ = *s++) == 0) break; } while (--n != 0); } /* Not enough room in dst, add NUL and traverse rest of src */ if (n == 0) { if (siz != 0) *d = '\0'; /* NUL-terminate dst */ while (*s++) ; } return(s - src - 1); /* count does not include NUL */ } #endif /* !HAVE_STRLCPY */ opendnssec-2.1.13/common/b64_pton.c0000644000077000001440000002622014446272525013761 00000000000000/* * Copyright (c) 1996, 1998 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* * Portions Copyright (c) 1995 by International Business Machines, Inc. * * International Business Machines, Inc. (hereinafter called IBM) grants * permission under its copyrights to use, copy, modify, and distribute this * Software with or without fee, provided that the above copyright notice and * all paragraphs of this notice appear in all copies, and that the name of IBM * not be used in connection with the marketing of any product incorporating * the Software or modifications thereof, without specific, written prior * permission. * * To the extent it has a right to do so, IBM grants an immunity from suit * under its patents, if any, for the use, sale or manufacture of products to * the extent that such products are used for performing Domain Name System * dynamic updates in TCP/IP networks by means of the Software. No immunity is * granted for any product per se or for any other function of any product. * * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. */ #include #include #include #include #include #include #include #include #include #include #define Assert(Cond) if (!(Cond)) abort() static const char Base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static const char Pad64 = '='; /* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) The following encoding technique is taken from RFC 1521 by Borenstein and Freed. It is reproduced here in a slightly edited form for convenience. A 65-character subset of US-ASCII is used, enabling 6 bits to be represented per printable character. (The extra 65th character, "=", is used to signify a special processing function.) The encoding process represents 24-bit groups of input bits as output strings of 4 encoded characters. Proceeding from left to right, a 24-bit input group is formed by concatenating 3 8-bit input groups. These 24 bits are then treated as 4 concatenated 6-bit groups, each of which is translated into a single digit in the base64 alphabet. Each 6-bit group is used as an index into an array of 64 printable characters. The character referenced by the index is placed in the output string. Table 1: The Base64 Alphabet Value Encoding Value Encoding Value Encoding Value Encoding 0 A 17 R 34 i 51 z 1 B 18 S 35 j 52 0 2 C 19 T 36 k 53 1 3 D 20 U 37 l 54 2 4 E 21 V 38 m 55 3 5 F 22 W 39 n 56 4 6 G 23 X 40 o 57 5 7 H 24 Y 41 p 58 6 8 I 25 Z 42 q 59 7 9 J 26 a 43 r 60 8 10 K 27 b 44 s 61 9 11 L 28 c 45 t 62 + 12 M 29 d 46 u 63 / 13 N 30 e 47 v 14 O 31 f 48 w (pad) = 15 P 32 g 49 x 16 Q 33 h 50 y Special processing is performed if fewer than 24 bits are available at the end of the data being encoded. A full encoding quantum is always completed at the end of a quantity. When fewer than 24 input bits are available in an input group, zero bits are added (on the right) to form an integral number of 6-bit groups. Padding at the end of the data is performed using the '=' character. Since all base64 input is an integral number of octets, only the following cases can arise: (1) the final quantum of encoding input is an integral multiple of 24 bits; here, the final unit of encoded output will be an integral multiple of 4 characters with no "=" padding, (2) the final quantum of encoding input is exactly 8 bits; here, the final unit of encoded output will be two characters followed by two "=" padding characters, or (3) the final quantum of encoding input is exactly 16 bits; here, the final unit of encoded output will be three characters followed by one "=" padding character. */ /* skips all whitespace anywhere. converts characters, four at a time, starting at (or after) src from base - 64 numbers into three 8 bit bytes in the target area. it returns the number of data bytes stored at the target, or -1 on error. */ static int b64rmap_initialized = 0; static uint8_t b64rmap[256]; static const uint8_t b64rmap_special = 0xf0; static const uint8_t b64rmap_end = 0xfd; static const uint8_t b64rmap_space = 0xfe; static const uint8_t b64rmap_invalid = 0xff; /** * Initializing the reverse map is not thread safe. * Which is fine for NSD. For now... **/ static void b64_initialize_rmap () { int i; char ch; /* Null: end of string, stop parsing */ b64rmap[0] = b64rmap_end; for (i = 1; i < 256; ++i) { ch = (char)i; /* Whitespaces */ if (isspace(ch)) b64rmap[i] = b64rmap_space; /* Padding: stop parsing */ else if (ch == Pad64) b64rmap[i] = b64rmap_end; /* Non-base64 char */ else b64rmap[i] = b64rmap_invalid; } /* Fill reverse mapping for base64 chars */ for (i = 0; Base64[i] != '\0'; ++i) b64rmap[(uint8_t)Base64[i]] = i; b64rmap_initialized = 1; } static int b64_pton_do(char const *src, uint8_t *target, size_t targsize) { int tarindex, state, ch; uint8_t ofs; state = 0; tarindex = 0; while (1) { ch = *src++; ofs = b64rmap[ch]; if (ofs >= b64rmap_special) { /* Ignore whitespaces */ if (ofs == b64rmap_space) continue; /* End of base64 characters */ if (ofs == b64rmap_end) break; /* A non-base64 character. */ return (-1); } switch (state) { case 0: if ((size_t)tarindex >= targsize) return (-1); target[tarindex] = ofs << 2; state = 1; break; case 1: if ((size_t)tarindex + 1 >= targsize) return (-1); target[tarindex] |= ofs >> 4; target[tarindex+1] = (ofs & 0x0f) << 4 ; tarindex++; state = 2; break; case 2: if ((size_t)tarindex + 1 >= targsize) return (-1); target[tarindex] |= ofs >> 2; target[tarindex+1] = (ofs & 0x03) << 6; tarindex++; state = 3; break; case 3: if ((size_t)tarindex >= targsize) return (-1); target[tarindex] |= ofs; tarindex++; state = 0; break; default: abort(); } } /* * We are done decoding Base-64 chars. Let's see if we ended * on a byte boundary, and/or with erroneous trailing characters. */ if (ch == Pad64) { /* We got a pad char. */ ch = *src++; /* Skip it, get next. */ switch (state) { case 0: /* Invalid = in first position */ case 1: /* Invalid = in second position */ return (-1); case 2: /* Valid, means one byte of info */ /* Skip any number of spaces. */ for ((void)NULL; ch != '\0'; ch = *src++) if (b64rmap[ch] != b64rmap_space) break; /* Make sure there is another trailing = sign. */ if (ch != Pad64) return (-1); ch = *src++; /* Skip the = */ /* Fall through to "single trailing =" case. */ /* FALLTHROUGH */ case 3: /* Valid, means two bytes of info */ /* * We know this char is an =. Is there anything but * whitespace after it? */ for ((void)NULL; ch != '\0'; ch = *src++) if (b64rmap[ch] != b64rmap_space) return (-1); /* * Now make sure for cases 2 and 3 that the "extra" * bits that slopped past the last full byte were * zeros. If we don't check them, they become a * subliminal channel. */ if (target[tarindex] != 0) return (-1); } } else { /* * We ended by seeing the end of the string. Make sure we * have no partial bytes lying around. */ if (state != 0) return (-1); } return (tarindex); } static int b64_pton_len(char const *src) { int tarindex, state, ch; uint8_t ofs; state = 0; tarindex = 0; while (1) { ch = *src++; ofs = b64rmap[ch]; if (ofs >= b64rmap_special) { /* Ignore whitespaces */ if (ofs == b64rmap_space) continue; /* End of base64 characters */ if (ofs == b64rmap_end) break; /* A non-base64 character. */ return (-1); } switch (state) { case 0: state = 1; break; case 1: tarindex++; state = 2; break; case 2: tarindex++; state = 3; break; case 3: tarindex++; state = 0; break; default: abort(); } } /* * We are done decoding Base-64 chars. Let's see if we ended * on a byte boundary, and/or with erroneous trailing characters. */ if (ch == Pad64) { /* We got a pad char. */ ch = *src++; /* Skip it, get next. */ switch (state) { case 0: /* Invalid = in first position */ case 1: /* Invalid = in second position */ return (-1); case 2: /* Valid, means one byte of info */ /* Skip any number of spaces. */ for ((void)NULL; ch != '\0'; ch = *src++) if (b64rmap[ch] != b64rmap_space) break; /* Make sure there is another trailing = sign. */ if (ch != Pad64) return (-1); ch = *src++; /* Skip the = */ /* Fall through to "single trailing =" case. */ /* FALLTHROUGH */ case 3: /* Valid, means two bytes of info */ /* * We know this char is an =. Is there anything but * whitespace after it? */ for ((void)NULL; ch != '\0'; ch = *src++) if (b64rmap[ch] != b64rmap_space) return (-1); } } else { /* * We ended by seeing the end of the string. Make sure we * have no partial bytes lying around. */ if (state != 0) return (-1); } return (tarindex); } int b64_pton(char const *src, uint8_t *target, size_t targsize) { if (!b64rmap_initialized) b64_initialize_rmap (); if (target) return b64_pton_do (src, target, targsize); else return b64_pton_len (src); } opendnssec-2.1.13/common/cmdhandler.h0000644000077000001440000000767114446272525014445 00000000000000/* * 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 typedef struct cmdhandler_struct cmdhandler_type; #include "janitor.h" typedef struct cmdhandler_ctx_struct { int sockfd; void* globalcontext; void* localcontext; cmdhandler_type* cmdhandler; } cmdhandler_ctx_type; struct cmd_func_block { /* Name of command */ char* name; /* print usage information */ void (*usage)(int sockfd); /* print help, more elaborate than usage. Allowed to be * NULL to indicate no help is available */ void (*help)(int sockfd); /* 1 if module claims responsibility for command * 0 otherwise */ int (*handles)(const char *cmd); /** Run the handler * * \param sockfd, pipe to client, * \param ctx, the client context * \param cmd, command and args for additional parsing null character * terminated * \param dbconn, connection to the database. * \return 0 command executed, all OK * -1 Errors parsing commandline / missing params * positive error code to return to user. */ int (*runarg)(__attribute__((unused)) cmdhandler_ctx_type*, __attribute__((unused)) char *cmd); int (*runargs)(__attribute__((unused)) cmdhandler_ctx_type*, __attribute__((unused)) int argc, __attribute__((unused)) char**argv); char** names; }; struct cmdhandler_struct { struct sockaddr_un listen_addr; janitor_thread_t thread_id; int listen_fd; int need_to_exit; int stopped; struct cmd_func_block** commands; void* globalcontext; void* (*createlocalcontext)(void*); void (*destroylocalcontext)(void*); }; /** * Create command handler. * \param[in] filename socket file name * \return cmdhandler_type* created command handler * */ cmdhandler_type* cmdhandler_create(const char* filename, struct cmd_func_block** functions, void* globalcontext, void*(*createlocalcontext)(void*globalcontext),void(*destroylocalcontext)(void*localcontext)); /** * Cleanup command handler. * \param[in] cmdhandler command handler * */ void cmdhandler_cleanup(cmdhandler_type* cmdhandler); /** * Start command handler. * \param[in] cmdhandler_type* command handler * */ void cmdhandler_start(cmdhandler_type* cmdhandler); void cmdhandler_stop(cmdhandler_type* cmdhandler); /** * Compare commandline with command, return arguments if found. * * \param[in] cmd, commandline to test * \param[in] scmd, command to look for * \return Pointer to arguments within cmd. NULL if scmd not found. */ const char *ods_check_command(const char *cmd, const char *scmd); #endif /* DAEMON_CMDHANDLER_H */ opendnssec-2.1.13/common/log.c0000644000077000001440000002314014446272525013105 00000000000000/* * Copyright (c) 2009-2018 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. */ /** * Logging. * */ #include "config.h" #include "duration.h" #include "file.h" #include "log.h" #include "util.h" #ifdef HAVE_SYSLOG_H static int logging_to_syslog = 0; #endif /* !HAVE_SYSLOG_H */ #include /* va_start(), va_end() */ #include /* fflush, fprintf(), vsnprintf() */ #include /* exit() */ #include /* strlen() */ #include #define LOG_DEEEBUG 8 /* ods_log_deeebug */ static FILE* logfile = NULL; static int log_level = LOG_CRIT; #define CTIME_LENGTH 26 /** * Use _r() functions on platforms that have. They are thread safe versions of * the normal syslog functions. Platforms without _r() usually have thread safe * normal functions. */ #if defined(HAVE_SYSLOG_R) && defined(HAVE_OPENLOG_R) && defined(HAVE_CLOSELOG_R) struct syslog_data sdata = SYSLOG_DATA_INIT; #else #undef HAVE_SYSLOG_R #undef HAVE_OPENLOG_R #undef HAVE_CLOSELOG_R #endif /* TODO: - prepend ods_ in common library ? - log_init should have program_name variable - wrap special case logging onto generic one - check if xml-specific logging functions are still neeeded (enforcer) - */ static const char* log_str = "log"; static char* log_ident = NULL; /** * Initialize logging. */ void ods_log_init(const char *programname, int use_syslog, const char *targetname, int verbosity) { #ifdef HAVE_SYSLOG_H int facility; int error = 0; #endif /* HAVE_SYSLOG_H */ if(logfile && logfile != stderr && logfile != stdout) { ods_fclose(logfile); } if(log_ident) { free(log_ident); log_ident = NULL; } log_level = verbosity + 2; #ifdef HAVE_SYSLOG_H if(logging_to_syslog) { #ifdef HAVE_CLOSELOG_R closelog_r(&sdata); #else closelog(); #endif logging_to_syslog = 0; } if(use_syslog) { facility = ods_log_get_facility(targetname, &error); #ifdef HAVE_OPENLOG_R openlog_r(programname, LOG_NDELAY, facility, &sdata); #else openlog(programname, LOG_NDELAY, facility); #endif logging_to_syslog = 1; if (error == 1) { ods_log_warning("[%s] syslog facility %s not supported, logging to " "log_daemon", log_str, targetname); } ods_log_verbose("[%s] switching log to syslog verbosity %i (log level %i)", log_str, verbosity, verbosity+2); return; } #endif /* HAVE_SYSLOG_H */ log_ident = strdup(programname); if(targetname && targetname[0]) { logfile = ods_fopen(targetname, NULL, "a"); if (logfile) { ods_log_debug("[%s] new logfile %s", log_str, targetname); return; } logfile = stderr; ods_log_warning("[%s] cannot open %s for appending, logging to " "stderr", log_str, targetname); } else { logfile = stderr; targetname = "stderr"; } ods_log_verbose("[%s] switching log to %s verbosity %i (log level %i)", log_str, targetname, verbosity, verbosity+2); } int ods_log_verbosity(void) { return log_level-2; } void ods_log_setverbosity(int verbosity) { log_level = verbosity + 2; } /** * Close logging. * */ void ods_log_close(void) { ods_log_debug("[%s] close log", log_str); ods_log_init("", 0, NULL, 0); } /** * Get facility by string. * ods_log_get_user * ods_log_get_facility * return error, LOG_*** as a parameter * */ #ifdef HAVE_SYSLOG_H int ods_log_get_facility(const char* facility, int* error) { int length; if (!facility) { return LOG_DAEMON; } length = strlen(facility); if (length == 4 && strncasecmp(facility, "KERN", 4) == 0) return LOG_KERN; else if (length == 4 && strncasecmp(facility, "USER", 4) == 0) return LOG_USER; else if (length == 4 && strncasecmp(facility, "MAIL", 4) == 0) return LOG_MAIL; else if (length == 6 && strncasecmp(facility, "DAEMON", 6) == 0) return LOG_DAEMON; else if (length == 4 && strncasecmp(facility, "AUTH", 4) == 0) return LOG_AUTH; else if (length == 3 && strncasecmp(facility, "LPR", 3) == 0) return LOG_LPR; else if (length == 4 && strncasecmp(facility, "NEWS", 4) == 0) return LOG_NEWS; else if (length == 4 && strncasecmp(facility, "UUCP", 4) == 0) return LOG_UUCP; else if (length == 4 && strncasecmp(facility, "CRON", 4) == 0) return LOG_CRON; else if (length == 6 && strncasecmp(facility, "LOCAL0", 6) == 0) return LOG_LOCAL0; else if (length == 6 && strncasecmp(facility, "LOCAL1", 6) == 0) return LOG_LOCAL1; else if (length == 6 && strncasecmp(facility, "LOCAL2", 6) == 0) return LOG_LOCAL2; else if (length == 6 && strncasecmp(facility, "LOCAL3", 6) == 0) return LOG_LOCAL3; else if (length == 6 && strncasecmp(facility, "LOCAL4", 6) == 0) return LOG_LOCAL4; else if (length == 6 && strncasecmp(facility, "LOCAL5", 6) == 0) return LOG_LOCAL5; else if (length == 6 && strncasecmp(facility, "LOCAL6", 6) == 0) return LOG_LOCAL6; else if (length == 6 && strncasecmp(facility, "LOCAL7", 6) == 0) return LOG_LOCAL7; *error = 1; return LOG_DAEMON; } #endif /* HAVE_SYSLOG_H */ /** * Get the log level. * */ int ods_log_get_level() { return log_level; } /** * Log message wrapper. * */ static void ods_log_vmsg(int priority, const char* t, const char* s, va_list args) { char message[ODS_SE_MAXLINE]; static char nowstr[CTIME_LENGTH]; time_t now = time_now(); vsnprintf(message, sizeof(message), s, args); #ifdef HAVE_SYSLOG_H if (logging_to_syslog) { #ifdef HAVE_SYSLOG_R syslog_r(priority, &sdata, "%s", message); #else syslog(priority, "%s", message); #endif return; } #endif /* HAVE_SYSLOG_H */ if (!logfile) { fprintf(stdout, "%s\n", message); return; } (void) ctime_r(&now, nowstr); nowstr[CTIME_LENGTH-2] = '\0'; /* remove trailing linefeed */ fprintf(logfile, "[%s] %s[%i] %s: %s\n", nowstr, log_ident, priority, t, message); fflush(logfile); } /** * Heavy debug logging. * */ void ods_log_deeebug(const char *format, ...) { va_list args; va_start(args, format); if (log_level >= LOG_DEEEBUG) { ods_log_vmsg(LOG_DEBUG, "debug ", format, args); } va_end(args); } /** * Log debug. * */ void ods_log_debug(const char *format, ...) { va_list args; va_start(args, format); if (log_level >= LOG_DEBUG) { ods_log_vmsg(LOG_DEBUG, "debug ", format, args); } va_end(args); } /** * Log verbose. * */ void ods_log_verbose(const char *format, ...) { va_list args; va_start(args, format); if (log_level >= LOG_INFO) { ods_log_vmsg(LOG_INFO, "verbose", format, args); } va_end(args); } /** * Log info. * */ void ods_log_info(const char *format, ...) { va_list args; va_start(args, format); if (log_level >= LOG_NOTICE) { ods_log_vmsg(LOG_NOTICE, "msg ", format, args); } va_end(args); } /** * Log warning. * */ void ods_log_warning(const char *format, ...) { va_list args; va_start(args, format); if (log_level >= LOG_WARNING) { ods_log_vmsg(LOG_WARNING, "warning", format, args); } va_end(args); } /** * Log error. * */ void ods_log_error(const char *format, ...) { va_list args; va_start(args, format); if (log_level >= LOG_ERR) { ods_log_vmsg(LOG_ERR, "error ", format, args); } va_end(args); } /** * Log error. * */ void ods_log_verror(const char *format, va_list args) { if (log_level >= LOG_ERR) { ods_log_vmsg(LOG_ERR, "error ", format, args); } } /** * Log critical. * */ void ods_log_crit(const char *format, ...) { va_list args; va_start(args, format); if (log_level >= LOG_CRIT) { ods_log_vmsg(LOG_CRIT, "crit ", format, args); } va_end(args); } /** * Log alert. * */ void ods_log_alert(const char *format, ...) { va_list args; va_start(args, format); if (log_level >= LOG_ALERT) { ods_log_vmsg(LOG_ALERT, "alert ", format, args); } va_end(args); } /** * Log emergency and exit. * */ void ods_fatal_exit(const char *format, ...) { va_list args; va_start(args, format); if (log_level >= LOG_CRIT) { ods_log_vmsg(LOG_CRIT, "fatal ", format, args); } va_end(args); abort(); } opendnssec-2.1.13/common/status.h0000644000077000001440000000665714446272525013672 00000000000000/* * 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" #include "log.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_FSEEK_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, ODS_STATUS_DB_ERR, ODS_STATUS_PIPE_ERR }; 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); #define CHECKALLOC(PTR) if(!(PTR)) { ods_fatal_exit("Out of memory when executing %s at %s:%d\n", #PTR, __FILE__, __LINE__); } #endif /* UTIL_STATUS_H */ opendnssec-2.1.13/common/locks.h0000644000077000001440000000373514446272525013454 00000000000000/* * 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 SCHEDULER_LOCKS_H #define SCHEDULER_LOCKS_H #include "config.h" #include "log.h" #include "janitor.h" #include #include #include /** ods-signerd will crash if the thread stacksize is too small */ #define ODS_MINIMUM_STACKSIZE 524288 /** thread creation */ typedef janitor_thread_t ods_thread_type; int ods_thread_wait(pthread_cond_t* cond, pthread_mutex_t* lock, time_t wait); void ods_janitor_initialize(char*argv0); extern janitor_threadclass_t detachedthreadclass; extern janitor_threadclass_t workerthreadclass; extern janitor_threadclass_t handlerthreadclass; extern janitor_threadclass_t cmdhandlerthreadclass; #endif /* SHARED_LOCKS_H */ opendnssec-2.1.13/common/clientpipe.h0000644000077000001440000000451314446272525014470 00000000000000/* * Copyright (c) 2014 NLNet Labs * Copyright (c) 2014 OpenDNSSEC AB (svb) * 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 DAEMON_CLIENTPIPE_H #define DAEMON_CLIENTPIPE_H #include "config.h" #include /* 1 on succes 0 on fail*/ int client_printf(int sockfd, const char * format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 2, 3))) #endif ; int client_printf_err(int sockfd, const char * format, ...) #ifdef HAVE___ATTRIBUTE__ __attribute__ ((format (printf, 2, 3))) #endif ; /** * Client part of prompt handling * * Block on stdin and send to daemon * * \param sockfd, pipe to daemon. * \return 1 success, 0 error */ int client_handleprompt(int sockfd); enum msg_type { CLIENT_OPC_STDOUT = 0, CLIENT_OPC_STDERR, CLIENT_OPC_STDIN, CLIENT_OPC_PROMPT, CLIENT_OPC_EXIT }; /* 1 on succes, 0 on fail */ int client_exit(int sockfd, char exitcode); int client_stdin(int sockfd, const char *cmd, uint16_t count); int client_stdout(int sockfd, const char *cmd, uint16_t count); int client_stderr(int sockfd, const char *cmd, uint16_t count); #endif /* DAEMON_CLIENTPIPE_H */ opendnssec-2.1.13/common/str.c0000644000077000001440000001025514446272525013137 00000000000000/* * Copyright (c) 2011-2018 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. */ /** * * String utilities */ #include "config.h" #include "str.h" #include "log.h" #include #include #include /* snprintf() */ #include #include /* strlen(), strcpy() */ #include /* isspace() */ #include #include static const char *module_str = "str"; /** * Concatenate characters without custom allocators. * * Will always allocate at least 1 byte (when catting empty strings) so * result should always be freed by the caller. * * \param[in] argc, number of strings in argv. * \param[in] argv, storage of strings. Must not be NULL; * \param[in] delim, delimiter used to join the strings. * \return string, may be empty string. */ char * ods_strcat_delim(int argc, char* argv[], char delim) { int i, pos = 0, len = 1; char *cat; assert(argv); for (i = 0; i < argc; i++) len += strlen(argv[i]) + 1; cat = (char *) malloc(len * sizeof (char)); memset(cat, delim, len-1); for (i = 0; i < argc; i++) { memcpy(cat+pos, argv[i], strlen(argv[i])); pos += strlen(argv[i]) + 1; } cat[len-1] = '\0'; return cat; } /** * Remove leading and trailing whitespace. * enforcer used ods_str_trim(s,0) */ char * ods_str_trim(char *str, int keep_newline) { int has_newline = 0; char *start, *end; if (str) { end = str + strlen(str); /* points at \0 */ for (start = str; start start; end--) { if (*(end-1) == '\n') has_newline = 1; if (!isspace(*(end-1))) break; } memmove(str, start, end-start); if(has_newline && keep_newline) { str[(end++)-start] = '\n'; } str[end-start] = '\0'; } return str; } /** * Version of ctime_r that does not feature a trailing '\n' character * */ char * ods_ctime_r(char *buf, size_t nbuf, time_t t) { #if 0 struct tm datetime; if (localtime_r(&t,&datetime) == NULL) { ods_log_error("[%s] time_datestamp: localtime_r() failed", module_str); return NULL; } snprintf(buf, nbuf, "%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d", 1900+datetime.tm_year, datetime.tm_mon + 1, datetime.tm_mday, datetime.tm_hour, datetime.tm_min, datetime.tm_sec); return buf; #else if (nbuf>=26 && buf!=NULL) { char *p; char *pbeg = ctime_r(&t,buf); char *pend = pbeg ? (pbeg+strlen(pbeg)) : pbeg; if (pbeg >= pend) { ods_log_error("[%s] time_datestamp: ctime_r() failed", module_str); return NULL; } /* strip trailing space characters including '\n' from time string */ for (p=pend-1; p>=pbeg && isspace(*p); --p) { *p = '\0'; } } return buf; #endif } opendnssec-2.1.13/common/utilities.h0000644000077000001440000000713014446272525014345 00000000000000/* * Copyright (c) 2021 A.W. van Halderen * 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 UTILITIES_H #define UTILITIES_H #ifdef NOTDEFINED #error "never define NOTDEFINED" #endif #define QUOTE(ARG) #ARG #ifdef __cplusplus #include #include #include #endif #include #include #if !defined(__GNUC__) || __GNUC__ < 2 || \ (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\ defined(NEXT) #ifndef __attribute__ #define __attribute__(__x) #endif #endif #ifdef __cplusplus class mkstring { private: std::ostringstream os; public: template mkstring &operator<<(const T &t) { os << t; return *this; } mkstring& operator<<(const char* m) { os << m; return *this; } mkstring& operator<<(const std::string& s) { os << s; return *this; } static std::string format(const char *fmt, va_list ap); static std::string format(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2))); operator std::string() const { return os.str(); } const std::string str() const { return os.str(); }; const char* c_str() const { return os.str().c_str(); }; }; #endif #ifdef DEBUG # define BUG(ARG) ARG #else # define BUG(ARG) #endif #ifndef CHECK #define CHECK(EX) do { if(EX) { int err = errno; fprintf(stderr, "operation" \ " \"%s\" failed on line %d: %s (%d)\n", #EX, __LINE__, strerror(err), err); \ abort(); }} while(0) #endif #ifndef CHECKALLOC #define CHECKALLOC(PTR) if(!(PTR)) { fprintf(stderr,"Out of memory when executing %s at %s:%d\n", #PTR, __FILE__, __LINE__); } #endif extern char* argv0; typedef void (*functioncast_type)(void); extern functioncast_type functioncast(void*generic); typedef void (*voidfunc)(void); /** * Clamp an integer value between a lower and an upper bound. * * In effect a combination of a min() and max() call this function * will return the value as long as it lies between the lower and * upper bound. If smaller (or equal) to the lower bound it will * return the lower bound and likewise if larger or equal to the * upper, the upper bound. The result may be either lower or * upper bound if the upper bound is smaller than the lower bound. */ extern int clamp(int value, int lbnd, int ubnd); extern unsigned long long int rnd(void); extern int alloc(void* ptr, size_t size, int* countptr, int newcount); extern char* dupstr(const char* ptr); #endif opendnssec-2.1.13/common/janitor.c0000644000077000001440000005500114446272525013773 00000000000000/* * Copyright (c) 2016-2018 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 _GNU_SOURCE #define _GNU_SOURCE #endif #ifndef _GNU_SOURCE #define __USE_GNU #endif #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_BACKTRACE_FULL #include #endif #ifdef HAVE_BACKTRACE #include #endif #ifdef HAVE_LIBUNWIND #include #endif #include "janitor.h" static struct sigaction original_quit_action; static struct sigaction original_abrt_action; static struct sigaction original_segv_action; static struct sigaction original_fpe_action; static struct sigaction original_ill_action; static struct sigaction original_bus_action; static struct sigaction original_sys_action; static janitor_alertfn_t alert; static janitor_alertfn_t report; struct janitor_threadclass_struct { char* name; int detached; int autorun; int blocksignals; int hasattr; pthread_attr_t attr; }; int janitor_threadclass_create(janitor_threadclass_t* threadclass, const char* name) { *threadclass = malloc(sizeof(struct janitor_threadclass_struct)); (*threadclass)->name = strdup(name); (*threadclass)->detached = 0; (*threadclass)->autorun = 0; (*threadclass)->blocksignals = 0; (*threadclass)->hasattr = 0; return 0; } char* janitor_threadclass_name(janitor_threadclass_t threadclass) { return threadclass->name; } void janitor_threadclass_destroy(janitor_threadclass_t threadclass) { if (threadclass->hasattr) { pthread_attr_destroy(&threadclass->attr); } free(threadclass->name); free(threadclass); } void janitor_threadclass_setdetached(janitor_threadclass_t threadclass) { threadclass->detached = 1; if (!threadclass->hasattr) { pthread_attr_init(&threadclass->attr); } pthread_attr_setdetachstate(&threadclass->attr, PTHREAD_CREATE_DETACHED); } void janitor_threadclass_setautorun(janitor_threadclass_t threadclass) { threadclass->autorun = 1; } void janitor_threadclass_setblockedsignals(janitor_threadclass_t threadclass) { threadclass->blocksignals = 1; } void janitor_threadclass_setminstacksize(janitor_threadclass_t threadclass, size_t minstacksize) { size_t stacksize; if (!threadclass->hasattr) { pthread_attr_init(&threadclass->attr); } pthread_attr_getstacksize(&threadclass->attr, &stacksize); if (stacksize < minstacksize) { pthread_attr_setstacksize(&threadclass->attr, minstacksize); threadclass->hasattr = 1; } } static void fail(const char* file, int line, const char* func, const char* expr, int stat); #define CHECKFAIL(EX) do { int CHECKFAIL; if((CHECKFAIL = (EX))) { fail(__FILE__,__LINE__,__func__,#EX,CHECKFAIL); goto fail; } } while(0) static void fail(const char* file, int line, const char* func, const char* expr, int stat) { report("Failure %d in %s at %s:%d of %s\n", stat, func, file, line, expr); } void janitor_initialize(janitor_alertfn_t alertfn, janitor_alertfn_t reportfn) { report = reportfn; alert = alertfn; } struct janitor_thread_struct { struct janitor_thread_struct* next; struct janitor_thread_struct* prev; pthread_t thread; janitor_runfn_t runfunc; void* rundata; int isstarted; int blocksignals; pthread_barrier_t startbarrier; janitor_threadclass_t threadclass; }; static pthread_mutex_t threadlock = PTHREAD_MUTEX_INITIALIZER; static struct janitor_thread_struct *threadlist = NULL; /* running threads */ static struct janitor_thread_struct *finishedthreadlist = NULL; /* threads waiting to be joined */ static pthread_once_t threadlocatorinitializeonce = PTHREAD_ONCE_INIT; static pthread_key_t threadlocator; static pthread_cond_t threadblock = PTHREAD_COND_INITIALIZER; static void threadlocatorinitialize(void) { pthread_key_create(&threadlocator, NULL); } static void janitor_thread_unregister(janitor_thread_t info) { int err, errcount; if (info == NULL) return; CHECKFAIL(pthread_mutex_lock(&threadlock)); if (threadlist != NULL) { if (threadlist == info) { if (info->next == info) { threadlist = NULL; } else { threadlist = info->next; } } info->next->prev = info->prev; info->prev->next = info->next; info->next = info->prev = NULL; /* The implementation on FreeBSD10 of pthreads is pretty brain dead. * If two threads enter a barrier with count 2, then the barrier * is satisfied and thus not really being waited upon. If now one * of the threads tries to destroy the thread, while the other thread * did not have its turn yet on the CPU, then still the destroy call * will return EBUSY. Although valid, this is really a brain dead * implementation causing pain to application developers to do the * following every time: */ errcount = 0; do { err = pthread_barrier_destroy(&info->startbarrier); if (err == EBUSY) { ++errcount; sleep(1); } } while(err == EBUSY && errcount <= 3); CHECKFAIL(pthread_cond_signal(&threadblock)); } CHECKFAIL(pthread_mutex_unlock(&threadlock)); fail: ; } static void janitor_thread_dispose(janitor_thread_t info) { if (info == NULL) return; if (!info->threadclass || !info->threadclass->detached) { pthread_mutex_lock(&threadlock); if (finishedthreadlist != NULL) { if (finishedthreadlist == info) { if (info->next == info) { finishedthreadlist = NULL; } else { finishedthreadlist = info->next; } } if(info->next && info->next->prev == info) info->next->prev = info->prev; if(info->prev && info->prev->next == info) info->prev->next = info->next; info->next = info->prev = NULL; } pthread_mutex_unlock(&threadlock); } free(info); } static void janitor_thread_register(janitor_thread_t info) { pthread_mutex_lock(&threadlock); pthread_once(&threadlocatorinitializeonce, threadlocatorinitialize); if (threadlist != NULL) { info->next = threadlist; info->prev = threadlist->prev; threadlist->prev->next = info; threadlist->prev = info; } else { info->next = info->prev = info; } threadlist = info; pthread_mutex_unlock(&threadlock); } static void janitor_thread_finished(janitor_thread_t info) { if (!info->threadclass->detached) { pthread_mutex_lock(&threadlock); if (finishedthreadlist != NULL) { info->next = finishedthreadlist; info->prev = finishedthreadlist->prev; finishedthreadlist->prev->next = info; finishedthreadlist->prev = info; } else { info->next = info->prev = info; } finishedthreadlist = info; pthread_mutex_unlock(&threadlock); } else { pthread_detach(pthread_self()); janitor_thread_dispose(info); } } static void* runthread(void* data) { int err; sigset_t sigset; struct janitor_thread_struct* info; stack_t ss; stack_t prevss; info = (struct janitor_thread_struct*) data; pthread_setspecific(threadlocator, info); ss.ss_sp = malloc(SIGSTKSZ); ss.ss_size = SIGSTKSZ; ss.ss_flags = 0; sigaltstack(&ss, &prevss); pthread_barrier_wait(&info->startbarrier); if (info->blocksignals) { sigfillset(&sigset); sigdelset(&sigset, SIGQUIT); sigdelset(&sigset, SIGABRT); sigdelset(&sigset, SIGSEGV); sigdelset(&sigset, SIGFPE); sigdelset(&sigset, SIGILL); sigdelset(&sigset, SIGBUS); sigdelset(&sigset, SIGSYS); if ((err = pthread_sigmask(SIG_SETMASK, &sigset, NULL))) report("pthread_sigmask: %s (%d)", strerror(err), err); } info->runfunc(info->rundata); sigaltstack(&prevss, NULL); free(ss.ss_sp); /* libxml has/had problems when freeing this as it tries to access it */ janitor_thread_unregister(info); janitor_thread_finished(info); return NULL; } int janitor_thread_create(janitor_thread_t* thread, janitor_threadclass_t threadclass, janitor_runfn_t func, void*data) { struct janitor_thread_struct* info; info = malloc(sizeof (struct janitor_thread_struct)); info->runfunc = func; info->rundata = data; info->blocksignals = 0; info->isstarted = 0; info->threadclass = threadclass; CHECKFAIL(pthread_barrier_init(&info->startbarrier, NULL, 2)); CHECKFAIL(pthread_create(&info->thread, ((threadclass && threadclass->hasattr) ? &threadclass->attr : NULL), runthread, info)); janitor_thread_register(info); *thread = info; if(threadclass && threadclass->autorun) { janitor_thread_start(info); } return 0; fail: return 1; } void janitor_thread_signal(janitor_thread_t thread) { pthread_kill(thread->thread, SIGHUP); } void janitor_thread_start(janitor_thread_t thread) { int isstarted; pthread_mutex_lock(&threadlock); isstarted = thread->isstarted; thread->isstarted = 1; pthread_mutex_unlock(&threadlock); if (!isstarted) { pthread_barrier_wait(&thread->startbarrier); } } int janitor_thread_join(janitor_thread_t thread) { int status; status = pthread_join(thread->thread, NULL); janitor_thread_dispose(thread); return status; } int janitor_thread_tryjoinall(janitor_threadclass_t threadclass) { struct janitor_thread_struct* thread; struct janitor_thread_struct* foundthread; do { foundthread = NULL; pthread_mutex_lock(&threadlock); thread = finishedthreadlist; if (thread) { do { if (thread->threadclass == threadclass) { foundthread = thread; break; } thread = thread->next; } while (thread != finishedthreadlist); } pthread_mutex_unlock(&threadlock); if (foundthread) { janitor_thread_join(foundthread); } } while(foundthread); pthread_mutex_lock(&threadlock); foundthread = NULL; thread = finishedthreadlist; if (thread) { do { if (thread->threadclass == threadclass) { foundthread = thread; break; } thread = thread->next; } while (thread != finishedthreadlist); } thread = threadlist; if (!foundthread && thread) { do { if (thread->threadclass == threadclass) { foundthread = thread; break; } thread = thread->next; } while (thread != threadlist); } pthread_mutex_unlock(&threadlock); if (foundthread) { return 1; } else { return 0; } } void janitor_thread_joinall(janitor_threadclass_t threadclass) { int moreleft; do { moreleft = janitor_thread_tryjoinall(threadclass); } while(moreleft); } static void dumpthreads(void) { struct janitor_thread_struct* info; struct janitor_thread_struct* list; pthread_mutex_lock(&threadlock); info = pthread_getspecific(threadlocator); list = threadlist; if (list) { do { if (list != info) { pthread_kill(list->thread, SIGQUIT); pthread_cond_wait(&threadblock, &threadlock); } list = list->next; } while (list != threadlist); } pthread_mutex_unlock(&threadlock); } #ifdef HAVE_BACKTRACE_FULL static struct backtrace_state *state = NULL; static struct backtrace_state *frames = NULL; static pthread_mutex_t frameslock = PTHREAD_MUTEX_INITIALIZER; static int callback(void* data, uintptr_t pc, const char *filename, int lineno, const char *function) { if (filename == NULL && lineno == 0 && function == NULL) { alert(" inlined method\n"); } else { alert(" %s:%d in %s()\n", filename, lineno, function); } if (function && !strcmp(function, "main")) return 1; else return 0; } static void errorhandler(void* data, const char *msg, int xerrno) { int len = strlen(msg); (void) (write(2, msg, len)); (void) (write(2, "\n", 1)); } #endif static void outputbacktrace(int skips, void *workaround) { #ifdef HAVE_BACKTRACE_FULL struct backtrace_state *state = (struct backtrace_state*) workaround; #else #ifdef HAVE_BACKTRACE Dl_info btinfo; void *bt[20]; int count, i; #else #ifdef HAVE_LIBUNWIND unw_context_t ctx; unw_cursor_t cursor; char symbol[256]; unw_word_t offset; #endif #endif #endif #ifdef HAVE_BACKTRACE_FULL backtrace_full(state, skips, (backtrace_full_callback) callback, (backtrace_error_callback) errorhandler, NULL); #else #ifdef HAVE_BACKTRACE count = backtrace(bt, sizeof (bt) / sizeof (void*)); for (i = skips; i < count; i++) { dladdr(bt[i], &btinfo); if (btinfo.dli_sname != NULL) { alert(" %s\n", btinfo.dli_sname); if (!strcmp(btinfo.dli_sname, "main")) break; } else alert(" unknown\n"); } #else #ifdef HAVE_LIBUNWIND unw_getcontext(&ctx); unw_init_local(&cursor, &ctx); if (unw_step(&cursor)) { /* skip the first one */ while (unw_step(&cursor)) { unw_get_proc_name(&cursor, symbol, sizeof (symbol) - (skips-1), &offset); alert(" %s\n", symbol); if (!strcmp(symbol, "main")) break; } } #endif #endif #endif } static void handlesignal(int signal, siginfo_t* info, void* data) { const char* signalname; Dl_info btinfo; janitor_thread_t thrinfo; (void) signal; (void) data; #ifndef HAVE_BACKTRACE_FULL #ifdef HAVE_BACKTRACE void *bt[20]; int count, i; #else #ifdef HAVE_LIBUNWIND unw_context_t ctx; unw_cursor_t cursor; char symbol[256]; unw_word_t offset; #endif #endif #endif switch (info->si_signo) { case SIGQUIT: signalname = "Threaddump"; break; case SIGABRT: sigaction(info->si_signo, &original_abrt_action, NULL); signalname = "Aborted"; break; case SIGSEGV: sigaction(info->si_signo, &original_segv_action, NULL); signalname = "Segmentation fault"; break; case SIGFPE: sigaction(info->si_signo, &original_fpe_action, NULL); signalname = "Floating point error"; break; case SIGILL: sigaction(info->si_signo, &original_ill_action, NULL); signalname = "Illegal instruction"; break; case SIGBUS: sigaction(info->si_signo, &original_bus_action, NULL); signalname = "Bus error"; break; case SIGSYS: sigaction(info->si_signo, &original_sys_action, NULL); signalname = "System error"; break; default: signalname = "Unknown error"; } if (dladdr(info->si_addr, &btinfo) != 0) alert("%s in %s", signalname, btinfo.dli_sname); else alert("%s", signalname); #ifdef HAVE_BACKTRACE_FULL alert(":\n"); #else #ifdef HAVE_BACKTRACE alert(":\n"); #else #ifdef HAVE_LIBUNWIND alert(":\n"); #else alert("\n"); #endif #endif #endif #ifdef HAVE_BACKTRACE_FULL outputbacktrace(2, state); #else outputbacktrace(2, NULL); #endif if (info->si_signo == SIGQUIT) { pthread_mutex_lock(&threadlock); pthread_cond_signal(&threadblock); pthread_mutex_unlock(&threadlock); } else { dumpthreads(); raise(info->si_signo); } } void janitor_backtrace(void) { #ifdef HAVE_BACKTRACE_FULL if(frames == NULL) { frames = backtrace_create_state(NULL, 0, (backtrace_error_callback) errorhandler, NULL); } pthread_mutex_lock(&frameslock); outputbacktrace(1, frames); pthread_mutex_unlock(&frameslock); #else outputbacktrace(1, NULL); #endif } static int callbackstring(void* data, uintptr_t pc, const char *filename, int lineno, const char *function) { int siz, len; char** ptr = data; if (filename != NULL || lineno != 0 || function == NULL) { siz = snprintf(NULL, 0, " %s:%d in %s()\n", filename, lineno, function); if (*ptr != NULL) { len = strlen(*ptr); siz += len + 1; *ptr = realloc(*ptr, siz); } else { len = 0; siz += 1; *ptr = malloc(siz); } snprintf(&(*ptr)[len], siz-len, " %s:%d in %s()\n", filename, lineno, function); } if (function && !strcmp(function, "main")) return 1; else return 0; } char* janitor_backtrace_string(void) { char* string = NULL; #ifdef HAVE_BACKTRACE Dl_info btinfo; void *bt[20]; const char* symb; int count, i, siz, len; #endif #ifdef HAVE_BACKTRACE_FULL if(frames == NULL) { frames = backtrace_create_state(NULL, 0, (backtrace_error_callback) errorhandler, NULL); } pthread_mutex_lock(&frameslock); backtrace_full(frames, 1, (backtrace_full_callback) callbackstring, (backtrace_error_callback) errorhandler, &string); pthread_mutex_unlock(&frameslock); #else #ifdef HAVE_BACKTRACE count = backtrace(bt, sizeof (bt) / sizeof (void*)); for (i = 1; i < count; i++) { dladdr(bt[i], &btinfo); if (btinfo.dli_sname != NULL) { symb = btinfo.dli_sname; if (!strcmp(btinfo.dli_sname, "main")) break; } else symb = "unknown"; siz = 2 + strlen(symb) + 1; if (string != NULL) { len = strlen(string); siz += len + 1; string = realloc(string, siz); } else { len = 0; siz += 1; string = malloc(siz); } snprintf(&(string[len]), siz-len, " %s\n", symb); } #endif #endif return string; } void janitor_backtrace_all(void) { dumpthreads(); } int janitor_trapsignals(char* argv0) { sigset_t mask; stack_t ss; struct sigaction newsigaction; static struct backtrace_state *frames; #ifdef HAVE_BACKTRACE_FULL CHECKFAIL((state = backtrace_create_state(argv0, 0, (backtrace_error_callback)errorhandler, NULL)) == NULL); CHECKFAIL((frames = backtrace_create_state(argv0, 0, (backtrace_error_callback)errorhandler, NULL)) == NULL); #else (void) argv0; #endif /*ss.ss_sp = malloc(SIGSTKSZ); ss.ss_size = SIGSTKSZ; ss.ss_flags = 0; CHECKFAIL(sigaltstack(&ss, NULL) == -1);*/ sigfillset(&mask); sigdelset(&mask, SIGQUIT); newsigaction.sa_sigaction = handlesignal; newsigaction.sa_flags = SA_SIGINFO | SA_ONSTACK; newsigaction.sa_mask = mask; CHECKFAIL(sigaction(SIGQUIT, &newsigaction, &original_quit_action)); CHECKFAIL(sigaction(SIGABRT, &newsigaction, &original_abrt_action)); CHECKFAIL(sigaction(SIGSEGV, &newsigaction, &original_segv_action)); CHECKFAIL(sigaction(SIGFPE, &newsigaction, &original_fpe_action)); CHECKFAIL(sigaction(SIGILL, &newsigaction, &original_ill_action)); CHECKFAIL(sigaction(SIGBUS, &newsigaction, &original_bus_action)); CHECKFAIL(sigaction(SIGSYS, &newsigaction, &original_sys_action)); return 0; fail: return -1; } int janitor_disablecoredump(void) { struct rlimit rlim; rlim.rlim_cur = 0; rlim.rlim_max = 0; CHECKFAIL(setrlimit(RLIMIT_CORE, &rlim)); return 0; fail: return -1; } struct janitor_pthread_barrier_struct { pthread_mutex_t mutex; pthread_cond_t cond; unsigned int waiting; unsigned int count; }; int janitor_pthread_barrier_init(pthread_barrier_t* barrier, const pthread_barrierattr_t* attr, unsigned int count) { struct janitor_pthread_barrier_struct* b; b = malloc(sizeof(struct janitor_pthread_barrier_struct)); if(count == 0 || attr != NULL) { errno = EINVAL; return -1; } if(pthread_mutex_init(&b->mutex, 0) < 0) { free(b); return -1; } if(pthread_cond_init(&b->cond, 0) < 0) { pthread_mutex_destroy(&b->mutex); free(b); return -1; } b->count = count; b->waiting = 0; *(void**)barrier = b; return 0; } int janitor_pthread_barrier_destroy(pthread_barrier_t* barrier) { struct janitor_pthread_barrier_struct* b = *(void**)barrier; pthread_mutex_lock(&b->mutex); if(b->count > 0) { pthread_mutex_unlock(&b->mutex); errno = EBUSY; return -1; } *(void**)barrier = NULL; pthread_mutex_unlock(&b->mutex); pthread_cond_destroy(&b->cond); pthread_mutex_destroy(&b->mutex); free(b); return 0; } int janitor_pthread_barrier_wait(pthread_barrier_t* barrier) { struct janitor_pthread_barrier_struct* b = *(void**)barrier; pthread_mutex_lock(&b->mutex); b->waiting += 1; if(b->waiting == b->count) { b->count = 0; pthread_cond_broadcast(&b->cond); pthread_mutex_unlock(&b->mutex); return PTHREAD_BARRIER_SERIAL_THREAD; } else { pthread_cond_wait(&b->cond, &b->mutex); pthread_mutex_unlock(&b->mutex); return 0; } } opendnssec-2.1.13/common/clientpipe.c0000644000077000001440000001227514446272525014467 00000000000000/* * Copyright (c) 2014-2018 NLNet Labs * Copyright (c) 2014 OpenDNSSEC AB (svb) * 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 "log.h" #include "file.h" #include "str.h" #include "clientpipe.h" /** * Create a message header * \param buf: buffer to write in, MUST be at least 3 octets. * \param opc: type of message * \param datalen: length of payload, MUST be in range 0..2^16-1 * */ static void header(char *buf, enum msg_type opc, uint16_t datalen) { assert(buf); buf[0] = opc; /* Do a memcpy instead of a cast in order to not break memory alignment * requirements on some targets. */ datalen = htons(datalen); memcpy(&buf[1], &datalen, 2); } /* 1 on succes, 0 on fail */ int client_exit(int sockfd, char exitcode) { char ctrl[4]; header(ctrl, CLIENT_OPC_EXIT, 1); ctrl[3] = exitcode; return (ods_writen(sockfd, ctrl, 4) != -1); } /* 1 on succes, 0 on fail */ static int client_msg(int sockfd, char opc, const char *cmd, uint16_t count) { char ctrl[3]; if (sockfd == -1) return 0; header(ctrl, opc, count); if (ods_writen(sockfd, ctrl, 3) == -1) return 0; return (ods_writen(sockfd, cmd, (size_t)count) != -1); } int client_stdin(int sockfd, const char *cmd, uint16_t count) { return client_msg(sockfd, CLIENT_OPC_STDIN, cmd, count); } int client_stdout(int sockfd, const char *cmd, uint16_t count) { return client_msg(sockfd, CLIENT_OPC_STDOUT, cmd, count); } int client_stderr(int sockfd, const char *cmd, uint16_t count) { return client_msg(sockfd, CLIENT_OPC_STDERR, cmd, count); } int client_printf(int sockfd, const char * format, ...) { char buf[ODS_SE_MAXLINE]; int msglen; /* len w/o \0 */ va_list ap; va_start(ap, format); msglen = vsnprintf(buf, ODS_SE_MAXLINE, format, ap); va_end(ap); if (msglen < 0) { ods_log_error("Failed parsing vsnprintf format."); return 0; } if (msglen >= ODS_SE_MAXLINE) { ods_log_error("[file] vsnprintf buffer too small. " "Want to write %d bytes but only %d available.", msglen+1, ODS_SE_MAXLINE); msglen = ODS_SE_MAXLINE; } return client_stdout(sockfd, buf, msglen); } int client_printf_err(int sockfd, const char * format, ...) { char buf[ODS_SE_MAXLINE]; int msglen; va_list ap; va_start(ap, format); msglen = vsnprintf(buf, ODS_SE_MAXLINE, format, ap); va_end(ap); if (msglen < 0) { ods_log_error("Failed parsing vsnprintf format."); return 0; } if (msglen >= ODS_SE_MAXLINE) { ods_log_error("[file] vsnprintf buffer too small. " "Want to write %d bytes but only %d available.", msglen+1, ODS_SE_MAXLINE); msglen = ODS_SE_MAXLINE; } return client_stderr(sockfd, buf, msglen); } /** * Combined error logging and writing to a file descriptor. * */ void ods_log_error_and_printf(int fd, const char *mod, const char *format, ...) { va_list ap; char fmt[128]; char buf[ODS_SE_MAXLINE]; int ok; /* first perform the ods_log_error */ ok = (snprintf(fmt, sizeof(fmt), "[%s] %s", mod, format) < (int)sizeof(fmt)); if (!ok) { ods_log_error("snprintf buffer too small"); client_printf_err(fd, "error: snprintf buffer too small\n"); return; } va_start(ap, format); ods_log_verror(fmt, ap); va_end(ap); /* then perform the ods_printf */ ok = (snprintf(fmt, sizeof(fmt), "error: %s\n", format) < (int)sizeof(fmt)); if (!ok) { ods_log_error("snprintf buffer too small"); client_printf_err(fd, "error: snprintf buffer too small\n"); return; } va_start(ap, format); ok = (vsnprintf(buf, ODS_SE_MAXLINE, fmt,ap) < ODS_SE_MAXLINE); va_end(ap); if (!ok) { ods_log_error("vsnprintf buffer too small"); client_printf_err(fd, "error: vsnprintf buffer too small\n"); return; } client_printf(fd, "%s", buf); } int client_handleprompt(int sockfd) { char data[ODS_SE_MAXLINE]; int n = read(fileno(stdin), data, ODS_SE_MAXLINE); if (n == -1) return 0; if (n == 0) return 0; if (!client_stdin(sockfd, data, n)) return 0; return 1; } opendnssec-2.1.13/common/privdrop.c0000644000077000001440000002150714446272525014176 00000000000000/* * Copyright (c) 2009 Nominet UK. All rights reserved. * * Based heavily on uidswap.c from openssh-5.2p1 * * 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. * */ /** * * Privileges. */ #define _GNU_SOURCE /* defines for setres{g|u}id */ #include "config.h" #include "log.h" #include "privdrop.h" #include "status.h" #include #include #include #include #include #include #include #include #include #include #include #ifndef _SC_GETPW_R_SIZE_MAX #define _SC_GETPW_R_SIZE_MAX 16384 #endif /* _SC_GETPW_R_SIZE_MAX */ #ifndef _SC_GETGR_R_SIZE_MAX #define _SC_GETGR_R_SIZE_MAX 16384 #endif /* _SC_GETGR_R_SIZE_MAX */ static const char* privdrop_str = "privdrop"; /** * Get the user identifier from the username. * */ uid_t privuid(const char* username) { struct passwd pwd; struct passwd* result; long bufsize; char* buf; uid_t uid, olduid; int s; uid = olduid = geteuid(); if (username) { bufsize = sysconf(_SC_GETPW_R_SIZE_MAX); if (bufsize == -1) { bufsize = 16384; /* should be more than enough */ } buf = (char*) calloc(bufsize, sizeof(char)); if (!buf) { ods_log_error("[%s] calloc failed: out of memory?", privdrop_str); return -1; } /* Lookup the user id in /etc/passwd */ s = getpwnam_r(username, &pwd, buf, bufsize, &result); /* LEAK */ if (s) { ods_log_error("[%s] unable to get user id for %s: %s", privdrop_str, username, strerror(s)); } if (result != NULL) { uid = pwd.pw_uid; } free((void*) buf); } else { uid = -1; } return uid; } /** * Get the group identifier from the group name. * */ gid_t privgid(const char *groupname) { struct group grp; struct group* result; long bufsize; char* buf; gid_t gid, oldgid; int s; gid = oldgid = getegid(); if (groupname) { bufsize = sysconf(_SC_GETGR_R_SIZE_MAX); if (bufsize == -1) { bufsize = 16384; /* should be more than enough */ } buf = (char*) calloc(bufsize, sizeof(char)); if (!buf) { ods_log_error("[%s] calloc failed: out of memory?", privdrop_str); return -1; } /* Lookup the group id in /etc/group */ s = getgrnam_r(groupname, &grp, buf, bufsize, &result); /* LEAK */ if (s) { ods_log_error("[%s] unable to get group id for %s: %s", privdrop_str, groupname, strerror(s)); } if (result != NULL) { gid = grp.gr_gid; } free((void*) buf); } else { gid = -1; } return gid; } /** * Drop privileges. * */ ods_status privdrop(const char *username, const char *groupname, const char *newroot, uid_t* puid, gid_t* pgid) { int status; uid_t uid, olduid; gid_t gid; long ngroups_max; gid_t *final_groups; int final_group_len = -1; /* Save effective uid/gid */ uid = olduid = geteuid(); gid = getegid(); /* Check if we're going to drop uid */ if (username) { uid = privuid(username); if (uid == (uid_t)-1) { ods_log_error("[%s] user %s does not exist", privdrop_str, username); return ODS_STATUS_PRIVDROP_ERR; } } /* Check if we're going to drop gid */ if (groupname) { gid = privgid(groupname); if (gid == (gid_t)-1) { ods_log_error("[%s] group %s does not exist", privdrop_str, groupname); return ODS_STATUS_PRIVDROP_ERR; } } /* Change root if requested */ if (newroot) { #ifdef HAVE_CHROOT status = chroot(newroot); if (status != 0 || chdir("/") != 0) { ods_log_error("[%s] chroot to %s failed: %.100s", privdrop_str, newroot, strerror(errno)); return ODS_STATUS_CHROOT_ERR; } #else ods_log_error("[%s] chroot to %s failed: !HAVE_CHROOT", privdrop_str, newroot); return ODS_STATUS_CHROOT_ERR; #endif /* HAVE_CHROOT */ } /* Do additional groups first */ if (username != NULL && !olduid) { #ifdef HAVE_INITGROUPS if (initgroups(username, gid) < 0) { ods_log_error("[%s] initgroups failed: %s: %.100s", privdrop_str, username, strerror(errno)); return ODS_STATUS_PRIVDROP_ERR; } #else ods_log_error("initgroups failed: %s: !HAVE_INITGROUPS", username); return ODS_STATUS_PRIVDROP_ERR; #endif /* HAVE_INITGROUPS */ ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; final_groups = (gid_t *)malloc(ngroups_max *sizeof(gid_t)); if (!final_groups) { return ODS_STATUS_MALLOC_ERR; } #if defined(HAVE_GETGROUPS) && defined(HAVE_SETGROUPS) final_group_len = getgroups(ngroups_max, final_groups); /* If we are root then drop all groups other than the final one */ if (!olduid) { setgroups(final_group_len, final_groups); } #endif /* defined(HAVE_GETGROUPS) && defined(HAVE_SETGROUPS) */ free((void*)final_groups); } else { /* If we are root then drop all groups other than the final one */ #if defined(HAVE_SETGROUPS) if (!olduid) setgroups(1, &(gid)); #endif /* defined(HAVE_SETGROUPS) */ } /* Drop gid? */ if (groupname) { #if defined(HAVE_SETRESGID) && !defined(BROKEN_SETRESGID) status = setresgid(gid, gid, gid); #elif defined(HAVE_SETREGID) && !defined(BROKEN_SETREGID) status = setregid(gid, gid); #else # ifndef SETEUID_BREAKS_SETUID status = setegid(gid); if (status != 0) { ods_log_error("[%s] setegid() for %s (%lu) failed: %s", privdrop_str, groupname, (unsigned long) gid, strerror(errno)); return ODS_STATUS_PRIVDROP_ERR; } # endif /* SETEUID_BREAKS_SETUID */ status = setgid(gid); #endif if (status != 0) { ods_log_error("[%s] setgid() for %s (%lu) failed: %s", privdrop_str, groupname, (unsigned long) gid, strerror(errno)); return ODS_STATUS_PRIVDROP_ERR; } else { ods_log_debug("[%s] group set to %s (%lu)", privdrop_str, groupname, (unsigned long) gid); } } /* Drop uid? */ if (username) { /* Set the user to drop to if specified; else just set the uid as the real one */ #if defined(HAVE_SETRESUID) && !defined(BROKEN_SETRESUID) status = setresuid(uid, uid, uid); #elif defined(HAVE_SETREUID) && !defined(BROKEN_SETREUID) status = setreuid(uid, uid); #else # ifndef SETEUID_BREAKS_SETUID status = seteuid(uid); if (status != 0) { ods_log_error("[%s] seteuid() for %s (%lu) failed: %s", privdrop_str, username, (unsigned long) uid, strerror(errno)); return ODS_STATUS_PRIVDROP_ERR; } # endif /* SETEUID_BREAKS_SETUID */ status = setuid(uid); #endif if (status != 0) { ods_log_error("[%s] setuid() for %s (%lu) failed: %s", privdrop_str, username, (unsigned long) uid, strerror(errno)); return ODS_STATUS_PRIVDROP_ERR; } else { ods_log_debug("[%s] user set to %s (%lu)", privdrop_str, username, (unsigned long) uid); } } *puid = uid; *pgid = gid; return ODS_STATUS_OK; } /** * Close privdrop. * */ void privclose(const char* username, const char* groupname) { if (username) { endpwent(); } if (groupname) { endgrent(); } } opendnssec-2.1.13/common/scheduler/0000755000077000001440000000000014446272544014217 500000000000000opendnssec-2.1.13/common/scheduler/task.c0000644000077000001440000001575614446272525015262 00000000000000/* * Copyright (c) 2009-2018 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 #include #include "scheduler/task.h" #include "scheduler/schedule.h" #include "status.h" #include "duration.h" #include "file.h" #include "log.h" static const char* task_str = "task"; static pthread_mutex_t worklock = PTHREAD_MUTEX_INITIALIZER; const char* TASK_CLASS_ENFORCER = "enforcer"; const char* TASK_CLASS_SIGNER = "signer"; const char* TASK_NONE = "[ignore]"; const char* TASK_TYPE_ENFORCE = "enforce"; const char* TASK_TYPE_RESALT = "resalt"; const char* TASK_TYPE_HSMKEYGEN = "hsmkeygen"; const char* TASK_TYPE_DSSUBMIT = "ds-submit"; const char* TASK_TYPE_DSRETRACT = "ds-retract"; const char* TASK_TYPE_SIGNCONF = "signconf"; const char* TASK_SIGNCONF = "[configure]"; const char* TASK_READ = "[read]"; const char* TASK_NSECIFY = "[???]"; const char* TASK_SIGN = "[sign]"; const char* TASK_WRITE = "[write]"; const char* TASK_FORCESIGNCONF = "[forcesignconf]"; const char* TASK_FORCEREAD = "[forceread]"; task_type* task_create(const char *owner, char const *class, char const *type, time_t (*callback)(task_type* task, char const *owner, void *userdata, void *context), void *userdata, void (*freedata)(void *userdata), time_t due_date) { task_type* task; ods_log_assert(owner); ods_log_assert(class); ods_log_assert(type); CHECKALLOC(task = (task_type*) malloc(sizeof(task_type)));; task->owner = owner; /* TODO: each call to task_create needs to strdup this, but the free is inside task_destroy */ task->class = class; task->type = type; task->callback = callback; task->userdata = userdata; task->freedata = freedata; task->due_date = due_date; task->lock = NULL; task->backoff = 0; return task; } void task_destroy(task_type* task) { ods_log_assert(task); free((void*)task->owner); if (task->freedata) task->freedata((void*)task->userdata); free(task); } void task_perform(schedule_type* scheduler, task_type* task, void* context) { time_t rescheduleTime; ods_status status; if (task->callback) { /* * It is sad but we need worklock to prevent concurrent database * access. Our code is not able to handle that properly. (we can't * really tell the difference between an error and nodata.) Once we * fixed our database backend this lock can be removed. */ ods_log_assert(task->owner); if (!strcmp(task->class, TASK_CLASS_ENFORCER)) pthread_mutex_lock(&worklock); if (task->lock) { pthread_mutex_lock(task->lock); rescheduleTime = task->callback(task, task->owner, task->userdata, context); pthread_mutex_unlock(task->lock); } else { rescheduleTime = task->callback(task, task->owner, task->userdata, context); } if (!strcmp(task->class, TASK_CLASS_ENFORCER)) pthread_mutex_unlock(&worklock); } else { /* We'll allow a task without callback, just don't reschedule. */ rescheduleTime = schedule_SUCCESS; } if (rescheduleTime == schedule_PROMPTLY) { rescheduleTime = time_now(); } else if (rescheduleTime == schedule_IMMEDIATELY) { rescheduleTime = 0; } else if (rescheduleTime == schedule_DEFER) { task->backoff = clamp(task->backoff * 2, 60, ODS_SE_MAX_BACKOFF); ods_log_info("back-off task %s for zone %s with %lu seconds", task->type, task->owner, (long) task->backoff); rescheduleTime = time_now() + task->backoff; } if (rescheduleTime >= 0) { task->due_date = rescheduleTime; status = schedule_task(scheduler, task, (!strcmp(task->class, TASK_CLASS_ENFORCER) ? 1 : 0), (!strcmp(task->class, TASK_CLASS_SIGNER) ? 1 : 0)); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to schedule task for zone %s: %s", task_str, task->owner, ods_status2str(status)); } } else { task_destroy(task); } } task_type* task_duplicate_shallow(task_type *task) { task_type *dup; dup = (task_type*) calloc(1, sizeof(task_type)); if (!dup) { ods_log_error("[%s] cannot create: malloc failed", task_str); return NULL; /* TODO */ } dup->owner = strdup(task->owner); dup->type = task->type; dup->class = task->class; dup->lock = NULL; return dup; } static int cmp_ttuple(task_type *x, task_type *y) { int cmp; cmp = strcmp(x->owner, y->owner); if (cmp != 0) return cmp; if (strcmp(x->type, schedule_WHATEVER) && strcmp(y->type, schedule_WHATEVER)) { cmp = strcmp(x->type, y->type); if (cmp != 0) return cmp; } return strcmp(x->class, y->class); } int task_compare_ttuple(const void* a, const void* b) { task_type* x = (task_type*)a; task_type* y = (task_type*)b; ods_log_assert(a); ods_log_assert(b); return cmp_ttuple(x, y); } int task_compare_time_then_ttuple(const void* a, const void* b) { task_type* x = (task_type*)a; task_type* y = (task_type*)b; ods_log_assert(a); ods_log_assert(b); if (x->due_date != schedule_WHENEVER && y->due_date != schedule_WHENEVER) { if (x->due_date != y->due_date) { return x->due_date - y->due_date; } } return cmp_ttuple(x, y); } void task_log(task_type* task) { char* strtime = NULL; if (task) { strtime = ctime(&task->due_date); if (strtime) { strtime[strlen(strtime)-1] = '\0'; } ods_log_debug("[%s] On %s I will %s zone %s", task_str, strtime?strtime:"(null)", task->type, task->owner); } } opendnssec-2.1.13/common/scheduler/task.h0000644000077000001440000001150114446272525015247 00000000000000/* * Copyright (c) 2009-2018 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. * * Tasks consists of several parts: * * Identifier: a task is uniquely identified by its ttuple (task-tuple). * which consist of a class (enforcer/signer) a type (resalt/sign) and * an owner, usually the zone the task is for. This way we can find * all tasks belonging to a component so we can later merge signer and * enforcer if we so wish. * * due_date: The time this task should run on. Unix timestamp. Anything * smaller than now() should be considered ASAP. Negative values should * not be given. They are special and tell the signer not to schedule a * task. * * Payload: the callback, a context passed to the callback and method * to free the context. * */ #ifndef SCHEDULER_TASK_H #define SCHEDULER_TASK_H #include "config.h" #include #include #include "status.h" struct task_struct; typedef struct task_struct task_type; typedef const char* task_id; struct task_struct { /* The following span the T-tuple. It is used to uniquely identify * a task. */ task_id owner; /* e.g. "example.com". string owned by task */ task_id class; /* e.g. "enforcer" */ task_id type; /* e.g. "resalt" */ /* date and time this task should execute anything. If time is in * the past interpret it as *now* */ time_t due_date; /* time this tasks has been delayed from its original due_date */ time_t backoff; /* if returned time >= 0 the task is rescheduled for that time. * keeping context. otherwise scheduler will free context, owner, * and task. */ time_t (*callback)(task_type* task, char const *owner, void *userdata, void *context); /* Context passed to callback. */ void *userdata; /* Callback to deepfree task context. Leave NULL to not free the * context. The function should accept a NULL argument just like * free() does. */ void (*freedata)(void *userdata); /* Lock specific for this task. It is assigned by the scheduler * on scheduler_push_task(). All tasks with the same ttuple will * get the same lock. */ pthread_mutex_t *lock; }; extern const char* TASK_CLASS_ENFORCER; extern const char* TASK_CLASS_SIGNER; extern const char* TASK_TYPE_ENFORCE; extern const char* TASK_TYPE_RESALT; extern const char* TASK_TYPE_HSMKEYGEN; extern const char* TASK_TYPE_DSSUBMIT; extern const char* TASK_TYPE_DSRETRACT; extern const char* TASK_TYPE_SIGNCONF; extern const char* TASK_NONE; extern const char* TASK_SIGNCONF; extern const char* TASK_READ; extern const char* TASK_NSECIFY; extern const char* TASK_SIGN; extern const char* TASK_WRITE; extern const char* TASK_FORCESIGNCONF; extern const char* TASK_FORCEREAD; /* * owner: string is owned by task. * context: also owned by task */ task_type* task_create(const char *owner, char const *class, char const *type, time_t (*callback)(task_type* task, char const *owner, void* userdata, void *context), void *userdata, void (*freedata)(void *userdata), time_t due_date); /* Free task, owner, and context */ void task_destroy(task_type* task); /* used in our reverse lookup structure. */ int task_compare_ttuple(const void* a, const void* b); /* This is used for sorting our queue */ int task_compare_time_then_ttuple(const void* a, const void* b); /* Create new task, copy ttuple from existing task. NULL on malloc * failure. */ task_type* task_duplicate_shallow(task_type *task); void task_log(task_type* task); char* task2str(task_type* task, char* buftask); const char* task_what2str(task_id what); const char* task_who2str(task_type* task); #endif /* SCHEDULER_TASK_H */ opendnssec-2.1.13/common/scheduler/schedule.c0000644000077000001440000005117014446272525016102 00000000000000/* * Copyright (c) 2009-2018 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. * * This module maintains a collection of tasks. All external functions * should be thread safe. Beware not to call an external function from * within this module, it will cause deadlocks. * * In principle the calling function should never need to lock the * scheduler. */ #include "config.h" #include #include #include #include "scheduler/schedule.h" #include "scheduler/task.h" #include "scheduler/fifoq.h" #include "duration.h" #include "log.h" #include "locks.h" #include "util.h" #include "utilities.h" static const char* schedule_str = "scheduler"; /** * Convert task to a tree node. * NULL on malloc failure */ 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; } /** * Get the first scheduled task. As long as return value is used * caller should hold schedule->schedule_lock. * * \param[in] schedule schedule * \return task_type* first scheduled task, NULL on no task or error. */ static 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; } /* no more tasks to be flushed, return first task in schedule */ pop = (task_type*) first_node->data; return pop; } /** * pop the first scheduled task. Caller must hold * schedule->schedule_lock. Result is safe to use outside lock. * * \param[in] schedule schedule * \return task_type* first scheduled task, NULL on no task or error. */ static task_type* pop_first_task(schedule_type* schedule) { ldns_rbnode_t *node, *delnode; task_type *task; if (!schedule || !schedule->tasks) return NULL; node = ldns_rbtree_first(schedule->tasks); if (!node) return NULL; delnode = ldns_rbtree_delete(schedule->tasks, node->data); /* delnode == node, but we don't free it just yet, data is shared * with tasks_by_name tree */ if (!delnode) return NULL; delnode = ldns_rbtree_delete(schedule->tasks_by_name, node->data); free(node); if (!delnode) return NULL; task = (task_type*) delnode->data; free(delnode); /* this delnode != node */ pthread_cond_signal(&schedule->schedule_cond); return task; } /** * Internal task cleanup function. * */ static void task_delfunc(ldns_rbnode_t* node) { task_type* task; if (node && node != LDNS_RBTREE_NULL) { task = (task_type*) node->data; task_delfunc(node->left); task_delfunc(node->right); task_destroy(task); free((void*)node); } } static void task_delfunc2(ldns_rbnode_t* node) { if (node && node != LDNS_RBTREE_NULL) { task_delfunc2(node->left); task_delfunc2(node->right); free((void*)node); } } /* Removes task from both trees and assign nodes to node1 and node2. * These belong to the caller now * * 0 on success */ static int fetch_node_pair(schedule_type *schedule, task_type *task, ldns_rbnode_t **nodeFromTimeTree, ldns_rbnode_t **nodeFromNameTree, int remove) { task_type *originalTask; ods_log_assert(schedule); ods_log_assert(task); *nodeFromTimeTree = NULL; if (remove) { *nodeFromNameTree = ldns_rbtree_delete(schedule->tasks_by_name, task); } else { *nodeFromNameTree = ldns_rbtree_search(schedule->tasks_by_name, task); } if (!*nodeFromNameTree) { return 1; /* could not find task*/ } else { originalTask = (task_type*) (*nodeFromNameTree)->key; /* This is the original task, it has the correct time so we can find it in tasks */ ods_log_assert(originalTask); if (remove) { *nodeFromTimeTree = ldns_rbtree_delete(schedule->tasks, originalTask); } else { *nodeFromTimeTree = ldns_rbtree_search(schedule->tasks, originalTask); } ods_log_assert(*nodeFromTimeTree); return 0; } } /** * Create new schedule. Allocate and initialise scheduler. To clean * up schedule_cleanup() should be called. */ schedule_type* schedule_create() { schedule_type* schedule; CHECKALLOC(schedule = (schedule_type*) malloc(sizeof(schedule_type))); schedule->tasks = ldns_rbtree_create(task_compare_time_then_ttuple); schedule->tasks_by_name = ldns_rbtree_create(task_compare_ttuple); schedule->locks_by_name = ldns_rbtree_create(task_compare_ttuple); pthread_mutex_init(&schedule->schedule_lock, NULL); pthread_cond_init(&schedule->schedule_cond, NULL); schedule->num_waiting = 0; schedule->handlers = NULL; schedule->nhandlers = 0; CHECKALLOC(schedule->signq = fifoq_create()); return schedule; } /** * Clean up schedule. deinitialise and free scheduler. * Threads MUST be stopped before calling this function. */ void schedule_cleanup(schedule_type* schedule) { if (!schedule) return; ods_log_debug("[%s] cleanup schedule", schedule_str); if (schedule->tasks) { task_delfunc(schedule->tasks->root); task_delfunc2(schedule->tasks_by_name->root); ldns_rbtree_free(schedule->tasks); ldns_rbtree_free(schedule->tasks_by_name); ldns_rbtree_free(schedule->locks_by_name); schedule->tasks = NULL; } fifoq_cleanup(schedule->signq); pthread_mutex_destroy(&schedule->schedule_lock); pthread_cond_destroy(&schedule->schedule_cond); free(schedule->handlers); free(schedule); } void schedule_purge(schedule_type* schedule) { ldns_rbnode_t* node; if (!schedule || !schedule->tasks) return; pthread_mutex_lock(&schedule->schedule_lock); /* don't attempt to free payload, still referenced by other tree*/ while ((node = ldns_rbtree_first(schedule->tasks)) != LDNS_RBTREE_NULL) { node = ldns_rbtree_delete(schedule->tasks, node->data); if (node == 0) break; free(node); } /* also clean up name tree */ while ((node = ldns_rbtree_first(schedule->tasks_by_name)) != LDNS_RBTREE_NULL) { node = ldns_rbtree_delete(schedule->tasks_by_name, node->data); if (node == 0) break; task_destroy((task_type*) node->data); free(node); } /* also clean up locks tree */ while ((node = ldns_rbtree_first(schedule->locks_by_name)) != LDNS_RBTREE_NULL) { node = ldns_rbtree_delete(schedule->locks_by_name, node->data); if (node == 0) break; pthread_mutex_destroy(((task_type*) node->data)->lock); free(((task_type*) node->data)->lock); task_destroy((task_type*) node->data); free(node); } pthread_mutex_unlock(&schedule->schedule_lock); } void schedule_purge_owner(schedule_type* schedule, char const *class, char const *owner) { /* This method is somewhat inefficient but not too bad. Approx: * O(N + M log N). Where N total tasks, M tasks to remove. Probably * a bit worse since the trees are balanced. */ task_type **tasks, *task; int i, num_slots = 10, num_tasks = 0; ldns_rbnode_t *n1, *n2, *node; /* We expect around 3 tasks per owner so we probably never have to * realloc if we start with num_slots = 10 */ tasks = (task_type **)malloc(num_slots * sizeof(task_type *)); if (!tasks) return; pthread_mutex_lock(&schedule->schedule_lock); /* First collect all tasks that match. Don't fiddle with the * tree. That is not save and might mess up our iteration. */ node = ldns_rbtree_first(schedule->tasks_by_name); while (node != LDNS_RBTREE_NULL) { task = (task_type *) node->key; node = ldns_rbtree_next(node); if (!strcmp(task->owner, owner) && !strcmp(task->class, class)) { tasks[num_tasks++] = task; if (num_tasks == num_slots) { num_slots *= 2; tasks = realloc(tasks, num_slots * sizeof(task_type *)); if (!tasks) { pthread_mutex_unlock(&schedule->schedule_lock); return; } } } } /* Be free my little tasks, be free! */ for (i = 0; ischedule_lock); } ods_status schedule_task(schedule_type* schedule, task_type* task, int replace, int log) { ods_status status = ODS_STATUS_OK; ldns_rbnode_t* node1; ldns_rbnode_t* node2; task_type *existing_task, *t; ods_log_assert(task); if (!schedule || !schedule->tasks) { ods_log_error("[%s] unable to schedule task: no schedule", schedule_str); return ODS_STATUS_ERR; } ods_log_debug("[%s] schedule task %s for %s", schedule_str, task->type, task->owner); pthread_mutex_lock(&schedule->schedule_lock); if (fetch_node_pair(schedule, task, &node1, &node2, replace)) { /* Though no such task is scheduled at the moment, there could * be a lock for it. If task already has a lock, keep using that. */ if (!task->lock) { node1 = ldns_rbtree_search(schedule->locks_by_name, task); if (!node1) { /* New lock, insert in tree */ t = task_duplicate_shallow(task); t->lock = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); if (pthread_mutex_init(t->lock, NULL)) { task_destroy(t); pthread_mutex_unlock(&schedule->schedule_lock); return ODS_STATUS_ERR; } node1 = task2node(t); ods_log_assert(ldns_rbtree_insert(schedule->locks_by_name, node1)); } task->lock = ((task_type*)node1->key)->lock; } /* not is schedule yet */ node1 = task2node(task); node2 = task2node(task); if (!node1 || !node2) { pthread_mutex_unlock(&schedule->schedule_lock); free(node1); free(node2); return ODS_STATUS_ERR; } ods_log_assert(ldns_rbtree_insert(schedule->tasks, node1)); ods_log_assert(ldns_rbtree_insert(schedule->tasks_by_name, node2)); } else { if (!replace) { ods_log_error("[%s] unable to schedule task %s for zone %s: already present", schedule_str, task->type, task->owner); status = ODS_STATUS_ERR; } else { ods_log_assert(node1->key == node2->key); existing_task = (task_type*) node1->key; if (task->due_date < existing_task->due_date) existing_task->due_date = task->due_date; if (existing_task->freedata) existing_task->freedata(existing_task->userdata); existing_task->userdata = task->userdata; existing_task->freedata = task->freedata; existing_task->callback = task->callback; task->userdata = NULL; /* context is now assigned to existing_task, prevent it from freeing */ task_destroy(task); ods_log_assert(ldns_rbtree_insert(schedule->tasks, node1)); ods_log_assert(ldns_rbtree_insert(schedule->tasks_by_name, node2)); task = existing_task; } } if (status == ODS_STATUS_OK) { if (log) { task_log(task); } } pthread_cond_signal(&schedule->schedule_cond); pthread_mutex_unlock(&schedule->schedule_lock); return status; } /** * Unschedule task. * * \param[in] schedule schedule * \return task_type* first scheduled task, NULL on no task or error. */ static task_type* unschedule_task(schedule_type* schedule, task_type* task) { ldns_rbnode_t* del_node = LDNS_RBTREE_NULL; ldns_rbnode_t* node2 = 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->type, task->owner); del_node = ldns_rbtree_delete(schedule->tasks, (const void*) task); if (del_node) { del_task = (task_type*) del_node->data; node2 = ldns_rbtree_delete(schedule->tasks_by_name, del_task); if (node2 != NULL && node2 != LDNS_RBTREE_NULL) { free(node2); } free((void*)del_node); return del_task; } else { return NULL; } } task_type* schedule_unschedule(schedule_type* schedule, task_type* task) { task_type* originalTask; pthread_mutex_lock(&schedule->schedule_lock); originalTask = unschedule_task(schedule, task); pthread_mutex_unlock(&schedule->schedule_lock); return originalTask; } task_type* schedule_pop_task(schedule_type* schedule) { time_t timeout, now = time_now(); task_type* task; pthread_mutex_lock(&schedule->schedule_lock); task = schedule_get_first_task(schedule); if (task && (task->due_date <= now)) { ods_log_debug("[%s] pop task for zone %s", schedule_str, task->owner); task = unschedule_task(schedule, task); } else { /* nothing to do now, sleep and wait for signal */ schedule->num_waiting += 1; timeout = clamp((task ? (task->due_date - now) : 0), ((task && !strcmp(task->class, TASK_CLASS_ENFORCER)) ? 0 : 60), ODS_SE_MAX_BACKOFF); ods_thread_wait(&schedule->schedule_cond, &schedule->schedule_lock, timeout); schedule->num_waiting -= 1; task = NULL; } pthread_mutex_unlock(&schedule->schedule_lock); return task; } task_type* schedule_pop_first_task(schedule_type* schedule) { task_type *task; pthread_mutex_lock(&schedule->schedule_lock); task = pop_first_task(schedule); pthread_mutex_unlock(&schedule->schedule_lock); return task; } void schedule_flush(schedule_type* schedule) { ldns_rbnode_t *node; task_type* task; ods_log_debug("[%s] flush all tasks", schedule_str); if (!schedule || !schedule->tasks) return; pthread_mutex_lock(&schedule->schedule_lock); do { node = ldns_rbtree_last(schedule->tasks); if (node && node != LDNS_RBTREE_NULL) { task = (task_type*) node->data; if (task->due_date > time_now()) { /* we only need to delete the node from the tasks tree as we * are immediately inserting it again. */ ldns_rbtree_delete(schedule->tasks, task); task->due_date = time_now(); ldns_rbtree_insert(schedule->tasks, node); } else { /* the last in the ordered tree is already executing * immediately so this means that all of them are, we can abort * the loop as if we just hit the last one in the tree. */ node = NULL; } } } while (node && node != LDNS_RBTREE_NULL); pthread_cond_signal(&schedule->schedule_cond); pthread_mutex_unlock(&schedule->schedule_lock); } int schedule_info(schedule_type* schedule, time_t* firstFireTime, int* idleWorkers, int* taskCount) { task_type* task; if (firstFireTime) { *firstFireTime = -1; } if (idleWorkers) { *idleWorkers = 0; } if (taskCount) { *taskCount = 0; } if (!schedule || !schedule->tasks) { return -1; } pthread_mutex_lock(&schedule->schedule_lock); if (taskCount) *taskCount = schedule->tasks->count; if (idleWorkers) { *idleWorkers = schedule->num_waiting; } task = schedule_get_first_task(schedule); if (task) if (firstFireTime) *firstFireTime = task->due_date; pthread_mutex_unlock(&schedule->schedule_lock); return 0; } void schedule_release_all(schedule_type* schedule) { pthread_mutex_lock(&schedule->schedule_lock); pthread_cond_broadcast(&schedule->schedule_cond); pthread_mutex_unlock(&schedule->schedule_lock); fifoq_notifyall(schedule->signq); } void schedule_task_destroy(schedule_type* sched, task_type* task) { pthread_mutex_lock(&sched->schedule_lock); task = unschedule_task(sched, (task_type*) task); pthread_mutex_unlock(&sched->schedule_lock); task_destroy(task); } char* schedule_describetask(task_type* task) { char ctimebuf[32]; /* at least 26 according to docs */ char* strtime = NULL; char* strtask = NULL; time_t time; if (task) { time = (task->due_date < time_now()) ? time_now() : task->due_date; strtime = ctime_r(&time, ctimebuf); if (strtime) { strtime[strlen(strtime)-1] = '\0'; } strtask = (char*) calloc(ODS_SE_MAXLINE, sizeof(char)); if (strtask) { snprintf(strtask, ODS_SE_MAXLINE, "On %s I will %s zone %s\n", strtime ? strtime : "(null)", task->type, task->owner); return strtask; } else { ods_log_error("unable to convert task to string: malloc error"); return NULL; } } return strtask; } int schedule_task_istype(task_type* task, task_id type) { return !strcmp(task->type, type); } void schedule_registertask(schedule_type* schedule, task_id taskclass, task_id tasktype, time_t (*callback)(task_type* task, char const *owner, void *userdata, void *context)) { struct schedule_handler* handlers; handlers = realloc(schedule->handlers, sizeof(struct schedule_handler)*(schedule->nhandlers+1)); if (handlers != NULL) { handlers[schedule->nhandlers].class = taskclass; handlers[schedule->nhandlers].type = tasktype; handlers[schedule->nhandlers].callback = callback; schedule->handlers = handlers; schedule->nhandlers += 1; } } void schedule_scheduletask(schedule_type* schedule, task_id type, const char* owner, void* userdata, pthread_mutex_t* resource, time_t when) { int i; task_type* task; struct schedule_handler* handler = NULL; for (i = 0; i < schedule->nhandlers; i++) { if (schedule->handlers[i].type == type) { handler = &schedule->handlers[i]; } } if (handler) { task = task_create(strdup(owner), handler->class, type, handler->callback, userdata, NULL, when); task->lock = resource; schedule_task(schedule, task, 0, 0); } } void schedule_unscheduletask(schedule_type* schedule, task_id type, const char* owner) { ldns_rbnode_t* node1; ldns_rbnode_t* node2; task_type* match; task_type* found; match = task_create(owner, TASK_CLASS_SIGNER, type, NULL, NULL, NULL, schedule_WHENEVER); pthread_mutex_lock(&schedule->schedule_lock); while (fetch_node_pair(schedule, match, &node1, &node2, 0) == 0) { ods_log_assert(node1->key == node2->key); found = (task_type*) node1->key; unschedule_task(schedule, found); } pthread_mutex_unlock(&schedule->schedule_lock); free(match); /* do not perform a destroy, this is a temporary, internal, flat task only */ } opendnssec-2.1.13/common/scheduler/fifoq.h0000644000077000001440000000573614446272525015426 00000000000000/* * Copyright (c) 2011-2018 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 #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_UNISTD_H # include #endif #include typedef struct fifoq_struct fifoq_type; #include "scheduler/schedule.h" #include "worker.h" #include "locks.h" #include "status.h" #define FIFOQ_MAX_COUNT 1000 #define FIFOQ_TRIES_COUNT 10 /** * FIFO Queue. */ struct fifoq_struct { void* blob[FIFOQ_MAX_COUNT]; void* owner[FIFOQ_MAX_COUNT]; size_t count; pthread_mutex_t q_lock; pthread_cond_t q_threshold; pthread_cond_t q_nonfull; }; /** * Create new FIFO queue. * \param[in] allocator memory allocator * \return fifoq_type* created queue * */ fifoq_type* fifoq_create(void); /** * 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, void** 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, void* worker, int* tries); /** * Clean up queue. * \param[in] q queue to be cleaned up * */ void fifoq_cleanup(fifoq_type* q); void fifoq_report(fifoq_type* q, worker_type* superior, ods_status subtaskstatus); void fifoq_waitfor(fifoq_type* q, worker_type* worker, long nsubtasks, long* nsubtasksfailed); void fifoq_notifyall(fifoq_type* q); #endif /* SCHEDULER_FIFOQ_H */ opendnssec-2.1.13/common/scheduler/schedule.h0000644000077000001440000001325214446272525016106 00000000000000/* * Copyright (c) 2009-2018 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 #include #include #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_UNISTD_H # include #endif typedef struct schedule_struct schedule_type; #include "fifoq.h" #include "scheduler/task.h" #include "locks.h" #include "status.h" #include "task.h" struct schedule_handler { task_id type; task_id class; time_t (*callback)(task_type* task, char const *owner, void *userdata, void *context); }; struct schedule_struct { /* Contains all tasks sorted by due_date so we can quickly find * the first task. */ ldns_rbtree_t* tasks; /* Contains all tasks in tasks tree but here sorted by ttuple. */ ldns_rbtree_t* tasks_by_name; /* For every ttuple contains a task structure with an unique lock */ ldns_rbtree_t* locks_by_name; fifoq_type* signq; pthread_cond_t schedule_cond; pthread_mutex_t schedule_lock; /* For testing. So we can verify al workers are waiting and nothing * is to be done. Used by enforcer_idle. */ int num_waiting; struct schedule_handler* handlers; int nhandlers; }; /** * Create new schedule. * \param[in] allocator memory allocator * \return schedule_type* created schedule */ schedule_type* schedule_create(void); /** * Clean up schedule. * \param[in] schedule schedule to be cleaned up * */ void schedule_cleanup(schedule_type* schedule); void schedule_registertask(schedule_type* schedule, task_id class, task_id type, time_t (*callback)(task_type* task, char const *owner, void *userdata, void *context)); /** * purge schedule. All tasks will be thrashed. * \param[in] schedule schedule to be purged */ void schedule_purge(schedule_type* schedule); /** * Delete and free all tasks from the queue associated with owner for a * specific class */ void schedule_purge_owner(schedule_type* schedule, char const *class, char const *owner); /** * Schedule task. Task is now owned by scheduler and should must no * longer be accessed. If a task with the same identifier is scheduled * it is updated with this tasks' context and due_time is the minimum * of both tasks. * On return ERROR caller is responsible for freeing 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 replace, int log); void schedule_scheduletask(schedule_type* schedule, task_id task, const char* owner, void* userdata, pthread_mutex_t* resource, time_t when); /** * Unschedule task. * \return task_type* task, if it was scheduled * */ void schedule_unscheduletask(schedule_type* schedule, task_id task, const char* userdata); /** * Pop the first scheduled task that is due. If an item is directly * available it will be returned. Else the call will block and return * NULL when the caller is awoken. * * \param[in] schedule schedule * \return task_type* popped task, or NULL when no task available or * no task due */ task_type* schedule_pop_task(schedule_type* schedule); /** * Pop the first scheduled task. regardless of its due time. * Used for timeleap. * * \param[in] schedule schedule * \return task_type* popped task, or NULL when no task available or * no task available */ task_type* schedule_pop_first_task(schedule_type* schedule); void schedule_flush(schedule_type* schedule); int schedule_info(schedule_type* schedule, time_t* firstFireTime, int* idleWorkers, int* taskCount); /** * Wake up all threads waiting for tasks. Useful to on program teardown. */ void schedule_release_all(schedule_type* schedule); void schedule_task_destroy(schedule_type* sched, task_type* task); time_t sched_task_due(task_type* task); int schedule_task_istype(task_type* task, task_id type); char* schedule_describetask(task_type* task); void task_perform(schedule_type* sched, task_type* task, void* context); #define schedule_PROMPTLY 1 /* now */ #define schedule_IMMEDIATELY 0 /* !! Priority !! */ #define schedule_SUCCESS -1 /* Don't reschedule */ #define schedule_DEFER -2 /* Retry with backoff */ #define schedule_FAILED -3 /* Don't reschedule */ #define schedule_WHATEVER "[any]" #define schedule_WHENEVER -1 #endif /* SCHEDULER_SCHEDULE_H */ opendnssec-2.1.13/common/scheduler/worker.h0000644000077000001440000000424214446272525015622 00000000000000/* * Copyright (c) 2009-2018 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 "janitor.h" #include "scheduler/task.h" struct engine_struct; typedef struct worker_struct worker_type; struct worker_struct { const char* name; schedule_type* taskq; janitor_thread_t thread_id; int need_to_exit; void* context; int tasksOutstanding; int tasksFailed; pthread_cond_t tasksBlocker; }; /** * Create worker. * \param[in] num thread number * \param[in] type type of worker * \return worker_type* created worker * */ worker_type* worker_create(const char* name, schedule_type* taskq); /** * Start working. * \param[in] worker worker to start working * */ void worker_start(worker_type* worker); /** * Clean up worker. * \param[in] worker worker to clean up * */ void worker_cleanup(worker_type* worker); #endif /* DAEMON_WORKER_H */ opendnssec-2.1.13/common/scheduler/fifoq.c0000644000077000001440000001156614446272525015417 00000000000000/* * Copyright (c) 2011-2018 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 "log.h" #include static const char* fifoq_str = "fifo"; /** * Create new FIFO queue. * */ fifoq_type* fifoq_create() { fifoq_type* fifoq; CHECKALLOC(fifoq = (fifoq_type*) malloc(sizeof(fifoq_type))); fifoq_wipe(fifoq); pthread_mutex_init(&fifoq->q_lock, NULL); pthread_cond_init(&fifoq->q_threshold, NULL); pthread_cond_init(&fifoq->q_nonfull, NULL); 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; } /** * Pop item from queue. * */ void* fifoq_pop(fifoq_type* q, void** context) { void* pop = NULL; size_t i = 0; if (!q || q->count <= 0) { return NULL; } pop = q->blob[0]; *context = 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. */ pthread_cond_broadcast(&q->q_nonfull); } return pop; } /** * Push item to queue. * */ ods_status fifoq_push(fifoq_type* q, void* item, void* context, int* tries) { if (!q || !item) { 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) { pthread_cond_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] = context; q->count += 1; if (q->count == 1) { ods_log_deeebug("[%s] threshold %lu reached, notify drudgers", fifoq_str, (unsigned long) q->count); /* If no drudgers are waiting, this call has no effect. */ pthread_cond_broadcast(&q->q_threshold); } return ODS_STATUS_OK; } void fifoq_report(fifoq_type* q, worker_type* superior, ods_status subtaskstatus) { pthread_mutex_lock(&q->q_lock); if (subtaskstatus != ODS_STATUS_OK) { superior->tasksFailed += 1; } superior->tasksOutstanding -= 1; if (superior->tasksOutstanding == 0) { pthread_cond_signal(&superior->tasksBlocker); } pthread_mutex_unlock(&q->q_lock); } void fifoq_waitfor(fifoq_type* q, worker_type* worker, long nsubtasks, long* nsubtasksfailed) { pthread_mutex_lock(&q->q_lock); worker->tasksOutstanding += nsubtasks; while (worker->tasksOutstanding > 0 && !worker->need_to_exit) { pthread_cond_wait(&worker->tasksBlocker, &q->q_lock); } *nsubtasksfailed = worker->tasksFailed; worker->tasksFailed = 0; pthread_mutex_unlock(&q->q_lock); } /** * Clean up queue. * */ void fifoq_cleanup(fifoq_type* q) { if (!q) { return; } pthread_cond_destroy(&q->q_threshold); pthread_cond_destroy(&q->q_nonfull); pthread_mutex_destroy(&q->q_lock); free(q); } void fifoq_notifyall(fifoq_type* q) { pthread_mutex_lock(&q->q_lock); pthread_cond_broadcast(&q->q_threshold); pthread_cond_broadcast(&q->q_nonfull); pthread_mutex_unlock(&q->q_lock); } opendnssec-2.1.13/common/scheduler/worker.c0000644000077000001440000000512214446272525015613 00000000000000/* * Copyright (c) 2009-2018 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 "scheduler/schedule.h" #include "scheduler/worker.h" #include "scheduler/task.h" #include "log.h" #include "status.h" #include "util.h" /** * Create worker. * */ worker_type* worker_create(const char* name, schedule_type* taskq) { worker_type* worker; CHECKALLOC(worker = (worker_type*) malloc(sizeof(worker_type))); worker->name = name; worker->need_to_exit = 0; worker->context = NULL; worker->taskq = taskq; worker->tasksOutstanding = 0; worker->tasksFailed = 0; pthread_cond_init(&worker->tasksBlocker, NULL); return worker; } /** * Work. * */ void worker_start(worker_type* worker) { task_type *task; ods_log_assert(worker); while (worker->need_to_exit == 0) { ods_log_debug("[%s]: report for duty", worker->name); /* When no task available this call blocks and waits for event. * Then it will return NULL; */ task = schedule_pop_task(worker->taskq); if (task) { ods_log_debug("[%s] start working", worker->name); task_perform(worker->taskq, task, worker->context); ods_log_debug("[%s] finished working", worker->name); } } } /** * Clean up worker. * */ void worker_cleanup(worker_type* worker) { free((void*)worker->name); free(worker); } opendnssec-2.1.13/common/Makefile.am0000644000077000001440000000133114446272525014212 00000000000000MAINTAINERCLEANFILES = $(srcdir)/Makefile.in AM_CPPFLAGS = \ @LDNS_INCLUDES@ noinst_LIBRARIES = libcompat.a libcompat_a_SOURCES = \ b64_ntop.c b64_pton.c \ clientpipe.c clientpipe.h \ compat.h \ duration.c duration.h \ file.c file.h \ locks.c locks.h \ log.c log.h \ privdrop.c privdrop.h \ pselect.c \ status.c status.h \ str.c str.h strlcat.c strlcpy.c \ util.c util.h \ datastructure.c datastructure.h \ scheduler/schedule.c scheduler/schedule.h \ scheduler/task.c scheduler/task.h \ scheduler/fifoq.c scheduler/fifoq.h \ scheduler/worker.c scheduler/worker.h \ scheduler/task.c scheduler/task.h \ utilities.c utilities.h \ cmdhandler.c cmdhandler.h \ janitor.c janitor.h \ longgetopt.c longgetopt.h opendnssec-2.1.13/common/b64_ntop.c0000644000077000001440000001626314446272525013767 00000000000000/* * Copyright (c) 1996, 1998 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* * Portions Copyright (c) 1995 by International Business Machines, Inc. * * International Business Machines, Inc. (hereinafter called IBM) grants * permission under its copyrights to use, copy, modify, and distribute this * Software with or without fee, provided that the above copyright notice and * all paragraphs of this notice appear in all copies, and that the name of IBM * not be used in connection with the marketing of any product incorporating * the Software or modifications thereof, without specific, written prior * permission. * * To the extent it has a right to do so, IBM grants an immunity from suit * under its patents, if any, for the use, sale or manufacture of products to * the extent that such products are used for performing Domain Name System * dynamic updates in TCP/IP networks by means of the Software. No immunity is * granted for any product per se or for any other function of any product. * * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. */ #include #include #include #include #include #include #include #include #include #include #define Assert(Cond) if (!(Cond)) abort() static const char Base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static const char Pad64 = '='; /* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) The following encoding technique is taken from RFC 1521 by Borenstein and Freed. It is reproduced here in a slightly edited form for convenience. A 65-character subset of US-ASCII is used, enabling 6 bits to be represented per printable character. (The extra 65th character, "=", is used to signify a special processing function.) The encoding process represents 24-bit groups of input bits as output strings of 4 encoded characters. Proceeding from left to right, a 24-bit input group is formed by concatenating 3 8-bit input groups. These 24 bits are then treated as 4 concatenated 6-bit groups, each of which is translated into a single digit in the base64 alphabet. Each 6-bit group is used as an index into an array of 64 printable characters. The character referenced by the index is placed in the output string. Table 1: The Base64 Alphabet Value Encoding Value Encoding Value Encoding Value Encoding 0 A 17 R 34 i 51 z 1 B 18 S 35 j 52 0 2 C 19 T 36 k 53 1 3 D 20 U 37 l 54 2 4 E 21 V 38 m 55 3 5 F 22 W 39 n 56 4 6 G 23 X 40 o 57 5 7 H 24 Y 41 p 58 6 8 I 25 Z 42 q 59 7 9 J 26 a 43 r 60 8 10 K 27 b 44 s 61 9 11 L 28 c 45 t 62 + 12 M 29 d 46 u 63 / 13 N 30 e 47 v 14 O 31 f 48 w (pad) = 15 P 32 g 49 x 16 Q 33 h 50 y Special processing is performed if fewer than 24 bits are available at the end of the data being encoded. A full encoding quantum is always completed at the end of a quantity. When fewer than 24 input bits are available in an input group, zero bits are added (on the right) to form an integral number of 6-bit groups. Padding at the end of the data is performed using the '=' character. Since all base64 input is an integral number of octets, only the following cases can arise: (1) the final quantum of encoding input is an integral multiple of 24 bits; here, the final unit of encoded output will be an integral multiple of 4 characters with no "=" padding, (2) the final quantum of encoding input is exactly 8 bits; here, the final unit of encoded output will be two characters followed by two "=" padding characters, or (3) the final quantum of encoding input is exactly 16 bits; here, the final unit of encoded output will be three characters followed by one "=" padding character. */ int b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) { size_t datalength = 0; uint8_t input[3]; uint8_t output[4]; size_t i; while (2 < srclength) { input[0] = *src++; input[1] = *src++; input[2] = *src++; srclength -= 3; output[0] = input[0] >> 2; output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); output[3] = input[2] & 0x3f; Assert(output[0] < 64); Assert(output[1] < 64); Assert(output[2] < 64); Assert(output[3] < 64); if (datalength + 4 > targsize) return (-1); target[datalength++] = Base64[output[0]]; target[datalength++] = Base64[output[1]]; target[datalength++] = Base64[output[2]]; target[datalength++] = Base64[output[3]]; } /* Now we worry about padding. */ if (0 != srclength) { /* Get what's left. */ input[0] = input[1] = input[2] = '\0'; for (i = 0; i < srclength; i++) input[i] = *src++; output[0] = input[0] >> 2; output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); Assert(output[0] < 64); Assert(output[1] < 64); Assert(output[2] < 64); if (datalength + 4 > targsize) return (-1); target[datalength++] = Base64[output[0]]; target[datalength++] = Base64[output[1]]; if (srclength == 1) target[datalength++] = Pad64; else target[datalength++] = Base64[output[2]]; target[datalength++] = Pad64; } if (datalength >= targsize) return (-1); target[datalength] = '\0'; /* Returned value doesn't count \0. */ return (datalength); } opendnssec-2.1.13/common/datastructure.h0000644000077000001440000000514714446272525015232 00000000000000/* * Copyright (c) 2015 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 UTIL_DATASTRUCTURE_H #define UTIL_DATASTRUCTURE_H #include "config.h" struct collection_class_struct; typedef struct collection_class_struct* collection_class; struct collection_instance_struct; typedef struct collection_instance_struct* collection_t; /** * Creates and initialized an empty collection * \param[out] collection a reference to the collection to be initialized * \param[in] membsize the size as returned by sizeof() of the data elements stored */ void collection_create_array(collection_t* collection, size_t membsize, collection_class klass); void collection_class_allocated(collection_class* klass, void *cargo, int (*member_destroy)(void* cargo, void* member)); void collection_class_backed(collection_class* klass, char* fname, void *cargo, int (*member_destroy)(void* cargo, void* member), int (*member_dispose)(void* cargo, void* member, FILE*), int (*member_restore)(void* cargo, void* member, FILE*)); void collection_class_destroy(collection_class* klass); void collection_destroy(collection_t* collection); void collection_add(collection_t collection, void* data); void collection_del_index(collection_t collection, int index); void collection_del_cursor(collection_t collection); void* collection_iterator(collection_t collection); #endif /* UTIL_DATASTRUCTURE_H */ opendnssec-2.1.13/configure0000755000077000001440000317536214446272531012615 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for opendnssec 2.1.13. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1 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\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: https://issues.opendnssec.org/ about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='opendnssec' PACKAGE_TARNAME='opendnssec' PACKAGE_VERSION='2.1.13' PACKAGE_STRING='opendnssec 2.1.13' PACKAGE_BUGREPORT='https://issues.opendnssec.org/' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_list= ac_func_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBUNWIND_LIBS LIBUNWIND_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG DX_RULES PAPER_SIZE DOXYGEN_PAPER_SIZE GENERATE_LATEX DX_PDFLATEX DX_FLAG_pdf DX_EGREP DX_DVIPS DX_MAKEINDEX DX_LATEX DX_FLAG_ps DX_FLAG_html GENERATE_CHI DX_FLAG_chi GENERATE_HTMLHELP GENERATE_HTML HHC_PATH DX_HHC DX_FLAG_chm GENERATE_XML DX_FLAG_xml GENERATE_RTF DX_FLAG_rtf GENERATE_MAN DX_FLAG_man DOT_PATH HAVE_DOT DX_DOT DX_FLAG_dot PERL_PATH DX_PERL DX_DOXYGEN DX_FLAG_doc PROJECT SRCDIR DX_ENV DX_DOCDIR DX_CONFIG DX_PROJECT INSTALLATIONCOND INSTALLATIONUSERARG INSTALLATIONUSER INSTALLATIONGROUPARG INSTALLATIONGROUP ENABLE_SIGNER_FALSE ENABLE_SIGNER_TRUE ENABLE_ENFORCER_FALSE ENABLE_ENFORCER_TRUE READLINE_LIBS ENFORCER_DB_PASSWORD ENFORCER_DB_USERNAME ENFORCER_DB_DATABASE ENFORCER_DB_PORT_TEXT ENFORCER_DB_PORT ENFORCER_DB_HOST ENFORCER_DB_LIBS ENFORCER_DB_INCLUDES MYSQL_LDFLAGS MYSQL_CFLAGS MYSQL_VERSION MYSQL_CONFIG USE_MYSQL_FALSE USE_MYSQL_TRUE USE_SQLITE_FALSE USE_SQLITE_TRUE SQLITE3_VERSION SQLITE3_LDFLAGS SQLITE3_CFLAGS WITH_CUNIT_FALSE WITH_CUNIT_TRUE CUNIT_LIBS CUNIT_INCLUDES SSL_LIBS SSL_INCLUDES HAVE_SSL_NEW_HMAC HAVE_SSL C_LIBS RT_LIBS pkcs11_aepkeyper_module pkcs11_ncipher_module pkcs11_opensc_module pkcs11_etoken_module pkcs11_sca6000_module pkcs11_softhsm_module LDNS_LIBS LDNS_INCLUDES LDNS_CONFIG XML2_LIBS XML2_INCLUDES XML2_CONFIG LIBOBJS PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CXX PTHREAD_CC ax_pthread_config target_os target_vendor target_cpu target WARN_CFLAGS CP JAVA XSLTPROC XMLLINT CXXCPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL EGREP GREP CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC OPENDNSSEC_ENFORCER_SOCKETFILE OPENDNSSEC_SIGNER_CLI OPENDNSSEC_SIGNER_ENGINE OPENDNSSEC_SIGNER_SOCKET OPENDNSSEC_FETCH_PIDFILE OPENDNSSEC_ENFORCER_PIDFILE OPENDNSSEC_SIGNER_PIDFILE OPENDNSSEC_STATE_DIR OPENDNSSEC_SCHEMA_DIR OPENDNSSEC_CONFIG_FILE OPENDNSSEC_CONFIG_DIR OPENDNSSEC_PID_DIR OPENDNSSEC_LOCALSTATE_DIR OPENDNSSEC_SYSCONF_DIR OPENDNSSEC_DATA_DIR OPENDNSSEC_LIBEXEC_DIR OPENDNSSEC_LIB_DIR OPENDNSSEC_SBIN_DIR OPENDNSSEC_BIN_DIR AM_BACKSLASH AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM AM_DEFAULT_VERBOSITY target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock enable_pedantic enable_rpath with_libxml2 with_ldns with_pkcs11_softhsm with_pkcs11_sca6000 with_pkcs11_etoken with_pkcs11_opensc with_pkcs11_ncipher with_pkcs11_aepkeyper with_ssl with_cunit enable_enforcer with_enforcer_database with_enforcer_database_test_host with_enforcer_database_test_port with_enforcer_database_test_database with_enforcer_database_test_username with_enforcer_database_test_password with_sqlite3 with_mysql with_readline enable_signer enable_installation_user enable_installation_group enable_doxygen_doc enable_doxygen_dot enable_doxygen_man enable_doxygen_rtf enable_doxygen_xml enable_doxygen_chm enable_doxygen_chi enable_doxygen_html enable_doxygen_ps enable_doxygen_pdf with_libunwind ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP LT_SYS_LIBRARY_PATH CXX CXXFLAGS CCC CXXCPP MYSQL_CONFIG DOXYGEN_PAPER_SIZE PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR LIBUNWIND_CFLAGS LIBUNWIND_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures opendnssec 2.1.13 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/opendnssec] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of opendnssec 2.1.13:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-pedantic enable pedantic compile mode [enabled] --disable-rpath disable hardcoded rpath (default=enabled) --disable-enforcer Disable enforcer build (default enabled) --disable-signer Disable signer build (default enabled) --enable-installation-user Install for usage by specific user (default=disabled) --enable-installation-group Install for usage by specific group (default=disabled) --disable-doxygen-doc don't generate any doxygen documentation --enable-doxygen-dot generate graphics for doxygen documentation --enable-doxygen-man generate doxygen manual pages --enable-doxygen-rtf generate doxygen RTF documentation --enable-doxygen-xml generate doxygen XML documentation --enable-doxygen-chm generate doxygen compressed HTML help documentation --enable-doxygen-chi generate doxygen separate compressed HTML help index file --disable-doxygen-html don't generate doxygen plain HTML documentation --enable-doxygen-ps generate doxygen PostScript documentation --enable-doxygen-pdf generate doxygen PDF documentation Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-libxml2=DIR look for libxml2 in this dir --with-ldns=PATH specify prefix of path of ldns library to use --with-pkcs11-softhsm=PATH specify path of SoftHSM PKCS#11 library (default PREFIX/lib/softhsm/libsofthsm2.so) --with-pkcs11-sca6000=PATH specify path of SCA/6000 PKCS#11 library (default /usr/lib/libpkcs11.so) --with-pkcs11-etoken=PATH specify path of Aladdin eToken PKCS#11 library (default /usr/local/lib/libeTPkcs11.so) --with-pkcs11-opensc=PATH specify path of OpenSC PKCS#11 library (default /usr/lib/pkcs11/opensc-pkcs11.so) --with-pkcs11-ncipher=PATH specify path of nCipher PKCS#11 library (default /opt/nfast/toolkits/pkcs11/libcknfast.so) --with-pkcs11-aepkeyper=PATH specify path of AEP Keyper PKCS#11 library (default /opt/Keyper/PKCS11Provider/pkcs11.so) --with-ssl=pathname enable SSL (will check /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/sfw /usr/local /usr) --with-cunit=DIR Look for cunit in this dir --with-enforcer-database=BACKEND Select database backend: sqlite3 (default), mysql --with-enforcer-database-test-host=HOST Host to use when testing the Enforcer database backend --with-enforcer-database-test-port=PORT Port to use when testing the Enforcer database backend --with-enforcer-database-test-database=DATABASE Database to use when testing the Enforcer database backend --with-enforcer-database-test-username=USERNAME Username to use when testing the Enforcer database backend --with-enforcer-database-test-password=PASSWORD Password to use when testing the Enforcer database backend --with-sqlite3=[ARG] use SQLite 3 library [default=yes], optionally specify the prefix for sqlite3 library --with-mysql=[ARG] use MySQL client library [default=yes], optionally specify path to mysql_config --with-readline compile with the system readline library --with-libunwind Build with the libunwind library Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor LT_SYS_LIBRARY_PATH User-defined run-time library search path. CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor MYSQL_CONFIG Full path to mysql_config program DOXYGEN_PAPER_SIZE a4wide (default), a4, letter, legal or executive PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path LIBUNWIND_CFLAGS C compiler flags for LIBUNWIND, overriding pkg-config LIBUNWIND_LIBS linker flags for LIBUNWIND, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF opendnssec configure 2.1.13 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## --------------------------------------------- ## ## Report this to https://issues.opendnssec.org/ ## ## --------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by opendnssec $as_me 2.1.13, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` 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 || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_list " sys/time.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_func_list " alarm" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu AM_DEFAULT_VERBOSITY="0" am__api_version='1.16' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='opendnssec' VERSION='2.1.13' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi case "$prefix" in NONE) case "$sysconfdir" in '${prefix}/etc') sysconfdir=/etc ac_configure_args="$ac_configure_args --sysconfdir=$sysconfdir" { $as_echo "$as_me:${as_lineno-$LINENO}: sysconfdir set to $sysconfdir" >&5 $as_echo "$as_me: sysconfdir set to $sysconfdir" >&6;} ;; esac case "$localstatedir" in '${prefix}/var') localstatedir=/var ac_configure_args="$ac_configure_args --localstatedir=$localstatedir" { $as_echo "$as_me:${as_lineno-$LINENO}: localstate set to $localstatedir" >&5 $as_echo "$as_me: localstate set to $localstatedir" >&6;} ;; esac ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: Detecting common OpenDNSSEC settings" >&5 $as_echo "$as_me: Detecting common OpenDNSSEC settings" >&6;} 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" 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 cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_CONFIG_DIR "$OPENDNSSEC_CONFIG_DIR" _ACEOF cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_CONFIG_FILE "$OPENDNSSEC_CONFIG_FILE" _ACEOF cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_SCHEMA_DIR "$OPENDNSSEC_SCHEMA_DIR" _ACEOF cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_STATE_DIR "$OPENDNSSEC_STATE_DIR" _ACEOF 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 cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_SIGNER_PIDFILE "$OPENDNSSEC_SIGNER_PIDFILE" _ACEOF cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_ENFORCER_PIDFILE "$OPENDNSSEC_ENFORCER_PIDFILE" _ACEOF cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_FETCH_PIDFILE "$OPENDNSSEC_FETCH_PIDFILE" _ACEOF # 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/signer cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_SIGNER_SOCKET "$OPENDNSSEC_SIGNER_SOCKET" _ACEOF cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_SIGNER_ENGINE "$OPENDNSSEC_SIGNER_ENGINE" _ACEOF cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_SIGNER_CLI "$OPENDNSSEC_SIGNER_CLI" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_PIDFILE "$OPENDNSSEC_SIGNER_PIDFILE" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_ZF_PIDFILE "$OPENDNSSEC_FETCH_PIDFILE" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_SOCKFILE "$OPENDNSSEC_SIGNER_SOCKET" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_WORKDIR "$OPENDNSSEC_SIGNER_WORKINGDIR" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_CFGFILE "$OPENDNSSEC_CONFIG_FILE" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_RNGDIR "$OPENDNSSEC_SCHEMA_DIR" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_ENGINE "$OPENDNSSEC_SIGNER_ENGINE" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_CLI "$OPENDNSSEC_SIGNER_CLI" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_MAXLINE 1024 _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_MAX_BACKOFF 3600 _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_WORKERTHREADS 4 _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_STOP_RESPONSE "Engine shut down." _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_FILE_MAGIC_V3 ";OpenDNSSEC-backup-v3" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_FILE_MAGIC_V2 ";ODSSE2" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_FILE_MAGIC_V1 ";ODSSE1" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_SE_VERBOSITY 3 _ACEOF # enforcer specific OPENDNSSEC_ENFORCER_ENGINE=$OPENDNSSEC_SBIN_DIR/ods-enforcerd OPENDNSSEC_ENFORCER_CONTROL=$OPENDNSSEC_SBIN_DIR/ods-control OPENDNSSEC_ENFORCER_WORKINGDIR=$OPENDNSSEC_STATE_DIR/enforcer OPENDNSSEC_ENFORCER_ZONELIST=zones.xml cat >>confdefs.h <<_ACEOF #define ODS_EN_ENGINE "$OPENDNSSEC_ENFORCER_ENGINE" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_EN_CONTROL "$OPENDNSSEC_ENFORCER_CONTROL enforcer " _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_EN_START_RESPONSE "Engine already running." _ACEOF OPENDNSSEC_ENFORCER_SOCKETFILE=$OPENDNSSEC_PID_DIR/enforcer.sock cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_ENFORCER_SOCKETFILE "$OPENDNSSEC_ENFORCER_SOCKETFILE" _ACEOF cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_ENFORCER_WORKINGDIR "$OPENDNSSEC_ENFORCER_WORKINGDIR" _ACEOF cat >>confdefs.h <<_ACEOF #define OPENDNSSEC_ENFORCER_ZONELIST "$OPENDNSSEC_ENFORCER_ZONELIST" _ACEOF $as_echo "#define OPENDNSSEC_ENFORCER_WORKERTHREADS 4" >>confdefs.h OPENDNSSEC_ENFORCER_KASPCHECK=$OPENDNSSEC_BIN_DIR/ods-kaspcheck cat >>confdefs.h <<_ACEOF #define ODS_EN_VERBOSITY 3 _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_EN_CONTROL "$OPENDNSSEC_ENFORCER_CONTROL enforcer " _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_EN_NOTIFY "$OPENDNSSEC_ENFORCER_CONTROL enforcer notify" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_EN_KASPCHECK "$OPENDNSSEC_ENFORCER_KASPCHECK" _ACEOF cat >>confdefs.h <<_ACEOF #define ODS_EN_FILE_MAGIC ";ODSSE2" _ACEOF # extensions DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 $as_echo "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h # standard programs ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # 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' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # 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*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } 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 yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else 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 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else 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 # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) 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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; 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 if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else 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; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # 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" && \ test undefined != "$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 17 != "$i" # 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 fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else 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 fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #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 fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/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 ;; 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 | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) 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* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; 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 ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } 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 if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else 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 one 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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # 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 bitrig* | 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 # 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 # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # 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 ia64 = "$host_cpu"; 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 if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # 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"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$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"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/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, # D for any global variable and I for any imported 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};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,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 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && 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 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_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_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$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_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && 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" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || 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 what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; 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 what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; 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* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; 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*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; 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" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; 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" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-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 if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else 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" >&5 $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 >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else 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" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $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 >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } 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 yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; 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 no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; 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 else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; 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 else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; 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 else pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; 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 else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else 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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF 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 set != "${COLLECT_NAMES+set}"; 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 func_cc_basename $compiler cc_basename=$func_cc_basename_result # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else 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 ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" 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 fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else 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 ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" 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 fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$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);}' # 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 # 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 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* 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* ## 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_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # 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\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 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 lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-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_prog_compiler_pic='-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 lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; 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_prog_compiler_pic='-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_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; 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). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-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_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-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_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # 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\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 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 lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" 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>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=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\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 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_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $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* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=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\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 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_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $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* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # 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'. exclude_expsyms='_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. 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 yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac ld_shlibs=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 yes = "$with_gnu_ld"; 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 yes = "$lt_use_gnu_ld_interface"; 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 hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$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 whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 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 ia64 != "$host_cpu"; then ld_shlibs=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 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$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)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+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 archive_cmds='$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, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; 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 ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$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. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='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 linux-dietlibc = "$host_os"; 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 no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$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 whole_archive_flag_spec='$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 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-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 whole_archive_flag_spec='$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' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$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' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='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 tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='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 ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$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 ld_shlibs=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 archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** 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 hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$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. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; 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 GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | 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 # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; 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. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; 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 hardcode_direct=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 hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$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. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`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_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$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. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`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_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$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. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$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)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-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 hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # 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. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $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, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='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 hardcode_libdir_flag_spec=' ' allow_undefined_flag=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. archive_cmds='$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. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="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" module_expsym_cmds="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" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=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*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$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*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # 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) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" 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>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$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 archive_cmds='$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' archive_expsym_cmds='$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 archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$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 allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$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 archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$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' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$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' archive_expsym_cmds='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 hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='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='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='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' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='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 hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=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 yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT 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. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; 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` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac 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" elif test -n "$lt_multi_os_dir"; then 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 ia64 = "$host_cpu"; 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 # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # 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' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # 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' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac 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%'\''`; $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' 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`' 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$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' 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 ;; 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=no 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 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; 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 yes = "$lt_cv_prog_gnu_ld"; 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 ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # 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 dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | 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 if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi 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 # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) 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' ;; 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* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi 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 shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec 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' ;; 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 yes = "$with_gnu_ld"; 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=sco 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 yes = "$with_gnu_ld"; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && 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" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross 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 -fvisibility=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 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross 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 -fvisibility=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 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } 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 striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } 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" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } 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" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi 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 if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds reload_flag_CXX=$reload_flag reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$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 yes != "$_lt_caught_CXX_error"; 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. # 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 # save warnings/boilerplate of simple test code 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* 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* # 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 compiler_CXX=$CC func_cc_basename $compiler cc_basename=$func_cc_basename_result if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } 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 yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else 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 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_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 yes = "$with_gnu_ld"; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$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' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$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 whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec_CXX= 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. archive_cmds_CXX='$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test ia64 = "$host_cpu"; 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 # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive 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 if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; 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. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no ;; esac if test yes = "$GXX"; 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 hardcode_direct_CXX=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 hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec_CXX='$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. always_export_symbols_CXX=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. no_undefined_flag_CXX='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`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_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$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. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`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_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$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. no_undefined_flag_CXX=' $wl-bernotok' allow_undefined_flag_CXX=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=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. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # 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. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $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, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='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, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' export_dynamic_flag_spec_CXX='$wl--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$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, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; 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 ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds_CXX="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" module_expsym_cmds_CXX="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" if test yes != "$lt_cv_apple_cc_single_mod"; then archive_cmds_CXX="\$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" archive_expsym_cmds_CXX="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 ld_shlibs_CXX=no fi ;; os2*) hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_minus_L_CXX=yes allow_undefined_flag_CXX=unsupported shrext_cmds=.dll archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='$wl-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=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 ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$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 yes = "$GXX"; then archive_cmds_CXX='$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 "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=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 ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$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 yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$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 ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$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. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='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++ archive_cmds_CXX='$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. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then archive_cmds_CXX='$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 archive_cmds_CXX='$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 link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | 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. archive_cmds_CXX='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' archive_expsym_cmds_CXX='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"' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$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."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$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 archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='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`"' old_archive_cmds_CXX='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' archive_cmds_CXX='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' archive_expsym_cmds_CXX='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 archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$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 hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$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++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$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 hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # 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 hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_CXX='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 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='$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' compiler_needs_object_CXX=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. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=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*) ld_shlibs_CXX=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='$wl-E' whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=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. archive_cmds_CXX='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' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' archive_cmds_CXX='$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' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$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' archive_expsym_cmds_CXX='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' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # 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 yes,no = "$GXX,$with_gnu_ld"; then allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' case $host in osf3*) archive_cmds_CXX='$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' ;; *) archive_cmds_CXX='$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 hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: # 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 ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='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' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=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?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=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. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$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. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then no_undefined_flag_CXX=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='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 $wl-h $wl$soname -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. archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='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 $wl-h $wl$soname -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 hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='$wl-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT 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. no_undefined_flag_CXX='$wl-z,text' allow_undefined_flag_CXX='$wl-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$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 ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no GCC_CXX=$GXX LD_CXX=$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... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _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 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; 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 x-L = "$p" || test x-R = "$p"; 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 no = "$pre_test_object_deps_done"; 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 "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX=$prev$p else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $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 "$postdeps_CXX"; then postdeps_CXX=$prev$p else postdeps_CXX="${postdeps_CXX} $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 no = "$pre_test_object_deps_done"; then if test -z "$predep_objects_CXX"; then predep_objects_CXX=$p else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX=$p else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken 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. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi lt_prog_compiler_pic_CXX='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-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_prog_compiler_pic_CXX='-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 lt_prog_compiler_pic_CXX='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static_CXX='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_CXX= ;; 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_prog_compiler_pic_CXX=-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_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--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). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+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_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-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_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment # 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\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 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 lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" 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>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then : else lt_prog_compiler_static_CXX= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=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\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 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_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $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* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=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\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 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_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $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* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_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 GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds_CXX 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no else lt_cv_archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 $as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } 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 ia64 = "$host_cpu"; 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 # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # 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' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # 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' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac 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%'\''`; $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' ;; 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`' 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$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' 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 ;; 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=no 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 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; 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 yes = "$lt_cv_prog_gnu_ld"; 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 ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # 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 dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec_CXX='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | 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 if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi 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 # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) 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' ;; 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* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi 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 shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec 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' ;; 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 yes = "$with_gnu_ld"; 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=sco 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 yes = "$with_gnu_ld"; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test yes = "$hardcode_automatic_CXX"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct_CXX" && # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && test no != "$hardcode_minus_L_CXX"; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } if test relink = "$hardcode_action_CXX" || test yes = "$inherit_rpath_CXX"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi 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 yes != "$_lt_caught_CXX_error" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # additional programs # Extract the first word of "xmllint", so it can be a program name with args. set dummy xmllint; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_XMLLINT+:} false; then : $as_echo_n "(cached) " >&6 else case $XMLLINT in [\\/]* | ?:[\\/]*) ac_cv_path_XMLLINT="$XMLLINT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_XMLLINT="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi XMLLINT=$ac_cv_path_XMLLINT if test -n "$XMLLINT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLLINT" >&5 $as_echo "$XMLLINT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "xsltproc", so it can be a program name with args. set dummy xsltproc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_XSLTPROC+:} false; then : $as_echo_n "(cached) " >&6 else case $XSLTPROC in [\\/]* | ?:[\\/]*) ac_cv_path_XSLTPROC="$XSLTPROC" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi XSLTPROC=$ac_cv_path_XSLTPROC if test -n "$XSLTPROC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XSLTPROC" >&5 $as_echo "$XSLTPROC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "java", so it can be a program name with args. set dummy java; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_JAVA+:} false; then : $as_echo_n "(cached) " >&6 else case $JAVA in [\\/]* | ?:[\\/]*) ac_cv_path_JAVA="$JAVA" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_JAVA="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi JAVA=$ac_cv_path_JAVA if test -n "$JAVA"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA" >&5 $as_echo "$JAVA" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_CP+:} false; then : $as_echo_n "(cached) " >&6 else case $CP in [\\/]* | ?:[\\/]*) ac_cv_path_CP="$CP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi CP=$ac_cv_path_CP if test -n "$CP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CP" >&5 $as_echo "$CP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi cat >>confdefs.h <<_ACEOF #define CP_COMMAND "$CP" _ACEOF # building, compiler flags ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # Check whether --enable-pedantic was given. if test "${enable_pedantic+set}" = set; then : enableval=$enable_pedantic; else enable_pedantic="yes" fi if test "${enable_pedantic}" = "yes"; then enable_strict="yes"; CFLAGS="${CFLAGS} -pedantic" fi # Variable names ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus #error "no C++" #endif int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_compiler_cxx=yes; else ax_compiler_cxx=no; fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Always pass -Werror=unknown-warning-option to get Clang to fail on bad # flags, otherwise they are always appended to the warn_cflags variable, and # Clang warns on them for every compilation unit. # If this is passed to GCC, it will explode, so the flag must be enabled # conditionally. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Werror=unknown-warning-option" >&5 $as_echo_n "checking whether C compiler accepts -Werror=unknown-warning-option... " >&6; } if ${ax_cv_check_cflags___Werror_unknown_warning_option+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror=unknown-warning-option" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_cv_check_cflags___Werror_unknown_warning_option=yes else ax_cv_check_cflags___Werror_unknown_warning_option=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Werror_unknown_warning_option" >&5 $as_echo "$ax_cv_check_cflags___Werror_unknown_warning_option" >&6; } if test "x$ax_cv_check_cflags___Werror_unknown_warning_option" = xyes; then : ax_compiler_flags_test="-Werror=unknown-warning-option" else ax_compiler_flags_test="" fi # Check that -Wno-suggest-attribute=format is supported { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wno-suggest-attribute=format" >&5 $as_echo_n "checking whether C compiler accepts -Wno-suggest-attribute=format... " >&6; } if ${ax_cv_check_cflags___Wno_suggest_attribute_format+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Wno-suggest-attribute=format" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_cv_check_cflags___Wno_suggest_attribute_format=yes else ax_cv_check_cflags___Wno_suggest_attribute_format=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wno_suggest_attribute_format" >&5 $as_echo "$ax_cv_check_cflags___Wno_suggest_attribute_format" >&6; } if test "x$ax_cv_check_cflags___Wno_suggest_attribute_format" = xyes; then : ax_compiler_no_suggest_attribute_flags="-Wno-suggest-attribute=format" else ax_compiler_no_suggest_attribute_flags="" fi # Base flags for flag in -fno-strict-aliasing ; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ax_compiler_flags_test $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : if ${WARN_CFLAGS+:} false; then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else WARN_CFLAGS=$flag { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } fi else : fi done if test "$ax_enable_compile_warnings" != "no"; then : if test "$ax_compiler_cxx" = "no" ; then # C-only flags. Warn in C++ for flag in -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -Wdeclaration-after-statement -Wimplicit-function-declaration -Wold-style-definition -Wjump-misses-init ; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ax_compiler_flags_test $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : if ${WARN_CFLAGS+:} false; then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else WARN_CFLAGS=$flag { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } fi else : fi done fi # "yes" flags for flag in -Wall -Wextra -Wundef -Wwrite-strings -Wpointer-arith -Wmissing-declarations -Wredundant-decls -Wno-unused-parameter -Wno-missing-field-initializers -Wformat=2 -Wcast-align -Wformat-nonliteral -Wformat-security -Wsign-compare -Wstrict-aliasing -Wshadow -Winline -Wpacked -Wmissing-format-attribute -Wmissing-noreturn -Winit-self -Wredundant-decls -Wmissing-include-dirs -Wunused-but-set-variable -Warray-bounds -Wreturn-type -Wswitch-enum -Wswitch-default -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wrestrict -Wnull-dereference -Wdouble-promotion ; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ax_compiler_flags_test $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : if ${WARN_CFLAGS+:} false; then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else WARN_CFLAGS=$flag { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } fi else : fi done fi if test "$ax_enable_compile_warnings" = "error"; then : # "error" flags; -Werror has to be appended unconditionally because # it's not possible to test for # # suggest-attribute=format is disabled because it gives too many false # positives if ${WARN_CFLAGS+:} false; then : case " $WARN_CFLAGS " in #( *" -Werror "*) : { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains -Werror"; } >&5 (: WARN_CFLAGS already contains -Werror) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " -Werror" { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else WARN_CFLAGS=-Werror { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } fi for flag in $ax_compiler_no_suggest_attribute_flags ; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ax_compiler_flags_test $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : if ${WARN_CFLAGS+:} false; then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else WARN_CFLAGS=$flag { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } fi else : fi done fi # In the flags below, when disabling specific flags, always add *both* # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example) # we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall, # which effectively turns that flag back on again as an error. for flag in $WARN_CFLAGS; do case $flag in #( -Wno-*=*) : ;; #( -Wno-*) : for flag in -Wno-error=$($as_echo $flag | $SED 's/^-Wno-//'); do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ax_compiler_flags_test $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : if ${WARN_CFLAGS+:} false; then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else WARN_CFLAGS=$flag { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } fi else : fi done ;; #( *) : ;; esac done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Substitute the variables { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__" >&5 $as_echo_n "checking for __attribute__... " >&6; } if ${ax_cv___attribute__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include static void foo(void) __attribute__ ((unused)); static void foo(void) { exit(1); } int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_cv___attribute__=yes else ax_cv___attribute__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv___attribute__" >&5 $as_echo "$ax_cv___attribute__" >&6; } if test "$ax_cv___attribute__" = "yes"; then $as_echo "#define HAVE___ATTRIBUTE__ 1" >>confdefs.h fi # Check whether --enable-rpath was given. if test "${enable_rpath+set}" = set; then : enableval=$enable_rpath; enable_rpath=$enableval else enable_rpath=yes fi if test "x$enable_rpath" = xno; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Fixing libtool for -rpath problems." >&5 $as_echo "Fixing libtool for -rpath problems." >&6; } 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 if test "x$enable_rpath" = xyes; then if echo "" | grep "^/" >/dev/null; then RUNTIME_PATH="$RUNTIME_PATH -R" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler vendor" >&5 $as_echo_n "checking for C compiler vendor... " >&6; } if ${ax_cv_c_compiler_vendor+:} false; then : $as_echo_n "(cached) " >&6 else vendors=" intel: __ICC,__ECC,__INTEL_COMPILER ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__,__ibmxl__ pathscale: __PATHCC__,__PATHSCALE__ clang: __clang__ cray: _CRAYC fujitsu: __FUJITSU sdcc: SDCC,__SDCC sx: _SX portland: __PGI gnu: __GNUC__ sun: __SUNPRO_C,__SUNPRO_CC,__SUNPRO_F90,__SUNPRO_F95 hp: __HP_cc,__HP_aCC dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland: __BORLANDC__,__CODEGEARC__,__TURBOC__ comeau: __COMO__ kai: __KCC lcc: __LCC__ sgi: __sgi,sgi microsoft: _MSC_VER metrowerks: __MWERKS__ watcom: __WATCOMC__ tcc: __TINYC__ unknown: UNKNOWN " for ventest in $vendors; do case $ventest in *:) vendor=$ventest continue ;; *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; esac cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #if !($vencpp) thisisanerror; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done ax_cv_c_compiler_vendor=`echo $vendor | cut -d: -f1` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_c_compiler_vendor" >&5 $as_echo "$ax_cv_c_compiler_vendor" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for most reasonable warnings" >&5 $as_echo_n "checking CFLAGS for most reasonable warnings... " >&6; } if ${ac_cv_cflags_warn_all+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_cflags_warn_all="" ac_save_cflags_warn_all_found="yes" case "$ax_cv_c_compiler_vendor" in #( intel) : ac_cv_cflags_warn_all="-w2" ;; #( ibm) : ac_cv_cflags_warn_all="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" ;; #( pathscale) : ;; #( clang) : ac_cv_cflags_warn_all="-Wall" ;; #( cray) : ac_cv_cflags_warn_all="-h msglevel 2" ;; #( fujitsu) : ;; #( sdcc) : ;; #( sx) : ac_cv_cflags_warn_all="-pvctl,fullmsg" ;; #( portland) : ;; #( gnu) : ac_cv_cflags_warn_all="-Wall" ;; #( sun) : ac_cv_cflags_warn_all="-v" ;; #( hp) : ac_cv_cflags_warn_all="+w1" ;; #( dec) : ac_cv_cflags_warn_all="-verbose -w0 -warnprotos" ;; #( borland) : ;; #( comeau) : ;; #( kai) : ;; #( lcc) : ;; #( sgi) : ac_cv_cflags_warn_all="-fullwarn" ;; #( microsoft) : ;; #( metrowerks) : ;; #( watcom) : ;; #( tcc) : ;; #( unknown) : ac_cv_cflags_warn_all="" ac_save_cflags_warn_all_found="no" ;; #( *) : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unknown compiler vendor returned by AX_COMPILER_VENDOR" >&5 $as_echo "$as_me: WARNING: Unknown compiler vendor returned by AX_COMPILER_VENDOR" >&2;} ac_cv_cflags_warn_all="" ac_save_cflags_warn_all_found="no" ;; esac if test "x$ac_save_cflags_warn_all_found" = "xyes"; then : if test "x$ac_cv_cflags_warn_all" != "x"; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in #( *" $ac_cv_cflags_warn_all "*) : { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$ac_cv_cflags_warn_all"; } >&5 (: CFLAGS already contains $ac_cv_cflags_warn_all) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : CFLAGS="$ac_cv_cflags_warn_all $CFLAGS" { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 (: CFLAGS="$CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else CFLAGS=$ac_cv_cflags_warn_all { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 (: CFLAGS="$CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } fi fi else true fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags_warn_all" >&5 $as_echo "$ac_cv_cflags_warn_all" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -rdynamic" >&5 $as_echo_n "checking whether C compiler accepts -rdynamic... " >&6; } if ${ax_cv_check_cflags___rdynamic+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -rdynamic" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_cv_check_cflags___rdynamic=yes else ax_cv_check_cflags___rdynamic=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___rdynamic" >&5 $as_echo "$ax_cv_check_cflags___rdynamic" >&6; } if test "x$ax_cv_check_cflags___rdynamic" = xyes; then : CFLAGS="$CFLAGS -rdynamic" else : fi # checks for header files { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi for ac_header in fcntl.h inttypes.h stdio.h stdlib.h string.h syslog.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in getopt.h do : ac_fn_c_check_header_mongrel "$LINENO" "getopt.h" "ac_cv_header_getopt_h" "$ac_includes_default" if test "x$ac_cv_header_getopt_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETOPT_H 1 _ACEOF else $ac_includes_default fi done for ac_header in errno.h getopt.h pthread.h signal.h stdarg.h stdint.h strings.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/select.h sys/socket.h sys/stat.h sys/time.h sys/types.h sys/wait.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in libxml/parser.h libxml/relaxng.h libxml/xmlreader.h libxml/xpath.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqrt" >&5 $as_echo_n "checking for library containing sqrt... " >&6; } if ${ac_cv_search_sqrt+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char sqrt (); int main () { return sqrt (); ; return 0; } _ACEOF for ac_lib in '' m; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_sqrt=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_sqrt+:} false; then : break fi done if ${ac_cv_search_sqrt+:} false; then : else ac_cv_search_sqrt=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sqrt" >&5 $as_echo "$ac_cv_search_sqrt" >&6; } ac_res=$ac_cv_search_sqrt if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi # checks for typedefs, structures, and compiler characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then : ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 $as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then $as_echo "#define uid_t int" >>confdefs.h $as_echo "#define gid_t int" >>confdefs.h fi ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define uint16_t $ac_cv_c_uint16_t _ACEOF ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for union semun" >&5 $as_echo_n "checking for union semun... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { union semun arg; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : have_union_semun=1 else have_union_semun=0 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $have_union_semun = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_UNION_SEMUN 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 Tru64 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_CFLAGS$PTHREAD_LIBS" != "x"; then ax_pthread_save_CC="$CC" ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" if test "x$PTHREAD_CC" != "x"; then : CC="$PTHREAD_CC" fi if test "x$PTHREAD_CXX" != "x"; then : CXX="$PTHREAD_CXX" fi CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5 $as_echo_n "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_join (); int main () { return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 $as_echo "$ax_pthread_ok" >&6; } if test "x$ax_pthread_ok" = "xno"; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi CC="$ax_pthread_save_CC" CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" 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 with a "," contain both # C compiler flags (before ",") and linker flags (after ","). Other items # starting with a "-" are C compiler flags, and remaining 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 -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) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 # (Note: HP C rejects this with "bad form for `-t' option") # -pthreads: Solaris/gcc (Note: HP C also rejects) # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads and # -D_REENTRANT too), HP C (must be checked before -lpthread, which # is present but should not be used directly; and before -mthreads, # because the compiler interprets this as "-mt" + "-hreads") # -mthreads: Mingw32/gcc, Lynx/gcc # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case $target_os in freebsd*) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) ax_pthread_flags="-kthread lthread $ax_pthread_flags" ;; hpux*) # From the cc(1) man page: "[-mt] Sets various -D flags to enable # multi-threading and also sets -lpthread." ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" ;; openedition*) # IBM z/OS requires a feature-test macro to be defined in order to # enable POSIX threads at all, so give the user a hint if this is # not set. (We don't define these ourselves, as they can affect # other portions of the system API in unpredictable ways.) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) AX_PTHREAD_ZOS_MISSING # endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5 $as_echo "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;} fi rm -f conftest* ;; 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. (N.B.: 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 check first for the # standard Solaris way of linking pthreads (-mt -lpthread). ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" ;; esac # Are we compiling with Clang? { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5 $as_echo_n "checking whether $CC is Clang... " >&6; } if ${ax_cv_PTHREAD_CLANG+:} false; then : $as_echo_n "(cached) " >&6 else ax_cv_PTHREAD_CLANG=no # Note that Autoconf sets GCC=yes for Clang as well as GCC if test "x$GCC" = "xyes"; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Note: Clang 2.7 lacks __clang_[a-z]+__ */ # if defined(__clang__) && defined(__llvm__) AX_PTHREAD_CC_IS_CLANG # endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1; then : ax_cv_PTHREAD_CLANG=yes fi rm -f conftest* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5 $as_echo "$ax_cv_PTHREAD_CLANG" >&6; } ax_pthread_clang="$ax_cv_PTHREAD_CLANG" # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) # Note that for GCC and Clang -pthread generally implies -lpthread, # except when -nostdlib is passed. # This is problematic using libtool to build C++ shared libraries with pthread: # [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 # [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 # [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 # To solve this, first try -pthread together with -lpthread for GCC if test "x$GCC" = "xyes"; then : ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags" fi # Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first if test "x$ax_pthread_clang" = "xyes"; then : ax_pthread_flags="-pthread,-lpthread -pthread" fi # The presence of a feature test macro requesting re-entrant function # definitions is, on some systems, a strong hint that pthreads support is # correctly enabled case $target_os in darwin* | hpux* | linux* | osf* | solaris*) ax_pthread_check_macro="_REENTRANT" ;; aix*) ax_pthread_check_macro="_THREAD_SAFE" ;; *) ax_pthread_check_macro="--" ;; esac if test "x$ax_pthread_check_macro" = "x--"; then : ax_pthread_check_cond=0 else ax_pthread_check_cond="!defined($ax_pthread_check_macro)" fi if test "x$ax_pthread_ok" = "xno"; then for ax_pthread_try_flag in $ax_pthread_flags; do case $ax_pthread_try_flag in none) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 $as_echo_n "checking whether pthreads work without any flags... " >&6; } ;; *,*) PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"" >&5 $as_echo_n "checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"... " >&6; } ;; -*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5 $as_echo_n "checking whether pthreads work with $ax_pthread_try_flag... " >&6; } PTHREAD_CFLAGS="$ax_pthread_try_flag" ;; pthread-config) # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ax_pthread_config+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ax_pthread_config"; then ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ax_pthread_config="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" fi fi ax_pthread_config=$ac_cv_prog_ax_pthread_config if test -n "$ax_pthread_config"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 $as_echo "$ax_pthread_config" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ax_pthread_config" = "xno"; then : continue fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5 $as_echo_n "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; } PTHREAD_LIBS="-l$ax_pthread_try_flag" ;; esac ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" # 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. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include # if $ax_pthread_check_cond # error "$ax_pthread_check_macro must be defined" # endif static void *some_global = NULL; static void routine(void *a) { /* To avoid any unused-parameter or unused-but-set-parameter warning. */ some_global = a; } static void *start_routine(void *a) { return a; } int main () { 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) /* ; */ ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 $as_echo "$ax_pthread_ok" >&6; } if test "x$ax_pthread_ok" = "xyes"; then : break fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Clang needs special handling, because older versions handle the -pthread # option in a rather... idiosyncratic way if test "x$ax_pthread_clang" = "xyes"; then # Clang takes -pthread; it has never supported any other flag # (Note 1: This will need to be revisited if a system that Clang # supports has POSIX threads in a separate library. This tends not # to be the way of modern systems, but it's conceivable.) # (Note 2: On some systems, notably Darwin, -pthread is not needed # to get POSIX threads support; the API is always present and # active. We could reasonably leave PTHREAD_CFLAGS empty. But # -pthread does define _REENTRANT, and while the Darwin headers # ignore this macro, third-party headers might not.) # However, older versions of Clang make a point of warning the user # that, in an invocation where only linking and no compilation is # taking place, the -pthread option has no effect ("argument unused # during compilation"). They expect -pthread to be passed in only # when source code is being compiled. # # Problem is, this is at odds with the way Automake and most other # C build frameworks function, which is that the same flags used in # compilation (CFLAGS) are also used in linking. Many systems # supported by AX_PTHREAD require exactly this for POSIX threads # support, and in fact it is often not straightforward to specify a # flag that is used only in the compilation phase and not in # linking. Such a scenario is extremely rare in practice. # # Even though use of the -pthread flag in linking would only print # a warning, this can be a nuisance for well-run software projects # that build with -Werror. So if the active version of Clang has # this misfeature, we search for an option to squash it. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5 $as_echo_n "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; } if ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+:} false; then : $as_echo_n "(cached) " >&6 else ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown # Create an alternate version of $ac_link that compiles and # links in two steps (.c -> .o, .o -> exe) instead of one # (.c -> exe), because the warning occurs only in the second # step ax_pthread_save_ac_link="$ac_link" ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" ax_pthread_save_CFLAGS="$CFLAGS" for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do if test "x$ax_pthread_try" = "xunknown"; then : break fi CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" ac_link="$ax_pthread_save_ac_link" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main(void){return 0;} _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_link="$ax_pthread_2step_ac_link" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main(void){return 0;} _ACEOF if ac_fn_c_try_link "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done ac_link="$ax_pthread_save_ac_link" CFLAGS="$ax_pthread_save_CFLAGS" if test "x$ax_pthread_try" = "x"; then : ax_pthread_try=no fi ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5 $as_echo "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; } case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in no | unknown) ;; *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; esac fi # $ax_pthread_clang = yes # Various other checks: if test "x$ax_pthread_ok" = "xyes"; then ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 $as_echo_n "checking for joinable pthread attribute... " >&6; } if ${ax_cv_PTHREAD_JOINABLE_ATTR+:} false; then : $as_echo_n "(cached) " >&6 else ax_cv_PTHREAD_JOINABLE_ATTR=unknown for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int attr = $ax_pthread_attr; return attr /* ; */ ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5 $as_echo "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; } if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ test "x$ax_pthread_joinable_attr_defined" != "xyes"; then : cat >>confdefs.h <<_ACEOF #define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR _ACEOF ax_pthread_joinable_attr_defined=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5 $as_echo_n "checking whether more special flags are required for pthreads... " >&6; } if ${ax_cv_PTHREAD_SPECIAL_FLAGS+:} false; then : $as_echo_n "(cached) " >&6 else ax_cv_PTHREAD_SPECIAL_FLAGS=no case $target_os in solaris*) ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5 $as_echo "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; } if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ test "x$ax_pthread_special_flags_added" != "xyes"; then : PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" ax_pthread_special_flags_added=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 $as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; } if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int i = PTHREAD_PRIO_INHERIT; return i; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_PTHREAD_PRIO_INHERIT=yes else ax_cv_PTHREAD_PRIO_INHERIT=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 $as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ test "x$ax_pthread_prio_inherit_defined" != "xyes"; then : $as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h ax_pthread_prio_inherit_defined=yes fi CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" # More AIX lossage: compile with *_r variant if test "x$GCC" != "xyes"; then case $target_os in aix*) case "x/$CC" in #( x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) : #handle absolute path differently from PATH based program lookup case "x$CC" in #( x/*) : if as_fn_executable_p ${CC}_r; then : PTHREAD_CC="${CC}_r" fi if test "x${CXX}" != "x"; then : if as_fn_executable_p ${CXX}_r; then : PTHREAD_CXX="${CXX}_r" fi fi ;; #( *) : for ac_prog in ${CC}_r do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PTHREAD_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PTHREAD_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 $as_echo "$PTHREAD_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PTHREAD_CC" && break done test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" if test "x${CXX}" != "x"; then : for ac_prog in ${CXX}_r do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PTHREAD_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PTHREAD_CXX"; then ac_cv_prog_PTHREAD_CXX="$PTHREAD_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PTHREAD_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PTHREAD_CXX=$ac_cv_prog_PTHREAD_CXX if test -n "$PTHREAD_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CXX" >&5 $as_echo "$PTHREAD_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PTHREAD_CXX" && break done test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" fi ;; esac ;; #( *) : ;; esac ;; esac fi fi test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test "x$ax_pthread_ok" = "xyes"; then $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h : else ax_pthread_ok=no fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # pthread # AX_PTHREAD([AC_DEFINE([HAVE_PTHREAD], [1], # AS_ECHO(["Define if you have POSIX threads libraries and header files."]) # LDFLAGS="$CFLAGS $PTHREAD_CFLAGS $LDFLAGS $PTHREAD_LIBS $LIBS"]) # LIBS="$PTHREAD_LIBS $LIBS" # CFLAGS="$CFLAGS $PTHREAD_CFLAGS $WARN_CFLAGS" # CC="$PTHREAD_CC" # checks for library functions for ac_func in arc4random arc4random_uniform do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in dup2 endpwent select strerror strtol do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getpass getpassphrase memset do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in localtime_r memset strdup strerror strstr strtol strtoul do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in setregid setreuid do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in chown stat exit time atoi getpid waitpid sigfillset do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in malloc calloc realloc free do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in strlen strncmp strncat strncpy strerror strncasecmp strdup do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in fgetc fopen fclose ferror fprintf vsnprintf snprintf fflush do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in openlog closelog syslog do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in openlog_r closelog_r syslog_r vsyslog_r do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in chroot getgroups setgroups initgroups do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in close unlink fcntl socket listen bzero do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in va_start va_end do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in xmlInitParser xmlCleanupParser xmlCleanupThreads do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in pthread_mutex_init pthread_mutex_destroy pthread_mutex_lock pthread_mutex_unlock do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in pthread_cond_init pthread_cond_signal pthread_cond_destroy pthread_cond_wait pthread_cond_timedwait do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in pthread_create pthread_detach pthread_self pthread_join pthread_sigmask pthread_barrier_wait do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getopt_long do : ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long" if test "x$ac_cv_func_getopt_long" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETOPT_LONG 1 _ACEOF fi done for ac_header in unistd.h do : ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UNISTD_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5 $as_echo_n "checking for working chown... " >&6; } if ${ac_cv_func_chown_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_chown_works=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #include int main () { char *f = "conftest.chown"; struct stat before, after; if (creat (f, 0600) < 0) return 1; if (stat (f, &before) < 0) return 1; if (chown (f, (uid_t) -1, (gid_t) -1) == -1) return 1; if (stat (f, &after) < 0) return 1; return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_chown_works=yes else ac_cv_func_chown_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f conftest.chown fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5 $as_echo "$ac_cv_func_chown_works" >&6; } if test $ac_cv_func_chown_works = yes; then $as_echo "#define HAVE_CHOWN 1" >>confdefs.h fi for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 $as_echo_n "checking for working memcmp... " >&6; } if ${ac_cv_func_memcmp_working+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_memcmp_working=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_memcmp_working=yes else ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 $as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac for ac_header in $ac_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in $ac_func_list do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mktime" >&5 $as_echo_n "checking for working mktime... " >&6; } if ${ac_cv_func_working_mktime+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_working_mktime=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Test program from Paul Eggert and Tony Leneis. */ #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #include #include #ifdef HAVE_UNISTD_H # include #endif #ifndef HAVE_ALARM # define alarm(X) /* empty */ #endif /* Work around redefinition to rpl_putenv by other config tests. */ #undef putenv static time_t time_t_max; static time_t time_t_min; /* Values we'll use to set the TZ environment variable. */ static const char *tz_strings[] = { (const char *) 0, "TZ=GMT0", "TZ=JST-9", "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" }; #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) /* Return 0 if mktime fails to convert a date in the spring-forward gap. Based on a problem report from Andreas Jaeger. */ static int spring_forward_gap () { /* glibc (up to about 1998-10-07) failed this test. */ struct tm tm; /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" instead of "TZ=America/Vancouver" in order to detect the bug even on systems that don't support the Olson extension, or don't have the full zoneinfo tables installed. */ putenv ((char*) "TZ=PST8PDT,M4.1.0,M10.5.0"); tm.tm_year = 98; tm.tm_mon = 3; tm.tm_mday = 5; tm.tm_hour = 2; tm.tm_min = 0; tm.tm_sec = 0; tm.tm_isdst = -1; return mktime (&tm) != (time_t) -1; } static int mktime_test1 (time_t now) { struct tm *lt; return ! (lt = localtime (&now)) || mktime (lt) == now; } static int mktime_test (time_t now) { return (mktime_test1 (now) && mktime_test1 ((time_t) (time_t_max - now)) && mktime_test1 ((time_t) (time_t_min + now))); } static int irix_6_4_bug () { /* Based on code from Ariel Faigon. */ struct tm tm; tm.tm_year = 96; tm.tm_mon = 3; tm.tm_mday = 0; tm.tm_hour = 0; tm.tm_min = 0; tm.tm_sec = 0; tm.tm_isdst = -1; mktime (&tm); return tm.tm_mon == 2 && tm.tm_mday == 31; } static int bigtime_test (int j) { struct tm tm; time_t now; tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j; now = mktime (&tm); if (now != (time_t) -1) { struct tm *lt = localtime (&now); if (! (lt && lt->tm_year == tm.tm_year && lt->tm_mon == tm.tm_mon && lt->tm_mday == tm.tm_mday && lt->tm_hour == tm.tm_hour && lt->tm_min == tm.tm_min && lt->tm_sec == tm.tm_sec && lt->tm_yday == tm.tm_yday && lt->tm_wday == tm.tm_wday && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) return 0; } return 1; } static int year_2050_test () { /* The correct answer for 2050-02-01 00:00:00 in Pacific time, ignoring leap seconds. */ unsigned long int answer = 2527315200UL; struct tm tm; time_t t; tm.tm_year = 2050 - 1900; tm.tm_mon = 2 - 1; tm.tm_mday = 1; tm.tm_hour = tm.tm_min = tm.tm_sec = 0; tm.tm_isdst = -1; /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" instead of "TZ=America/Vancouver" in order to detect the bug even on systems that don't support the Olson extension, or don't have the full zoneinfo tables installed. */ putenv ((char*) "TZ=PST8PDT,M4.1.0,M10.5.0"); t = mktime (&tm); /* Check that the result is either a failure, or close enough to the correct answer that we can assume the discrepancy is due to leap seconds. */ return (t == (time_t) -1 || (0 < t && answer - 120 <= t && t <= answer + 120)); } int main () { time_t t, delta; int i, j; /* This test makes some buggy mktime implementations loop. Give up after 60 seconds; a mktime slower than that isn't worth using anyway. */ alarm (60); for (;;) { t = (time_t_max << 1) + 1; if (t <= time_t_max) break; time_t_max = t; } time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max; delta = time_t_max / 997; /* a suitable prime number */ for (i = 0; i < N_STRINGS; i++) { if (tz_strings[i]) putenv ((char*) tz_strings[i]); for (t = 0; t <= time_t_max - delta; t += delta) if (! mktime_test (t)) return 1; if (! (mktime_test ((time_t) 1) && mktime_test ((time_t) (60 * 60)) && mktime_test ((time_t) (60 * 60 * 24)))) return 1; for (j = 1; ; j <<= 1) if (! bigtime_test (j)) return 1; else if (INT_MAX / 2 < j) break; if (! bigtime_test (INT_MAX)) return 1; } return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_working_mktime=yes else ac_cv_func_working_mktime=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_working_mktime" >&5 $as_echo "$ac_cv_func_working_mktime" >&6; } if test $ac_cv_func_working_mktime = no; then case " $LIBOBJS " in *" mktime.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS mktime.$ac_objext" ;; esac fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } if ${ac_cv_func_realloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_realloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_realloc_0_nonnull=yes else ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then : $as_echo "#define HAVE_REALLOC 1" >>confdefs.h else $as_echo "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; esac $as_echo "#define realloc rpl_realloc" >>confdefs.h fi for ac_header in sys/select.h sys/socket.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5 $as_echo_n "checking types of arguments for select... " >&6; } if ${ac_cv_func_select_args+:} false; then : $as_echo_n "(cached) " >&6 else for ac_arg234 in 'fd_set *' 'int *' 'void *'; do for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_SELECT_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif int main () { extern int select ($ac_arg1, $ac_arg234, $ac_arg234, $ac_arg234, $ac_arg5); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done done done # Provide a safe default value. : "${ac_cv_func_select_args=int,int *,struct timeval *}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5 $as_echo "$ac_cv_func_select_args" >&6; } ac_save_IFS=$IFS; IFS=',' set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` IFS=$ac_save_IFS shift cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG1 $1 _ACEOF cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG234 ($2) _ACEOF cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG5 ($3) _ACEOF rm -f conftest* for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VPRINTF 1 _ACEOF ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" if test "x$ac_cv_func__doprnt" = xyes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat" if test "x$ac_cv_func_strlcat" = xyes; then : $as_echo "#define HAVE_STRLCAT 1" >>confdefs.h else case " $LIBOBJS " in *" strlcat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strlcat.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" if test "x$ac_cv_func_strlcpy" = xyes; then : $as_echo "#define HAVE_STRLCPY 1" >>confdefs.h else case " $LIBOBJS " in *" strlcpy.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strlcpy.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "b64_pton" "ac_cv_func_b64_pton" if test "x$ac_cv_func_b64_pton" = xyes; then : $as_echo "#define HAVE_B64_PTON 1" >>confdefs.h else case " $LIBOBJS " in *" b64_pton.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS b64_pton.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "b64_ntop" "ac_cv_func_b64_ntop" if test "x$ac_cv_func_b64_ntop" = xyes; then : $as_echo "#define HAVE_B64_NTOP 1" >>confdefs.h else case " $LIBOBJS " in *" b64_ntop.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS b64_ntop.$ac_objext" ;; esac fi for ac_func in setresuid do : ac_fn_c_check_func "$LINENO" "setresuid" "ac_cv_func_setresuid" if test "x$ac_cv_func_setresuid" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETRESUID 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setresuid seems to work" >&5 $as_echo_n "checking if setresuid seems to work... " >&6; } if test "$cross_compiling" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking setresuid" >&5 $as_echo "$as_me: WARNING: cross compiling: not checking setresuid" >&2;} else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);} _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else $as_echo "#define BROKEN_SETRESUID 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: not implemented" >&5 $as_echo "not implemented" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi done for ac_func in setresgid do : ac_fn_c_check_func "$LINENO" "setresgid" "ac_cv_func_setresgid" if test "x$ac_cv_func_setresgid" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETRESGID 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setresgid seems to work" >&5 $as_echo_n "checking if setresgid seems to work... " >&6; } if test "$cross_compiling" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking setresuid" >&5 $as_echo "$as_me: WARNING: cross compiling: not checking setresuid" >&2;} else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);} _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else $as_echo "#define BROKEN_SETRESGID 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: not implemented" >&5 $as_echo "not implemented" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strptime needs defines" >&5 $as_echo_n "checking whether strptime needs defines... " >&6; } if ${ac_cv_c_strptime_needs_defs+:} false; then : $as_echo_n "(cached) " >&6 else 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* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_strptime_needs_defs" >&5 $as_echo "$ac_cv_c_strptime_needs_defs" >&6; } if test $ac_cv_c_strptime_needs_defs = yes; then cat >>confdefs.h <<_ACEOF #define STRPTIME_NEEDS_DEFINES 1 _ACEOF fi # check for some target-specific stuff case "$host" in *-*-darwin*) $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h ;; *-*-netbsd*) $as_echo "#define _NETBSD_SOURCE 1" >>confdefs.h ;; esac # check for the sockaddr_un.sun_len member ac_fn_c_check_member "$LINENO" "struct sockaddr_un" "sun_len" "ac_cv_member_struct_sockaddr_un_sun_len" " #include #include " if test "x$ac_cv_member_struct_sockaddr_un_sun_len" = xyes; then : $as_echo "#define HAVE_SOCKADDR_SUN_LEN 1" >>confdefs.h fi # common dependencies # Check whether --with-libxml2 was given. if test "${with_libxml2+set}" = set; then : withval=$with_libxml2; XML2_PATH="$withval" for ac_prog in xml2-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_XML2_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $XML2_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_XML2_CONFIG="$XML2_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $XML2_PATH/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_XML2_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi XML2_CONFIG=$ac_cv_path_XML2_CONFIG if test -n "$XML2_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML2_CONFIG" >&5 $as_echo "$XML2_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$XML2_CONFIG" && break done test -n "$XML2_CONFIG" || XML2_CONFIG="xml2-config" else XML2_PATH="/usr/local" for ac_prog in xml2-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_XML2_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $XML2_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_XML2_CONFIG="$XML2_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_XML2_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi XML2_CONFIG=$ac_cv_path_XML2_CONFIG if test -n "$XML2_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML2_CONFIG" >&5 $as_echo "$XML2_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$XML2_CONFIG" && break done test -n "$XML2_CONFIG" || XML2_CONFIG="xml2-config" fi if test -x "$XML2_CONFIG" then { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the xml2 includes" >&5 $as_echo_n "checking what are the xml2 includes... " >&6; } XML2_INCLUDES="`$XML2_CONFIG --cflags`" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML2_INCLUDES" >&5 $as_echo "$XML2_INCLUDES" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the xml2 libs" >&5 $as_echo_n "checking what are the xml2 libs... " >&6; } XML2_LIBS="`$XML2_CONFIG --libs`" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML2_LIBS" >&5 $as_echo "$XML2_LIBS" >&6; } tmp_CPPFLAGS=$CPPFLAGS tmp_LIBS=$LIBS CPPFLAGS="$CPPFLAGS $XML2_INCLUDES" LIBS="$LIBS $XML2_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xmlDocGetRootElement in -lxml2" >&5 $as_echo_n "checking for xmlDocGetRootElement in -lxml2... " >&6; } if ${ac_cv_lib_xml2_xmlDocGetRootElement+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lxml2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char xmlDocGetRootElement (); int main () { return xmlDocGetRootElement (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_xml2_xmlDocGetRootElement=yes else ac_cv_lib_xml2_xmlDocGetRootElement=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xml2_xmlDocGetRootElement" >&5 $as_echo "$ac_cv_lib_xml2_xmlDocGetRootElement" >&6; } if test "x$ac_cv_lib_xml2_xmlDocGetRootElement" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBXML2 1 _ACEOF LIBS="-lxml2 $LIBS" else as_fn_error $? "Can't find libxml2 library" "$LINENO" 5 fi CPPFLAGS=$tmp_CPPFLAGS LIBS=$tmp_LIBS else as_fn_error $? "libxml2 required, but not found." "$LINENO" 5 fi # Check whether --with-ldns was given. if test "${with_ldns+set}" = set; then : withval=$with_ldns; LDNS_PATH="$withval" for ac_prog in ldns-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LDNS_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $LDNS_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_LDNS_CONFIG="$LDNS_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $LDNS_PATH/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LDNS_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi LDNS_CONFIG=$ac_cv_path_LDNS_CONFIG if test -n "$LDNS_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_CONFIG" >&5 $as_echo "$LDNS_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LDNS_CONFIG" && break done test -n "$LDNS_CONFIG" || LDNS_CONFIG="ldns-config" else LDNS_PATH="/usr/local" for ac_prog in ldns-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LDNS_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $LDNS_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_LDNS_CONFIG="$LDNS_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LDNS_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi LDNS_CONFIG=$ac_cv_path_LDNS_CONFIG if test -n "$LDNS_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_CONFIG" >&5 $as_echo "$LDNS_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LDNS_CONFIG" && break done test -n "$LDNS_CONFIG" || LDNS_CONFIG="ldns-config" fi if test -x "$LDNS_CONFIG" then { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the ldns includes" >&5 $as_echo_n "checking what are the ldns includes... " >&6; } LDNS_INCLUDES="`$LDNS_CONFIG --cflags`" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_INCLUDES" >&5 $as_echo "$LDNS_INCLUDES" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the ldns libs" >&5 $as_echo_n "checking what are the ldns libs... " >&6; } LDNS_LIBS="`$LDNS_CONFIG --libs`" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_LIBS" >&5 $as_echo "$LDNS_LIBS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the ldns includes" >&5 $as_echo_n "checking what are the ldns includes... " >&6; } LDNS_INCLUDES="-I$LDNS_PATH/include" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_INCLUDES" >&5 $as_echo "$LDNS_INCLUDES" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the ldns libs" >&5 $as_echo_n "checking what are the ldns libs... " >&6; } LDNS_LIBS="-L$LDNS_PATH/lib -lldns" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_LIBS" >&5 $as_echo "$LDNS_LIBS" >&6; } fi tmp_CPPFLAGS=$CPPFLAGS tmp_LIBS=$LIBS CPPFLAGS="$CPPFLAGS $LDNS_INCLUDES" LIBS="$LIBS $LDNS_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns_rr_new in -lldns" >&5 $as_echo_n "checking for ldns_rr_new in -lldns... " >&6; } if ${ac_cv_lib_ldns_ldns_rr_new+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lldns $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ldns_rr_new (); int main () { return ldns_rr_new (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ldns_ldns_rr_new=yes else ac_cv_lib_ldns_ldns_rr_new=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldns_ldns_rr_new" >&5 $as_echo "$ac_cv_lib_ldns_ldns_rr_new" >&6; } if test "x$ac_cv_lib_ldns_ldns_rr_new" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBLDNS 1 _ACEOF LIBS="-lldns $LIBS" else as_fn_error $? "Can't find ldns library" "$LINENO" 5 fi LIBS=$tmp_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns version" >&5 $as_echo_n "checking for ldns version... " >&6; } CHECK_LDNS_VERSION=0x010611 ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main() { #ifdef LDNS_REVISION if (LDNS_REVISION >= $CHECK_LDNS_VERSION) return 0; #endif return 1; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: >= 1.6.17" >&5 $as_echo ">= 1.6.17" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: < 1.6.17" >&5 $as_echo "< 1.6.17" >&6; } as_fn_error $? "ldns library too old (1.6.17 or later required)" "$LINENO" 5 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CPPFLAGS=$tmp_CPPFLAGS # Check whether --with-ldns was given. if test "${with_ldns+set}" = set; then : withval=$with_ldns; LDNS_PATH="$withval" for ac_prog in ldns-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LDNS_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $LDNS_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_LDNS_CONFIG="$LDNS_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $LDNS_PATH/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LDNS_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi LDNS_CONFIG=$ac_cv_path_LDNS_CONFIG if test -n "$LDNS_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_CONFIG" >&5 $as_echo "$LDNS_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LDNS_CONFIG" && break done test -n "$LDNS_CONFIG" || LDNS_CONFIG="ldns-config" else LDNS_PATH="/usr/local" for ac_prog in ldns-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LDNS_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $LDNS_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_LDNS_CONFIG="$LDNS_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LDNS_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi LDNS_CONFIG=$ac_cv_path_LDNS_CONFIG if test -n "$LDNS_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_CONFIG" >&5 $as_echo "$LDNS_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LDNS_CONFIG" && break done test -n "$LDNS_CONFIG" || LDNS_CONFIG="ldns-config" fi if test -x "$LDNS_CONFIG" then { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the ldns includes" >&5 $as_echo_n "checking what are the ldns includes... " >&6; } LDNS_INCLUDES="`$LDNS_CONFIG --cflags`" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_INCLUDES" >&5 $as_echo "$LDNS_INCLUDES" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the ldns libs" >&5 $as_echo_n "checking what are the ldns libs... " >&6; } LDNS_LIBS="`$LDNS_CONFIG --libs`" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_LIBS" >&5 $as_echo "$LDNS_LIBS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the ldns includes" >&5 $as_echo_n "checking what are the ldns includes... " >&6; } LDNS_INCLUDES="-I$LDNS_PATH/include" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_INCLUDES" >&5 $as_echo "$LDNS_INCLUDES" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the ldns libs" >&5 $as_echo_n "checking what are the ldns libs... " >&6; } LDNS_LIBS="-L$LDNS_PATH/lib -lldns" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_LIBS" >&5 $as_echo "$LDNS_LIBS" >&6; } fi tmp_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS $LDNS_INCLUDES" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns version not 1.6.14" >&5 $as_echo_n "checking for ldns version not 1.6.14... " >&6; } CHECK_LDNS_VERSION=0x01060e ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main() { #ifdef LDNS_REVISION if (LDNS_REVISION != $CHECK_LDNS_VERSION) return 0; #endif return 1; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "ldns version 1.6.14 is not compatible due to binary incompatibility, see http://open.nlnetlabs.nl/pipermail/ldns-users/2012-October/000564.html" "$LINENO" 5 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CPPFLAGS=$tmp_CPPFLAGS # Check whether --with-ldns was given. if test "${with_ldns+set}" = set; then : withval=$with_ldns; LDNS_PATH="$withval" for ac_prog in ldns-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LDNS_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $LDNS_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_LDNS_CONFIG="$LDNS_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $LDNS_PATH/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LDNS_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi LDNS_CONFIG=$ac_cv_path_LDNS_CONFIG if test -n "$LDNS_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_CONFIG" >&5 $as_echo "$LDNS_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LDNS_CONFIG" && break done test -n "$LDNS_CONFIG" || LDNS_CONFIG="ldns-config" else LDNS_PATH="/usr/local" for ac_prog in ldns-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LDNS_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $LDNS_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_LDNS_CONFIG="$LDNS_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LDNS_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi LDNS_CONFIG=$ac_cv_path_LDNS_CONFIG if test -n "$LDNS_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_CONFIG" >&5 $as_echo "$LDNS_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LDNS_CONFIG" && break done test -n "$LDNS_CONFIG" || LDNS_CONFIG="ldns-config" fi if test -x "$LDNS_CONFIG" then { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the ldns includes" >&5 $as_echo_n "checking what are the ldns includes... " >&6; } LDNS_INCLUDES="`$LDNS_CONFIG --cflags`" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_INCLUDES" >&5 $as_echo "$LDNS_INCLUDES" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the ldns libs" >&5 $as_echo_n "checking what are the ldns libs... " >&6; } LDNS_LIBS="`$LDNS_CONFIG --libs`" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_LIBS" >&5 $as_echo "$LDNS_LIBS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the ldns includes" >&5 $as_echo_n "checking what are the ldns includes... " >&6; } LDNS_INCLUDES="-I$LDNS_PATH/include" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_INCLUDES" >&5 $as_echo "$LDNS_INCLUDES" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the ldns libs" >&5 $as_echo_n "checking what are the ldns libs... " >&6; } LDNS_LIBS="-L$LDNS_PATH/lib -lldns" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDNS_LIBS" >&5 $as_echo "$LDNS_LIBS" >&6; } fi tmp_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS $LDNS_INCLUDES" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns version not 1.6.15" >&5 $as_echo_n "checking for ldns version not 1.6.15... " >&6; } CHECK_LDNS_VERSION=0x01060f ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main() { #ifdef LDNS_REVISION if (LDNS_REVISION != $CHECK_LDNS_VERSION) return 0; #endif return 1; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "ldns version 1.6.15 is not compatible due to fail to create NSEC3 bitmap for empty non-terminals, see http://www.nlnetlabs.nl/pipermail/ldns-users/2012-November/000565.html" "$LINENO" 5 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CPPFLAGS=$tmp_CPPFLAGS # Check whether --with-pkcs11-softhsm was given. if test "${with_pkcs11_softhsm+set}" = set; then : withval=$with_pkcs11_softhsm; pkcs11_softhsm_module="$withval" else pkcs11_softhsm_module="$full_libdir/softhsm/libsofthsm2.so" fi # Check whether --with-pkcs11-sca6000 was given. if test "${with_pkcs11_sca6000+set}" = set; then : withval=$with_pkcs11_sca6000; pkcs11_sca6000_module="$withval" else pkcs11_sca6000_module="/usr/lib/libpkcs11.so" fi # Check whether --with-pkcs11-etoken was given. if test "${with_pkcs11_etoken+set}" = set; then : withval=$with_pkcs11_etoken; pkcs11_etoken_module="$withval" else pkcs11_etoken_module="/usr/local/lib/libeTPkcs11.so" fi # Check whether --with-pkcs11-opensc was given. if test "${with_pkcs11_opensc+set}" = set; then : withval=$with_pkcs11_opensc; pkcs11_opensc_module="$withval" else pkcs11_opensc_module="/usr/lib/pkcs11/opensc-pkcs11.so" fi # Check whether --with-pkcs11-ncipher was given. if test "${with_pkcs11_ncipher+set}" = set; then : withval=$with_pkcs11_ncipher; pkcs11_ncipher_module="$withval" else pkcs11_ncipher_module="/opt/nfast/toolkits/pkcs11/libcknfast.so" fi # Check whether --with-pkcs11-aepkeyper was given. if test "${with_pkcs11_aepkeyper+set}" = set; then : withval=$with_pkcs11_aepkeyper; pkcs11_aepkeyper_module="$withval" else pkcs11_aepkeyper_module="/opt/Keyper/PKCS11Provider/pkcs11.so" fi RT_LIBS="-lrt" tmp_LIBS=$LIBS LIBS="$LIBS $RT_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 $as_echo_n "checking for clock_gettime in -lrt... " >&6; } if ${ac_cv_lib_rt_clock_gettime+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char clock_gettime (); int main () { return clock_gettime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_rt_clock_gettime=yes else ac_cv_lib_rt_clock_gettime=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 $as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : $as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h else RT_LIBS="" fi LIBS=$tmp_LIBS for ac_header in sys/time.h time.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "x$RT_LIBS" = "x" ; then ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" if test "x$ac_cv_func_gettimeofday" = xyes; then : else as_fn_error $? "Could not find the function clock_gettime or gettimeofday" "$LINENO" 5 fi fi C_LIBS="-lc" # some checks could go in here # Check whether --with-ssl was given. if test "${with_ssl+set}" = set; then : withval=$with_ssl; else withval="yes" fi if test x_$withval != x_no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL" >&5 $as_echo_n "checking for SSL... " >&6; } 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"; cat >>confdefs.h <<_ACEOF #define HAVE_SSL /**/ _ACEOF 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 as_fn_error $? "Cannot find the SSL libraries in $withval" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5 $as_echo "found in $ssldir" >&6; } 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 save_LIBS=$LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_CTX_reset in -lcrypto" >&5 $as_echo_n "checking for HMAC_CTX_reset in -lcrypto... " >&6; } if ${ac_cv_lib_crypto_HMAC_CTX_reset+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char HMAC_CTX_reset (); int main () { return HMAC_CTX_reset (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_crypto_HMAC_CTX_reset=yes else ac_cv_lib_crypto_HMAC_CTX_reset=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_HMAC_CTX_reset" >&5 $as_echo "$ac_cv_lib_crypto_HMAC_CTX_reset" >&6; } if test "x$ac_cv_lib_crypto_HMAC_CTX_reset" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SSL_NEW_HMAC /**/ _ACEOF else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_CTX_init in -lcrypto" >&5 $as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; } if ${ac_cv_lib_crypto_HMAC_CTX_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char HMAC_CTX_init (); int main () { return HMAC_CTX_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_crypto_HMAC_CTX_init=yes else ac_cv_lib_crypto_HMAC_CTX_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_HMAC_CTX_init" >&5 $as_echo "$ac_cv_lib_crypto_HMAC_CTX_init" >&6; } if test "x$ac_cv_lib_crypto_HMAC_CTX_init" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBCRYPTO 1 _ACEOF LIBS="-lcrypto $LIBS" else as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 fi fi SSL_LIBS="$SSL_LIBS -lcrypto"; LIBS="$SSL_LIBS $LIBS" for ac_func in EVP_sha1 EVP_sha256 do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done LIBS=$saveLIBS fi fi # Check whether --with-cunit was given. if test "${with_cunit+set}" = set; then : withval=$with_cunit; CUNIT_PATH="$withval" else CUNIT_PATH="/usr/local" fi if test "x$with_cunit" != xno; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the cunit includes" >&5 $as_echo_n "checking what are the cunit includes... " >&6; } CUNIT_INCLUDES="-I$CUNIT_PATH/include" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUNIT_INCLUDES" >&5 $as_echo "$CUNIT_INCLUDES" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking what are the cunit libs" >&5 $as_echo_n "checking what are the cunit libs... " >&6; } CUNIT_LIBS="-L$CUNIT_PATH/lib -lcunit" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUNIT_LIBS" >&5 $as_echo "$CUNIT_LIBS" >&6; } tmp_CPPFLAGS=$CPPFLAGS tmp_LIBS=$LIBS CPPFLAGS="$CPPFLAGS $CUNIT_INCLUDES" LIBS="$LIBS $CUNIT_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CU_run_test in -lcunit" >&5 $as_echo_n "checking for CU_run_test in -lcunit... " >&6; } if ${ac_cv_lib_cunit_CU_run_test+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcunit $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char CU_run_test (); int main () { return CU_run_test (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_cunit_CU_run_test=yes else ac_cv_lib_cunit_CU_run_test=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cunit_CU_run_test" >&5 $as_echo "$ac_cv_lib_cunit_CU_run_test" >&6; } if test "x$ac_cv_lib_cunit_CU_run_test" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBCUNIT 1 _ACEOF LIBS="-lcunit $LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: Can't find cunit library" >&5 $as_echo "$as_me: Can't find cunit library" >&6;} CUNIT_INCLUDES= CUNIT_LIBS= fi CPPFLAGS=$tmp_CPPFLAGS LIBS=$tmp_LIBS else { $as_echo "$as_me:${as_lineno-$LINENO}: cunit disabled" >&5 $as_echo "$as_me: cunit disabled" >&6;} CUNIT_INCLUDES= CUNIT_LIBS= fi $as_echo "#define USE_ED25519 1" >>confdefs.h $as_echo "#define USE_ED448 1" >>confdefs.h # cunit if test "${with_cunit}" != "no" -a -n "$CUNIT_LIBS"; then WITH_CUNIT_TRUE= WITH_CUNIT_FALSE='#' else WITH_CUNIT_TRUE='#' WITH_CUNIT_FALSE= fi # libhsm tmp_SUCCESS="no" # Unix ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : $as_echo "#define HAVE_DLOPEN 1" >>confdefs.h tmp_SUCCESS="yes" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : $as_echo "#define HAVE_DLOPEN 1" >>confdefs.h LIBS="$LIBS -ldl" tmp_SUCCESS="yes" fi fi # Windows if test "$tmp_SUCCESS" = "no" then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LoadLibrary" >&5 $as_echo_n "checking for LoadLibrary... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { LoadLibrary(NULL); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_LOADLIBRARY 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi cat >>confdefs.h <<_ACEOF #define HSM_DEFAULT_CONFIG "$OPENDNSSEC_CONFIG_FILE" _ACEOF # enforcer # Check whether --enable-enforcer was given. if test "${enable_enforcer+set}" = set; then : enableval=$enable_enforcer; enable_enforcer="${enableval}" else enable_enforcer="yes" fi if test "x${enable_enforcer}" = "xyes"; then cat >>confdefs.h <<_ACEOF #define SIGNER_CLI_UPDATE "$OPENDNSSEC_SIGNER_CLI update" _ACEOF # Check whether --with-enforcer-database was given. if test "${with_enforcer_database+set}" = set; then : withval=$with_enforcer_database; database_backend="${withval}" else database_backend="sqlite3" fi # Check whether --with-enforcer-database-test-host was given. if test "${with_enforcer_database_test_host+set}" = set; then : withval=$with_enforcer_database_test_host; database_host="${withval}" else database_host="" fi # Check whether --with-enforcer-database-test-port was given. if test "${with_enforcer_database_test_port+set}" = set; then : withval=$with_enforcer_database_test_port; database_port="${withval}" else database_port="0" fi # Check whether --with-enforcer-database-test-database was given. if test "${with_enforcer_database_test_database+set}" = set; then : withval=$with_enforcer_database_test_database; database_database="${withval}" else database_database="" fi # Check whether --with-enforcer-database-test-username was given. if test "${with_enforcer_database_test_username+set}" = set; then : withval=$with_enforcer_database_test_username; database_username="${withval}" else database_username="" fi # Check whether --with-enforcer-database-test-password was given. if test "${with_enforcer_database_test_password+set}" = set; then : withval=$with_enforcer_database_test_password; database_password="${withval}" else database_password="" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for database backend" >&5 $as_echo_n "checking for database backend... " >&6; } if test "x${database_backend}" = "xsqlite3"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: SQLite3" >&5 $as_echo "SQLite3" >&6; } # Check whether --with-sqlite3 was given. if test "${with_sqlite3+set}" = set; then : withval=$with_sqlite3; if test "$withval" = "no"; then WANT_SQLITE3="no" elif test "$withval" = "yes"; then WANT_SQLITE3="yes" ac_sqlite3_path="" else WANT_SQLITE3="yes" ac_sqlite3_path="$withval" fi else WANT_SQLITE3="yes" fi SQLITE3_CFLAGS="" SQLITE3_LDFLAGS="" SQLITE3_VERSION="" if test "x$WANT_SQLITE3" = "xyes"; then ac_sqlite3_header="sqlite3.h" sqlite3_version_req=3.0.0 sqlite3_version_req_shorten=`expr $sqlite3_version_req : '\([0-9]*\.[0-9]*\)'` sqlite3_version_req_major=`expr $sqlite3_version_req : '\([0-9]*\)'` sqlite3_version_req_minor=`expr $sqlite3_version_req : '[0-9]*\.\([0-9]*\)'` sqlite3_version_req_micro=`expr $sqlite3_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'` if test "x$sqlite3_version_req_micro" = "x" ; then sqlite3_version_req_micro="0" fi sqlite3_version_req_number=`expr $sqlite3_version_req_major \* 1000000 \ \+ $sqlite3_version_req_minor \* 1000 \ \+ $sqlite3_version_req_micro` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLite3 library >= $sqlite3_version_req" >&5 $as_echo_n "checking for SQLite3 library >= $sqlite3_version_req... " >&6; } if test "x$ac_sqlite3_path" != "x"; then ac_sqlite3_ldflags="-L$ac_sqlite3_path/lib" ac_sqlite3_cppflags="-I$ac_sqlite3_path/include" else for ac_sqlite3_path_tmp in /usr /usr/local /opt ; do if test -f "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header" \ && test -r "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header"; then ac_sqlite3_path=$ac_sqlite3_path_tmp ac_sqlite3_cppflags="-I$ac_sqlite3_path_tmp/include" ac_sqlite3_ldflags="-L$ac_sqlite3_path_tmp/lib" break; fi done fi ac_sqlite3_ldflags="$ac_sqlite3_ldflags -lsqlite3" saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $ac_sqlite3_cppflags" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if (SQLITE_VERSION_NUMBER >= $sqlite3_version_req_number) /* Everything is okay */ #else # error SQLite version is too old #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } success="yes" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } success="no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CPPFLAGS="$saved_CPPFLAGS" if test "$success" = "yes"; then SQLITE3_CFLAGS="$ac_sqlite3_cppflags" SQLITE3_LDFLAGS="$ac_sqlite3_ldflags" ac_sqlite3_header_path="$ac_sqlite3_path/include/$ac_sqlite3_header" if test "x$ac_sqlite3_header_path" != "x"; then ac_sqlite3_version=`cat $ac_sqlite3_header_path \ | grep '#define.*SQLITE_VERSION.*\"' | sed -e 's/.* "//' \ | sed -e 's/"//'` if test "x$ac_sqlite3_version" != "x"; then SQLITE3_VERSION=$ac_sqlite3_version else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!" >&5 $as_echo "$as_me: WARNING: Cannot find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!" >&2;} fi fi $as_echo "#define HAVE_SQLITE3 /**/" >>confdefs.h fi fi ENFORCER_DB_INCLUDES=$SQLITE3_CFLAGS ENFORCER_DB_LIBS=$SQLITE3_LDFLAGS cat >>confdefs.h <<_ACEOF #define ENFORCER_DATABASE_SQLITE3 1 _ACEOF if true; then USE_SQLITE_TRUE= USE_SQLITE_FALSE='#' else USE_SQLITE_TRUE='#' USE_SQLITE_FALSE= fi if false; then USE_MYSQL_TRUE= USE_MYSQL_FALSE='#' else USE_MYSQL_TRUE='#' USE_MYSQL_FALSE= fi elif test "x${database_backend}" = "xmysql"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: MySQL" >&5 $as_echo "MySQL" >&6; } # Check whether --with-mysql was given. if test "${with_mysql+set}" = set; then : withval=$with_mysql; if test "$withval" = "no"; then want_mysql="no" elif test "$withval" = "yes"; then want_mysql="yes" else want_mysql="yes" MYSQL_CONFIG="$withval" fi else want_mysql="yes" fi MYSQL_CFLAGS="" MYSQL_LDFLAGS="" MYSQL_VERSION="" if test "$want_mysql" = "yes"; then if test -z "$MYSQL_CONFIG" ; then for ac_prog in mysql_config mysql_config5 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_MYSQL_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $MYSQL_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_MYSQL_CONFIG="$MYSQL_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_MYSQL_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi MYSQL_CONFIG=$ac_cv_path_MYSQL_CONFIG if test -n "$MYSQL_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MYSQL_CONFIG" >&5 $as_echo "$MYSQL_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$MYSQL_CONFIG" && break done test -n "$MYSQL_CONFIG" || MYSQL_CONFIG="no" fi if test "$MYSQL_CONFIG" != "no"; then MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`" MYSQL_LDFLAGS="`$MYSQL_CONFIG --libs`" MYSQL_VERSION=`$MYSQL_CONFIG --version` found_mysql="yes" else found_mysql="no" fi fi mysql_version_req=5.0.0 if test "$found_mysql" = "yes" -a -n "$mysql_version_req"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if MySQL version is >= $mysql_version_req" >&5 $as_echo_n "checking if MySQL version is >= $mysql_version_req... " >&6; } mysql_version_req_major=`expr $mysql_version_req : '\([0-9]*\)'` mysql_version_req_minor=`expr $mysql_version_req : '[0-9]*\.\([0-9]*\)'` mysql_version_req_micro=`expr $mysql_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'` if test "x$mysql_version_req_micro" = "x"; then mysql_version_req_micro="0" fi mysql_version_req_number=`expr $mysql_version_req_major \* 1000000 \ \+ $mysql_version_req_minor \* 1000 \ \+ $mysql_version_req_micro` mysql_version_major=`expr $MYSQL_VERSION : '\([0-9]*\)'` mysql_version_minor=`expr $MYSQL_VERSION : '[0-9]*\.\([0-9]*\)'` mysql_version_micro=`expr $MYSQL_VERSION : '[0-9]*\.[0-9]*\.\([0-9]*\)'` if test "x$mysql_version_micro" = "x"; then mysql_version_micro="0" fi mysql_version_number=`expr $mysql_version_major \* 1000000 \ \+ $mysql_version_minor \* 1000 \ \+ $mysql_version_micro` mysql_version_check=`expr $mysql_version_number \>\= $mysql_version_req_number` if test "$mysql_version_check" = "1"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test "$found_mysql" = "yes" ; then $as_echo "#define HAVE_MYSQL 1" >>confdefs.h fi if test "$found_mysql" != "yes"; then as_fn_error $? "MySQL is missing." "$LINENO" 5 fi ENFORCER_DB_INCLUDES=$MYSQL_CFLAGS ENFORCER_DB_LIBS=$MYSQL_LDFLAGS cat >>confdefs.h <<_ACEOF #define ENFORCER_DATABASE_MYSQL 1 _ACEOF if false; then USE_SQLITE_TRUE= USE_SQLITE_FALSE='#' else USE_SQLITE_TRUE='#' USE_SQLITE_FALSE= fi if true; then USE_MYSQL_TRUE= USE_MYSQL_FALSE='#' else USE_MYSQL_TRUE='#' USE_MYSQL_FALSE= fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Unknown" >&5 $as_echo "Unknown" >&6; } as_fn_error $? "Database backend ${database_backend} not supported." "$LINENO" 5 fi ENFORCER_DB_HOST="$database_host" ENFORCER_DB_PORT=$database_port ENFORCER_DB_PORT_TEXT="$database_port" ENFORCER_DB_DATABASE="$database_database" ENFORCER_DB_USERNAME="$database_username" ENFORCER_DB_PASSWORD="$database_password" cat >>confdefs.h <<_ACEOF #define ENFORCER_DB_HOST "$database_host" _ACEOF cat >>confdefs.h <<_ACEOF #define ENFORCER_DB_PORT $database_port _ACEOF cat >>confdefs.h <<_ACEOF #define ENFORCER_DB_PORT_TEXT "$database_port" _ACEOF cat >>confdefs.h <<_ACEOF #define ENFORCER_DB_DATABASE "$database_database" _ACEOF cat >>confdefs.h <<_ACEOF #define ENFORCER_DB_USERNAME "$database_username" _ACEOF cat >>confdefs.h <<_ACEOF #define ENFORCER_DB_PASSWORD "$database_password" _ACEOF # Check whether --with-readline was given. if test "${with_readline+set}" = set; then : withval=$with_readline; if test x"${withval}" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -lreadline" >&5 $as_echo_n "checking for readline in -lreadline... " >&6; } if ${ac_cv_lib_readline_readline+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char readline (); int main () { return readline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_readline_readline=yes else ac_cv_lib_readline_readline=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5 $as_echo "$ac_cv_lib_readline_readline" >&6; } if test "x$ac_cv_lib_readline_readline" = xyes; then : if test x"${ac_cv_lib_readline_readline}" = xno; then as_fn_error $? "libreadline not found" "$LINENO" 5 fi READLINE_LIBS="-lreadline" $as_echo "#define HAVE_READLINE 1" >>confdefs.h fi fi fi fi if test "${enable_enforcer}" = "yes"; then ENABLE_ENFORCER_TRUE= ENABLE_ENFORCER_FALSE='#' else ENABLE_ENFORCER_TRUE='#' ENABLE_ENFORCER_FALSE= fi # signer # Check whether --enable-signer was given. if test "${enable_signer+set}" = set; then : enableval=$enable_signer; enable_signer="${enableval}" else enable_signer="yes" fi if test "${enable_signer}" = "yes"; then ENABLE_SIGNER_TRUE= ENABLE_SIGNER_FALSE='#' else ENABLE_SIGNER_TRUE='#' ENABLE_SIGNER_FALSE= fi INSTALLATIONCOND="" # Check whether --enable-installation-user was given. if test "${enable_installation_user+set}" = set; then : enableval=$enable_installation_user; enable_installationuser=$enableval else enable_installationuser="no" fi # Check whether --enable-installation-group was given. if test "${enable_installation_group+set}" = set; then : enableval=$enable_installation_group; enable_installationgroup=$enableval else enable_installationgroup="no" fi if test "x${enable_installationuser}" != "xno"; then INSTALLATIONUSER="${enable_installationuser}" INSTALLATIONUSERARG="-o${enable_installationuser}" INSTALLATIONCOND="user" else INSTALLATIONUSER="" INSTALLATIONUSERARG="" fi if test "x${enable_installationgroup}" != "xno"; then INSTALLATIONGROUP="${enable_installationgroup}" INSTALLATIONGROUPARG="-g${enable_installationgroup}" if test "x${enable_installationuser}" != "xno"; then INSTALLATIONCOND="both" else INSTALLATIONCOND="group" fi else INSTALLATIONGROUP="" INSTALLATIONGROUPARG="" fi # doxygen # Files: DX_PROJECT=${PACKAGE_NAME} DX_CONFIG='Doxyfile' DX_DOCDIR='doxygen-doc' # Environment variables used inside doxygen.cfg: DX_ENV="$DX_ENV SRCDIR='$srcdir'" SRCDIR=$srcdir DX_ENV="$DX_ENV PROJECT='$DX_PROJECT'" PROJECT=$DX_PROJECT DX_ENV="$DX_ENV VERSION='$PACKAGE_VERSION'" # Doxygen itself: # Check whether --enable-doxygen-doc was given. if test "${enable_doxygen_doc+set}" = set; then : enableval=$enable_doxygen_doc; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_doc=1 ;; #( n|N|no|No|NO) DX_FLAG_doc=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-doc" "$LINENO" 5 ;; esac else DX_FLAG_doc=1 fi if test "$DX_FLAG_doc" = 1; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}doxygen", so it can be a program name with args. set dummy ${ac_tool_prefix}doxygen; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DX_DOXYGEN+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_DOXYGEN in [\\/]* | ?:[\\/]*) ac_cv_path_DX_DOXYGEN="$DX_DOXYGEN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DX_DOXYGEN="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DX_DOXYGEN=$ac_cv_path_DX_DOXYGEN if test -n "$DX_DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DOXYGEN" >&5 $as_echo "$DX_DOXYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_DOXYGEN"; then ac_pt_DX_DOXYGEN=$DX_DOXYGEN # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_DX_DOXYGEN+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_DOXYGEN in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_DOXYGEN="$ac_pt_DX_DOXYGEN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_DX_DOXYGEN="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_DX_DOXYGEN=$ac_cv_path_ac_pt_DX_DOXYGEN if test -n "$ac_pt_DX_DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DOXYGEN" >&5 $as_echo "$ac_pt_DX_DOXYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_DOXYGEN" = x; then DX_DOXYGEN="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DX_DOXYGEN=$ac_pt_DX_DOXYGEN fi else DX_DOXYGEN="$ac_cv_path_DX_DOXYGEN" fi if test "$DX_FLAG_doc$DX_DOXYGEN" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: doxygen not found - will not generate any doxygen documentation" >&5 $as_echo "$as_me: WARNING: doxygen not found - will not generate any doxygen documentation" >&2;} DX_FLAG_doc=0 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}perl", so it can be a program name with args. set dummy ${ac_tool_prefix}perl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DX_PERL+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_PERL in [\\/]* | ?:[\\/]*) ac_cv_path_DX_PERL="$DX_PERL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DX_PERL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DX_PERL=$ac_cv_path_DX_PERL if test -n "$DX_PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_PERL" >&5 $as_echo "$DX_PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_PERL"; then ac_pt_DX_PERL=$DX_PERL # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_DX_PERL+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_PERL in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_PERL="$ac_pt_DX_PERL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_DX_PERL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_DX_PERL=$ac_cv_path_ac_pt_DX_PERL if test -n "$ac_pt_DX_PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_PERL" >&5 $as_echo "$ac_pt_DX_PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_PERL" = x; then DX_PERL="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DX_PERL=$ac_pt_DX_PERL fi else DX_PERL="$ac_cv_path_DX_PERL" fi if test "$DX_FLAG_doc$DX_PERL" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: perl not found - will not generate any doxygen documentation" >&5 $as_echo "$as_me: WARNING: perl not found - will not generate any doxygen documentation" >&2;} DX_FLAG_doc=0 fi : fi if test "$DX_FLAG_doc" = 1; then DX_ENV="$DX_ENV PERL_PATH='$DX_PERL'" PERL_PATH=$DX_PERL : else : fi # Dot for graphics: # Check whether --enable-doxygen-dot was given. if test "${enable_doxygen_dot+set}" = set; then : enableval=$enable_doxygen_dot; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_dot=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-dot requires doxygen-doc" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_dot=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-dot" "$LINENO" 5 ;; esac else DX_FLAG_dot=0 test "$DX_FLAG_doc" = "1" || DX_FLAG_dot=0 fi if test "$DX_FLAG_dot" = 1; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dot", so it can be a program name with args. set dummy ${ac_tool_prefix}dot; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DX_DOT+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_DOT in [\\/]* | ?:[\\/]*) ac_cv_path_DX_DOT="$DX_DOT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DX_DOT="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DX_DOT=$ac_cv_path_DX_DOT if test -n "$DX_DOT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DOT" >&5 $as_echo "$DX_DOT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_DOT"; then ac_pt_DX_DOT=$DX_DOT # Extract the first word of "dot", so it can be a program name with args. set dummy dot; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_DX_DOT+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_DOT in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_DOT="$ac_pt_DX_DOT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_DX_DOT="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_DX_DOT=$ac_cv_path_ac_pt_DX_DOT if test -n "$ac_pt_DX_DOT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DOT" >&5 $as_echo "$ac_pt_DX_DOT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_DOT" = x; then DX_DOT="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DX_DOT=$ac_pt_DX_DOT fi else DX_DOT="$ac_cv_path_DX_DOT" fi if test "$DX_FLAG_dot$DX_DOT" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dot not found - will not generate graphics for doxygen documentation" >&5 $as_echo "$as_me: WARNING: dot not found - will not generate graphics for doxygen documentation" >&2;} DX_FLAG_dot=0 fi : fi if test "$DX_FLAG_dot" = 1; then DX_ENV="$DX_ENV HAVE_DOT='YES'" HAVE_DOT=YES DX_ENV="$DX_ENV DOT_PATH='`expr ".$DX_DOT" : '\(\.\)[^/]*$' \| "x$DX_DOT" : 'x\(.*\)/[^/]*$'`'" DOT_PATH=`expr ".$DX_DOT" : '\(\.\)[^/]*$' \| "x$DX_DOT" : 'x\(.*\)/[^/]*$'` : else DX_ENV="$DX_ENV HAVE_DOT='NO'" HAVE_DOT=NO : fi # Man pages generation: # Check whether --enable-doxygen-man was given. if test "${enable_doxygen_man+set}" = set; then : enableval=$enable_doxygen_man; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_man=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-man requires doxygen-doc" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_man=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-man" "$LINENO" 5 ;; esac else DX_FLAG_man=0 test "$DX_FLAG_doc" = "1" || DX_FLAG_man=0 fi if test "$DX_FLAG_man" = 1; then : fi if test "$DX_FLAG_man" = 1; then DX_ENV="$DX_ENV GENERATE_MAN='YES'" GENERATE_MAN=YES : else DX_ENV="$DX_ENV GENERATE_MAN='NO'" GENERATE_MAN=NO : fi # RTF file generation: # Check whether --enable-doxygen-rtf was given. if test "${enable_doxygen_rtf+set}" = set; then : enableval=$enable_doxygen_rtf; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_rtf=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-rtf requires doxygen-doc" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_rtf=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-rtf" "$LINENO" 5 ;; esac else DX_FLAG_rtf=0 test "$DX_FLAG_doc" = "1" || DX_FLAG_rtf=0 fi if test "$DX_FLAG_rtf" = 1; then : fi if test "$DX_FLAG_rtf" = 1; then DX_ENV="$DX_ENV GENERATE_RTF='YES'" GENERATE_RTF=YES : else DX_ENV="$DX_ENV GENERATE_RTF='NO'" GENERATE_RTF=NO : fi # XML file generation: # Check whether --enable-doxygen-xml was given. if test "${enable_doxygen_xml+set}" = set; then : enableval=$enable_doxygen_xml; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_xml=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-xml requires doxygen-doc" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_xml=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-xml" "$LINENO" 5 ;; esac else DX_FLAG_xml=0 test "$DX_FLAG_doc" = "1" || DX_FLAG_xml=0 fi if test "$DX_FLAG_xml" = 1; then : fi if test "$DX_FLAG_xml" = 1; then DX_ENV="$DX_ENV GENERATE_XML='YES'" GENERATE_XML=YES : else DX_ENV="$DX_ENV GENERATE_XML='NO'" GENERATE_XML=NO : fi # (Compressed) HTML help generation: # Check whether --enable-doxygen-chm was given. if test "${enable_doxygen_chm+set}" = set; then : enableval=$enable_doxygen_chm; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_chm=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-chm requires doxygen-doc" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_chm=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-chm" "$LINENO" 5 ;; esac else DX_FLAG_chm=0 test "$DX_FLAG_doc" = "1" || DX_FLAG_chm=0 fi if test "$DX_FLAG_chm" = 1; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}hhc", so it can be a program name with args. set dummy ${ac_tool_prefix}hhc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DX_HHC+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_HHC in [\\/]* | ?:[\\/]*) ac_cv_path_DX_HHC="$DX_HHC" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DX_HHC="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DX_HHC=$ac_cv_path_DX_HHC if test -n "$DX_HHC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_HHC" >&5 $as_echo "$DX_HHC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_HHC"; then ac_pt_DX_HHC=$DX_HHC # Extract the first word of "hhc", so it can be a program name with args. set dummy hhc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_DX_HHC+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_HHC in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_HHC="$ac_pt_DX_HHC" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_DX_HHC="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_DX_HHC=$ac_cv_path_ac_pt_DX_HHC if test -n "$ac_pt_DX_HHC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_HHC" >&5 $as_echo "$ac_pt_DX_HHC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_HHC" = x; then DX_HHC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DX_HHC=$ac_pt_DX_HHC fi else DX_HHC="$ac_cv_path_DX_HHC" fi if test "$DX_FLAG_chm$DX_HHC" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hhc not found - will not generate doxygen compressed HTML help documentation" >&5 $as_echo "$as_me: WARNING: hhc not found - will not generate doxygen compressed HTML help documentation" >&2;} DX_FLAG_chm=0 fi : fi if test "$DX_FLAG_chm" = 1; then DX_ENV="$DX_ENV HHC_PATH='$DX_HHC'" HHC_PATH=$DX_HHC DX_ENV="$DX_ENV GENERATE_HTML='YES'" GENERATE_HTML=YES DX_ENV="$DX_ENV GENERATE_HTMLHELP='YES'" GENERATE_HTMLHELP=YES : else DX_ENV="$DX_ENV GENERATE_HTMLHELP='NO'" GENERATE_HTMLHELP=NO : fi # Separate CHI file generation. # Check whether --enable-doxygen-chi was given. if test "${enable_doxygen_chi+set}" = set; then : enableval=$enable_doxygen_chi; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_chi=1 test "$DX_FLAG_chm" = "1" \ || as_fn_error $? "doxygen-chi requires doxygen-chm" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_chi=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-chi" "$LINENO" 5 ;; esac else DX_FLAG_chi=0 test "$DX_FLAG_chm" = "1" || DX_FLAG_chi=0 fi if test "$DX_FLAG_chi" = 1; then : fi if test "$DX_FLAG_chi" = 1; then DX_ENV="$DX_ENV GENERATE_CHI='YES'" GENERATE_CHI=YES : else DX_ENV="$DX_ENV GENERATE_CHI='NO'" GENERATE_CHI=NO : fi # Plain HTML pages generation: # Check whether --enable-doxygen-html was given. if test "${enable_doxygen_html+set}" = set; then : enableval=$enable_doxygen_html; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_html=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-html requires doxygen-doc" "$LINENO" 5 test "$DX_FLAG_chm" = "0" \ || as_fn_error $? "doxygen-html contradicts doxygen-chm" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_html=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-html" "$LINENO" 5 ;; esac else DX_FLAG_html=1 test "$DX_FLAG_doc" = "1" || DX_FLAG_html=0 test "$DX_FLAG_chm" = "0" || DX_FLAG_html=0 fi if test "$DX_FLAG_html" = 1; then : fi if test "$DX_FLAG_html" = 1; then DX_ENV="$DX_ENV GENERATE_HTML='YES'" GENERATE_HTML=YES : else test "$DX_FLAG_chm" = 1 || DX_ENV="$DX_ENV GENERATE_HTML='NO'" GENERATE_HTML=NO : fi # PostScript file generation: # Check whether --enable-doxygen-ps was given. if test "${enable_doxygen_ps+set}" = set; then : enableval=$enable_doxygen_ps; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_ps=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-ps requires doxygen-doc" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_ps=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-ps" "$LINENO" 5 ;; esac else DX_FLAG_ps=0 test "$DX_FLAG_doc" = "1" || DX_FLAG_ps=0 fi if test "$DX_FLAG_ps" = 1; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}latex", so it can be a program name with args. set dummy ${ac_tool_prefix}latex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DX_LATEX+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_LATEX in [\\/]* | ?:[\\/]*) ac_cv_path_DX_LATEX="$DX_LATEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DX_LATEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DX_LATEX=$ac_cv_path_DX_LATEX if test -n "$DX_LATEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_LATEX" >&5 $as_echo "$DX_LATEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_LATEX"; then ac_pt_DX_LATEX=$DX_LATEX # Extract the first word of "latex", so it can be a program name with args. set dummy latex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_DX_LATEX+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_LATEX in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_LATEX="$ac_pt_DX_LATEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_DX_LATEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_DX_LATEX=$ac_cv_path_ac_pt_DX_LATEX if test -n "$ac_pt_DX_LATEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_LATEX" >&5 $as_echo "$ac_pt_DX_LATEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_LATEX" = x; then DX_LATEX="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DX_LATEX=$ac_pt_DX_LATEX fi else DX_LATEX="$ac_cv_path_DX_LATEX" fi if test "$DX_FLAG_ps$DX_LATEX" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: latex not found - will not generate doxygen PostScript documentation" >&5 $as_echo "$as_me: WARNING: latex not found - will not generate doxygen PostScript documentation" >&2;} DX_FLAG_ps=0 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}makeindex", so it can be a program name with args. set dummy ${ac_tool_prefix}makeindex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DX_MAKEINDEX+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_MAKEINDEX in [\\/]* | ?:[\\/]*) ac_cv_path_DX_MAKEINDEX="$DX_MAKEINDEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DX_MAKEINDEX=$ac_cv_path_DX_MAKEINDEX if test -n "$DX_MAKEINDEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_MAKEINDEX" >&5 $as_echo "$DX_MAKEINDEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_MAKEINDEX"; then ac_pt_DX_MAKEINDEX=$DX_MAKEINDEX # Extract the first word of "makeindex", so it can be a program name with args. set dummy makeindex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_DX_MAKEINDEX+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_MAKEINDEX in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_MAKEINDEX="$ac_pt_DX_MAKEINDEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_DX_MAKEINDEX=$ac_cv_path_ac_pt_DX_MAKEINDEX if test -n "$ac_pt_DX_MAKEINDEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_MAKEINDEX" >&5 $as_echo "$ac_pt_DX_MAKEINDEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_MAKEINDEX" = x; then DX_MAKEINDEX="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DX_MAKEINDEX=$ac_pt_DX_MAKEINDEX fi else DX_MAKEINDEX="$ac_cv_path_DX_MAKEINDEX" fi if test "$DX_FLAG_ps$DX_MAKEINDEX" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: makeindex not found - will not generate doxygen PostScript documentation" >&5 $as_echo "$as_me: WARNING: makeindex not found - will not generate doxygen PostScript documentation" >&2;} DX_FLAG_ps=0 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dvips", so it can be a program name with args. set dummy ${ac_tool_prefix}dvips; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DX_DVIPS+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_DVIPS in [\\/]* | ?:[\\/]*) ac_cv_path_DX_DVIPS="$DX_DVIPS" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DX_DVIPS="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DX_DVIPS=$ac_cv_path_DX_DVIPS if test -n "$DX_DVIPS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DVIPS" >&5 $as_echo "$DX_DVIPS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_DVIPS"; then ac_pt_DX_DVIPS=$DX_DVIPS # Extract the first word of "dvips", so it can be a program name with args. set dummy dvips; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_DX_DVIPS+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_DVIPS in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_DVIPS="$ac_pt_DX_DVIPS" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_DX_DVIPS="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_DX_DVIPS=$ac_cv_path_ac_pt_DX_DVIPS if test -n "$ac_pt_DX_DVIPS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DVIPS" >&5 $as_echo "$ac_pt_DX_DVIPS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_DVIPS" = x; then DX_DVIPS="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DX_DVIPS=$ac_pt_DX_DVIPS fi else DX_DVIPS="$ac_cv_path_DX_DVIPS" fi if test "$DX_FLAG_ps$DX_DVIPS" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dvips not found - will not generate doxygen PostScript documentation" >&5 $as_echo "$as_me: WARNING: dvips not found - will not generate doxygen PostScript documentation" >&2;} DX_FLAG_ps=0 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}egrep", so it can be a program name with args. set dummy ${ac_tool_prefix}egrep; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DX_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_EGREP in [\\/]* | ?:[\\/]*) ac_cv_path_DX_EGREP="$DX_EGREP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DX_EGREP="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DX_EGREP=$ac_cv_path_DX_EGREP if test -n "$DX_EGREP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_EGREP" >&5 $as_echo "$DX_EGREP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_EGREP"; then ac_pt_DX_EGREP=$DX_EGREP # Extract the first word of "egrep", so it can be a program name with args. set dummy egrep; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_DX_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_EGREP in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_EGREP="$ac_pt_DX_EGREP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_DX_EGREP="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_DX_EGREP=$ac_cv_path_ac_pt_DX_EGREP if test -n "$ac_pt_DX_EGREP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_EGREP" >&5 $as_echo "$ac_pt_DX_EGREP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_EGREP" = x; then DX_EGREP="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DX_EGREP=$ac_pt_DX_EGREP fi else DX_EGREP="$ac_cv_path_DX_EGREP" fi if test "$DX_FLAG_ps$DX_EGREP" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: egrep not found - will not generate doxygen PostScript documentation" >&5 $as_echo "$as_me: WARNING: egrep not found - will not generate doxygen PostScript documentation" >&2;} DX_FLAG_ps=0 fi : fi if test "$DX_FLAG_ps" = 1; then : else : fi # PDF file generation: # Check whether --enable-doxygen-pdf was given. if test "${enable_doxygen_pdf+set}" = set; then : enableval=$enable_doxygen_pdf; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_pdf=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-pdf requires doxygen-doc" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_pdf=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-pdf" "$LINENO" 5 ;; esac else DX_FLAG_pdf=0 test "$DX_FLAG_doc" = "1" || DX_FLAG_pdf=0 fi if test "$DX_FLAG_pdf" = 1; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pdflatex", so it can be a program name with args. set dummy ${ac_tool_prefix}pdflatex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DX_PDFLATEX+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_PDFLATEX in [\\/]* | ?:[\\/]*) ac_cv_path_DX_PDFLATEX="$DX_PDFLATEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DX_PDFLATEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DX_PDFLATEX=$ac_cv_path_DX_PDFLATEX if test -n "$DX_PDFLATEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_PDFLATEX" >&5 $as_echo "$DX_PDFLATEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_PDFLATEX"; then ac_pt_DX_PDFLATEX=$DX_PDFLATEX # Extract the first word of "pdflatex", so it can be a program name with args. set dummy pdflatex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_DX_PDFLATEX+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_PDFLATEX in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_PDFLATEX="$ac_pt_DX_PDFLATEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_DX_PDFLATEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_DX_PDFLATEX=$ac_cv_path_ac_pt_DX_PDFLATEX if test -n "$ac_pt_DX_PDFLATEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_PDFLATEX" >&5 $as_echo "$ac_pt_DX_PDFLATEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_PDFLATEX" = x; then DX_PDFLATEX="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DX_PDFLATEX=$ac_pt_DX_PDFLATEX fi else DX_PDFLATEX="$ac_cv_path_DX_PDFLATEX" fi if test "$DX_FLAG_pdf$DX_PDFLATEX" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pdflatex not found - will not generate doxygen PDF documentation" >&5 $as_echo "$as_me: WARNING: pdflatex not found - will not generate doxygen PDF documentation" >&2;} DX_FLAG_pdf=0 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}makeindex", so it can be a program name with args. set dummy ${ac_tool_prefix}makeindex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DX_MAKEINDEX+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_MAKEINDEX in [\\/]* | ?:[\\/]*) ac_cv_path_DX_MAKEINDEX="$DX_MAKEINDEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DX_MAKEINDEX=$ac_cv_path_DX_MAKEINDEX if test -n "$DX_MAKEINDEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_MAKEINDEX" >&5 $as_echo "$DX_MAKEINDEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_MAKEINDEX"; then ac_pt_DX_MAKEINDEX=$DX_MAKEINDEX # Extract the first word of "makeindex", so it can be a program name with args. set dummy makeindex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_DX_MAKEINDEX+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_MAKEINDEX in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_MAKEINDEX="$ac_pt_DX_MAKEINDEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_DX_MAKEINDEX=$ac_cv_path_ac_pt_DX_MAKEINDEX if test -n "$ac_pt_DX_MAKEINDEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_MAKEINDEX" >&5 $as_echo "$ac_pt_DX_MAKEINDEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_MAKEINDEX" = x; then DX_MAKEINDEX="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DX_MAKEINDEX=$ac_pt_DX_MAKEINDEX fi else DX_MAKEINDEX="$ac_cv_path_DX_MAKEINDEX" fi if test "$DX_FLAG_pdf$DX_MAKEINDEX" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: makeindex not found - will not generate doxygen PDF documentation" >&5 $as_echo "$as_me: WARNING: makeindex not found - will not generate doxygen PDF documentation" >&2;} DX_FLAG_pdf=0 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}egrep", so it can be a program name with args. set dummy ${ac_tool_prefix}egrep; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DX_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_EGREP in [\\/]* | ?:[\\/]*) ac_cv_path_DX_EGREP="$DX_EGREP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DX_EGREP="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DX_EGREP=$ac_cv_path_DX_EGREP if test -n "$DX_EGREP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_EGREP" >&5 $as_echo "$DX_EGREP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_EGREP"; then ac_pt_DX_EGREP=$DX_EGREP # Extract the first word of "egrep", so it can be a program name with args. set dummy egrep; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_DX_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_EGREP in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_EGREP="$ac_pt_DX_EGREP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_DX_EGREP="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_DX_EGREP=$ac_cv_path_ac_pt_DX_EGREP if test -n "$ac_pt_DX_EGREP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_EGREP" >&5 $as_echo "$ac_pt_DX_EGREP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_EGREP" = x; then DX_EGREP="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DX_EGREP=$ac_pt_DX_EGREP fi else DX_EGREP="$ac_cv_path_DX_EGREP" fi if test "$DX_FLAG_pdf$DX_EGREP" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: egrep not found - will not generate doxygen PDF documentation" >&5 $as_echo "$as_me: WARNING: egrep not found - will not generate doxygen PDF documentation" >&2;} DX_FLAG_pdf=0 fi : fi if test "$DX_FLAG_pdf" = 1; then : else : fi # LaTeX generation for PS and/or PDF: if test "$DX_FLAG_ps" = 1 || test "$DX_FLAG_pdf" = 1; then DX_ENV="$DX_ENV GENERATE_LATEX='YES'" GENERATE_LATEX=YES else DX_ENV="$DX_ENV GENERATE_LATEX='NO'" GENERATE_LATEX=NO fi # Paper size for PS and/or PDF: case "$DOXYGEN_PAPER_SIZE" in #( "") DOXYGEN_PAPER_SIZE="" ;; #( a4wide|a4|letter|legal|executive) DX_ENV="$DX_ENV PAPER_SIZE='$DOXYGEN_PAPER_SIZE'" PAPER_SIZE=$DOXYGEN_PAPER_SIZE ;; #( *) as_fn_error $? "unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'" "$LINENO" 5 ;; esac # Rules: if test $DX_FLAG_html -eq 1; then : DX_SNIPPET_html="## ------------------------------- ## ## Rules specific for HTML output. ## ## ------------------------------- ## DX_CLEAN_HTML = \$(DX_DOCDIR)/html\\ \$(DX_DOCDIR)/html " else DX_SNIPPET_html="" fi if test $DX_FLAG_chi -eq 1; then : DX_SNIPPET_chi=" DX_CLEAN_CHI = \$(DX_DOCDIR)/\$(PACKAGE).chi\\ \$(DX_DOCDIR)/\$(PACKAGE).chi" else DX_SNIPPET_chi="" fi if test $DX_FLAG_chm -eq 1; then : DX_SNIPPET_chm="## ------------------------------ ## ## Rules specific for CHM output. ## ## ------------------------------ ## DX_CLEAN_CHM = \$(DX_DOCDIR)/chm\\ \$(DX_DOCDIR)/chm\ ${DX_SNIPPET_chi} " else DX_SNIPPET_chm="" fi if test $DX_FLAG_man -eq 1; then : DX_SNIPPET_man="## ------------------------------ ## ## Rules specific for MAN output. ## ## ------------------------------ ## DX_CLEAN_MAN = \$(DX_DOCDIR)/man\\ \$(DX_DOCDIR)/man " else DX_SNIPPET_man="" fi if test $DX_FLAG_rtf -eq 1; then : DX_SNIPPET_rtf="## ------------------------------ ## ## Rules specific for RTF output. ## ## ------------------------------ ## DX_CLEAN_RTF = \$(DX_DOCDIR)/rtf\\ \$(DX_DOCDIR)/rtf " else DX_SNIPPET_rtf="" fi if test $DX_FLAG_xml -eq 1; then : DX_SNIPPET_xml="## ------------------------------ ## ## Rules specific for XML output. ## ## ------------------------------ ## DX_CLEAN_XML = \$(DX_DOCDIR)/xml\\ \$(DX_DOCDIR)/xml " else DX_SNIPPET_xml="" fi if test $DX_FLAG_ps -eq 1; then : DX_SNIPPET_ps="## ----------------------------- ## ## Rules specific for PS output. ## ## ----------------------------- ## DX_CLEAN_PS = \$(DX_DOCDIR)/\$(PACKAGE).ps\\ \$(DX_DOCDIR)/\$(PACKAGE).ps DX_PS_GOAL = doxygen-ps doxygen-ps: \$(DX_CLEAN_PS) \$(DX_DOCDIR)/\$(PACKAGE).ps: \$(DX_DOCDIR)/\$(PACKAGE).tag \$(DX_V_LATEX)cd \$(DX_DOCDIR)/latex; \\ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\ \$(DX_LATEX) refman.tex; \\ \$(DX_MAKEINDEX) 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 " else DX_SNIPPET_ps="" fi if test $DX_FLAG_pdf -eq 1; then : DX_SNIPPET_pdf="## ------------------------------ ## ## Rules specific for PDF output. ## ## ------------------------------ ## DX_CLEAN_PDF = \$(DX_DOCDIR)/\$(PACKAGE).pdf\\ \$(DX_DOCDIR)/\$(PACKAGE).pdf DX_PDF_GOAL = doxygen-pdf doxygen-pdf: \$(DX_CLEAN_PDF) \$(DX_DOCDIR)/\$(PACKAGE).pdf: \$(DX_DOCDIR)/\$(PACKAGE).tag \$(DX_V_LATEX)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 " else DX_SNIPPET_pdf="" fi if test $DX_FLAG_ps -eq 1 -o $DX_FLAG_pdf -eq 1; then : DX_SNIPPET_latex="## ------------------------------------------------- ## ## Rules specific for LaTeX (shared for PS and PDF). ## ## ------------------------------------------------- ## DX_V_LATEX = \$(_DX_v_LATEX_\$(V)) _DX_v_LATEX_ = \$(_DX_v_LATEX_\$(AM_DEFAULT_VERBOSITY)) _DX_v_LATEX_0 = @echo \" LATEX \" \$@; DX_CLEAN_LATEX = \$(DX_DOCDIR)/latex\\ \$(DX_DOCDIR)/latex " else DX_SNIPPET_latex="" fi if test $DX_FLAG_doc -eq 1; then : DX_SNIPPET_doc="## --------------------------------- ## ## Format-independent Doxygen rules. ## ## --------------------------------- ## ${DX_SNIPPET_html}\ ${DX_SNIPPET_chm}\ ${DX_SNIPPET_man}\ ${DX_SNIPPET_rtf}\ ${DX_SNIPPET_xml}\ ${DX_SNIPPET_ps}\ ${DX_SNIPPET_pdf}\ ${DX_SNIPPET_latex}\ DX_V_DXGEN = \$(_DX_v_DXGEN_\$(V)) _DX_v_DXGEN_ = \$(_DX_v_DXGEN_\$(AM_DEFAULT_VERBOSITY)) _DX_v_DXGEN_0 = @echo \" DXGEN \" \$<; .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) \$(A""M_V_at)rm -rf \$(DX_DOCDIR) \$(DX_V_DXGEN)\$(DX_ENV) DOCDIR=\$(DX_DOCDIR) \$(DX_DOXYGEN) \$(DX_CONFIG) \$(A""M_V_at)echo Timestamp >\$@ DX_CLEANFILES = \\ \$(DX_DOCDIR)/doxygen_sqlite3.db \\ \$(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)" else DX_SNIPPET_doc="" fi DX_RULES="${DX_SNIPPET_doc}" #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 ac_fn_c_check_func "$LINENO" "backtrace" "ac_cv_func_backtrace" if test "x$ac_cv_func_backtrace" = xyes; then : $as_echo "#define HAVE_BACKTRACE 1" >>confdefs.h fi # Possibly also force using flag -rdynamic as well? { $as_echo "$as_me:${as_lineno-$LINENO}: checking for backtrace_full in -lgdruntime" >&5 $as_echo_n "checking for backtrace_full in -lgdruntime... " >&6; } if ${ac_cv_lib_gdruntime_backtrace_full+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgdruntime $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char backtrace_full (); int main () { return backtrace_full (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gdruntime_backtrace_full=yes else ac_cv_lib_gdruntime_backtrace_full=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gdruntime_backtrace_full" >&5 $as_echo "$ac_cv_lib_gdruntime_backtrace_full" >&6; } if test "x$ac_cv_lib_gdruntime_backtrace_full" = xyes; then : $as_echo "#define HAVE_BACKTRACE_FULL 1" >>confdefs.h LIBS="$LIBS -lgdruntime" fi # Check whether --with-libunwind was given. if test "${with_libunwind+set}" = set; then : withval=$with_libunwind; fi if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi if test "x$with_libunwind" = "xyes"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libunwind" >&5 $as_echo_n "checking for libunwind... " >&6; } if test -n "$LIBUNWIND_CFLAGS"; then pkg_cv_LIBUNWIND_CFLAGS="$LIBUNWIND_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 ($PKG_CONFIG --exists --print-errors "libunwind") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUNWIND_CFLAGS=`$PKG_CONFIG --cflags "libunwind" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBUNWIND_LIBS"; then pkg_cv_LIBUNWIND_LIBS="$LIBUNWIND_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 ($PKG_CONFIG --exists --print-errors "libunwind") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUNWIND_LIBS=`$PKG_CONFIG --libs "libunwind" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then LIBUNWIND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libunwind" 2>&1` else LIBUNWIND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libunwind" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBUNWIND_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (libunwind) were not met: $LIBUNWIND_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables LIBUNWIND_CFLAGS and LIBUNWIND_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables LIBUNWIND_CFLAGS and LIBUNWIND_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else LIBUNWIND_CFLAGS=$pkg_cv_LIBUNWIND_CFLAGS LIBUNWIND_LIBS=$pkg_cv_LIBUNWIND_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi fi LIBS="$LIBS $LIBUNWIND_LIBS" ac_config_headers="$ac_config_headers common/config.h" ac_config_files="$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/src/Makefile enforcer/man/Makefile enforcer/src/db/test/Makefile enforcer/man/ods-enforcer.8 enforcer/man/ods-enforcer-db-setup.8 enforcer/man/ods-enforcerd.8 enforcer/src/utils/Makefile enforcer/src/utils/ods-kaspcheck.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/ods-kasp.5 tools/opendnssec.7 tools/ods-control.8 tools/ods-kasp2html" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_CUNIT_TRUE}" && test -z "${WITH_CUNIT_FALSE}"; then as_fn_error $? "conditional \"WITH_CUNIT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_SQLITE_TRUE}" && test -z "${USE_SQLITE_FALSE}"; then as_fn_error $? "conditional \"USE_SQLITE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_MYSQL_TRUE}" && test -z "${USE_MYSQL_FALSE}"; then as_fn_error $? "conditional \"USE_MYSQL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_SQLITE_TRUE}" && test -z "${USE_SQLITE_FALSE}"; then as_fn_error $? "conditional \"USE_SQLITE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_MYSQL_TRUE}" && test -z "${USE_MYSQL_FALSE}"; then as_fn_error $? "conditional \"USE_MYSQL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_ENFORCER_TRUE}" && test -z "${ENABLE_ENFORCER_FALSE}"; then as_fn_error $? "conditional \"ENABLE_ENFORCER\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_SIGNER_TRUE}" && test -z "${ENABLE_SIGNER_FALSE}"; then as_fn_error $? "conditional \"ENABLE_SIGNER\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by opendnssec $as_me 2.1.13, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ opendnssec config.status 2.1.13 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # 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' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' 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 SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "common/config.h") CONFIG_HEADERS="$CONFIG_HEADERS common/config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "Doxyfile") CONFIG_FILES="$CONFIG_FILES Doxyfile" ;; "common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;; "conf/Makefile") CONFIG_FILES="$CONFIG_FILES conf/Makefile" ;; "conf/addns.xml") CONFIG_FILES="$CONFIG_FILES conf/addns.xml" ;; "conf/conf.xml") CONFIG_FILES="$CONFIG_FILES conf/conf.xml" ;; "conf/enforcerstate.xml") CONFIG_FILES="$CONFIG_FILES conf/enforcerstate.xml" ;; "conf/kasp.xml") CONFIG_FILES="$CONFIG_FILES conf/kasp.xml" ;; "conf/signconf.xml") CONFIG_FILES="$CONFIG_FILES conf/signconf.xml" ;; "conf/zonelist.xml") CONFIG_FILES="$CONFIG_FILES conf/zonelist.xml" ;; "enforcer/Makefile") CONFIG_FILES="$CONFIG_FILES enforcer/Makefile" ;; "enforcer/src/Makefile") CONFIG_FILES="$CONFIG_FILES enforcer/src/Makefile" ;; "enforcer/man/Makefile") CONFIG_FILES="$CONFIG_FILES enforcer/man/Makefile" ;; "enforcer/src/db/test/Makefile") CONFIG_FILES="$CONFIG_FILES enforcer/src/db/test/Makefile" ;; "enforcer/man/ods-enforcer.8") CONFIG_FILES="$CONFIG_FILES enforcer/man/ods-enforcer.8" ;; "enforcer/man/ods-enforcer-db-setup.8") CONFIG_FILES="$CONFIG_FILES enforcer/man/ods-enforcer-db-setup.8" ;; "enforcer/man/ods-enforcerd.8") CONFIG_FILES="$CONFIG_FILES enforcer/man/ods-enforcerd.8" ;; "enforcer/src/utils/Makefile") CONFIG_FILES="$CONFIG_FILES enforcer/src/utils/Makefile" ;; "enforcer/src/utils/ods-kaspcheck.1") CONFIG_FILES="$CONFIG_FILES enforcer/src/utils/ods-kaspcheck.1" ;; "libhsm/Makefile") CONFIG_FILES="$CONFIG_FILES libhsm/Makefile" ;; "libhsm/src/Makefile") CONFIG_FILES="$CONFIG_FILES libhsm/src/Makefile" ;; "libhsm/src/bin/Makefile") CONFIG_FILES="$CONFIG_FILES libhsm/src/bin/Makefile" ;; "libhsm/src/bin/ods-hsmspeed.1") CONFIG_FILES="$CONFIG_FILES libhsm/src/bin/ods-hsmspeed.1" ;; "libhsm/src/bin/ods-hsmutil.1") CONFIG_FILES="$CONFIG_FILES libhsm/src/bin/ods-hsmutil.1" ;; "libhsm/src/lib/Makefile") CONFIG_FILES="$CONFIG_FILES libhsm/src/lib/Makefile" ;; "libhsm/checks/Makefile") CONFIG_FILES="$CONFIG_FILES libhsm/checks/Makefile" ;; "libhsm/checks/conf-softhsm.xml") CONFIG_FILES="$CONFIG_FILES libhsm/checks/conf-softhsm.xml" ;; "libhsm/checks/conf-sca6000.xml") CONFIG_FILES="$CONFIG_FILES libhsm/checks/conf-sca6000.xml" ;; "libhsm/checks/conf-etoken.xml") CONFIG_FILES="$CONFIG_FILES libhsm/checks/conf-etoken.xml" ;; "libhsm/checks/conf-multi.xml") CONFIG_FILES="$CONFIG_FILES libhsm/checks/conf-multi.xml" ;; "libhsm/checks/conf-opensc.xml") CONFIG_FILES="$CONFIG_FILES libhsm/checks/conf-opensc.xml" ;; "libhsm/checks/conf-ncipher.xml") CONFIG_FILES="$CONFIG_FILES libhsm/checks/conf-ncipher.xml" ;; "libhsm/checks/conf-aepkeyper.xml") CONFIG_FILES="$CONFIG_FILES libhsm/checks/conf-aepkeyper.xml" ;; "signer/Makefile") CONFIG_FILES="$CONFIG_FILES signer/Makefile" ;; "signer/man/Makefile") CONFIG_FILES="$CONFIG_FILES signer/man/Makefile" ;; "signer/man/ods-signer.8") CONFIG_FILES="$CONFIG_FILES signer/man/ods-signer.8" ;; "signer/man/ods-signerd.8") CONFIG_FILES="$CONFIG_FILES signer/man/ods-signerd.8" ;; "signer/src/Makefile") CONFIG_FILES="$CONFIG_FILES signer/src/Makefile" ;; "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; "tools/ods-control") CONFIG_FILES="$CONFIG_FILES tools/ods-control" ;; "tools/solaris/Makefile") CONFIG_FILES="$CONFIG_FILES tools/solaris/Makefile" ;; "tools/solaris/ods-enforcerd.init") CONFIG_FILES="$CONFIG_FILES tools/solaris/ods-enforcerd.init" ;; "tools/solaris/ods-signerd.init") CONFIG_FILES="$CONFIG_FILES tools/solaris/ods-signerd.init" ;; "tools/ods-timing.5") CONFIG_FILES="$CONFIG_FILES tools/ods-timing.5" ;; "tools/ods-kasp.5") CONFIG_FILES="$CONFIG_FILES tools/ods-kasp.5" ;; "tools/opendnssec.7") CONFIG_FILES="$CONFIG_FILES tools/opendnssec.7" ;; "tools/ods-control.8") CONFIG_FILES="$CONFIG_FILES tools/ods-control.8" ;; "tools/ods-kasp2html") CONFIG_FILES="$CONFIG_FILES tools/ods-kasp2html" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "libtool":C) # See if we are running on zsh, and set the options that 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 # Generated automatically by $as_me ($PACKAGE) $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. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 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. # 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 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 this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='CXX ' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # 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 library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # 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. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _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 set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # 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) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # How to create reloadable object files. reload_flag=$lt_reload_flag_CXX reload_cmds=$lt_reload_cmds_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # 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. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi opendnssec-2.1.13/signer/0000755000077000001440000000000014446272546012242 500000000000000opendnssec-2.1.13/signer/README0000644000077000001440000002235714446272525013050 00000000000000The signer engine and its tools are part of the OpenDNSSEC project. For more information, visit http://www.opendnssec.org CONTENTS: INTRODUCTION DEPENDENCIES INSTALLATION INTERACTION FROM THE COMMAND LINE RUNNING THE ENGINE RUNNING WITHOUT THE KASP DEBUGGING ------------------------------------------------------------------- INTRODUCTION ------------------------------------------------------------------- As part of the OpenDNSSEC project, the task of the signer engine is to schedule signing operation on DNS zones. Taking input from the KASP, it will automatically sign zones and keep their signatures up-to-date. Until version 1.3, OpenDNSSEC could only handle file-to-file signing. With the Zonefetcher enabled, AXFR-to-file signing was possible. Version 1.4 and up can handle unsigned zones in file, AXFR and IXFR format, as well as output signed zones as file, AXFR and IXFR. When a zone has changed, the engine can run a specified command, for instance to signal an actual DNS server that it should reload its zones (useful for file output). The signer engine has a scheduler, including a set of workers to do zone manipulation, and zone in- and output is handled by different types of adapters. The signer is written in c is run as a daemon. When a zone needs to be sorted or (re)signed, the workers will report for duty and perform the job. It uses a worker/task-queue design, where the worker threads will suspend until there is something to do. ------------------------------------------------------------------- DEPENDENCIES ------------------------------------------------------------------- The signer depends on the ldns library: http://www.NLnetLabs.nl/projects/ldns and can only be used in conjuction with a PKCS#11 library (a software version of which, softHSM, is supplied with the OpenDNSSEC). ------------------------------------------------------------------- INSTALLATION ------------------------------------------------------------------- The signer is installed as part of the OpenDNSSEC install. To build and install the signer engine separately, the following steps are needed: From the base directory /signer autoreconf --install ./configure make make install The options provided with configure: --with-ldns= The base directory (prefix) of your ldns installation, if it isn't in your standard path. --prefix= Installation directory. All files will be installed relative to this path, and default search paths will be relative to the prefix. Defaults to /usr/local The signer engine will be installed in /sbin ------------------------------------------------------------------- INTERACTION FROM THE COMMAND LINE ------------------------------------------------------------------- If the engine is running (see the next section on how to run one manually), you can interact with it using the tool ods-signer. If you give no arguments, it will connect to the engine and go to interactive mode. Only the start command cannot be called in interactive mode. The command 'help' shows a list of possible commands: $ ods-signer cmd> help Commands: zones show the currently known zones sign schedule zone for immediate (re-)signing sign --all schedule all zones for immediate (re-)signing. clear delete the internal storage of this zone. All signatures will be regenerated on the next re-sign. queue show the current task queue. flush execute all scheduled tasks immediately. update update this zone signer configurations. update [--all] update zone list and all signer configurations. start start the engine. reload reload the engine. running test if the engine is running. stop stop the engine. verbosity set verbosity. cmd> quit You can also use these commands directly from your shell, by giving them as arguments to ods-signer. If you do this, the client will execute the command and quit. ------------------------------------------------------------------- RUNNING THE ENGINE ------------------------------------------------------------------- You can run the engine by calling /sbin/ods-signer start If everything is ok, you should see the following output: $ ./ods-signer start OpenDNSSEC signer engine version 1.4.0 $ The engine has daemonized itself and should be running. You can check that it does by using ods-signer as specified in the section INTERACTION FROM THE COMMAND LINE. ------------------------------------------------------------------- RUNNING WITHOUT THE KASP ------------------------------------------------------------------- If you want to test the engine on its own, or run it without using the KASP module, you will need to perform the following steps. Of course it has to be installed using the steps from section INSTALLATION. HSM --- You will need to set up an HSM module. If you use SoftHSM, you will need to make sure that a token is initialized, and that the correct softhsm2.conf file is set in the environment variable $SOFTHSM2_CONF. Some keys should be present in the token. If not, you can generate them with the hsm-toolkit from OpenDNSSEC. conf.xml -------- You will need to either create or update the /etc/opendnssec/conf.xml file to your settings; the element should contain the name of the token you have initialized in your HSM, the complete path of the module library (e.g. /lib/libsofthsm2.so). Optionally you can use a PIN value here too. If you do not specify it, the engine will prompt for it. If you run a nameserver, you will need to create a little script that tells that server to reload its zones, and point to that script with the element below . The rest of the values can be left to their defaults. The elements and their exact meanings are described here: http://www.opendnssec.se/browser/trunk/conf/opendnssec/conf.rnc zonelist.xml ------------ You can tell the engine what zones to sign with /etc/zonelist.xml An example zone list file can be found at http://www.opendnssec.se/browser/trunk/conf/opendnssec/zonelist.xml The elements and their exact meanings are described here: http://www.opendnssec.se/browser/trunk/conf/opendnssec/zonelist.rnc This file will specify the specific zone configuration, and its in- and output-files. addns.xml ------------ If you use AXFR or IXFR as zone input/output, you can tell the engine where and how to get the zones from the master servers with /etc/addns.xml This can be configured on a per-zone basis in the zonelist.xml file. An example zone list file can be found at http://www.opendnssec.se/browser/trunk/conf/opendnssec/addns.xml The elements and their exact meanings are described here: http://www.opendnssec.se/browser/trunk/conf/opendnssec/addns.rnc This file will specify the interface to listen NOTIFY messages on, the master servers that are allowed to send NOTIFY messages and to contact for zone transfers and optionally, the TSIG credentials. zone file --------- If you use files as input, you obviously will need to give the engine an actual zone file to work on. You will have already specified the location of this file in the zonelist.xml file above. zone configuration ------------------ Finally, at the location pointed to in your zonelist.xml, you should create a signer configuration xml file. An example can be found at: http://www.opendnssec.se/browser/trunk/conf/opendnssec/signconf.xml The elements and their exact meanings are described here: http://www.opendnssec.se/browser/trunk/conf/opendnssec/signconf.rnc Diagnostics ----------- The signer prints statistics about the signed zones into the logs. [STATS] opendnssec.org RR[count=32 time=1(sec)] NSEC[count=32 time=1(sec)] RRSIG[new=1 reused=31 time=1(sec) avg=1(sig/sec)] TOTAL[time=5(sec)] RR[count] is the number of records read in the unsigned zone. It is zero if the zone was not re-read. This happens for example when only re-signing. RR[time] is the time it took to read the unsigned zone. NSEC[count] is the number of NSEC or NSEC3 records added to the zone. This can be zero too, when only re-signing. NSEC[time] is the time it took to create all the Denial of Existence records. RRSIG[new] is the number of signatures newly created. RRSIG[reused] is the number of signatures that were created on a previous run, but are fresh enough that they may be remained in the zone. RRSIG[time] is the time it took to gather all the new and reused signatures. RRSIG[avg] is the average number of created signatures per second. TOTAL[time] is the total time it took for the signer engine to sign the latest version of the zone. ------------------------------------------------------------------- DNS FILE ADAPTERS ------------------------------------------------------------------- As mentioned above, you can use DNS adapters instead of File adapters. Put something like this in your zonelist.xml: ... example.com.dns.xml example.com.dns.xml The example.com.dns.xml holds all master and slave configurations for transfers. opendnssec-2.1.13/signer/Makefile.in0000644000077000001440000005610214446272532014226 00000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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@ target_triplet = @target@ subdir = signer 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_dlopen.m4 \ $(top_srcdir)/m4/acx_enforcer_database.m4 \ $(top_srcdir)/m4/acx_ldns.m4 $(top_srcdir)/m4/acx_libc.m4 \ $(top_srcdir)/m4/acx_libreadline.m4 \ $(top_srcdir)/m4/acx_libxml2.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_ssl.m4 \ $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 \ $(top_srcdir)/m4/ax_lib_sqlite3.m4 \ $(top_srcdir)/m4/ax_prepend_flag.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.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)/m4/pkg.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/common/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS README 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@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CP = @CP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CUNIT_INCLUDES = @CUNIT_INCLUDES@ CUNIT_LIBS = @CUNIT_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ C_LIBS = @C_LIBS@ 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@ ENFORCER_DB_DATABASE = @ENFORCER_DB_DATABASE@ ENFORCER_DB_HOST = @ENFORCER_DB_HOST@ ENFORCER_DB_INCLUDES = @ENFORCER_DB_INCLUDES@ ENFORCER_DB_LIBS = @ENFORCER_DB_LIBS@ ENFORCER_DB_PASSWORD = @ENFORCER_DB_PASSWORD@ ENFORCER_DB_PORT = @ENFORCER_DB_PORT@ ENFORCER_DB_PORT_TEXT = @ENFORCER_DB_PORT_TEXT@ ENFORCER_DB_USERNAME = @ENFORCER_DB_USERNAME@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_SSL = @HAVE_SSL@ HAVE_SSL_NEW_HMAC = @HAVE_SSL_NEW_HMAC@ INSTALL = @INSTALL@ INSTALLATIONCOND = @INSTALLATIONCOND@ INSTALLATIONGROUP = @INSTALLATIONGROUP@ INSTALLATIONGROUPARG = @INSTALLATIONGROUPARG@ INSTALLATIONUSER = @INSTALLATIONUSER@ INSTALLATIONUSERARG = @INSTALLATIONUSERARG@ 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@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MYSQL_CFLAGS = @MYSQL_CFLAGS@ MYSQL_CONFIG = @MYSQL_CONFIG@ MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ MYSQL_VERSION = @MYSQL_VERSION@ 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_ENFORCER_SOCKETFILE = @OPENDNSSEC_ENFORCER_SOCKETFILE@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ READLINE_LIBS = @READLINE_LIBS@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_VERSION = @SQLITE3_VERSION@ SSL_INCLUDES = @SSL_INCLUDES@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ 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_CXX = @ac_ct_CXX@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ 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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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 \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ 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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am 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-am uninstall uninstall-am .PRECIOUS: Makefile 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-2.1.13/signer/src/0000755000077000001440000000000014446272546013031 500000000000000opendnssec-2.1.13/signer/src/wire/0000755000077000001440000000000014446272546013777 500000000000000opendnssec-2.1.13/signer/src/wire/tcpset.c0000644000077000001440000001536214446272525015371 00000000000000/* * 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. * */ /** * TCP connections. * */ #include "config.h" #include "wire/tcpset.h" #include static const char* tcp_str = "tcp"; /** * Create a tcp connection. * */ tcp_conn_type* tcp_conn_create() { tcp_conn_type* tcp_conn = NULL; CHECKALLOC(tcp_conn = (tcp_conn_type*) malloc(sizeof(tcp_conn_type))); memset(tcp_conn, 0, sizeof(tcp_conn_type)); tcp_conn->packet = buffer_create(PACKET_BUFFER_SIZE); if (!tcp_conn->packet) { free(tcp_conn); return NULL; } tcp_conn->msglen = 0; tcp_conn->total_bytes = 0; tcp_conn->fd = -1; return tcp_conn; } /** * Create a set of tcp connections. * */ tcp_set_type* tcp_set_create() { size_t i = 0; tcp_set_type* tcp_set = NULL; CHECKALLOC(tcp_set = (tcp_set_type*) malloc(sizeof(tcp_set_type))); memset(tcp_set, 0, sizeof(tcp_set_type)); tcp_set->tcp_count = 0; for (i=0; i < TCPSET_MAX; i++) { tcp_set->tcp_conn[i] = tcp_conn_create(); } tcp_set->tcp_waiting_first = NULL; tcp_set->tcp_waiting_last = NULL; return tcp_set; } /** * Make tcp connection ready for reading. * \param[in] tcp tcp connection * */ void tcp_conn_ready(tcp_conn_type* tcp) { ods_log_assert(tcp); tcp->total_bytes = 0; tcp->msglen = 0; buffer_clear(tcp->packet); } /* * Read from a tcp connection. * */ int tcp_conn_read(tcp_conn_type* tcp) { ssize_t received = 0; ods_log_assert(tcp); ods_log_assert(tcp->fd != -1); /* receive leading packet length bytes */ if (tcp->total_bytes < sizeof(tcp->msglen)) { received = read(tcp->fd, (char*) &tcp->msglen + tcp->total_bytes, sizeof(tcp->msglen) - tcp->total_bytes); if (received == -1) { if (errno == EAGAIN || errno == EINTR) { /* read would block, try later */ return 0; } else { if (errno != ECONNRESET) { ods_log_error("[%s] error read() sz: %s", tcp_str, strerror(errno)); } return -1; } } else if (received == 0) { /* EOF */ return -1; } tcp->total_bytes += received; if (tcp->total_bytes < sizeof(tcp->msglen)) { /* not complete yet, try later */ return 0; } ods_log_assert(tcp->total_bytes == sizeof(tcp->msglen)); tcp->msglen = ntohs(tcp->msglen); if (tcp->msglen > buffer_capacity(tcp->packet)) { /* packet to big, drop connection */ ods_log_error("[%s] packet too big, dropping connection", tcp_str); return 0; } buffer_set_limit(tcp->packet, tcp->msglen); } ods_log_assert(buffer_remaining(tcp->packet) > 0); received = read(tcp->fd, buffer_current(tcp->packet), buffer_remaining(tcp->packet)); if (received == -1) { if (errno == EAGAIN || errno == EINTR) { /* read would block, try later */ return 0; } else { if (errno != ECONNRESET) { ods_log_error("[%s] error read(): %s", tcp_str, strerror(errno)); } return -1; } } else if (received == 0) { /* EOF */ return -1; } tcp->total_bytes += received; buffer_skip(tcp->packet, received); if (buffer_remaining(tcp->packet) > 0) { /* not complete yet, wait for more */ return 0; } /* completed */ ods_log_assert(buffer_position(tcp->packet) == tcp->msglen); return 1; } /* * Write to a tcp connection. * */ int tcp_conn_write(tcp_conn_type* tcp) { ssize_t sent = 0; ods_log_assert(tcp); ods_log_assert(tcp->fd != -1); if (tcp->total_bytes < sizeof(tcp->msglen)) { uint16_t sendlen = htons(tcp->msglen); sent = write(tcp->fd, (const char*)&sendlen + tcp->total_bytes, sizeof(tcp->msglen) - tcp->total_bytes); if (sent == -1) { if (errno == EAGAIN || errno == EINTR) { /* write would block, try later */ return 0; } else { return -1; } } tcp->total_bytes += sent; if (tcp->total_bytes < sizeof(tcp->msglen)) { /* incomplete write, resume later */ return 0; } ods_log_assert(tcp->total_bytes == sizeof(tcp->msglen)); } ods_log_assert(tcp->total_bytes < tcp->msglen + sizeof(tcp->msglen)); sent = write(tcp->fd, buffer_current(tcp->packet), buffer_remaining(tcp->packet)); if (sent == -1) { if (errno == EAGAIN || errno == EINTR) { /* write would block, try later */ return 0; } else { return -1; } } buffer_skip(tcp->packet, sent); tcp->total_bytes += sent; if (tcp->total_bytes < tcp->msglen + sizeof(tcp->msglen)) { /* more to write when socket becomes writable again */ return 0; } ods_log_assert(tcp->total_bytes == tcp->msglen + sizeof(tcp->msglen)); return 1; } /** * Clean up tcp connection. * */ static void tcp_conn_cleanup(tcp_conn_type* conn) { if (!conn) { return; } buffer_cleanup(conn->packet); free(conn); } /** * Clean up set of tcp connections. * */ void tcp_set_cleanup(tcp_set_type* set) { size_t i = 0; if (!set) { return; } for (i=0; i < TCPSET_MAX; i++) { tcp_conn_cleanup(set->tcp_conn[i]); } free(set); } opendnssec-2.1.13/signer/src/wire/query.h0000644000077000001440000000733214446272525015237 00000000000000/* * 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. * */ /** * Query. * */ #ifndef WIRE_QUERY_H #define WIRE_QUERY_H #include "config.h" #include "status.h" #include "signer/zone.h" #include "wire/buffer.h" #include "wire/edns.h" #include "wire/tsig.h" #define UDP_MAX_MESSAGE_LEN 512 #define TCP_MAX_MESSAGE_LEN 65535 #define QUERY_RESPONSE_MAX_RRSET 10 /* should be enough */ enum query_enum { QUERY_PROCESSED = 0, QUERY_DISCARDED, QUERY_AXFR, QUERY_IXFR }; typedef enum query_enum query_state; /** * Query. * */ typedef struct query_struct query_type; struct query_struct { /* Query from addres */ struct sockaddr_storage addr; socklen_t addrlen; /* Maximum supported query size */ size_t maxlen; size_t reserved_space; /* TSIG */ tsig_rr_type* tsig_rr; /* EDNS */ edns_rr_type* edns_rr; /* TCP */ int tcp; uint16_t tcplen; buffer_type* buffer; /* QNAME, QTYPE, QCLASS */ /* Zone */ zone_type* zone; /* Compression */ /* AXFR IXFR */ FILE* axfr_fd; uint32_t serial; size_t startpos; /* Bits */ unsigned axfr_is_done : 1; unsigned tsig_prepare_it : 1; unsigned tsig_update_it : 1; unsigned tsig_sign_it : 1; }; /** * Response. * */ typedef struct response_struct response_type; struct response_struct { size_t rrset_count; ldns_pkt_section sections[QUERY_RESPONSE_MAX_RRSET]; rrset_type* rrsets[QUERY_RESPONSE_MAX_RRSET]; }; /** * Create query. * \return query_type* query * */ extern query_type* query_create(void); /** * Prepare response. * \param[in] q query * */ extern void query_prepare(query_type* q); /** * Process query. * \param[in] q query * \param[in] engine signer engine * \return query_state state of the query * */ extern query_state query_process(query_type* q, engine_type* engine); /** * Reset query. * \param[in] q query * \param[in] maxlen maximum message length * \param[in] is_tcp 1 if tcp query * */ extern void query_reset(query_type* q, size_t maxlen, int is_tcp); /** * Add optional RRs to query. * \param[in] q query * \param[in] engine signer engine * */ extern void query_add_optional(query_type* q, engine_type* engine); /** * Add RR to query. * \param[in] q query * \param[in] rr RR * \return int 1 if ok, 0 if overflow. * */ extern int query_add_rr(query_type* q, ldns_rr* rr); /** * Cleanup query. * \param[in] q query * */ extern void query_cleanup(query_type* q); #endif /* WIRE_QUERY_H */ opendnssec-2.1.13/signer/src/wire/netio.c0000644000077000001440000002307414446272525015204 00000000000000/* * Copyright (c) 2001-2011, NLnet Labs. All rights reserved. * * See LICENSE for the license. * */ #include #include #include #include #include #include #include "log.h" #include "wire/netio.h" #ifndef HAVE_PSELECT int pselect(int n, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, const struct timespec* timeout, const sigset_t* sigmask); #else #include #endif /* One second is 1e9 nanoseconds. */ #define NANOSECONDS_PER_SECOND 1000000000L static const char* netio_str = "netio"; /* * Create a new netio instance. * \return netio_type* netio instance * */ netio_type* netio_create() { netio_type* netio = NULL; CHECKALLOC(netio = (netio_type*) malloc(sizeof(netio_type))); netio->handlers = NULL; netio->dispatch_next = NULL; return netio; } /* * Add a new handler to netio. * */ void netio_add_handler(netio_type* netio, netio_handler_type* handler) { netio_handler_list_type* l = NULL; ods_log_assert(netio); ods_log_assert(handler); CHECKALLOC(l = (netio_handler_list_type*) malloc(sizeof(netio_handler_list_type))); l->next = netio->handlers; l->handler = handler; netio->handlers = l; ods_log_debug("[%s] handler added", netio_str); } /* * Remove the handler from netio. Caller is responsible for freeing * handler afterwards. */ void netio_remove_handler(netio_type* netio, netio_handler_type* handler) { netio_handler_list_type** lptr; if (!netio || !handler) { return; } for (lptr = &netio->handlers; *lptr; lptr = &(*lptr)->next) { if ((*lptr)->handler == handler) { netio_handler_list_type* next = (*lptr)->next; if ((*lptr) == netio->dispatch_next) { netio->dispatch_next = next; } (*lptr)->handler = NULL; free(*lptr); *lptr = next; break; } } ods_log_debug("[%s] handler removed", netio_str); } /* * Convert timeval to timespec. * */ static void timeval_to_timespec(struct timespec* left, const struct timeval* right) { left->tv_sec = right->tv_sec; left->tv_nsec = 1000 * right->tv_usec; } /** * Compare timespec. * */ static int timespec_compare(const struct timespec* left, const struct timespec* right) { if (left->tv_sec < right->tv_sec) { return -1; } else if (left->tv_sec > right->tv_sec) { return 1; } else if (left->tv_nsec < right->tv_nsec) { return -1; } else if (left->tv_nsec > right->tv_nsec) { return 1; } return 0; } /** * Add timespecs. * */ void timespec_add(struct timespec* left, const struct timespec* right) { left->tv_sec += right->tv_sec; left->tv_nsec += right->tv_nsec; if (left->tv_nsec >= NANOSECONDS_PER_SECOND) { ++left->tv_sec; left->tv_nsec -= NANOSECONDS_PER_SECOND; } } /** * Substract timespecs. * */ static void timespec_subtract(struct timespec* left, const struct timespec* right) { left->tv_sec -= right->tv_sec; left->tv_nsec -= right->tv_nsec; if (left->tv_nsec < 0L) { --left->tv_sec; left->tv_nsec += NANOSECONDS_PER_SECOND; } } /* * Retrieve the current time (using gettimeofday(2)). * */ const struct timespec* netio_current_time(netio_type* netio) { struct timeval current_timeval; ods_log_assert(netio); if (!netio->have_current_time) { if (gettimeofday(¤t_timeval, NULL) == -1) { ods_log_crit("[%s] unable to get current time: " "gettimeofday() failed (%s)", netio_str, strerror(errno)); abort(); } timeval_to_timespec(&netio->cached_current_time, ¤t_timeval); netio->have_current_time = 1; } return &netio->cached_current_time; } /* * Check for events and dispatch them to the handlers. * */ int netio_dispatch(netio_type* netio, const struct timespec* timeout, const sigset_t* sigmask) { fd_set readfds, writefds, exceptfds; int max_fd; int have_timeout = 0; struct timespec minimum_timeout; netio_handler_type* timeout_handler = NULL; netio_handler_list_type* l = NULL; int rc = 0; int result = 0; if (!netio || !netio->handlers) { return 0; } /* Clear the cached current time */ netio->have_current_time = 0; /* Initialize the minimum timeout with the timeout parameter */ if (timeout) { have_timeout = 1; memcpy(&minimum_timeout, timeout, sizeof(struct timespec)); } /* Initialize the fd_sets and timeout based on the handler * information */ max_fd = -1; FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptfds); for (l = netio->handlers; l; l = l->next) { netio_handler_type* handler = l->handler; if (handler->fd >= 0 && handler->fd < (int) FD_SETSIZE) { if (handler->fd > max_fd) { max_fd = handler->fd; } if (handler->event_types & NETIO_EVENT_READ) { FD_SET(handler->fd, &readfds); } if (handler->event_types & NETIO_EVENT_WRITE) { FD_SET(handler->fd, &writefds); } if (handler->event_types & NETIO_EVENT_EXCEPT) { FD_SET(handler->fd, &exceptfds); } } if (handler->timeout && (handler->event_types & NETIO_EVENT_TIMEOUT)) { struct timespec relative; relative.tv_sec = handler->timeout->tv_sec; relative.tv_nsec = handler->timeout->tv_nsec; timespec_subtract(&relative, netio_current_time(netio)); if (!have_timeout || timespec_compare(&relative, &minimum_timeout) < 0) { have_timeout = 1; minimum_timeout.tv_sec = relative.tv_sec; minimum_timeout.tv_nsec = relative.tv_nsec; timeout_handler = handler; } } } if (have_timeout && minimum_timeout.tv_sec < 0) { /* * On negative timeout for a handler, immediately * dispatch the timeout event without checking for other events. */ ods_log_debug("[%s] dispatch timeout event without checking for " "other events", netio_str); if (timeout_handler && (timeout_handler->event_types & NETIO_EVENT_TIMEOUT)) { timeout_handler->event_handler(netio, timeout_handler, NETIO_EVENT_TIMEOUT); } return result; } /* Check for events. */ rc = pselect(max_fd + 1, &readfds, &writefds, &exceptfds, have_timeout ? &minimum_timeout : NULL, sigmask); if (rc == -1) { if(errno == EINVAL || errno == EACCES || errno == EBADF) { ods_fatal_exit("[%s] fatal error pselect: %s", netio_str, strerror(errno)); } return -1; } /* Clear the cached current_time (pselect(2) may block for * some time so the cached value is likely to be old). */ netio->have_current_time = 0; if (rc == 0) { ods_log_debug("[%s] no events before the minimum timeout " "expired", netio_str); /* * No events before the minimum timeout expired. * Dispatch to handler if interested. */ if (timeout_handler && (timeout_handler->event_types & NETIO_EVENT_TIMEOUT)) { timeout_handler->event_handler(netio, timeout_handler, NETIO_EVENT_TIMEOUT); } } else { /* * Dispatch all the events to interested handlers * based on the fd_sets. Note that a handler might * deinstall itself, so store the next handler before * calling the current handler! */ ods_log_assert(netio->dispatch_next == NULL); for (l = netio->handlers; l && rc; ) { netio_handler_type* handler = l->handler; netio->dispatch_next = l->next; if (handler->fd >= 0 && handler->fd < (int) FD_SETSIZE) { netio_events_type event_types = NETIO_EVENT_NONE; if (FD_ISSET(handler->fd, &readfds)) { event_types |= NETIO_EVENT_READ; FD_CLR(handler->fd, &readfds); rc--; } if (FD_ISSET(handler->fd, &writefds)) { event_types |= NETIO_EVENT_WRITE; FD_CLR(handler->fd, &writefds); rc--; } if (FD_ISSET(handler->fd, &exceptfds)) { event_types |= NETIO_EVENT_EXCEPT; FD_CLR(handler->fd, &exceptfds); rc--; } if (event_types & handler->event_types) { handler->event_handler(netio, handler, event_types & handler->event_types); ++result; } } l = netio->dispatch_next; } netio->dispatch_next = NULL; } return result; } /** * Clean up netio instance * */ void netio_cleanup(netio_type* netio) { ods_log_assert(netio); while (netio->handlers) { netio_handler_list_type* handler = netio->handlers; netio->handlers = handler->next; if (handler->handler->free_handler) { free(handler->handler->user_data); free(handler->handler); } free(handler); } free(netio); } /** * Clean up netio instance */ void netio_cleanup_shallow(netio_type* netio) { ods_log_assert(netio); free(netio->handlers); free(netio); } opendnssec-2.1.13/signer/src/wire/sock.c0000644000077000001440000006243114446272525015025 00000000000000/* * 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. * */ /** * Sockets. * */ #include "config.h" #include "daemon/engine.h" #include "log.h" #include "signer/zone.h" #include "wire/axfr.h" #include "wire/netio.h" #include "wire/sock.h" #include "wire/xfrd.h" #include #include #include #include #define SOCK_TCP_BACKLOG 5 static const char* sock_str = "socket"; /** * Set udp socket to non-blocking and bind. * */ static ods_status sock_fcntl_and_bind(sock_type* sock, const char* node, const char* port, const char* stype, const char* fam) { ods_log_assert(sock); ods_log_assert(port); ods_log_assert(stype); ods_log_assert(fam); if (fcntl(sock->s, F_SETFL, O_NONBLOCK) == -1) { ods_log_error("[%s] unable to set %s/%s socket '%s:%s' to " "non-blocking: fcntl() failed (%s)", sock_str, stype, fam, node?node:"localhost", port, strerror(errno)); return ODS_STATUS_SOCK_FCNTL_NONBLOCK; } ods_log_debug("[%s] bind %s/%s socket '%s:%s': %s", sock_str, stype, fam, node?node:"localhost", port, strerror(errno)); if (bind(sock->s, (struct sockaddr *) sock->addr->ai_addr, sock->addr->ai_addrlen) != 0) { ods_log_error("[%s] unable to bind %s/%s socket '%s:%s': bind() " "failed (%s)", sock_str, stype, fam, node?node:"localhost", port, strerror(errno)); return ODS_STATUS_SOCK_BIND; } return ODS_STATUS_OK; } /** * Set socket to v6 only. * */ static ods_status sock_v6only(sock_type* sock, const char* node, const char* port, int on, const char* stype) { ods_log_assert(sock); ods_log_assert(port); ods_log_assert(stype); #ifdef IPV6_V6ONLY #if defined(IPPROTO_IPV6) ods_log_debug("[%s] set %s/ipv6 socket '%s:%s' v6only", sock_str, stype, node?node:"localhost", port); if (setsockopt(sock->s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) { ods_log_error("[%s] unable to set %s/ipv6 socket '%s:%s' to " "ipv6-only: setsockopt() failed (%s)", sock_str, stype, node?node:"localhost", port, strerror(errno)); return ODS_STATUS_SOCK_SETSOCKOPT_V6ONLY; } #endif #endif /* IPV6_V6ONLY */ return ODS_STATUS_OK; } /** * Set tcp socket to reusable. * */ static void sock_tcp_reuseaddr(sock_type* sock, const char* node, const char* port, int on, const char* fam) { ods_log_assert(sock); ods_log_assert(port); ods_log_assert(fam); if (setsockopt(sock->s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) { ods_log_error("[%s] unable to set tcp/%s socket '%s:%s' to " "reuse-addr: setsockopt() failed (%s)", sock_str, fam, node?node:"localhost", port, strerror(errno)); } } /** * Listen on tcp socket. * */ static ods_status sock_tcp_listen(sock_type* sock, const char* node, const char* port, const char* fam) { ods_log_assert(sock); ods_log_assert(port); ods_log_assert(fam); if (listen(sock->s, SOCK_TCP_BACKLOG) == -1) { ods_log_error("[%s] unable to listen on tcp/%s socket '%s:%s': " "listen() failed (%s)", sock_str, fam, node?node:"localhost", port, strerror(errno)); return ODS_STATUS_SOCK_LISTEN; } return ODS_STATUS_OK; } /** * Create server udp socket. * */ static ods_status sock_server_udp(sock_type* sock, const char* node, const char* port, unsigned* ip6_support) { int on = 0; ods_status status = ODS_STATUS_OK; ods_log_assert(sock); ods_log_assert(port); #if defined(SO_REUSEADDR) || defined(IPV6_V6ONLY) on = 1; #endif *ip6_support = 1; /* socket */ ods_log_debug("[%s] create udp socket '%s:%s': %s", sock_str, node?node:"localhost", port, strerror(errno)); if ((sock->s = socket(sock->addr->ai_family, SOCK_DGRAM, 0))== -1) { ods_log_error("[%s] unable to create udp/ipv4 socket '%s:%s': " "socket() failed (%s)", sock_str, node?node:"localhost", port, strerror(errno)); if (sock->addr->ai_family == AF_INET6 && errno == EAFNOSUPPORT) { *ip6_support = 0; } return ODS_STATUS_SOCK_SOCKET_UDP; } /* ipv4 */ if (sock->addr->ai_family == AF_INET) { status = sock_fcntl_and_bind(sock, node, port, "udp", "ipv4"); } /* ipv6 */ else if (sock->addr->ai_family == AF_INET6) { status = sock_v6only(sock, node, port, on, "udp"); if (status != ODS_STATUS_OK) { return status; } status = sock_fcntl_and_bind(sock, node, port, "udp", "ipv6"); } return status; } /** * Create server tcp socket. * */ static ods_status sock_server_tcp(sock_type* sock, const char* node, const char* port, unsigned* ip6_support) { int on = 0; ods_status status = ODS_STATUS_OK; ods_log_assert(sock); ods_log_assert(port); #if defined(SO_REUSEADDR) || defined(IPV6_V6ONLY) on = 1; #endif *ip6_support = 1; /* socket */ ods_log_debug("[%s] create tcp socket '%s:%s': %s", sock_str, node?node:"localhost", port, strerror(errno)); if ((sock->s = socket(sock->addr->ai_family, SOCK_STREAM, 0))== -1) { ods_log_error("[%s] unable to create tcp/ipv4 socket '%s:%s': " "socket() failed (%s)", sock_str, node?node:"localhost", port, strerror(errno)); if (sock->addr->ai_family == AF_INET6 && errno == EAFNOSUPPORT) { *ip6_support = 0; } return ODS_STATUS_SOCK_SOCKET_TCP; } /* ipv4 */ if (sock->addr->ai_family == AF_INET) { sock_tcp_reuseaddr(sock, node, port, on, "ipv4"); status = sock_fcntl_and_bind(sock, node, port, "tcp", "ipv4"); if (status == ODS_STATUS_OK) { status = sock_tcp_listen(sock, node, port, "ipv4"); } } /* ipv6 */ else if (sock->addr->ai_family == AF_INET6) { status = sock_v6only(sock, node, port, on, "tcp"); if (status != ODS_STATUS_OK) { return status; } sock_tcp_reuseaddr(sock, node, port, on, "ipv6"); status = sock_fcntl_and_bind(sock, node, port, "tcp", "ipv6"); if (status == ODS_STATUS_OK) { status = sock_tcp_listen(sock, node, port, "ipv6"); } } return status; } /** * Create listening socket. * */ static ods_status socket_listen(sock_type* sock, struct addrinfo hints, int socktype, const char* node, const char* port, unsigned* ip6_support) { ods_status status = ODS_STATUS_OK; int r = 0; ods_log_assert(sock); ods_log_assert(port); *ip6_support = 1; hints.ai_socktype = socktype; /* getaddrinfo */ if ((r = getaddrinfo(node, port, &hints, &sock->addr)) != 0 || !sock->addr) { ods_log_error("[%s] unable to parse address '%s:%s': getaddrinfo() " "failed (%s %s)", sock_str, node?node:"localhost", port, gai_strerror(r), #ifdef EAI_SYSTEM r==EAI_SYSTEM?(char*)strerror(errno):""); #else ""); #endif if (hints.ai_family == AF_INET6 && r==EAFNOSUPPORT) { *ip6_support = 0; } return ODS_STATUS_SOCK_GETADDRINFO; } /* socket */ if (socktype == SOCK_DGRAM) { status = sock_server_udp(sock, node, port, ip6_support); } else if (socktype == SOCK_STREAM) { status = sock_server_tcp(sock, node, port, ip6_support); } ods_log_debug("[%s] socket listening to %s:%s", sock_str, node?node:"localhost", port); return status; } /** * Create sockets and listen. * */ ods_status sock_listen(socklist_type* sockets, listener_type* listener) { ods_status status = ODS_STATUS_OK; struct addrinfo hints[MAX_INTERFACES]; const char* node = NULL; const char* port = NULL; size_t i = 0; unsigned ip6_support = 1; if (!sockets || !listener) { return ODS_STATUS_ASSERT_ERR; } /* Initialize values */ for (i = 0; i < MAX_INTERFACES; i++) { memset(&hints[i], 0, sizeof(hints[i])); hints[i].ai_family = AF_UNSPEC; hints[i].ai_flags = AI_PASSIVE; sockets->udp[i].s = -1; sockets->tcp[i].s = -1; } /* Walk interfaces */ for (i=0; i < listener->count; i++) { node = NULL; if (strlen(listener->interfaces[i].address) > 0) { node = listener->interfaces[i].address; } port = DNS_PORT_STRING; if (listener->interfaces[i].port) { port = listener->interfaces[i].port; } if (node != NULL) { hints[i].ai_flags |= AI_NUMERICHOST; } else { hints[i].ai_family = listener->interfaces[i].family; } /* udp */ status = socket_listen(&sockets->udp[i], hints[i], SOCK_DGRAM, node, port, &ip6_support); if (status != ODS_STATUS_OK) { if (!ip6_support) { ods_log_warning("[%s] fallback to udp/ipv4, no udp/ipv6: " "not supported", sock_str); status = ODS_STATUS_OK; } else { return status; } } /* tcp */ status = socket_listen(&sockets->tcp[i], hints[i], SOCK_STREAM, node, port, &ip6_support); if (status != ODS_STATUS_OK) { if (!ip6_support) { ods_log_warning("[%s] fallback to udp/ipv4, no udp/ipv6: " "not supported", sock_str); status = ODS_STATUS_OK; } else { return status; } } } /* All ok */ return ODS_STATUS_OK; } /** * Send data over udp. * */ static void send_udp(struct udp_data* data, query_type* q) { ssize_t nb; ods_log_deeebug("[%s] sending %d bytes over udp", sock_str, (int)buffer_remaining(q->buffer)); nb = sendto(data->socket->s, buffer_begin(q->buffer), buffer_remaining(q->buffer), 0, (struct sockaddr*) &q->addr, q->addrlen); if (nb == -1) { ods_log_error("[%s] unable to send data over udp: sendto() failed " "(%s)", sock_str, strerror(errno)); ods_log_debug("[%s] len=%lu", sock_str, (unsigned long)buffer_remaining(q->buffer)); } else if ((size_t) nb != buffer_remaining(q->buffer)) { ods_log_error("[%s] unable to send data over udp: only sent %d of %d " "octets", sock_str, (int)nb, (int)buffer_remaining(q->buffer)); } } /** * Handle incoming udp queries. * */ void sock_handle_udp(netio_type* ATTR_UNUSED(netio), netio_handler_type* handler, netio_events_type event_types) { struct udp_data* data = (struct udp_data*) handler->user_data; int received = 0; query_type* q = data->query; query_state qstate = QUERY_PROCESSED; if (!(event_types & NETIO_EVENT_READ)) { return; } ods_log_debug("[%s] incoming udp message", sock_str); query_reset(q, UDP_MAX_MESSAGE_LEN, 0); received = recvfrom(handler->fd, buffer_begin(q->buffer), buffer_remaining(q->buffer), 0, (struct sockaddr*) &q->addr, &q->addrlen); if (received < 1) { if (errno != EAGAIN && errno != EINTR) { ods_log_error("[%s] recvfrom() failed: %s", sock_str, strerror(errno)); } return; } buffer_skip(q->buffer, received); buffer_flip(q->buffer); qstate = query_process(q, data->engine); if (qstate != QUERY_DISCARDED) { ods_log_debug("[%s] query processed qstate=%d", sock_str, qstate); query_add_optional(q, data->engine); buffer_flip(q->buffer); send_udp(data, q); } } /** * Cleanup tcp handler data. * */ static void cleanup_tcp_handler(netio_type* netio, netio_handler_type* handler) { struct tcp_data* data = (struct tcp_data*) handler->user_data; netio_remove_handler(netio, handler); close(handler->fd); free(handler->timeout); free(handler); query_cleanup(data->query); free(data); } /** * Handle incoming tcp connections. * */ void sock_handle_tcp_accept(netio_type* netio, netio_handler_type* handler, netio_events_type event_types) { struct tcp_accept_data* accept_data = (struct tcp_accept_data*) handler->user_data; int s = 0; struct tcp_data* tcp_data = NULL; netio_handler_type* tcp_handler = NULL; struct sockaddr_storage addr; socklen_t addrlen = 0; if (!(event_types & NETIO_EVENT_READ)) { return; } ods_log_debug("[%s] handle incoming tcp connection", sock_str); addrlen = sizeof(addr); s = accept(handler->fd, (struct sockaddr *) &addr, &addrlen); if (s == -1) { if (errno != EINTR && errno != EWOULDBLOCK) { ods_log_error("[%s] unable to handle incoming tcp connection: " "accept() failed (%s)", sock_str, strerror(errno)); } return; } if (fcntl(s, F_SETFL, O_NONBLOCK) == -1) { ods_log_error("[%s] unable to handle incoming tcp connection: " "fcntl() failed: %s", sock_str, strerror(errno)); close(s); return; } /* create tcp handler data */ CHECKALLOC(tcp_data = (struct tcp_data*) malloc(sizeof(struct tcp_data))); tcp_data->query = query_create(); if (!tcp_data->query) { ods_log_error("[%s] unable to handle incoming tcp connection: " "query_create() failed", sock_str); free(tcp_data); close(s); return; } tcp_data->engine = accept_data->engine; tcp_data->tcp_accept_handler_count = accept_data->tcp_accept_handler_count; tcp_data->tcp_accept_handlers = accept_data->tcp_accept_handlers; tcp_data->qstate = QUERY_PROCESSED; tcp_data->bytes_transmitted = 0; memcpy(&tcp_data->query->addr, &addr, addrlen); tcp_data->query->addrlen = addrlen; CHECKALLOC(tcp_handler = (netio_handler_type*) malloc(sizeof(netio_handler_type))); tcp_handler->fd = s; CHECKALLOC(tcp_handler->timeout = (struct timespec*) malloc(sizeof(struct timespec))); if (!tcp_handler->timeout) { ods_log_error("[%s] unable to handle incoming tcp connection: " "allocator_alloc() timeout failed", sock_str); free(tcp_handler); query_cleanup(tcp_data->query); free(tcp_data); close(s); return; } tcp_handler->timeout->tv_sec = XFRD_TCP_TIMEOUT; tcp_handler->timeout->tv_nsec = 0L; timespec_add(tcp_handler->timeout, netio_current_time(netio)); tcp_handler->user_data = tcp_data; tcp_handler->event_types = NETIO_EVENT_READ | NETIO_EVENT_TIMEOUT; tcp_handler->event_handler = sock_handle_tcp_read; netio_add_handler(netio, tcp_handler); } /** * Handle incoming tcp queries. * */ void sock_handle_tcp_read(netio_type* netio, netio_handler_type* handler, netio_events_type event_types) { struct tcp_data* data = (struct tcp_data *) handler->user_data; ssize_t received = 0; query_state qstate = QUERY_PROCESSED; if (event_types & NETIO_EVENT_TIMEOUT) { cleanup_tcp_handler(netio, handler); return; } ods_log_assert(event_types & NETIO_EVENT_READ); ods_log_debug("[%s] incoming tcp message", sock_str); if (data->bytes_transmitted == 0) { ods_log_debug("[%s] TCP_READ: reset query", sock_str); query_reset(data->query, TCP_MAX_MESSAGE_LEN, 1); } /* check if we received the leading packet length bytes yet. */ if (data->bytes_transmitted < sizeof(uint16_t)) { received = read(handler->fd, (char *) &data->query->tcplen + data->bytes_transmitted, sizeof(uint16_t) - data->bytes_transmitted); if (received == -1) { if (errno == EAGAIN || errno == EINTR) { /* read would block, wait until more data is available. */ return; } else { ods_log_error("[%s] unable to handle incoming tcp query: " "read() failed (%s)", sock_str, strerror(errno)); cleanup_tcp_handler(netio, handler); return; } } else if (received == 0) { cleanup_tcp_handler(netio, handler); return; } data->bytes_transmitted += received; ods_log_debug("[%s] TCP_READ: bytes transmitted %lu (received %lu)", sock_str, (unsigned long)data->bytes_transmitted, (unsigned long)received); if (data->bytes_transmitted < sizeof(uint16_t)) { /* not done with the tcplen yet, wait for more. */ ods_log_debug("[%s] TCP_READ: bytes transmitted %lu, while " "sizeof uint16_t %lu", sock_str, (unsigned long)data->bytes_transmitted, (unsigned long)sizeof(uint16_t)); return; } ods_log_assert(data->bytes_transmitted == sizeof(uint16_t)); data->query->tcplen = ntohs(data->query->tcplen); /* minimum query size is: 12 + 1 + 2 + 2: * header size + root dname + qclass + qtype */ if (data->query->tcplen < 17) { ods_log_warning("[%s] unable to handle incoming tcp query: " "packet too small", sock_str); cleanup_tcp_handler(netio, handler); return; } if (data->query->tcplen > data->query->maxlen) { ods_log_warning("[%s] unable to handle incoming tcp query: " "insufficient tcp buffer", sock_str); cleanup_tcp_handler(netio, handler); return; } buffer_set_limit(data->query->buffer, data->query->tcplen); } ods_log_assert(buffer_remaining(data->query->buffer) > 0); /* read the (remaining) query data. */ received = read(handler->fd, buffer_current(data->query->buffer), buffer_remaining(data->query->buffer)); if (received == -1) { if (errno == EAGAIN || errno == EINTR) { /* read would block, wait until more data is available. */ return; } else { ods_log_error("[%s] unable to handle incoming tcp query: " "read() failed (%s)", sock_str, strerror(errno)); cleanup_tcp_handler(netio, handler); return; } } else if (received == 0) { cleanup_tcp_handler(netio, handler); return; } data->bytes_transmitted += received; ods_log_debug("[%s] TCP_READ: bytes transmitted %lu (received %lu)", sock_str, (unsigned long)data->bytes_transmitted, (unsigned long)received); buffer_skip(data->query->buffer, received); if (buffer_remaining(data->query->buffer) > 0) { /* not done with message yet, wait for more. */ ods_log_debug("[%s] TCP_READ: remaining %lu", sock_str, (unsigned long)buffer_remaining(data->query->buffer)); return; } ods_log_assert(buffer_position(data->query->buffer) == data->query->tcplen); /* we have a complete query, process it. */ buffer_flip(data->query->buffer); qstate = query_process(data->query, data->engine); if (qstate == QUERY_DISCARDED) { cleanup_tcp_handler(netio, handler); return; } ods_log_debug("[%s] query processed qstate=%d", sock_str, qstate); data->qstate = qstate; /* edns, tsig */ query_add_optional(data->query, data->engine); /* switch to tcp write handler. */ buffer_flip(data->query->buffer); data->query->tcplen = buffer_remaining(data->query->buffer); ods_log_debug("[%s] TCP_READ: new tcplen %u", sock_str, data->query->tcplen); data->bytes_transmitted = 0; handler->timeout->tv_sec = XFRD_TCP_TIMEOUT; handler->timeout->tv_nsec = 0L; timespec_add(handler->timeout, netio_current_time(netio)); handler->event_types = NETIO_EVENT_WRITE | NETIO_EVENT_TIMEOUT; handler->event_handler = sock_handle_tcp_write; } /** * Handle outgoing tcp responses. * */ void sock_handle_tcp_write(netio_type* netio, netio_handler_type* handler, netio_events_type event_types) { struct tcp_data* data = (struct tcp_data *) handler->user_data; ssize_t sent = 0; query_type* q = data->query; if (event_types & NETIO_EVENT_TIMEOUT) { cleanup_tcp_handler(netio, handler); return; } ods_log_assert(event_types & NETIO_EVENT_WRITE); if (data->bytes_transmitted < sizeof(q->tcplen)) { uint16_t n_tcplen = htons(q->tcplen); sent = write(handler->fd, (const char*) &n_tcplen + data->bytes_transmitted, sizeof(n_tcplen) - data->bytes_transmitted); if (sent == -1) { if (errno == EAGAIN || errno == EINTR) { /* write would block, wait until socket becomes writeable. */ return; } else { ods_log_error("[%s] unable to handle outgoing tcp response: " "write() failed (%s)", sock_str, strerror(errno)); cleanup_tcp_handler(netio, handler); return; } } else if (sent == 0) { cleanup_tcp_handler(netio, handler); return; } data->bytes_transmitted += sent; ods_log_debug("[%s] TCP_WRITE: bytes transmitted %lu (sent %ld)", sock_str, (unsigned long)data->bytes_transmitted, (long)sent); if (data->bytes_transmitted < sizeof(q->tcplen)) { /* writing not complete, wait until socket becomes writable. */ ods_log_debug("[%s] TCP_WRITE: bytes transmitted %lu, while " "sizeof tcplen %lu", sock_str, (unsigned long)data->bytes_transmitted, (unsigned long)sizeof(q->tcplen)); return; } ods_log_assert(data->bytes_transmitted == sizeof(q->tcplen)); } ods_log_assert(data->bytes_transmitted < q->tcplen + sizeof(q->tcplen)); sent = write(handler->fd, buffer_current(q->buffer), buffer_remaining(q->buffer)); if (sent == -1) { if (errno == EAGAIN || errno == EINTR) { /* write would block, wait until socket becomes writeable. */ return; } else { ods_log_error("[%s] unable to handle outgoing tcp response: " "write() failed (%s)", sock_str, strerror(errno)); cleanup_tcp_handler(netio, handler); return; } } else if (sent == 0) { cleanup_tcp_handler(netio, handler); return; } buffer_skip(q->buffer, sent); data->bytes_transmitted += sent; if (data->bytes_transmitted < q->tcplen + sizeof(q->tcplen)) { /* still more data to write when socket becomes writable. */ ods_log_debug("[%s] TCP_WRITE: bytes transmitted %lu, while tcplen " "%u and sizeof tcplen %lu", sock_str, (unsigned long) data->bytes_transmitted, q->tcplen, (unsigned long)sizeof(q->tcplen)); return; } ods_log_debug("[%s] TCP_WRITE: bytes transmitted %lu", sock_str, (unsigned long)data->bytes_transmitted); ods_log_debug("[%s] TCP_WRITE: tcplen %u", sock_str, q->tcplen); ods_log_debug("[%s] TCP_WRITE: sizeof tcplen %lu", sock_str, (unsigned long)sizeof(q->tcplen)); ods_log_assert(data->bytes_transmitted == q->tcplen + sizeof(q->tcplen)); if (data->qstate == QUERY_AXFR || data->qstate == QUERY_IXFR) { /* continue processing AXFR and writing back results. */ buffer_clear(q->buffer); if (data->qstate == QUERY_IXFR) { data->qstate = ixfr(q, data->engine); } else { data->qstate = axfr(q, data->engine, 0); } if (data->qstate != QUERY_PROCESSED) { /* edns, tsig */ query_add_optional(q, data->engine); buffer_flip(q->buffer); q->tcplen = buffer_remaining(q->buffer); data->bytes_transmitted = 0; handler->timeout->tv_sec = XFRD_TCP_TIMEOUT; handler->timeout->tv_nsec = 0L; timespec_add(handler->timeout, netio_current_time(netio)); return; } } /* done sending, wait for the next request. */ data->bytes_transmitted = 0; handler->timeout->tv_sec = XFRD_TCP_TIMEOUT; handler->timeout->tv_nsec = 0L; timespec_add(handler->timeout, netio_current_time(netio)); handler->event_types = NETIO_EVENT_READ | NETIO_EVENT_TIMEOUT; handler->event_handler = sock_handle_tcp_read; } opendnssec-2.1.13/signer/src/wire/axfr.c0000644000077000001440000005432414446272525015030 00000000000000/* * 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. * */ /** * AXFR. * */ #include "config.h" #include "adapter/addns.h" #include "adapter/adutil.h" #include "file.h" #include "util.h" #include "wire/axfr.h" #include "wire/buffer.h" #include "wire/edns.h" #include "wire/query.h" #include "wire/sock.h" #define AXFR_TSIG_SIGN_EVERY_NTH 96 /* tsig sign every N packets. */ const char* axfr_str = "axfr"; /** * Handle SOA request. * */ query_state soa_request(query_type* q, engine_type* engine) { char* xfrfile = NULL; ldns_rr* rr = NULL; ldns_rdf* prev = NULL; ldns_rdf* orig = NULL; uint32_t ttl = 0; time_t expire = 0; ldns_status status = LDNS_STATUS_OK; char line[SE_ADFILE_MAXLINE]; unsigned l = 0; FILE* fd = NULL; ods_log_assert(q); ods_log_assert(q->buffer); ods_log_assert(q->zone); ods_log_assert(q->zone->name); ods_log_assert(engine); xfrfile = ods_build_path(q->zone->name, ".axfr", 0, 1); if (xfrfile) { fd = ods_fopen(xfrfile, NULL, "r"); } if (!fd) { ods_log_error("[%s] unable to open file %s for zone %s", axfr_str, xfrfile, q->zone->name); free((void*)xfrfile); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); return QUERY_PROCESSED; } free((void*)xfrfile); if (q->tsig_rr->status == TSIG_OK) { q->tsig_sign_it = 1; /* sign first packet in stream */ } /* compression? */ /* add SOA RR */ rr = addns_read_rr(fd, line, &orig, &prev, &ttl, &status, &l); if (!rr) { /* no SOA no transfer */ ods_log_error("[%s] bad axfr zone %s, corrupted file", axfr_str, q->zone->name); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(fd); return QUERY_PROCESSED; } /* first RR must be SOA */ if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_SOA) { ods_log_error("[%s] bad axfr zone %s, first rr is not soa", axfr_str, q->zone->name); ldns_rr_free(rr); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(fd); return QUERY_PROCESSED; } /* zone not expired? */ if (q->zone->xfrd) { expire = q->zone->xfrd->serial_xfr_acquired; expire += ldns_rdf2native_int32(ldns_rr_rdf(rr, SE_SOA_RDATA_EXPIRE)); if (expire < time_now()) { ods_log_warning("[%s] zone %s expired at %lld, and it is now %lld: " "not serving soa", axfr_str, q->zone->name, (long long)expire, (long long)time_now()); ldns_rr_free(rr); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(fd); return QUERY_PROCESSED; } } /* does it fit? */ if (query_add_rr(q, rr)) { ods_log_debug("[%s] set soa in response %s", axfr_str, q->zone->name); buffer_pkt_set_ancount(q->buffer, buffer_pkt_ancount(q->buffer)+1); ldns_rr_free(rr); rr = NULL; } else { ods_log_error("[%s] soa does not fit in response %s", axfr_str, q->zone->name); ldns_rr_free(rr); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(fd); return QUERY_PROCESSED; } ods_fclose(fd); buffer_pkt_set_ancount(q->buffer, 1); buffer_pkt_set_nscount(q->buffer, 0); buffer_pkt_set_arcount(q->buffer, 0); buffer_pkt_set_aa(q->buffer); /* check if it needs TSIG signatures */ if (q->tsig_rr->status == TSIG_OK) { q->tsig_sign_it = 1; } return QUERY_PROCESSED; } /** * Do AXFR. * */ query_state axfr(query_type* q, engine_type* engine, int fallback) { char* xfrfile = NULL; ldns_rr* rr = NULL; ldns_rdf* prev = NULL; ldns_rdf* orig = NULL; uint16_t total_added = 0; uint32_t ttl = 0; time_t expire = 0; ldns_status status = LDNS_STATUS_OK; char line[SE_ADFILE_MAXLINE]; unsigned l = 0; long fpos = 0; size_t bufpos = 0; ods_log_assert(q); ods_log_assert(q->buffer); ods_log_assert(q->zone); ods_log_assert(q->zone->name); ods_log_assert(engine); if (q->axfr_is_done) { ods_log_debug("[%s] zone transfer %s completed", axfr_str, q->zone->name); return QUERY_PROCESSED; } if (q->maxlen > AXFR_MAX_MESSAGE_LEN) { q->maxlen = AXFR_MAX_MESSAGE_LEN; } /* prepare TSIG */ if (!fallback) { q->tsig_prepare_it = 0; q->tsig_update_it = 1; if (q->tsig_sign_it) { q->tsig_prepare_it = 1; q->tsig_sign_it = 0; } } ods_log_assert(q->tsig_rr); if (q->axfr_fd == NULL) { /* start AXFR */ xfrfile = ods_build_path(q->zone->name, ".axfr", 0, 1); if (xfrfile) { q->axfr_fd = ods_fopen(xfrfile, NULL, "r"); } if (!q->axfr_fd) { ods_log_error("[%s] unable to open axfr file %s for zone %s", axfr_str, xfrfile, q->zone->name); free((void*)xfrfile); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); return QUERY_PROCESSED; } free((void*)xfrfile); if (q->tsig_rr->status == TSIG_OK) { q->tsig_sign_it = 1; /* sign first packet in stream */ } /* compression? */ /* add SOA RR */ fpos = ftell(q->axfr_fd); if (fpos < 0) { ods_log_error("[%s] unable to read axfr for zone %s: " "ftell() failed (%s)", axfr_str, q->zone->name, strerror(errno)); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); return QUERY_PROCESSED; } rr = addns_read_rr(q->axfr_fd, line, &orig, &prev, &ttl, &status, &l); if (!rr) { /* no SOA no transfer */ ods_log_error("[%s] bad axfr zone %s, corrupted file", axfr_str, q->zone->name); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(q->axfr_fd); q->axfr_fd = NULL; return QUERY_PROCESSED; } /* first RR must be SOA */ if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_SOA) { ods_log_error("[%s] bad axfr zone %s, first rr is not soa", axfr_str, q->zone->name); ldns_rr_free(rr); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(q->axfr_fd); q->axfr_fd = NULL; return QUERY_PROCESSED; } /* zone not expired? */ if (q->zone->xfrd) { expire = q->zone->xfrd->serial_xfr_acquired; expire += ldns_rdf2native_int32(ldns_rr_rdf(rr, SE_SOA_RDATA_EXPIRE)); if (expire < time_now()) { ods_log_warning("[%s] zone %s expired, not transferring zone", axfr_str, q->zone->name); ldns_rr_free(rr); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(q->axfr_fd); q->axfr_fd = NULL; return QUERY_PROCESSED; } } /* does it fit? */ if (query_add_rr(q, rr)) { ods_log_debug("[%s] set soa in axfr zone %s", axfr_str, q->zone->name); buffer_pkt_set_ancount(q->buffer, buffer_pkt_ancount(q->buffer)+1); total_added++; ldns_rr_free(rr); rr = NULL; bufpos = buffer_position(q->buffer); } else { ods_log_error("[%s] soa does not fit in axfr zone %s", axfr_str, q->zone->name); ldns_rr_free(rr); rr = NULL; buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(q->axfr_fd); q->axfr_fd = NULL; return QUERY_PROCESSED; } } else if (q->tcp) { /* subsequent AXFR packets */ ods_log_debug("[%s] subsequent axfr packet zone %s", axfr_str, q->zone->name); q->edns_rr->status = EDNS_NOT_PRESENT; buffer_set_limit(q->buffer, BUFFER_PKT_HEADER_SIZE); buffer_pkt_set_qdcount(q->buffer, 0); query_prepare(q); } /* add as many records as fit */ fpos = ftell(q->axfr_fd); if (fpos < 0) { ods_log_error("[%s] unable to read axfr for zone %s: " "ftell() failed (%s)", axfr_str, q->zone->name, strerror(errno)); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(q->axfr_fd); q->axfr_fd = NULL; return QUERY_PROCESSED; } while ((rr = addns_read_rr(q->axfr_fd, line, &orig, &prev, &ttl, &status, &l)) != NULL) { ods_log_deeebug("[%s] read rr at line %d", axfr_str, l); if (status != LDNS_STATUS_OK) { ldns_rr_free(rr); rr = NULL; ods_log_error("[%s] error reading rr at line %i (%s): %s", axfr_str, l, ldns_get_errorstr_by_id(status), line); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(q->axfr_fd); q->axfr_fd = NULL; return QUERY_PROCESSED; } /* does it fit? */ if (query_add_rr(q, rr)) { ods_log_deeebug("[%s] add rr at line %d", axfr_str, l); ldns_rr_free(rr); rr = NULL; fpos = ftell(q->axfr_fd); if (fpos < 0) { ods_log_error("[%s] unable to read axfr for zone %s: " "ftell() failed (%s)", axfr_str, q->zone->name, strerror(errno)); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(q->axfr_fd); q->axfr_fd = NULL; return QUERY_PROCESSED; } buffer_pkt_set_ancount(q->buffer, buffer_pkt_ancount(q->buffer)+1); total_added++; } else { ods_log_deeebug("[%s] rr at line %d does not fit", axfr_str, l); ldns_rr_free(rr); rr = NULL; if (fseek(q->axfr_fd, fpos, SEEK_SET) != 0) { ods_log_error("[%s] unable to reset file position in axfr " "file: fseek() failed (%s)", axfr_str, strerror(errno)); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(q->axfr_fd); q->axfr_fd = NULL; return QUERY_PROCESSED; } else if (q->tcp) { goto return_axfr; } else { goto udp_overflow; } } } ods_log_debug("[%s] axfr zone %s is done", axfr_str, q->zone->name); q->tsig_sign_it = 1; /* sign last packet */ q->axfr_is_done = 1; ods_fclose(q->axfr_fd); q->axfr_fd = NULL; return_axfr: if (q->tcp) { ods_log_debug("[%s] return part axfr zone %s", axfr_str, q->zone->name); buffer_pkt_set_aa(q->buffer); buffer_pkt_set_ancount(q->buffer, total_added); buffer_pkt_set_nscount(q->buffer, 0); buffer_pkt_set_arcount(q->buffer, 0); /* check if it needs TSIG signatures */ if (q->tsig_rr->status == TSIG_OK) { if (q->tsig_rr->update_since_last_prepare >= AXFR_TSIG_SIGN_EVERY_NTH) { q->tsig_sign_it = 1; } } return QUERY_AXFR; } ods_log_error("[%s] zone transfer %s not tcp", axfr_str, q->zone->name); udp_overflow: /* UDP Overflow */ ods_log_info("[%s] axfr udp overflow zone %s", axfr_str, q->zone->name); buffer_set_position(q->buffer, bufpos); buffer_pkt_set_aa(q->buffer); buffer_pkt_set_ancount(q->buffer, 1); buffer_pkt_set_nscount(q->buffer, 0); buffer_pkt_set_arcount(q->buffer, 0); /* check if it needs TSIG signatures */ if (q->tsig_rr->status == TSIG_OK) { q->tsig_sign_it = 1; } ods_log_debug("[%s] zone transfer %s udp overflow", axfr_str, q->zone->name); return QUERY_PROCESSED; } /** * Do IXFR (equal to AXFR for now). * */ query_state ixfr(query_type* q, engine_type* engine) { char* xfrfile = NULL; ldns_rr* rr = NULL; ldns_rdf* prev = NULL; ldns_rdf* orig = NULL; uint16_t total_added = 0; uint32_t ttl = 0; time_t expire = 0; ldns_status status = LDNS_STATUS_OK; char line[SE_ADFILE_MAXLINE]; unsigned l = 0; long fpos = 0; size_t bufpos = 0; uint32_t new_serial = 0; unsigned del_mode = 0; unsigned soa_found = 0; ods_log_assert(engine); ods_log_assert(q); ods_log_assert(q->buffer); ods_log_assert(q->zone); ods_log_assert(q->zone->name); if (q->axfr_is_done) { return QUERY_PROCESSED; } if (q->maxlen > AXFR_MAX_MESSAGE_LEN) { q->maxlen = AXFR_MAX_MESSAGE_LEN; } /* prepare TSIG */ q->tsig_prepare_it = 0; q->tsig_update_it = 1; if (q->tsig_sign_it) { q->tsig_prepare_it = 1; q->tsig_sign_it = 0; } ods_log_assert(q->tsig_rr); if (q->axfr_fd == NULL) { /* start IXFR */ xfrfile = ods_build_path(q->zone->name, ".ixfr", 0, 1); if (xfrfile) { q->axfr_fd = ods_fopen(xfrfile, NULL, "r"); } if (!q->axfr_fd) { ods_log_error("[%s] unable to open ixfr file %s for zone %s", axfr_str, xfrfile, q->zone->name); ods_log_info("[%s] axfr fallback zone %s", axfr_str, q->zone->name); free((void*)xfrfile); buffer_set_position(q->buffer, q->startpos); return axfr(q, engine, 1); } free((void*)xfrfile); if (q->tsig_rr->status == TSIG_OK) { q->tsig_sign_it = 1; /* sign first packet in stream */ } /* compression? */ /* add SOA RR */ fpos = ftell(q->axfr_fd); if (fpos < 0) { ods_log_error("[%s] unable to read ixfr for zone %s: ftell() " "failed (%s)", axfr_str, q->zone->name, strerror(errno)); ods_log_info("[%s] axfr fallback zone %s", axfr_str, q->zone->name); ods_fclose(q->axfr_fd); q->axfr_fd = NULL; buffer_set_position(q->buffer, q->startpos); return axfr(q, engine, 1); } rr = addns_read_rr(q->axfr_fd, line, &orig, &prev, &ttl, &status, &l); if (!rr) { /* no SOA no transfer */ ods_log_error("[%s] bad ixfr zone %s, corrupted file", axfr_str, q->zone->name); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); return QUERY_PROCESSED; } /* first RR must be SOA */ if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_SOA) { ods_log_error("[%s] bad ixfr zone %s, first rr is not soa", axfr_str, q->zone->name); ldns_rr_free(rr); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); return QUERY_PROCESSED; } /* zone not expired? */ if (q->zone->xfrd) { expire = q->zone->xfrd->serial_xfr_acquired; expire += ldns_rdf2native_int32(ldns_rr_rdf(rr, SE_SOA_RDATA_EXPIRE)); if (expire < time_now()) { ods_log_warning("[%s] zone %s expired, not transferring zone", axfr_str, q->zone->name); ldns_rr_free(rr); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); ods_fclose(q->axfr_fd); q->axfr_fd = NULL; return QUERY_PROCESSED; } } /* newest serial */ new_serial = ldns_rdf2native_int32( ldns_rr_rdf(rr, SE_SOA_RDATA_SERIAL)); /* does it fit? */ buffer_set_position(q->buffer, q->startpos); if (query_add_rr(q, rr)) { ods_log_debug("[%s] set soa in ixfr zone %s", axfr_str, q->zone->name); buffer_pkt_set_ancount(q->buffer, buffer_pkt_ancount(q->buffer)+1); total_added++; ldns_rr_free(rr); rr = NULL; bufpos = buffer_position(q->buffer); } else { ods_log_error("[%s] soa does not fit in ixfr zone %s", axfr_str, q->zone->name); ldns_rr_free(rr); rr = NULL; buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); return QUERY_PROCESSED; } if (util_serial_gt(q->serial, new_serial)) { goto axfr_fallback; } } else if (q->tcp) { /* subsequent IXFR packets */ ods_log_debug("[%s] subsequent ixfr packet zone %s", axfr_str, q->zone->name); buffer_set_limit(q->buffer, BUFFER_PKT_HEADER_SIZE); buffer_pkt_set_qdcount(q->buffer, 0); query_prepare(q); soa_found = 1; } /* add as many records as fit */ fpos = ftell(q->axfr_fd); if (fpos < 0) { ods_log_error("[%s] unable to read ixfr for zone %s: ftell() failed " "(%s)", axfr_str, q->zone->name, strerror(errno)); ods_log_info("[%s] axfr fallback zone %s", axfr_str, q->zone->name); ods_fclose(q->axfr_fd); q->axfr_fd = NULL; buffer_set_position(q->buffer, q->startpos); return axfr(q, engine, 1); } while ((rr = addns_read_rr(q->axfr_fd, line, &orig, &prev, &ttl, &status, &l)) != NULL) { ods_log_deeebug("[%s] read rr at line %d", axfr_str, l); if (status != LDNS_STATUS_OK) { ldns_rr_free(rr); rr = NULL; ods_log_error("[%s] error reading rr at line %i (%s): %s", axfr_str, l, ldns_get_errorstr_by_id(status), line); goto axfr_fallback; } if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) { del_mode = !del_mode; } if (!soa_found) { if (del_mode && ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA && q->serial == ldns_rdf2native_int32( ldns_rr_rdf(rr, SE_SOA_RDATA_SERIAL))) { soa_found = 1; } else { ods_log_deeebug("[%s] soa serial %u not found for rr at line %d", axfr_str, q->serial, l); ldns_rr_free(rr); rr = NULL; continue; } } /* does it fit? */ if (query_add_rr(q, rr)) { ods_log_deeebug("[%s] add rr at line %d", axfr_str, l); ldns_rr_free(rr); rr = NULL; fpos = ftell(q->axfr_fd); if (fpos < 0) { ods_log_error("[%s] unable to read ixfr for zone %s: ftell() " "failed (%s)", axfr_str, q->zone->name, strerror(errno)); ods_log_info("[%s] axfr fallback zone %s", axfr_str, q->zone->name); ods_fclose(q->axfr_fd); q->axfr_fd = NULL; buffer_set_position(q->buffer, q->startpos); return axfr(q, engine, 1); } buffer_pkt_set_ancount(q->buffer, buffer_pkt_ancount(q->buffer)+1); total_added++; } else { ods_log_deeebug("[%s] rr at line %d does not fit", axfr_str, l); ldns_rr_free(rr); rr = NULL; if (fseek(q->axfr_fd, fpos, SEEK_SET) != 0) { ods_log_error("[%s] unable to reset file position in ixfr " "file: fseek() failed (%s)", axfr_str, strerror(errno)); buffer_pkt_set_rcode(q->buffer, LDNS_RCODE_SERVFAIL); return QUERY_PROCESSED; } else if (q->tcp) { goto return_ixfr; } else { goto axfr_fallback; } } } if (!soa_found) { ods_log_warning("[%s] zone %s journal not found for serial %u", axfr_str, q->zone->name, q->serial); goto axfr_fallback; } ods_log_debug("[%s] ixfr zone %s is done", axfr_str, q->zone->name); q->tsig_sign_it = 1; /* sign last packet */ q->axfr_is_done = 1; ods_fclose(q->axfr_fd); q->axfr_fd = NULL; return_ixfr: ods_log_debug("[%s] return part ixfr zone %s", axfr_str, q->zone->name); buffer_pkt_set_ancount(q->buffer, total_added); buffer_pkt_set_nscount(q->buffer, 0); buffer_pkt_set_arcount(q->buffer, 0); /* check if it needs TSIG signatures */ if (q->tsig_rr->status == TSIG_OK) { if (q->tsig_rr->update_since_last_prepare >= AXFR_TSIG_SIGN_EVERY_NTH) { q->tsig_sign_it = 1; } } return QUERY_IXFR; axfr_fallback: if (q->tcp) { ods_log_info("[%s] axfr fallback zone %s", axfr_str, q->zone->name); if (q->axfr_fd) { ods_fclose(q->axfr_fd); q->axfr_fd = NULL; } buffer_set_position(q->buffer, q->startpos); return axfr(q, engine, 1); } /* UDP Overflow */ ods_log_info("[%s] ixfr udp overflow zone %s", axfr_str, q->zone->name); buffer_set_position(q->buffer, bufpos); buffer_pkt_set_ancount(q->buffer, 1); buffer_pkt_set_nscount(q->buffer, 0); buffer_pkt_set_arcount(q->buffer, 0); /* check if it needs TSIG signatures */ if (q->tsig_rr->status == TSIG_OK) { q->tsig_sign_it = 1; } return QUERY_PROCESSED; } opendnssec-2.1.13/signer/src/wire/xfrd.c0000644000077000001440000021401314446272525015024 00000000000000/* * 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. * */ /** * Zone transfers. * */ #include "config.h" #include "daemon/engine.h" #include "daemon/xfrhandler.h" #include "duration.h" #include "file.h" #include "log.h" #include "status.h" #include "util.h" #include "signer/domain.h" #include "signer/zone.h" #include "wire/tcpset.h" #include "wire/xfrd.h" #include "signer/backup.h" #include #include #define XFRD_TSIG_MAX_UNSIGNED 100 static const char* xfrd_str = "xfrd"; static void xfrd_handle_zone(netio_type* netio, netio_handler_type* handler, netio_events_type event_types); static void xfrd_make_request(xfrd_type* xfrd); static socklen_t xfrd_acl_sockaddr(acl_type* acl, unsigned int port, struct sockaddr_storage *sck); static void xfrd_write_soa(xfrd_type* xfrd, buffer_type* buffer); static int xfrd_parse_soa(xfrd_type* xfrd, buffer_type* buffer, unsigned rdata_only, unsigned update, uint32_t t, uint32_t* serial); static ods_status xfrd_parse_rrs(xfrd_type* xfrd, buffer_type* buffer, uint16_t count, int* done); static xfrd_pkt_status xfrd_parse_packet(xfrd_type* xfrd, buffer_type* buffer); static xfrd_pkt_status xfrd_handle_packet(xfrd_type* xfrd, buffer_type* buffer); static void xfrd_tcp_obtain(xfrd_type* xfrd, tcp_set_type* set); static void xfrd_tcp_read(xfrd_type* xfrd, tcp_set_type* set); static void xfrd_tcp_release(xfrd_type* xfrd, tcp_set_type* set, int open_waiting); static void xfrd_tcp_write(xfrd_type* xfrd, tcp_set_type* set); static void xfrd_tcp_xfr(xfrd_type* xfrd, tcp_set_type* set); static int xfrd_tcp_open(xfrd_type* xfrd, tcp_set_type* set); static void xfrd_udp_obtain(xfrd_type* xfrd); static void xfrd_udp_read(xfrd_type* xfrd); static void xfrd_udp_release(xfrd_type* xfrd); static int xfrd_udp_read_packet(xfrd_type* xfrd); static int xfrd_udp_send(xfrd_type* xfrd, buffer_type* buffer); static int xfrd_udp_send_request_ixfr(xfrd_type* xfrd); static time_t xfrd_time(xfrd_type* xfrd); static void xfrd_set_timer(xfrd_type* xfrd, time_t t); static void xfrd_set_timer_time(xfrd_type* xfrd, time_t t); static void xfrd_unset_timer(xfrd_type* xfrd); /** * Recover transfer variables. * */ static uint8_t xfrd_recover_dname(uint8_t* dname, const char* name) { const uint8_t *s = (const uint8_t *) name; uint8_t *h; uint8_t *p; uint8_t *d = dname; size_t label_length; if (strcmp(name, ".") == 0) { /* Root domain. */ dname[0] = 0; return 1; } for (h = d, p = h + 1; *s; ++s, ++p) { if (p - dname >= MAXDOMAINLEN) { return 0; } switch (*s) { case '.': if (p == h + 1) { /* Empty label. */ return 0; } else { label_length = p - h - 1; if (label_length > MAXLABELLEN) { return 0; } *h = label_length; h = p; } break; case '\\': /* Handle escaped characters (RFC1035 5.1) */ if (isdigit(s[1]) && isdigit(s[2]) && isdigit(s[3])) { int val = (ldns_hexdigit_to_int(s[1]) * 100 + ldns_hexdigit_to_int(s[2]) * 10 + ldns_hexdigit_to_int(s[3])); if (0 <= val && val <= 255) { s += 3; *p = val; } else { *p = *++s; } } else if (s[1] != '\0') { *p = *++s; } break; default: *p = *s; break; } } if (p != h + 1) { /* Terminate last label. */ label_length = p - h - 1; if (label_length > MAXLABELLEN) { return 0; } *h = label_length; h = p; } /* Add root label. */ *h = 0; return p-dname; } /** * Recover transfer variables. * */ static void xfrd_recover(xfrd_type* xfrd) { zone_type* zone = (zone_type*) xfrd->zone; char* file = NULL; FILE* fd = NULL; int round_num = 0; int master_num = 0; int next_master = 0; uint32_t timeout = 0; uint32_t serial_xfr = 0; uint32_t serial_notify = 0; uint32_t serial_disk = 0; time_t serial_xfr_acquired = 0; time_t serial_notify_acquired = 0; time_t serial_disk_acquired = 0; uint32_t soa_ttl = 0; uint32_t soa_serial = 0; uint32_t soa_refresh = 0; uint32_t soa_retry = 0; uint32_t soa_expire = 0; uint32_t soa_minimum = 0; const char* soa_mname = NULL; const char* soa_rname = NULL; if (zone && zone->name && zone->db && zone->db->is_initialized && zone->db->have_serial) { file = ods_build_path(zone->name, ".xfrd-state", 0, 1); if (file) { ods_log_verbose("[%s] recover xfrd.state file %s zone %s", xfrd_str, file, zone->name); fd = ods_fopen(file, NULL, "r"); if (fd) { if (!backup_read_check_str(fd, ODS_SE_FILE_MAGIC_V3)) { ods_log_error("[%s] corrupted state file zone %s: read " "magic (start) error", xfrd_str, zone->name); goto xfrd_recover_error; } if (!backup_read_check_str(fd, ";;Zone:") | !backup_read_check_str(fd, "name") | !backup_read_check_str(fd, zone->name) | !backup_read_check_str(fd, "ttl") | !backup_read_uint32_t(fd, &soa_ttl) | !backup_read_check_str(fd, "mname") | !backup_read_str(fd, &soa_mname) | !backup_read_check_str(fd, "rname") | !backup_read_str(fd, &soa_rname) | !backup_read_check_str(fd, "serial") | !backup_read_uint32_t(fd, &soa_serial) | !backup_read_check_str(fd, "refresh") | !backup_read_uint32_t(fd, &soa_refresh) | !backup_read_check_str(fd, "retry") | !backup_read_uint32_t(fd, &soa_retry) | !backup_read_check_str(fd, "expire") | !backup_read_uint32_t(fd, &soa_expire) | !backup_read_check_str(fd, "minimum") | !backup_read_uint32_t(fd, &soa_minimum)) { ods_log_error("[%s] corrupted state file zone %s: read " ";;Zone error", xfrd_str, zone->name); goto xfrd_recover_error; } if (!backup_read_check_str(fd, ";;Master:") | !backup_read_check_str(fd, "num") | !backup_read_int(fd, &master_num) | !backup_read_check_str(fd, "next") | !backup_read_int(fd, &next_master) | !backup_read_check_str(fd, "round") | !backup_read_int(fd, &round_num) | !backup_read_check_str(fd, "timeout") | !backup_read_uint32_t(fd, &timeout)) { ods_log_error("[%s] corrupt state file zone %s: read " ";;Master error", xfrd_str, zone->name); goto xfrd_recover_error; } if (!backup_read_check_str(fd, ";;Serial:") | !backup_read_check_str(fd, "xfr") | !backup_read_uint32_t(fd, &serial_xfr) | !backup_read_time_t(fd, &serial_xfr_acquired) | !backup_read_check_str(fd, "notify") | !backup_read_uint32_t(fd, &serial_notify) | !backup_read_time_t(fd, &serial_notify_acquired) | !backup_read_check_str(fd, "disk") | !backup_read_uint32_t(fd, &serial_disk) | !backup_read_time_t(fd, &serial_disk_acquired)) { ods_log_error("[%s] corrupt state file zone %s: read " ";;Serial error", xfrd_str, zone->name); goto xfrd_recover_error; } if (!backup_read_check_str(fd, ODS_SE_FILE_MAGIC_V3)) { ods_log_error("[%s] corrupt state file zone %s: read " "magic (end) error", xfrd_str, zone->name); goto xfrd_recover_error; } /* all ok */ xfrd->master_num = master_num; xfrd->next_master = next_master; xfrd->round_num = round_num; xfrd->timeout.tv_sec = timeout; xfrd->timeout.tv_nsec = 0; xfrd->master = NULL; /* acl_find_num(...) */ xfrd->soa.ttl = soa_ttl; xfrd->soa.serial = soa_serial; xfrd->soa.refresh = soa_refresh; xfrd->soa.retry = soa_retry; xfrd->soa.expire = soa_expire; xfrd->soa.minimum = soa_minimum; xfrd->soa.mname[0] = xfrd_recover_dname(xfrd->soa.mname+1, soa_mname); xfrd->soa.rname[0] = xfrd_recover_dname(xfrd->soa.rname+1, soa_rname); xfrd->serial_xfr = serial_xfr; xfrd->serial_xfr_acquired = serial_xfr_acquired; xfrd->serial_notify = serial_notify; xfrd->serial_notify_acquired = serial_notify_acquired; xfrd->serial_disk = serial_disk; xfrd->serial_disk_acquired = serial_disk_acquired; if (!timeout || serial_notify_acquired || (serial_disk_acquired && (uint32_t)xfrd_time(xfrd) - serial_disk_acquired > soa_refresh)) { xfrd_set_timer_refresh(xfrd); } if (serial_disk_acquired && ((uint32_t)xfrd_time(xfrd) - serial_disk_acquired > soa_expire)) { xfrd_set_timer_refresh(xfrd); } xfrd_recover_error: free((void*)soa_mname); free((void*)soa_rname); ods_fclose(fd); } free(file); } } else { ods_log_verbose("[%s] did not recover xfrd.state file zone %s", xfrd_str, (zone && zone->name)?zone->name:"(null)"); } } /** * Create zone transfer structure. * */ xfrd_type* xfrd_create(xfrhandler_type* xfrhandler, zone_type* zone) { xfrd_type* xfrd = NULL; if (!xfrhandler || !zone) { return NULL; } CHECKALLOC(xfrd = (xfrd_type*) malloc(sizeof(xfrd_type))); pthread_mutex_init(&xfrd->serial_lock, NULL); pthread_mutex_init(&xfrd->rw_lock, NULL); xfrd->xfrhandler = xfrhandler; xfrd->zone = zone; xfrd->tcp_conn = -1; xfrd->round_num = -1; xfrd->master_num = 0; xfrd->next_master = -1; xfrd->master = NULL; pthread_mutex_lock(&xfrd->serial_lock); xfrd->serial_xfr = 0; xfrd->serial_disk = 0; xfrd->serial_notify = 0; xfrd->serial_xfr_acquired = 0; xfrd->serial_disk_acquired = 0; xfrd->serial_notify_acquired = 0; xfrd->serial_retransfer = 0; pthread_mutex_unlock(&xfrd->serial_lock); xfrd->query_id = 0; xfrd->msg_seq_nr = 0; xfrd->msg_rr_count = 0; xfrd->msg_old_serial = 0; xfrd->msg_new_serial = 0; xfrd->msg_is_ixfr = 0; xfrd->msg_do_retransfer = 0; xfrd->udp_waiting = 0; xfrd->udp_waiting_next = NULL; xfrd->tcp_waiting = 0; xfrd->tcp_waiting_next = NULL; xfrd->tsig_rr = tsig_rr_create(); if (!xfrd->tsig_rr) { xfrd_cleanup(xfrd, 0); return NULL; } memset(&xfrd->soa, 0, sizeof(xfrd->soa)); xfrd->soa.ttl = 0; xfrd->soa.mname[0] = 1; xfrd->soa.rname[0] = 1; xfrd->soa.serial = 0; xfrd->soa.refresh = 3600; xfrd->soa.retry = 300; xfrd->soa.expire = 604800; xfrd->soa.minimum = 3600; xfrd->handler.fd = -1; xfrd->handler.user_data = (void*) xfrd; xfrd->handler.timeout = 0; xfrd->handler.event_types = NETIO_EVENT_READ|NETIO_EVENT_TIMEOUT; xfrd->handler.event_handler = xfrd_handle_zone; xfrd_set_timer_time(xfrd, 0); xfrd_recover(xfrd); return xfrd; } /** * Get time. * */ static time_t xfrd_time(xfrd_type* xfrd) { ods_log_assert(xfrd); ods_log_assert(xfrd->xfrhandler); return xfrhandler_time((xfrhandler_type*) xfrd->xfrhandler); } /** * Set timer. * */ static void xfrd_set_timer(xfrd_type* xfrd, time_t t) { if (!xfrd || !xfrd->xfrhandler) { return; } /** * Randomize the time, within 90%-100% of original. * Not later so zones cannot expire too late. */ if(t > xfrd_time(xfrd) + 10) { time_t extra = t - xfrd_time(xfrd); time_t base = extra*9/10; #ifdef HAVE_ARC4RANDOM_UNIFORM t = xfrd_time(xfrd) + base + arc4random_uniform(extra-base); #elif HAVE_ARC4RANDOM t = xfrd_time(xfrd) + base + arc4random()%(extra-base); #else t = xfrd_time(xfrd) + base + random()%(extra-base); #endif } xfrd->handler.timeout = &xfrd->timeout; xfrd->timeout.tv_sec = t; xfrd->timeout.tv_nsec = 0; } /** * Unset timer. * */ static void xfrd_unset_timer(xfrd_type* xfrd) { ods_log_assert(xfrd); xfrd->handler.timeout = NULL; } /** * Set timer timeout to time. * */ static void xfrd_set_timer_time(xfrd_type* xfrd, time_t t) { ods_log_assert(xfrd); xfrd_set_timer(xfrd, xfrd_time(xfrd) + t); } /** * Set timeout for zone transfer to now. * */ void xfrd_set_timer_now(xfrd_type* xfrd) { zone_type* zone = NULL; if (!xfrd || !xfrd->zone || !xfrd->xfrhandler) { return; } zone = (zone_type*) xfrd->zone; ods_log_debug("[%s] zone %s sets timer timeout now", xfrd_str, zone->name); xfrd_set_timer_time(xfrd, 0); } /** * Set timeout for zone transfer to RETRY. * */ void xfrd_set_timer_retry(xfrd_type* xfrd) { zone_type* zone = NULL; if (!xfrd || !xfrd->zone || !xfrd->xfrhandler) { return; } zone = (zone_type*) xfrd->zone; ods_log_debug("[%s] zone %s sets timer timeout retry %u", xfrd_str, zone->name, (unsigned) xfrd->soa.retry); xfrd_set_timer_time(xfrd, xfrd->soa.retry); } /** * Set timeout for zone transfer to REFRESH. * */ void xfrd_set_timer_refresh(xfrd_type* xfrd) { zone_type* zone = NULL; if (!xfrd || !xfrd->zone || !xfrd->xfrhandler) { return; } zone = (zone_type*) xfrd->zone; ods_log_debug("[%s] zone %s sets timer timeout refresh %u", xfrd_str, zone->name, (unsigned) xfrd->soa.refresh); xfrd_set_timer_time(xfrd, xfrd->soa.refresh); } /** * Use acl address to setup sockaddr struct. * */ static socklen_t xfrd_acl_sockaddr(acl_type* acl, unsigned int port, struct sockaddr_storage *sck) { ods_log_assert(acl); ods_log_assert(sck); ods_log_assert(port); memset(sck, 0, sizeof(struct sockaddr_storage)); if (acl->family == AF_INET6) { struct sockaddr_in6* sa = (struct sockaddr_in6*)sck; sa->sin6_family = AF_INET6; sa->sin6_port = htons(port); sa->sin6_addr = acl->addr.addr6; return sizeof(struct sockaddr_in6); } else { struct sockaddr_in* sa = (struct sockaddr_in*)sck; sa->sin_family = AF_INET; sa->sin_port = htons(port); sa->sin_addr = acl->addr.addr; return sizeof(struct sockaddr_in); } return 0; } /** * Use acl address to setup remote sockaddr struct. * */ socklen_t xfrd_acl_sockaddr_to(acl_type* acl, struct sockaddr_storage *to) { unsigned int port = 0; if (!acl || !to) { return 0; } port = acl->port ? acl->port : (unsigned) atoi(DNS_PORT_STRING); return xfrd_acl_sockaddr(acl, port, to); } /** * Sign transfer request. * */ static void xfrd_tsig_sign(xfrd_type* xfrd, buffer_type* buffer) { tsig_algo_type* algo = NULL; if (!xfrd || !xfrd->tsig_rr || !xfrd->master || !xfrd->master->tsig || !xfrd->master->tsig->key || !buffer) { return; /* no tsig configured */ } algo = tsig_lookup_algo(xfrd->master->tsig->algorithm); if (!algo) { ods_log_error("[%s] unable to sign request: tsig unknown algorithm " "%s", xfrd_str, xfrd->master->tsig->algorithm); return; } ods_log_assert(algo); tsig_rr_reset(xfrd->tsig_rr, algo, xfrd->master->tsig->key); xfrd->tsig_rr->original_query_id = buffer_pkt_id(buffer); xfrd->tsig_rr->algo_name = ldns_rdf_clone(xfrd->tsig_rr->algo->wf_name); xfrd->tsig_rr->key_name = ldns_rdf_clone(xfrd->tsig_rr->key->dname); log_dname(xfrd->tsig_rr->key_name, "tsig sign query with key", LOG_DEBUG); log_dname(xfrd->tsig_rr->algo_name, "tsig sign query with algorithm", LOG_DEBUG); tsig_rr_prepare(xfrd->tsig_rr); tsig_rr_update(xfrd->tsig_rr, buffer, buffer_position(buffer)); tsig_rr_sign(xfrd->tsig_rr); ods_log_debug("[%s] tsig append rr to request id=%u", xfrd_str, buffer_pkt_id(buffer)); tsig_rr_append(xfrd->tsig_rr, buffer); buffer_pkt_set_arcount(buffer, buffer_pkt_arcount(buffer)+1); tsig_rr_prepare(xfrd->tsig_rr); } /** * Process TSIG in transfer. * */ static int xfrd_tsig_process(xfrd_type* xfrd, buffer_type* buffer) { zone_type* zone = NULL; int have_tsig = 0; if (!xfrd || !xfrd->tsig_rr || !xfrd->master || !xfrd->master->tsig || !xfrd->master->tsig->key || !buffer) { return 1; /* no tsig configured */ } zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(xfrd->master->address); if (!tsig_rr_find(xfrd->tsig_rr, buffer)) { ods_log_error("[%s] unable to process tsig: xfr zone %s from %s " "has malformed tsig rr", xfrd_str, zone->name, xfrd->master->address); return 0; } if (xfrd->tsig_rr->status == TSIG_OK) { have_tsig = 1; if (xfrd->tsig_rr->error_code != LDNS_RCODE_NOERROR) { ods_log_error("[%s] zone %s, from %s has tsig error (%s)", xfrd_str, zone->name, xfrd->master->address, tsig_strerror(xfrd->tsig_rr->error_code)); } /* strip the TSIG resource record off... */ buffer_set_limit(buffer, xfrd->tsig_rr->position); buffer_pkt_set_arcount(buffer, buffer_pkt_arcount(buffer)-1); } /* keep running the TSIG hash */ tsig_rr_update(xfrd->tsig_rr, buffer, buffer_limit(buffer)); if (have_tsig) { if (!tsig_rr_verify(xfrd->tsig_rr)) { ods_log_error("[%s] unable to process tsig: xfr zone %s from %s " "has bad tsig signature", xfrd_str, zone->name, xfrd->master->address); return 0; } /* prepare for next tsigs */ tsig_rr_prepare(xfrd->tsig_rr); } else if (xfrd->tsig_rr->update_since_last_prepare > XFRD_TSIG_MAX_UNSIGNED) { /* we allow a number of non-tsig signed packets */ ods_log_error("[%s] unable to process tsig: xfr zone %s, from %s " "has too many consecutive packets without tsig", xfrd_str, zone->name, xfrd->master->address); return 0; } if (!have_tsig && xfrd->msg_seq_nr == 0) { ods_log_error("[%s] unable to process tsig: xfr zone %s from %s " "has no tsig in first packet of reply", xfrd_str, zone->name, xfrd->master->address); return 0; } /* process TSIG ok */ return 1; } /** * Commit answer on disk. * */ static void xfrd_commit_packet(xfrd_type* xfrd) { zone_type* zone = NULL; char* xfrfile = NULL; FILE* fd = NULL; time_t serial_disk_acq = 0; ods_log_assert(xfrd); zone = (zone_type*) xfrd->zone; xfrfile = ods_build_path(zone->name, ".xfrd", 0, 1); if (!xfrfile) { ods_log_crit("[%s] unable to commit xfr zone %s: build path failed", xfrd_str, zone->name); return; } ods_log_assert(zone); ods_log_assert(zone->name); pthread_mutex_lock(&zone->zone_lock); pthread_mutex_lock(&xfrd->rw_lock); pthread_mutex_lock(&xfrd->serial_lock); /* mark end packet */ fd = ods_fopen(xfrfile, NULL, "a"); free((void*)xfrfile); if (fd) { fprintf(fd, ";;ENDPACKET\n"); ods_fclose(fd); } else { pthread_mutex_unlock(&xfrd->rw_lock); pthread_mutex_unlock(&zone->zone_lock); pthread_mutex_unlock(&xfrd->serial_lock); ods_log_crit("[%s] unable to commit xfr zone %s: ods_fopen() failed " "(%s)", xfrd_str, zone->name, strerror(errno)); return; } /* update soa serial management */ xfrd->serial_disk = xfrd->msg_new_serial; serial_disk_acq = xfrd->serial_disk_acquired; xfrd->serial_disk_acquired = xfrd_time(xfrd); /* ensure newer time */ if (xfrd->serial_disk_acquired == serial_disk_acq) { xfrd->serial_disk_acquired++; } xfrd->soa.serial = xfrd->serial_disk; if (xfrd->msg_do_retransfer || (util_serial_gt(xfrd->serial_disk, xfrd->serial_xfr) && xfrd->serial_disk_acquired > xfrd->serial_xfr_acquired)) { /* reschedule task */ xfrhandler_type* xfrhandler = (xfrhandler_type*) xfrd->xfrhandler; engine_type* engine = (engine_type*) xfrhandler->engine; ods_log_assert(xfrhandler); ods_log_assert(engine); ods_log_debug("[%s] reschedule task for zone %s: disk serial=%u " "acquired=%lu, memory serial=%u acquired=%lu", xfrd_str, zone->name, xfrd->serial_disk, (unsigned long)xfrd->serial_disk_acquired, xfrd->serial_xfr, (unsigned long)xfrd->serial_xfr_acquired); schedule_scheduletask(engine->taskq, TASK_FORCEREAD, zone->name, zone, &zone->zone_lock, schedule_IMMEDIATELY); engine_wakeup_workers(engine); } /* reset retransfer */ xfrd->msg_do_retransfer = 0; pthread_mutex_unlock(&xfrd->serial_lock); pthread_mutex_unlock(&xfrd->rw_lock); pthread_mutex_unlock(&zone->zone_lock); } /** * Dump answer to disk. * */ static void xfrd_dump_packet(xfrd_type* xfrd, buffer_type* buffer) { zone_type* zone = NULL; char* xfrfile = NULL; FILE* fd = NULL; ldns_pkt* pkt = NULL; ldns_status status = LDNS_STATUS_OK; ods_log_assert(buffer); ods_log_assert(xfrd); zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->name); status = ldns_wire2pkt(&pkt, buffer_begin(buffer), buffer_limit(buffer)); if (status != LDNS_STATUS_OK) { ods_log_crit("[%s] unable to dump packet zone %s: ldns_wire2pkt() " "failed (%s)", xfrd_str, zone->name, ldns_get_errorstr_by_id(status)); return; } ods_log_assert(pkt); xfrfile = ods_build_path(zone->name, ".xfrd", 0, 1); if (!xfrfile) { ods_log_crit("[%s] unable to dump packet zone %s: build path failed", xfrd_str, zone->name); return; } pthread_mutex_lock(&xfrd->rw_lock); if (xfrd->msg_do_retransfer && !xfrd->msg_seq_nr && !xfrd->msg_is_ixfr) { fd = ods_fopen(xfrfile, NULL, "w"); } else { fd = ods_fopen(xfrfile, NULL, "a"); } free((void*) xfrfile); if (!fd) { ods_log_crit("[%s] unable to dump packet zone %s: ods_fopen() failed " "(%s)", xfrd_str, zone->name, strerror(errno)); pthread_mutex_unlock(&xfrd->rw_lock); return; } ods_log_assert(fd); if (xfrd->msg_seq_nr == 0) { fprintf(fd, ";;BEGINPACKET\n"); } ldns_rr_list_print(fd, ldns_pkt_answer(pkt)); ods_fclose(fd); pthread_mutex_unlock(&xfrd->rw_lock); ldns_pkt_free(pkt); } /** * Write SOA in packet. * */ static void xfrd_write_soa(xfrd_type* xfrd, buffer_type* buffer) { zone_type* zone = NULL; size_t rdlength_pos = 0; uint16_t rdlength = 0; ods_log_assert(xfrd); ods_log_assert(buffer); zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->apex); buffer_write_rdf(buffer, zone->apex); buffer_write_u16(buffer, (uint16_t) LDNS_RR_TYPE_SOA); buffer_write_u16(buffer, (uint16_t) zone->klass); buffer_write_u32(buffer, xfrd->soa.ttl); rdlength_pos = buffer_position(buffer); buffer_skip(buffer, sizeof(rdlength)); buffer_write(buffer, xfrd->soa.mname+1, xfrd->soa.mname[0]); buffer_write(buffer, xfrd->soa.rname+1, xfrd->soa.rname[0]); buffer_write_u32(buffer, xfrd->soa.serial); buffer_write_u32(buffer, xfrd->soa.refresh); buffer_write_u32(buffer, xfrd->soa.retry); buffer_write_u32(buffer, xfrd->soa.expire); buffer_write_u32(buffer, xfrd->soa.minimum); rdlength = buffer_position(buffer) - rdlength_pos - sizeof(rdlength); buffer_write_u16_at(buffer, rdlength_pos, rdlength); } /** * Update SOA. * */ static void xfrd_update_soa(xfrd_type* xfrd, buffer_type* buffer, uint32_t ttl, uint16_t mname_pos, uint16_t rname_pos, uint32_t refresh, uint32_t retry, uint32_t expire, uint32_t minimum) { zone_type* zone = NULL; ods_log_assert(xfrd); ods_log_assert(buffer); zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->apex); xfrd->soa.ttl = ttl; xfrd->soa.refresh = refresh; xfrd->soa.retry = retry; xfrd->soa.expire = expire; xfrd->soa.minimum = minimum; buffer_set_position(buffer, mname_pos); if (!(xfrd->soa.mname[0] = buffer_read_dname(buffer, xfrd->soa.mname+1, 1))) { xfrd->soa.mname[0] = 1; xfrd->soa.mname[1] = 0; } buffer_set_position(buffer, rname_pos); if (!(xfrd->soa.rname[0] = buffer_read_dname(buffer, xfrd->soa.rname+1, 1))) { xfrd->soa.rname[0] = 1; xfrd->soa.rname[1] = 0; } } /** * Parse SOA RR in packet. * */ static int xfrd_parse_soa(xfrd_type* xfrd, buffer_type* buffer, unsigned rdata_only, unsigned update, uint32_t t, uint32_t* soa_serial) { ldns_rr_type type = LDNS_RR_TYPE_SOA; uint16_t mname_pos = 0; uint16_t rname_pos = 0; uint16_t pos = 0; uint32_t serial = 0; uint32_t refresh = 0; uint32_t retry = 0; uint32_t expire = 0; uint32_t minimum = 0; uint32_t ttl = t; ods_log_assert(xfrd); ods_log_assert(buffer); /* type class ttl */ if (!rdata_only) { if (!buffer_available(buffer, 10)) { ods_log_debug("[%s] unable to parse soa: rr too short", xfrd_str); return 0; } type = (ldns_rr_type) buffer_read_u16(buffer); if (type != LDNS_RR_TYPE_SOA) { ods_log_debug("[%s] unable to parse soa: rrtype %u != soa", xfrd_str, (unsigned) type); return 0; } (void)buffer_read_u16(buffer); /* class */ ttl = buffer_read_u32(buffer); /* rdata length */ if (!buffer_available(buffer, buffer_read_u16(buffer))) { ods_log_debug("[%s] unable to parse soa: rdata too short", xfrd_str); return 0; } } /* MNAME */ mname_pos = buffer_position(buffer); if (!buffer_skip_dname(buffer)) { ods_log_debug("[%s] unable to parse soa: bad mname", xfrd_str); return 0; } /* RNAME */ rname_pos = buffer_position(buffer); if (!buffer_skip_dname(buffer)) { ods_log_debug("[%s] unable to parse soa: bad rname", xfrd_str); return 0; } serial = buffer_read_u32(buffer); refresh = buffer_read_u32(buffer); retry = buffer_read_u32(buffer); expire = buffer_read_u32(buffer); minimum = buffer_read_u32(buffer); pos = buffer_position(buffer); if (soa_serial) { *soa_serial = serial; } if (update) { xfrd_update_soa(xfrd, buffer, ttl, mname_pos, rname_pos, refresh, retry, expire, minimum); } buffer_set_position(buffer, pos); return 1; } /** * Parse RRs in packet. * */ static ods_status xfrd_parse_rrs(xfrd_type* xfrd, buffer_type* buffer, uint16_t count, int* done) { ldns_rr_type type = 0; uint16_t rrlen = 0; uint32_t ttl = 0; uint32_t serial = 0; uint32_t tmp_serial = 0; size_t i = 0; ods_log_assert(xfrd); ods_log_assert(buffer); ods_log_assert(done); for (i=0; i < count; ++i, ++xfrd->msg_rr_count) { if (*done) { return ODS_STATUS_OK; } if (!buffer_skip_dname(buffer)) { return ODS_STATUS_SKIPDNAME; } if (!buffer_available(buffer, 10)) { return ODS_STATUS_BUFAVAIL; } (void)buffer_position(buffer); type = (ldns_rr_type) buffer_read_u16(buffer); (void)buffer_read_u16(buffer); /* class */ ttl = buffer_read_u32(buffer); rrlen = buffer_read_u16(buffer); if (!buffer_available(buffer, rrlen)) { return ODS_STATUS_BUFAVAIL; } if (type == LDNS_RR_TYPE_SOA) { if (!xfrd_parse_soa(xfrd, buffer, 1, 0, ttl, &serial)) { return ODS_STATUS_PARSESOA; } if (xfrd->msg_rr_count == 1 && serial != xfrd->msg_new_serial) { /* 2nd RR is SOA with different serial, this is an IXFR */ xfrd->msg_is_ixfr = 1; pthread_mutex_lock(&xfrd->serial_lock); if (!xfrd->serial_disk_acquired) { pthread_mutex_unlock(&xfrd->serial_lock); /* got IXFR but need AXFR */ return ODS_STATUS_REQAXFR; } if (!xfrd->msg_do_retransfer && serial != xfrd->serial_disk) { pthread_mutex_unlock(&xfrd->serial_lock); /* bad start serial in IXFR */ return ODS_STATUS_INSERIAL; } pthread_mutex_unlock(&xfrd->serial_lock); xfrd->msg_old_serial = serial; tmp_serial = serial; } else if (serial == xfrd->msg_new_serial) { /* saw another SOA of new serial. */ if (xfrd->msg_is_ixfr == 1) { xfrd->msg_is_ixfr = 2; /* seen middle SOA in ixfr */ } else { *done = 1; /* final axfr/ixfr soa */ } } else if (xfrd->msg_is_ixfr) { /* some additional checks */ if (util_serial_gt(serial, xfrd->msg_new_serial)) { /* bad middle serial in IXFR (too high) */ return ODS_STATUS_INSERIAL; } if (util_serial_gt(tmp_serial, serial)) { /* middle serial decreases in IXFR */ return ODS_STATUS_INSERIAL; } /* serial ok, update tmp serial */ tmp_serial = serial; } } else { buffer_skip(buffer, rrlen); } } return ODS_STATUS_OK; } /** * Parse packet. * */ static xfrd_pkt_status xfrd_parse_packet(xfrd_type* xfrd, buffer_type* buffer) { zone_type* zone = NULL; uint16_t qdcount = 0; uint16_t ancount = 0; uint16_t ancount_todo = 0; uint16_t rrcount = 0; uint32_t serial = 0; int done = 0; ods_status status = ODS_STATUS_OK; ods_log_assert(buffer); ods_log_assert(xfrd); ods_log_assert(xfrd->master); ods_log_assert(xfrd->master->address); zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->name); /* check packet size */ if (!buffer_available(buffer, BUFFER_PKT_HEADER_SIZE)) { ods_log_error("[%s] unable to parse packet: zone %s received bad " "packet from %s (too small)", xfrd_str, zone->name, xfrd->master->address); return XFRD_PKT_BAD; } /* check query id */ if (buffer_pkt_id(buffer) != xfrd->query_id) { ods_log_error("[%s] bad packet: zone %s received bad query id " "%u from %s (expected %u)", xfrd_str, zone->name, buffer_pkt_id(buffer), xfrd->master->address, xfrd->query_id); return XFRD_PKT_BAD; } /* check rcode */ if (buffer_pkt_rcode(buffer) != LDNS_RCODE_NOERROR) { ods_log_error("[%s] bad packet: zone %s received error code %s from %s", xfrd_str, zone->name, ldns_pkt_rcode2str(buffer_pkt_rcode(buffer)), xfrd->master->address); if (buffer_pkt_rcode(buffer) == LDNS_RCODE_NOTIMPL) { return XFRD_PKT_NOTIMPL; } else if (buffer_pkt_rcode(buffer) != LDNS_RCODE_NOTAUTH) { return XFRD_PKT_BAD; } } /* check tsig */ if (!xfrd_tsig_process(xfrd, buffer)) { ods_log_error("[%s] bad packet: zone %s received bad tsig " "from %s", xfrd_str, zone->name, xfrd->master->address); return XFRD_PKT_BAD; } /* skip header and question section */ buffer_skip(buffer, BUFFER_PKT_HEADER_SIZE); qdcount = buffer_pkt_qdcount(buffer); for (rrcount = 0; rrcount < qdcount; rrcount++) { if (!buffer_skip_rr(buffer, 1)) { ods_log_error("[%s] bad packet: zone %s received bad " "question section from %s (bad rr)", xfrd_str, zone->name, xfrd->master->address); return XFRD_PKT_BAD; } } /* answer section */ ancount = buffer_pkt_ancount(buffer); if (xfrd->msg_rr_count == 0 && ancount == 0) { if (xfrd->tcp_conn == -1 && buffer_pkt_tc(buffer)) { ods_log_info("[%s] zone %s received tc from %s, retry tcp", xfrd_str, zone->name, xfrd->master->address); return XFRD_PKT_TC; } ods_log_error("[%s] bad packet: zone %s received bad xfr packet " "from %s (nodata)", xfrd_str, zone->name, xfrd->master->address); return XFRD_PKT_BAD; } ancount_todo = ancount; if (xfrd->msg_rr_count == 0) { /* parse the first RR, see if it is a SOA */ if (!buffer_skip_dname(buffer) || !xfrd_parse_soa(xfrd, buffer, 0, 1, 0, &serial)) { ods_log_error("[%s] bad packet: zone %s received bad xfr " "packet from %s (bad soa)", xfrd_str, zone->name, xfrd->master->address); return XFRD_PKT_BAD; } /* check serial */ pthread_mutex_lock(&xfrd->serial_lock); if (!xfrd->msg_do_retransfer && xfrd->serial_disk_acquired && xfrd->serial_disk == serial) { ods_log_info("[%s] zone %s got update indicating current " "serial %u from %s", xfrd_str, zone->name, serial, xfrd->master->address); xfrd->serial_disk_acquired = xfrd_time(xfrd); if (xfrd->serial_xfr == serial) { xfrd->serial_xfr_acquired = time_now(); if (!xfrd->serial_notify_acquired) { /* not notified or anything, so stop asking around */ xfrd->round_num = -1; /* next try start a new round */ xfrd_set_timer_refresh(xfrd); ods_log_debug("[%s] zone %s wait refresh time", xfrd_str, zone->name); pthread_mutex_unlock(&xfrd->serial_lock); return XFRD_PKT_NEWLEASE; } /* try next master */ ods_log_debug("[%s] zone %s try next master", xfrd_str, zone->name); pthread_mutex_unlock(&xfrd->serial_lock); return XFRD_PKT_BAD; } } if (!xfrd->msg_do_retransfer && xfrd->serial_disk_acquired && !util_serial_gt(serial, xfrd->serial_disk)) { ods_log_info("[%s] zone %s ignoring old serial %u from %s " "(have %u)", xfrd_str, zone->name, serial, xfrd->master->address, xfrd->serial_disk); pthread_mutex_unlock(&xfrd->serial_lock); return XFRD_PKT_BAD; } xfrd->msg_new_serial = serial; if (!xfrd->msg_do_retransfer && xfrd->serial_disk_acquired) { xfrd->msg_old_serial = xfrd->serial_disk; } else { xfrd->msg_old_serial = 0; } /* update notify serial if this xfr is newer */ if (ancount > 1 && xfrd->serial_notify_acquired && util_serial_gt(serial, xfrd->serial_notify)) { xfrd->serial_notify = serial; } pthread_mutex_unlock(&xfrd->serial_lock); xfrd->msg_rr_count = 1; xfrd->msg_is_ixfr = 0; ancount_todo = ancount - 1; } /* check tc bit */ if (xfrd->tcp_conn == -1 && buffer_pkt_tc(buffer)) { ods_log_info("[%s] zone %s received tc from %s, retry tcp", xfrd_str, zone->name, xfrd->master->address); return XFRD_PKT_TC; } if (xfrd->tcp_conn == -1 && ancount < 2) { /* too short to be a real ixfr/axfr data transfer */ ods_log_info("[%s] zone %s received too short udp reply from %s, " "retry tcp", xfrd_str, zone->name, xfrd->master->address); return XFRD_PKT_TC; } status = xfrd_parse_rrs(xfrd, buffer, ancount_todo, &done); if (status != ODS_STATUS_OK) { ods_log_error("[%s] bad packet: zone %s received bad xfr packet " "from %s (%s)", xfrd_str, zone->name, xfrd->master->address, ods_status2str(status)); return XFRD_PKT_BAD; } if (xfrd->tcp_conn == -1 && !done) { ods_log_error("[%s] bad packet: zone %s received bad xfr packet " "(xfr over udp incomplete)", xfrd_str, zone->name); return XFRD_PKT_BAD; } if (!done) { return XFRD_PKT_MORE; } return XFRD_PKT_XFR; } /** * Handle packet. * */ static xfrd_pkt_status xfrd_handle_packet(xfrd_type* xfrd, buffer_type* buffer) { xfrd_pkt_status res = XFRD_PKT_BAD; zone_type* zone = NULL; ods_log_assert(xfrd); ods_log_assert(xfrd->master); ods_log_assert(xfrd->master->address); zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->name); res = xfrd_parse_packet(xfrd, buffer); ods_log_debug("[%s] zone %s xfr packet parsed (res %d)", xfrd_str, zone->name, res); switch (res) { case XFRD_PKT_MORE: case XFRD_PKT_XFR: /* continue with commit */ break; case XFRD_PKT_NEWLEASE: xfrd->serial_notify_acquired = 0; case XFRD_PKT_TC: return res; break; case XFRD_PKT_NOTIMPL: case XFRD_PKT_BAD: default: /* rollback */ if (xfrd->msg_seq_nr > 0) { buffer_clear(buffer); ods_log_info("[%s] zone %s xfr rollback", xfrd_str, zone->name); buffer_flip(buffer); } return res; break; } /* dump reply on disk to diff file */ xfrd_dump_packet(xfrd, buffer); /* more? */ xfrd->msg_seq_nr++; if (res == XFRD_PKT_MORE) { /* wait for more */ return XFRD_PKT_MORE; } /* done */ buffer_clear(buffer); buffer_flip(buffer); /* commit packet */ xfrd_commit_packet(xfrd); /* next time */ pthread_mutex_lock(&xfrd->serial_lock); ods_log_info("[%s] zone %s transfer done [notify acquired %lu, serial on " "disk %u, notify serial %u]", xfrd_str, zone->name, (unsigned long)xfrd->serial_notify_acquired, xfrd->serial_disk, xfrd->serial_notify); if (xfrd->serial_notify_acquired && !util_serial_gt(xfrd->serial_notify, xfrd->serial_disk)) { ods_log_verbose("[%s] zone %s reset notify acquired", xfrd_str, zone->name); xfrd->serial_notify_acquired = 0; } if (!xfrd->serial_notify_acquired) { ods_log_debug("[%s] zone %s xfr done", xfrd_str, zone->name); xfrd->round_num = -1; /* next try start anew */ xfrd_set_timer_refresh(xfrd); pthread_mutex_unlock(&xfrd->serial_lock); return XFRD_PKT_XFR; } pthread_mutex_unlock(&xfrd->serial_lock); /* try to get an even newer serial */ ods_log_info("[%s] zone %s try get newer serial", xfrd_str, zone->name); return XFRD_PKT_BAD; } /** TCP **/ /** * Write to tcp. * */ static void xfrd_tcp_write(xfrd_type* xfrd, tcp_set_type* set) { zone_type* zone = NULL; tcp_conn_type* tcp = NULL; int ret = 0; int error = 0; socklen_t len = 0; ods_log_assert(set); ods_log_assert(xfrd); ods_log_assert(xfrd->tcp_conn != -1); zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->name); tcp = set->tcp_conn[xfrd->tcp_conn]; if (tcp->total_bytes == 0) { /* check for pending error from nonblocking connect */ /* from Stevens, unix network programming, vol1, 3rd ed, p450 */ len = sizeof(error); if (getsockopt(tcp->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { error = errno; /* on solaris errno is error */ } if (error == EINPROGRESS || error == EWOULDBLOCK) { ods_log_debug("[%s] zone %s zero write, write again later (%s)", xfrd_str, zone->name, strerror(error)); return; /* try again later */ } if (error != 0) { ods_log_error("[%s] zone %s cannot tcp connect to %s: %s", xfrd_str, zone->name, xfrd->master->address, strerror(errno)); xfrd_set_timer_now(xfrd); xfrd_tcp_release(xfrd, set, 1); return; } } ret = tcp_conn_write(tcp); if(ret == -1) { ods_log_error("[%s] zone %s cannot tcp write to %s: %s", xfrd_str, zone->name, xfrd->master->address, strerror(errno)); xfrd_set_timer_now(xfrd); xfrd_tcp_release(xfrd, set, 1); return; } if (ret == 0) { ods_log_debug("[%s] zone %s zero write, write again later", xfrd_str, zone->name); return; /* write again later */ } /* done writing, get ready for reading */ ods_log_debug("[%s] zone %s done writing, get ready for reading", xfrd_str, zone->name); tcp->is_reading = 1; tcp_conn_ready(tcp); xfrd->handler.event_types = NETIO_EVENT_READ|NETIO_EVENT_TIMEOUT; xfrd_tcp_read(xfrd, set); } /** * Open tcp connection. * */ static int xfrd_tcp_open(xfrd_type* xfrd, tcp_set_type* set) { int fd, family, conn; struct sockaddr_storage to; socklen_t to_len; zone_type* zone = NULL; ods_log_assert(set); ods_log_assert(xfrd); ods_log_assert(xfrd->tcp_conn != -1); ods_log_assert(xfrd->master); ods_log_assert(xfrd->master->address); zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->name); ods_log_debug("[%s] zone %s open tcp connection to %s", xfrd_str, zone->name, xfrd->master->address); set->tcp_conn[xfrd->tcp_conn]->is_reading = 0; set->tcp_conn[xfrd->tcp_conn]->total_bytes = 0; set->tcp_conn[xfrd->tcp_conn]->msglen = 0; if (xfrd->master->family == AF_INET6) { family = PF_INET6; } else { family = PF_INET; } fd = socket(family, SOCK_STREAM, IPPROTO_TCP); set->tcp_conn[xfrd->tcp_conn]->fd = fd; if (fd == -1) { ods_log_error("[%s] zone %s cannot create tcp socket to %s: %s", xfrd_str, zone->name, xfrd->master->address, strerror(errno)); xfrd_set_timer_now(xfrd); xfrd_tcp_release(xfrd, set, 0); return 0; } if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) { ods_log_error("[%s] zone %s cannot fcntl tcp socket: %s", xfrd_str, zone->name, strerror(errno)); xfrd_set_timer_now(xfrd); xfrd_tcp_release(xfrd, set, 0); return 0; } to_len = xfrd_acl_sockaddr_to(xfrd->master, &to); /* bind it */ interface_type interface = xfrd->xfrhandler->engine->dnshandler->interfaces->interfaces[0]; if (!interface.address) { ods_log_error("[%s] unable to get the address of interface", xfrd_str); return -1; } if (acl_parse_family(interface.address) == AF_INET) { struct sockaddr_in addr; addr.sin_family = acl_parse_family(interface.address); addr.sin_addr = interface.addr.addr; addr.sin_port = 0; if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) != 0) { ods_log_error("[%s] unable to bind address %s: bind failed %s", xfrd_str, interface.address, strerror(errno)); return -1; } } else { struct sockaddr_in6 addr6; addr6.sin6_family = acl_parse_family(interface.address); addr6.sin6_addr = interface.addr.addr6; addr6.sin6_port = 0; if (bind(fd, (struct sockaddr *) &addr6, sizeof(addr6)) != 0) { ods_log_error("[%s] unable to bind address %s: bind failed %s", xfrd_str, interface.address, strerror(errno)); return -1; } } conn = connect(fd, (struct sockaddr*)&to, to_len); if (conn == -1 && errno != EINPROGRESS) { ods_log_error("[%s] zone %s cannot connect tcp socket to %s: %s", xfrd_str, zone->name, xfrd->master->address, strerror(errno)); xfrd_set_timer_now(xfrd); xfrd_tcp_release(xfrd, set, 0); return 0; } xfrd->handler.fd = fd; xfrd->handler.event_types = NETIO_EVENT_WRITE|NETIO_EVENT_TIMEOUT; xfrd_set_timer(xfrd, xfrd_time(xfrd) + XFRD_TCP_TIMEOUT); return 1; } /** * Obtain tcp. * */ static void xfrd_tcp_obtain(xfrd_type* xfrd, tcp_set_type* set) { xfrhandler_type* xfrhandler; int i = 0; ods_log_assert(set); ods_log_assert(xfrd); ods_log_assert(xfrd->tcp_conn == -1); ods_log_assert(xfrd->tcp_waiting == 0); if (set->tcp_count < TCPSET_MAX) { ods_log_assert(!set->tcp_waiting_first); set->tcp_count ++; /* find a free tcp_buffer */ for (i=0; i < TCPSET_MAX; i++) { if (set->tcp_conn[i]->fd == -1) { xfrd->tcp_conn = i; break; } } ods_log_assert(xfrd->tcp_conn != -1); xfrd->tcp_waiting = 0; /* stop udp use (if any) */ if (xfrd->handler.fd != -1) { xfrd_udp_release(xfrd); } if (!xfrd_tcp_open(xfrd, set)) { return; } xfrd_tcp_xfr(xfrd, set); return; } /* wait, at end of line */ ods_log_verbose("[%s] max number of tcp connections (%d) reached", xfrd_str, TCPSET_MAX); xfrd->tcp_waiting = 1; xfrd_unset_timer(xfrd); /* add it to the waiting queue */ xfrhandler = (xfrhandler_type*) xfrd->xfrhandler; xfrd->tcp_waiting_next = xfrhandler->tcp_waiting_first; xfrhandler->tcp_waiting_first = xfrd; } /** * Start xfr. * */ static void xfrd_tcp_xfr(xfrd_type* xfrd, tcp_set_type* set) { tcp_conn_type* tcp = NULL; zone_type* zone = NULL; ods_log_assert(set); ods_log_assert(xfrd); zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(xfrd->tcp_conn != -1); ods_log_assert(xfrd->tcp_waiting == 0); ods_log_assert(xfrd->master); ods_log_assert(xfrd->master->address); /* start AXFR or IXFR for the zone */ tcp = set->tcp_conn[xfrd->tcp_conn]; if (xfrd->msg_do_retransfer || xfrd->serial_xfr_acquired <= 0 || xfrd->master->ixfr_disabled) { ods_log_info("[%s] zone %s request axfr to %s", xfrd_str, zone->name, xfrd->master->address); buffer_pkt_query(tcp->packet, zone->apex, LDNS_RR_TYPE_AXFR, zone->klass); } else { ods_log_info("[%s] zone %s request tcp/ixfr=%u to %s", xfrd_str, zone->name, xfrd->soa.serial, xfrd->master->address); buffer_pkt_query(tcp->packet, zone->apex, LDNS_RR_TYPE_IXFR, zone->klass); buffer_pkt_set_nscount(tcp->packet, 1); xfrd_write_soa(xfrd, tcp->packet); } /* make packet */ xfrd->query_id = buffer_pkt_id(tcp->packet); xfrd->msg_seq_nr = 0; xfrd->msg_rr_count = 0; xfrd->msg_old_serial = 0; xfrd->msg_new_serial = 0; xfrd->msg_is_ixfr = 0; xfrd_tsig_sign(xfrd, tcp->packet); buffer_flip(tcp->packet); tcp->msglen = buffer_limit(tcp->packet); ods_log_verbose("[%s] zone %s sending tcp query id=%d", xfrd_str, zone->name, xfrd->query_id); /* wait for select to complete connect before write */ } /** * Read from tcp. * */ static void xfrd_tcp_read(xfrd_type* xfrd, tcp_set_type* set) { tcp_conn_type* tcp = NULL; int ret = 0; ods_log_assert(set); ods_log_assert(xfrd); ods_log_assert(xfrd->tcp_conn != -1); tcp = set->tcp_conn[xfrd->tcp_conn]; ret = tcp_conn_read(tcp); if (ret == -1) { xfrd_set_timer_now(xfrd); xfrd_tcp_release(xfrd, set, 1); return; } if (ret == 0) { return; } /* completed msg */ buffer_flip(tcp->packet); ret = xfrd_handle_packet(xfrd, tcp->packet); switch (ret) { case XFRD_PKT_MORE: tcp_conn_ready(tcp); break; case XFRD_PKT_XFR: case XFRD_PKT_NEWLEASE: ods_log_verbose("[%s] tcp read %s: release connection", xfrd_str, XFRD_PKT_XFR?"xfr":"newlease"); xfrd_tcp_release(xfrd, set, 1); ods_log_assert(xfrd->round_num == -1); break; case XFRD_PKT_NOTIMPL: xfrd->master->ixfr_disabled = time_now(); ods_log_verbose("[%s] disable ixfr requests for %s from now (%lu)", xfrd_str, xfrd->master->address, (unsigned long)xfrd->master->ixfr_disabled); /* break; */ case XFRD_PKT_BAD: default: ods_log_debug("[%s] tcp read %s: release connection", xfrd_str, ret==XFRD_PKT_BAD?"bad":"notimpl"); xfrd_tcp_release(xfrd, set, 1); xfrd_make_request(xfrd); break; } } /** * Release tcp connection from set for xfrd. If there are waiting TCP * connections open as many as free slots in set. This step is skipped * if open_waiting flag is unset. */ static void xfrd_tcp_release(xfrd_type* xfrd, tcp_set_type* set, int open_waiting) { xfrhandler_type* xfrhandler; int conn = 0; zone_type* zone = NULL; ods_log_assert(set); ods_log_assert(xfrd); ods_log_assert(xfrd->master); ods_log_assert(xfrd->master->address); ods_log_assert(xfrd->tcp_conn != -1); ods_log_assert(xfrd->tcp_waiting == 0); zone = (zone_type*) xfrd->zone; ods_log_debug("[%s] zone %s release tcp connection to %s", xfrd_str, zone->name, xfrd->master->address); conn = xfrd->tcp_conn; xfrd->tcp_conn = -1; xfrd->tcp_waiting = 0; xfrd->handler.fd = -1; xfrd->handler.event_types = NETIO_EVENT_READ|NETIO_EVENT_TIMEOUT; if (set->tcp_conn[conn]->fd != -1) { close(set->tcp_conn[conn]->fd); } set->tcp_conn[conn]->fd = -1; set->tcp_count --; /* see if there are any connections waiting for a slot. Or return. */ if (!open_waiting) return; xfrhandler = (xfrhandler_type*) xfrd->xfrhandler; while (xfrhandler->tcp_waiting_first && set->tcp_count < TCPSET_MAX) { int i; xfrd_type* waiting_xfrd = xfrhandler->tcp_waiting_first; xfrhandler->tcp_waiting_first = waiting_xfrd->tcp_waiting_next; waiting_xfrd->tcp_waiting_next = NULL; /* find a free tcp_buffer */ for (i=0; i < TCPSET_MAX; i++) { if (set->tcp_conn[i]->fd == -1) { waiting_xfrd->tcp_conn = i; set->tcp_count++; break; } } waiting_xfrd->tcp_waiting = 0; /* stop udp use (if any) */ if (waiting_xfrd->handler.fd != -1) { xfrd_udp_release(waiting_xfrd); } /* if xfrd_tcp_open() fails its slot in set->tcp_conn[] * is released. Continue to next. We don't put it back in the * waiting queue, it would keep the signer busy retrying, making * things only worse. */ if (xfrd_tcp_open(waiting_xfrd, set)) { xfrd_tcp_xfr(waiting_xfrd, set); } } } /** UDP **/ /** * Send packet over udp. * */ static int xfrd_udp_send(xfrd_type* xfrd, buffer_type* buffer) { struct sockaddr_storage to; socklen_t to_len = 0; int fd = -1; int family = PF_INET; ssize_t nb = -1; ods_log_assert(buffer); ods_log_assert(xfrd); ods_log_assert(xfrd->master); ods_log_assert(xfrd->master->address); /* this will set the remote port to acl->port or TCP_PORT */ to_len = xfrd_acl_sockaddr_to(xfrd->master, &to); /* get the address family of the remote host */ if (xfrd->master->family == AF_INET6) { family = PF_INET6; } /* create socket */ fd = socket(family, SOCK_DGRAM, IPPROTO_UDP); if (fd == -1) { ods_log_error("[%s] unable to send data over udp to %s: " "socket() failed (%s)", xfrd_str, xfrd->master->address, strerror(errno)); return -1; } /* bind it? */ /* send it (udp) */ ods_log_deeebug("[%s] send %lu bytes over udp to %s", xfrd_str, (unsigned long)buffer_remaining(buffer), xfrd->master->address); nb = sendto(fd, buffer_current(buffer), buffer_remaining(buffer), 0, (struct sockaddr*)&to, to_len); if (nb == -1) { ods_log_error("[%s] unable to send data over udp to %s: " "sendto() failed (%s)", xfrd_str, xfrd->master->address, strerror(errno)); close(fd); return -1; } return fd; } /** * Send IXFR request. * */ static int xfrd_udp_send_request_ixfr(xfrd_type* xfrd) { int fd; xfrhandler_type* xfrhandler = NULL; zone_type* zone = NULL; ods_log_assert(xfrd); ods_log_assert(xfrd->master); ods_log_assert(xfrd->master->address); zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->name); if (xfrd->tcp_conn != -1) { /* tcp is using the handler.fd */ ods_log_error("[%s] unable to transfer zone %s: tried to send " "udp while tcp obtained", xfrd_str, zone->name); return -1; } /* make packet */ xfrhandler = (xfrhandler_type*) xfrd->xfrhandler; ods_log_assert(xfrhandler); buffer_pkt_query(xfrhandler->packet, zone->apex, LDNS_RR_TYPE_IXFR, zone->klass); xfrd->query_id = buffer_pkt_id(xfrhandler->packet); xfrd->msg_seq_nr = 0; xfrd->msg_rr_count = 0; xfrd->msg_old_serial = 0; xfrd->msg_new_serial = 0; xfrd->msg_is_ixfr = 0; buffer_pkt_set_nscount(xfrhandler->packet, 1); xfrd_write_soa(xfrd, xfrhandler->packet); xfrd_tsig_sign(xfrd, xfrhandler->packet); buffer_flip(xfrhandler->packet); xfrd_set_timer(xfrd, xfrd_time(xfrd) + XFRD_UDP_TIMEOUT); ods_log_info("[%s] zone %s request udp/ixfr=%u to %s", xfrd_str, zone->name, xfrd->soa.serial, xfrd->master->address); if((fd = xfrd_udp_send(xfrd, xfrhandler->packet)) == -1) { return -1; } return fd; } /** * Obtain udp. * */ static void xfrd_udp_obtain(xfrd_type* xfrd) { xfrhandler_type* xfrhandler = NULL; ods_log_assert(xfrd); ods_log_assert(xfrd->xfrhandler); ods_log_assert(xfrd->udp_waiting == 0); xfrhandler = (void*) xfrd->xfrhandler; if (xfrd->tcp_conn != -1) { /* no tcp and udp at the same time */ xfrd_tcp_release(xfrd, xfrhandler->tcp_set, 1); } if (xfrhandler->udp_use_num < XFRD_MAX_UDP) { xfrhandler->udp_use_num++; xfrd->handler.fd = xfrd_udp_send_request_ixfr(xfrd); if (xfrd->handler.fd == -1) { xfrhandler->udp_use_num--; } return; } /* queue the zone as last */ xfrd->udp_waiting = 1; xfrd->udp_waiting_next = NULL; if (!xfrhandler->udp_waiting_first) { xfrhandler->udp_waiting_first = xfrd; } if (xfrhandler->udp_waiting_last) { xfrhandler->udp_waiting_last->udp_waiting_next = xfrd; } xfrhandler->udp_waiting_last = xfrd; xfrd_unset_timer(xfrd); } /** * Read packet from udp. * */ static int xfrd_udp_read_packet(xfrd_type* xfrd) { xfrhandler_type* xfrhandler = NULL; ssize_t received = 0; ods_log_assert(xfrd); xfrhandler = (xfrhandler_type*) xfrd->xfrhandler; ods_log_assert(xfrhandler); /* read the data */ buffer_clear(xfrhandler->packet); received = recvfrom(xfrd->handler.fd, buffer_begin(xfrhandler->packet), buffer_remaining(xfrhandler->packet), 0, NULL, NULL); if (received == -1) { ods_log_error("[%s] unable to read packet: recvfrom() failed fd %d " "(%s)", xfrd_str, xfrd->handler.fd, strerror(errno)); return 0; } buffer_set_limit(xfrhandler->packet, received); return 1; } /** * Read from udp. * */ static void xfrd_udp_read(xfrd_type* xfrd) { xfrhandler_type* xfrhandler = NULL; zone_type* zone = NULL; xfrd_pkt_status res = XFRD_PKT_BAD; ods_log_assert(xfrd); zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->name); ods_log_debug("[%s] zone %s read data from udp", xfrd_str, zone->name); if (!xfrd_udp_read_packet(xfrd)) { ods_log_error("[%s] unable to read data from udp zone %s: " "xfrd_udp_read_packet() failed", xfrd_str, zone->name); xfrd_udp_release(xfrd); return; } xfrhandler = (xfrhandler_type*) xfrd->xfrhandler; ods_log_assert(xfrhandler); res = xfrd_handle_packet(xfrd, xfrhandler->packet); switch (res) { case XFRD_PKT_TC: ods_log_verbose("[%s] truncation from %s", xfrd_str, xfrd->master->address); xfrd_udp_release(xfrd); xfrd_set_timer(xfrd, xfrd_time(xfrd) + XFRD_TCP_TIMEOUT); xfrd_tcp_obtain(xfrd, xfrhandler->tcp_set); break; case XFRD_PKT_XFR: case XFRD_PKT_NEWLEASE: ods_log_verbose("[%s] xfr/newlease from %s", xfrd_str, xfrd->master->address); /* nothing more to do */ ods_log_assert(xfrd->round_num == -1); xfrd_udp_release(xfrd); break; case XFRD_PKT_NOTIMPL: xfrd->master->ixfr_disabled = time_now(); ods_log_verbose("[%s] disable ixfr requests for %s from now (%lu)", xfrd_str, xfrd->master->address, (unsigned long)xfrd->master->ixfr_disabled); /* break; */ case XFRD_PKT_BAD: default: ods_log_debug("[%s] bad ixfr packet from %s", xfrd_str, xfrd->master->address); xfrd_udp_release(xfrd); xfrd_make_request(xfrd); break; } } /** * Release udp. * */ static void xfrd_udp_release(xfrd_type* xfrd) { xfrhandler_type* xfrhandler = NULL; ods_log_assert(xfrd); ods_log_assert(xfrd->udp_waiting == 0); if(xfrd->handler.fd != -1) close(xfrd->handler.fd); xfrd->handler.fd = -1; xfrhandler = (xfrhandler_type*) xfrd->xfrhandler; ods_log_assert(xfrhandler); /* see if there are waiting zones */ if (xfrhandler->udp_use_num == XFRD_MAX_UDP) { while (xfrhandler->udp_waiting_first) { /* snip off waiting list */ xfrd_type* wf = xfrhandler->udp_waiting_first; ods_log_assert(wf->udp_waiting); wf->udp_waiting = 0; xfrhandler->udp_waiting_first = wf->udp_waiting_next; if (xfrhandler->udp_waiting_last == wf) { xfrhandler->udp_waiting_last = NULL; } /* see if this zone needs udp connection */ if (wf->tcp_conn == -1) { wf->handler.fd = xfrd_udp_send_request_ixfr(wf); if (wf->handler.fd != -1) { return; } } } } /* no waiting zones */ if (xfrhandler->udp_use_num > 0) { xfrhandler->udp_use_num --; } } /** * Make a zone transfer request. * */ static void xfrd_make_request(xfrd_type* xfrd) { zone_type* zone = NULL; dnsin_type* dnsin = NULL; if (!xfrd || !xfrd->xfrhandler) { return; } zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(zone->adinbound); ods_log_assert(zone->adinbound->type == ADAPTER_DNS); ods_log_assert(zone->adinbound->config); dnsin = (dnsin_type*) zone->adinbound->config; if (xfrd->next_master != -1) { /* we are told to use this next master */ xfrd->master_num = xfrd->next_master; xfrd->master = NULL; /* acl_find_num(...) */ /* if there is no next master, fallback to use the first one */ if (!xfrd->master) { xfrd->master = dnsin->request_xfr; xfrd->master_num = 0; } /* fallback to cycle master */ xfrd->next_master = -1; xfrd->round_num = 0; /* fresh set of retries after notify */ } else { /* cycle master */ if (xfrd->round_num != -1 && xfrd->master && xfrd->master->next) { /* try the next master */ xfrd->master = xfrd->master->next; xfrd->master_num++; } else { /* start a new round */ xfrd->master = dnsin->request_xfr; xfrd->master_num = 0; xfrd->round_num++; } if (xfrd->round_num >= XFRD_MAX_ROUNDS) { /* tried all servers that many times, wait */ xfrd->round_num = -1; xfrd_set_timer_retry(xfrd); ods_log_verbose("[%s] zone %s make request wait retry", xfrd_str, zone->name); return; } } if (!xfrd->master) { ods_log_debug("[%s] unable to make request for zone %s: no master", xfrd_str, zone->name); xfrd->round_num = -1; xfrd_set_timer_retry(xfrd); return; } /* cache ixfr_disabled only for XFRD_NO_IXFR_CACHE time */ if (xfrd->master->ixfr_disabled && (xfrd->master->ixfr_disabled + XFRD_NO_IXFR_CACHE) <= xfrd_time(xfrd)) { ods_log_verbose("[%s] clear negative caching ixfr disabled for " "master %s", xfrd_str, xfrd->master->address); ods_log_debug("[%s] clear negative caching calc: %lu + %lu <= %lu", xfrd_str, (unsigned long) xfrd->master->ixfr_disabled, (unsigned long)XFRD_NO_IXFR_CACHE, (unsigned long) xfrd_time(xfrd)); xfrd->master->ixfr_disabled = 0; } /* perform xfr request */ if (xfrd->serial_xfr_acquired && !xfrd->master->ixfr_disabled && !xfrd->serial_retransfer) { xfrd_set_timer(xfrd, xfrd_time(xfrd) + XFRD_UDP_TIMEOUT); ods_log_verbose("[%s] zone %s make request [udp round %d master %s:%u]", xfrd_str, zone->name, xfrd->round_num, xfrd->master->address, xfrd->master->port); xfrd_udp_obtain(xfrd); } else if (!xfrd->serial_xfr_acquired || xfrd->master->ixfr_disabled || xfrd->serial_retransfer) { xfrhandler_type* xfrhandler = (xfrhandler_type*) xfrd->xfrhandler; ods_log_assert(xfrhandler); if (xfrd->serial_retransfer) { xfrd->msg_do_retransfer = 1; xfrd->serial_retransfer = 0; } xfrd_set_timer(xfrd, xfrd_time(xfrd) + XFRD_TCP_TIMEOUT); ods_log_verbose("[%s] zone %s make request [tcp round %d master %s:%u]", xfrd_str, zone->name, xfrd->round_num, xfrd->master->address, xfrd->master->port); xfrd_tcp_obtain(xfrd, xfrhandler->tcp_set); } } /** * Handle zone transfer. * */ static void xfrd_handle_zone(netio_type* ATTR_UNUSED(netio), netio_handler_type* handler, netio_events_type event_types) { xfrd_type* xfrd = NULL; zone_type* zone = NULL; if (!handler) { return; } xfrd = (xfrd_type*) handler->user_data; ods_log_assert(xfrd); zone = (zone_type*) xfrd->zone; ods_log_assert(zone); ods_log_assert(zone->name); if (xfrd->tcp_conn != -1) { /* busy in tcp transaction */ xfrhandler_type* xfrhandler = (xfrhandler_type*) xfrd->xfrhandler; ods_log_assert(xfrhandler); if (event_types & NETIO_EVENT_READ) { ods_log_deeebug("[%s] zone %s event tcp read", xfrd_str, zone->name); xfrd_set_timer(xfrd, xfrd_time(xfrd) + XFRD_TCP_TIMEOUT); xfrd_tcp_read(xfrd, xfrhandler->tcp_set); return; } else if (event_types & NETIO_EVENT_WRITE) { ods_log_deeebug("[%s] zone %s event tcp write", xfrd_str, zone->name); xfrd_set_timer(xfrd, xfrd_time(xfrd) + XFRD_TCP_TIMEOUT); xfrd_tcp_write(xfrd, xfrhandler->tcp_set); return; } else if (event_types & NETIO_EVENT_TIMEOUT) { /* tcp connection timed out. Stop it. */ ods_log_deeebug("[%s] zone %s event tcp timeout", xfrd_str, zone->name); xfrd_tcp_release(xfrd, xfrhandler->tcp_set, 1); /* continue to retry; as if a timeout happened */ event_types = NETIO_EVENT_TIMEOUT; } } if (event_types & NETIO_EVENT_READ) { /* busy in udp transaction */ ods_log_deeebug("[%s] zone %s event udp read", xfrd_str, zone->name); xfrd_set_timer_now(xfrd); xfrd_udp_read(xfrd); return; } /* timeout */ ods_log_deeebug("[%s] zone %s timeout", xfrd_str, zone->name); if (handler->fd != -1) { ods_log_assert(xfrd->tcp_conn == -1); xfrd_udp_release(xfrd); } if (xfrd->tcp_waiting) { ods_log_deeebug("[%s] zone %s skips retry: tcp connections full", xfrd_str, zone->name); xfrd_unset_timer(xfrd); return; } if (xfrd->udp_waiting) { ods_log_deeebug("[%s] zone %s skips retry: udp connections full", xfrd_str, zone->name); xfrd_unset_timer(xfrd); return; } /* make a new request */ xfrd_make_request(xfrd); } /** * Backup xfrd domain names. * */ static void xfrd_backup_dname(FILE* out, uint8_t* dname) { uint8_t* d= dname+1; uint8_t len = *d++; uint8_t i; if (dname[0]<=1) { fprintf(out, "."); return; } while (len) { ods_log_assert(d - (dname+1) <= dname[0]); for (i=0; izone; char* file = NULL; int timeout = 0; FILE* fd = NULL; if (zone && zone->name) { file = ods_build_path(zone->name, ".xfrd-state", 0, 1); if (file) { fd = ods_fopen(file, NULL, "w"); if (fd) { if (xfrd->handler.timeout) { timeout = xfrd->timeout.tv_sec; } fprintf(fd, "%s\n", ODS_SE_FILE_MAGIC_V3); fprintf(fd, ";;Zone: name %s ttl %u mname ", zone->name, (unsigned) xfrd->soa.ttl); xfrd_backup_dname(fd, xfrd->soa.mname), fprintf(fd, " rname "); xfrd_backup_dname(fd, xfrd->soa.rname), fprintf(fd, " serial %u refresh %u retry %u expire %u " "minimum %u\n", (unsigned) xfrd->soa.serial, (unsigned) xfrd->soa.refresh, (unsigned) xfrd->soa.retry, (unsigned) xfrd->soa.expire, (unsigned) xfrd->soa.minimum); fprintf(fd, ";;Master: num %d next %d round %d timeout %d\n", xfrd->master_num, xfrd->next_master, xfrd->round_num, timeout); fprintf(fd, ";;Serial: xfr %u %u notify %u %u disk %u %u\n", (unsigned) xfrd->serial_xfr, (unsigned) xfrd->serial_xfr_acquired, (unsigned) xfrd->serial_notify, (unsigned) xfrd->serial_notify_acquired, (unsigned) xfrd->serial_disk, (unsigned) xfrd->serial_disk_acquired); fprintf(fd, "%s\n", ODS_SE_FILE_MAGIC_V3); ods_fclose(fd); } free(file); } } } /** * Unlink xfrd file. * */ static void xfrd_unlink(xfrd_type* xfrd) { zone_type* zone = (zone_type*) xfrd->zone; char* file = NULL; if (zone && zone->name) { ods_log_info("[%s] unlink zone %s xfrd state", xfrd_str, zone->name); file = ods_build_path(zone->name, ".xfrd-state", 0, 1); if (file) { (void)unlink(file); free(file); } } } /** * Cleanup zone transfer structure. * */ void xfrd_cleanup(xfrd_type* xfrd, int backup) { if (!xfrd) { return; } /* backup */ if (backup) { xfrd_backup(xfrd); } else { xfrd_unlink(xfrd); } tsig_rr_cleanup(xfrd->tsig_rr); pthread_mutex_destroy(&xfrd->serial_lock); pthread_mutex_destroy(&xfrd->rw_lock); free(xfrd); } opendnssec-2.1.13/signer/src/wire/buffer.h0000644000077000001440000003764214446272525015352 00000000000000/* * 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. * */ /** * Packet buffer. * */ #ifndef WIRE_BUFFER_H #define WIRE_BUFFER_H #include "config.h" #include "status.h" #include "log.h" #include "status.h" #include #include #define BUFFER_PKT_HEADER_SIZE 12 #define MAXDOMAINLEN 255 #define MAXLABELLEN 63 #define MAX_RDLENGTH 65535 #define MAX_RR_SIZE \ (MAXDOMAINLEN + sizeof(uint32_t) + 4*sizeof(uint16_t) + MAX_RDLENGTH) #define MAX_PACKET_SIZE 65535 #define PACKET_BUFFER_SIZE (MAX_PACKET_SIZE + MAX_RR_SIZE) #define QR_MASK 0x80U #define QR_SHIFT 7 #define QR(packet) (*buffer_at((packet), 2) & QR_MASK) #define QR_SET(packet) (*buffer_at((packet), 2) |= QR_MASK) #define QR_CLR(packet) (*buffer_at((packet), 2) &= ~QR_MASK) #define OPCODE_MASK 0x78U #define OPCODE_SHIFT 3 #define OPCODE(packet) ((*buffer_at((packet), 2) & OPCODE_MASK) >> OPCODE_SHIFT) #define OPCODE_SET(packet, opcode) \ (*buffer_at((packet), 2) = (*buffer_at((packet), 2) & ~OPCODE_MASK) | ((opcode) << OPCODE_SHIFT)) #define AA_MASK 0x04U #define AA_SHIFT 2 #define AA(packet) (*buffer_at((packet), 2) & AA_MASK) #define AA_SET(packet) (*buffer_at((packet), 2) |= AA_MASK) #define AA_CLR(packet) (*buffer_at((packet), 2) &= ~AA_MASK) #define TC_MASK 0x02U #define TC_SHIFT 1 #define TC(packet) (*buffer_at((packet), 2) & TC_MASK) #define TC_SET(packet) (*buffer_at((packet), 2) |= TC_MASK) #define TC_CLR(packet) (*buffer_at((packet), 2) &= ~TC_MASK) #define RD_MASK 0x01U #define RD_SHIFT 0 #define RD(packet) (*buffer_at((packet), 2) & RD_MASK) #define RD_SET(packet) (*buffer_at((packet), 2) |= RD_MASK) #define RD_CLR(packet) (*buffer_at((packet), 2) &= ~RD_MASK) #define RA_MASK 0x80U #define RA_SHIFT 7 #define RA(packet) (*buffer_at((packet), 3) & RA_MASK) #define RA_SET(packet) (*buffer_at((packet), 3) |= RA_MASK) #define RA_CLR(packet) (*buffer_at((packet), 3) &= ~RA_MASK) #define AD_MASK 0x20U #define AD_SHIFT 5 #define AD(packet) (*buffer_at((packet), 3) & AD_MASK) #define AD_SET(packet) (*buffer_at((packet), 3) |= AD_MASK) #define AD_CLR(packet) (*buffer_at((packet), 3) &= ~AD_MASK) #define CD_MASK 0x10U #define CD_SHIFT 4 #define CD(packet) (*buffer_at((packet), 3) & CD_MASK) #define CD_SET(packet) (*buffer_at((packet), 3) |= CD_MASK) #define CD_CLR(packet) (*buffer_at((packet), 3) &= ~CD_MASK) #define RCODE_MASK 0x0fU #define RCODE_SHIFT 0 #define RCODE(packet) (*buffer_at((packet), 3) & RCODE_MASK) #define RCODE_SET(packet, rcode) \ (*buffer_at((packet), 3) = (*buffer_at((packet), 3) & ~RCODE_MASK) | (rcode)) extern ods_lookup_table ods_rcode_str[]; /** * Buffer. */ typedef struct buffer_struct buffer_type; struct buffer_struct { size_t position; size_t limit; size_t capacity; uint8_t* data; unsigned fixed : 1; }; /** * Create a new buffer with the specified capacity. * \param[in] allocator memory allocator * \param[in] capacity specified capacity * \return buffer_type* buffer * */ extern buffer_type* buffer_create(size_t capacity); /** * Clear the buffer and make it ready for writing. * The buffer's limit is set to the capacity and the position is set to 0. * \param[in] buffer buffer * */ extern void buffer_clear(buffer_type* buffer); /** * Flip the buffer and make it ready for reading. * The data that has been written to the buffer. * The buffer's limit is set to the current position and the position is set * to 0. * \param[in] buffer buffer * */ void buffer_flip(buffer_type* buffer); /** * Get the buffer's position. * \param[in] buffer buffer * \return size_t position * */ extern size_t buffer_position(buffer_type* buffer); /** * Set the buffer's position. * The position must be less than or equal to the buffer's limit. * \param[in] buffer buffer * \param[in] pos position * */ extern void buffer_set_position(buffer_type* buffer, size_t pos); /** * Change the buffer's position. * The position must not be moved behind the buffer's limit or before the * beginning of the buffer. * \param[in] buffer buffer * \param[in] count number of bytes to skip * */ extern void buffer_skip(buffer_type* buffer, ssize_t count); /** * Change the buffer's position so that one dname is skipped. * \param[in] buffer buffer * \return int 0 if dname skipping failed * 1 otherwise * */ extern int buffer_skip_dname(buffer_type* buffer); /** * Change the buffer's position so that one RR is skipped. * \param[in] buffer buffer * \param[in] qrr 1 if we skip RRs in the question section. * \return int 0 if RR skipping failed * 1 otherwise * */ extern int buffer_skip_rr(buffer_type* buffer, unsigned qrr); /** * Get the buffer's limit. * \param[in] buffer buffer * \return size_t limit * */ extern size_t buffer_limit(buffer_type* buffer); /** * Set the buffer's limit. If the buffer's position is greater * than the new limit, the position is set to the limit. * \param[in] buffer buffer * \param[in] limit limit * */ extern void buffer_set_limit(buffer_type* buffer, size_t limit); /** * Get the buffer's capacity. * \param[in] buffer buffer * \return size_t capacity * */ extern size_t buffer_capacity(buffer_type* buffer); /** * Return a pointer to the data at the indicated position. * \param[in] buffer buffer * \param[in] at indicated position * \return uint8_t* pointer to the data at the indicated position * */ extern uint8_t* buffer_at(buffer_type* buffer, size_t at); /** * Return a pointer to the data at the beginning of the buffer. * \param[in] buffer buffer * \return uint8_t* pointer to the data at the begin of the buffer * */ extern uint8_t* buffer_begin(buffer_type* buffer); /** * Return a pointer to the data at the buffer's current position. * \param[in] buffer buffer * \return uint8_t* pointer to the data at the buffer's current position * */ extern uint8_t* buffer_current(buffer_type* buffer); /** * The number of bytes remaining between the buffer's position and limit. * \param[in] buffer buffer * \return size_t remaining number of bytes * */ extern size_t buffer_remaining(buffer_type* buffer); /** * Check if the buffer has enough bytes available. * \param[in] buffer buffer * \param[in] count number of bytes that needs to be available * \return int 0 if not enough bytes are available * 1 otherwise * */ extern int buffer_available(buffer_type* buffer, size_t count); /** * Write to buffer. * \param[in] buffer buffer * \param[in] data data to write * \param[in] count number of bytes to write * */ extern void buffer_write(buffer_type* buffer, const void* data, size_t count); /** * Write uint8_t to buffer. * \param[in] buffer buffer * \param[in] data data to write * */ extern void buffer_write_u8(buffer_type* buffer, uint8_t data); /** * Write uint16_t to buffer. * \param[in] buffer buffer * \param[in] data data to write * */ extern void buffer_write_u16(buffer_type* buffer, uint16_t data); /** * Write uint16_t to buffer at indicated position. * \param[in] buffer buffer * \param[in] at indicated position * \param[in] data data to write * */ extern void buffer_write_u16_at(buffer_type* buffer, size_t at, uint16_t data); /** * Write uint32_t to buffer. * \param[in] buffer buffer * \param[in] data data to write * */ extern void buffer_write_u32(buffer_type* buffer, uint32_t data); /** * Write rdf to buffer. * \param[in] buffer buffer * \param[in] rdf data to write * */ extern void buffer_write_rdf(buffer_type* buffer, ldns_rdf* rdf); /** * Write rr to buffer. * \param[in] buffer buffer * \param[in] rr data to write * \return int 1 if rr fits, 0 otherwise * */ extern int buffer_write_rr(buffer_type* buffer, ldns_rr* rr); /** * Read from buffer. * \param[in] buffer buffer * \param[in] data read data * \param[in] count number of bytes to read * */ extern void buffer_read(buffer_type* buffer, void* data, size_t count); /** * Read uint8_t from buffer. * \param[in] buffer buffer * \return uint8_t read data * */ extern uint8_t buffer_read_u8(buffer_type* buffer); /** * Read uint16_t from buffer. * \param[in] buffer buffer * \return uint16_t read data * */ extern uint16_t buffer_read_u16(buffer_type* buffer); /** * Read uint32_t from buffer. * \param[in] buffer buffer * \return uint32_t read data * */ extern uint32_t buffer_read_u32(buffer_type* buffer); /** * Read dname from buffer. * \param[in] buffer buffer * \param[out] dname dname * \param[in] allow_pointers allow pointer labels * \return int dname length * */ extern size_t buffer_read_dname(buffer_type* buffer, uint8_t* dname, unsigned allow_pointers); /** * Get query id from buffer. * \param[in] buffer buffer * \return uint16_t query id * */ extern uint16_t buffer_pkt_id(buffer_type* buffer); /** * Set random query id in buffer. * \param[in] buffer buffer * */ extern void buffer_pkt_set_random_id(buffer_type* buffer); /** * Get flags from buffer. * \param[in] buffer buffer * \return uint16_t flags * */ extern uint16_t buffer_pkt_flags(buffer_type* buffer); /** * Set flags in buffer. * \param[in] buffer buffer * \param[in] flags flags * */ extern void buffer_pkt_set_flags(buffer_type* buffer, uint16_t flags); /** * Get QR bit from buffer. * \param[in] buffer buffer * \return int 0 if QR bit is clear * 1 if QR bit is set * */ extern int buffer_pkt_qr(buffer_type* buffer); /** * Set QR bit in buffer. * \param[in] buffer buffer * */ extern void buffer_pkt_set_qr(buffer_type* buffer); /** * Clear QR bit in buffer. * \param[in] buffer buffer * */ extern void buffer_pkt_clear_qr(buffer_type* buffer); /** * Get AA bit from buffer. * \param[in] buffer buffer * \return int 0 if AA bit is clear * 1 if AA bit is set * */ extern int buffer_pkt_aa(buffer_type* buffer); /** * Set AA bit in buffer. * \param[in] buffer buffer * */ extern void buffer_pkt_set_aa(buffer_type* buffer); /** * Get TC bit from buffer. * \param[in] buffer buffer * \return int 0 if TC bit is clear * 1 if TC bit is set * */ extern int buffer_pkt_tc(buffer_type* buffer); /** * Get RD bit from buffer. * \param[in] buffer buffer * \return int 0 if RD bit is clear * 1 if RD bit is set * */ extern int buffer_pkt_rd(buffer_type* buffer); /** * Get RA bit from buffer. * \param[in] buffer buffer * \return int 0 if RA bit is clear * 1 if RA bit is set * */ extern int buffer_pkt_ra(buffer_type* buffer); /** * Get AD bit from buffer. * \param[in] buffer buffer * \return int 0 if AD bit is clear * 1 if AD bit is set * */ extern int buffer_pkt_ad(buffer_type* buffer); /** * Get CD bit from buffer. * \param[in] buffer buffer * \return int 0 if CD bit is clear * 1 if CD bit is set * */ extern int buffer_pkt_cd(buffer_type* buffer); /** * Get OPCODE from buffer. * \param[in] buffer buffer * \return ldns_pkt_opcode OPCODE * */ extern ldns_pkt_opcode buffer_pkt_opcode(buffer_type* buffer); /** * Set OPCODE in buffer. * \param[in] buffer buffer * \param[in] opcode OPCODE * */ extern void buffer_pkt_set_opcode(buffer_type* buffer, ldns_pkt_opcode opcode); /** * Get RCODE from buffer. * \param[in] buffer buffer * \return ldns_pkt_rcode RCODE * */ extern ldns_pkt_rcode buffer_pkt_rcode(buffer_type* buffer); /** * Set RCODE in buffer. * \param[in] buffer buffer * \param[in] rcode RCODE * */ extern void buffer_pkt_set_rcode(buffer_type* buffer, ldns_pkt_rcode rcode); /** * Look up a descriptive text by each rcode. * \param[in] rcode rcode * \return const char* descriptive text * */ extern const char* buffer_rcode2str(ldns_pkt_rcode rcode); /** * Get QDCOUNT from buffer. * \param[in] buffer buffer * \return uint16_t QDCOUNT * */ extern uint16_t buffer_pkt_qdcount(buffer_type* buffer); /** * Set QDCOUNT in buffer. * \param[in] buffer buffer * \param[in] count QDCOUNT * */ extern void buffer_pkt_set_qdcount(buffer_type* buffer, uint16_t count); /** * Get ANCOUNT from buffer. * \param[in] buffer buffer * \return uint16_t ANCOUNT * */ extern uint16_t buffer_pkt_ancount(buffer_type* buffer); /** * Set ANCOUNT in buffer. * \param[in] buffer buffer * \param[in] count ANCOUNT * */ extern void buffer_pkt_set_ancount(buffer_type* buffer, uint16_t count); /** * Get NSCOUNT from buffer. * \param[in] buffer buffer * \return uint16_t NSCOUNT * */ extern uint16_t buffer_pkt_nscount(buffer_type* buffer); /** * Set NSCOUNT in buffer. * \param[in] buffer buffer * \param[in] count NSCOUNT * */ extern void buffer_pkt_set_nscount(buffer_type* buffer, uint16_t count); /** * Get ARCOUNT from buffer. * \param[in] buffer buffer * \return uint16_t ARCOUNT * */ extern uint16_t buffer_pkt_arcount(buffer_type* buffer); /** * Set ARCOUNT in buffer. * \param[in] buffer buffer * \param[in] count ARCOUNT * */ extern void buffer_pkt_set_arcount(buffer_type* buffer, uint16_t count); /** * Make a new query. * \param[in] buffer buffer * \param[in] qname qname * \param[in] qtype qtype * \param[in] qclass qclass * */ extern void buffer_pkt_query(buffer_type* buffer, ldns_rdf* qname, ldns_rr_type qtype, ldns_rr_class qclass); /** * Make a new notify. * \param[in] buffer buffer * \param[in] qname qname * \param[in] qclass qclass * */ extern void buffer_pkt_notify(buffer_type* buffer, ldns_rdf* qname, ldns_rr_class qclass); /** * Clean up buffer. * \param[in] buffer buffer * \param[in] allocator memory allocator * */ extern void buffer_cleanup(buffer_type* buffer); /** UTIL **/ /* * Copy data allowing for unaligned accesses in network byte order * (big endian). */ static inline uint16_t read_uint16(const void *src) { #ifdef ALLOW_UNALIGNED_ACCESSES return ntohs(* (uint16_t *) src); #else uint8_t *p = (uint8_t *) src; return (p[0] << 8) | p[1]; #endif } static inline uint32_t read_uint32(const void *src) { #ifdef ALLOW_UNALIGNED_ACCESSES return ntohl(* (uint32_t *) src); #else uint8_t *p = (uint8_t *) src; return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; #endif } static inline void write_uint16(void *dst, uint16_t data) { #ifdef ALLOW_UNALIGNED_ACCESSES * (uint16_t *) dst = htons(data); #else uint8_t *p = (uint8_t *) dst; p[0] = (uint8_t) ((data >> 8) & 0xff); p[1] = (uint8_t) (data & 0xff); #endif } static inline void write_uint32(void *dst, uint32_t data) { #ifdef ALLOW_UNALIGNED_ACCESSES * (uint32_t *) dst = htonl(data); #else uint8_t *p = (uint8_t *) dst; p[0] = (uint8_t) ((data >> 24) & 0xff); p[1] = (uint8_t) ((data >> 16) & 0xff); p[2] = (uint8_t) ((data >> 8) & 0xff); p[3] = (uint8_t) (data & 0xff); #endif } #endif /* WIRE_BUFFER_H */ opendnssec-2.1.13/signer/src/wire/edns.h0000644000077000001440000000624614446272525015026 00000000000000/* * Copyright (c) 2011 NLNet Labs. All rights reserved. * * Taken from NSD3 and adjusted for OpenDNSSEC, NLnet Labs. * * 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. * */ /** * EDNS. * */ #ifndef WIRE_EDNS_H #define WIRE_EDNS_H #include "config.h" #include "status.h" #include "wire/buffer.h" #include #define OPT_LEN 9U /* length of the NSD EDNS response record minus 2 */ #define OPT_RDATA 2 /* holds the rdata length comes after OPT_LEN */ #define DNSSEC_OK_MASK 0x8000U /* do bit mask */ #define EDNS_MAX_MESSAGE_LEN 4096 /** * EDNS data. * */ typedef struct edns_data_struct edns_data_type; struct edns_data_struct { unsigned char ok[OPT_LEN]; unsigned char error[OPT_LEN]; unsigned char rdata_none[OPT_RDATA]; }; /** * EDNS status. * */ enum edns_status_enum { EDNS_NOT_PRESENT, EDNS_OK, EDNS_ERROR }; typedef enum edns_status_enum edns_status; /** * EDNS RR. * */ typedef struct edns_rr_struct edns_rr_type; struct edns_rr_struct { edns_status status; size_t position; size_t maxlen; int dnssec_ok; }; /** * Initialize EDNS. * \param[in] data EDNS data. * \param[in] max_length maximum length. * */ extern void edns_init(edns_data_type* data, uint16_t max_length); /** * Create new EDNS RR. * \param[in] allocator memory allocator. * \return edns_rr_type* EDNS RR. * */ extern edns_rr_type* edns_rr_create(void); /** * Reset EDNS OPT RR. * \param[in] err EDNS record. * */ extern void edns_rr_reset(edns_rr_type* err); /** * Parse EDNS OPT RR. * \param[in] err EDNS record. * \param[in] buffer packet buffer. * \return int 1 if EDNS and valid, 0 otherwise. * */ extern int edns_rr_parse(edns_rr_type* err, buffer_type* buffer); /** * The amount of space to reserve in the response for the EDNS data. * \param[in] err EDNS record. * \return size_t amount of space to reserve. * */ extern size_t edns_rr_reserved_space(edns_rr_type* err); extern void edns_rr_cleanup(edns_rr_type* err); #endif /* WIRE_EDNS_H */ opendnssec-2.1.13/signer/src/wire/notify.h0000644000077000001440000000527314446272525015404 00000000000000/* * 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. * */ /** * Notify sending. * */ #ifndef WIRE_NOTIFY_H #define WIRE_NOTIFY_H #include "config.h" #include typedef struct notify_struct notify_type; #include "status.h" #include "wire/acl.h" #include "wire/buffer.h" #include "wire/netio.h" #include "wire/tsig.h" #include "daemon/xfrhandler.h" #include "signer/zone.h" #define NOTIFY_MAX_UDP 50 #define NOTIFY_MAX_RETRY 5 #define NOTIFY_RETRY_TIMEOUT 15 /** * Notify. * */ struct notify_struct { notify_type* waiting_next; ldns_rr* soa; tsig_rr_type* tsig_rr; acl_type* secondary; zone_type* zone; xfrhandler_type* xfrhandler; netio_handler_type handler; struct timespec timeout; uint16_t query_id; uint8_t retry; unsigned is_waiting : 1; }; /** * Create notify structure. * \param[in] xfrhandler zone transfer handler * \param[in] zone zone reference * \return notify_type* notify structure. * */ extern notify_type* notify_create(xfrhandler_type* xfrhandler, zone_type* zone); /** * Enable notify. * \param[in] notify notify structure * \param[in] soa current soa * */ extern void notify_enable(notify_type* notify, ldns_rr* soa); /** * Send notify. * \param[in] notify notify structure * */ extern void notify_send(notify_type* notify); /** * Cleanup notify structure. * \param[in] notify notify structure. * */ extern void notify_cleanup(notify_type* notify); #endif /* WIRE_NOTIFY_H */ opendnssec-2.1.13/signer/src/wire/acl.c0000644000077000001440000003170214446272525014622 00000000000000/* * 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. * */ /** * Access Control List. * */ #include "config.h" #include "log.h" #include "file.h" #include "status.h" #include "wire/acl.h" static const char* acl_str = "acl"; /** * Returns range type. * mask is the 2nd part of the range. * */ static acl_range_type acl_parse_range_type(char* ip, char** mask) { char *p; if((p=strchr(ip, '&'))!=0) { *p = 0; *mask = p+1; return ACL_RANGE_MASK; } if((p=strchr(ip, '/'))!=0) { *p = 0; *mask = p+1; return ACL_RANGE_SUBNET; } if((p=strchr(ip, '-'))!=0) { *p = 0; *mask = p+1; return ACL_RANGE_MINMAX; } *mask = 0; return ACL_RANGE_SINGLE; } /** * Parses subnet mask, fills 0 mask as well * */ static ods_status acl_parse_range_subnet(char* p, void* addr, int maxbits) { int subnet_bits = atoi(p); uint8_t* addr_bytes = (uint8_t*)addr; if (subnet_bits == 0 && strcmp(p, "0")!=0) { return ODS_STATUS_ACL_SUBNET_BAD_RANGE; } if (subnet_bits < 0 || subnet_bits > maxbits) { return ODS_STATUS_ACL_SUBNET_OUT_RANGE; } /* fill addr with n bits of 1s (struct has been zeroed) */ while(subnet_bits >= 8) { *addr_bytes++ = 0xff; subnet_bits -= 8; } if(subnet_bits > 0) { uint8_t shifts[] = {0x0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; *addr_bytes = shifts[subnet_bits]; } return ODS_STATUS_OK; } /** * Parse family from address. * */ int acl_parse_family(const char* a) { /* see if addr is ipv6 or ipv4 -- by : and . */ while (*a) { if (*a == '.') { return AF_INET; } if (*a == ':') { return AF_INET6; } ++a; } /* default to v4 */ return AF_INET; } /** * Create ACL. * */ acl_type* acl_create(char* address, char* port, char* tsig_name, tsig_type* tsig) { ods_status status = ODS_STATUS_OK; acl_type* acl = NULL; char* p = NULL; CHECKALLOC(acl = (acl_type*) malloc(sizeof(acl_type))); acl->address = NULL; acl->next = NULL; acl->tsig = NULL; if (tsig_name) { acl->tsig = tsig_lookup_by_name(tsig, tsig_name); if (!acl->tsig) { ods_log_error("[%s] unable to create acl: tsig %s not found", acl_str, tsig_name); acl_cleanup(acl); return NULL; } } acl->port = 0; if (port) { acl->port = atoi((const char*) port); } memset(&acl->addr, 0, sizeof(union acl_addr_storage)); memset(&acl->range_mask, 0, sizeof(union acl_addr_storage)); if (address) { acl->family = acl_parse_family(address); acl->range_type = acl_parse_range_type(address, &p); acl->address = strdup(address); if (!acl->address) { ods_log_error("[%s] unable to create acl: allocator_strdup() " "failed", acl_str); acl_cleanup(acl); return NULL; } if (acl->family == AF_INET6) { if (inet_pton(AF_INET6, acl->address, &acl->addr.addr6) != 1) { ods_log_error("[%s] unable to create acl: bad ipv6 address " "(%s)", acl_str, acl->address); acl_cleanup(acl); return NULL; } if (acl->range_type == ACL_RANGE_MASK || acl->range_type == ACL_RANGE_MINMAX) { if (inet_pton(AF_INET6, p, &acl->range_mask.addr6) != 1) { ods_log_error("[%s] unable to create acl: bad ipv6 address" " mask (%s)", acl_str, p); acl_cleanup(acl); return NULL; } } else if (acl->range_type == ACL_RANGE_SUBNET) { status = acl_parse_range_subnet(p, &acl->range_mask.addr6, 128); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to create acl: %s (%s)", acl_str, ods_status2str(status), p); acl_cleanup(acl); return NULL; } } } else if (acl->family == AF_INET) { if (inet_pton(AF_INET, acl->address, &acl->addr.addr) != 1) { ods_log_error("[%s] unable to create acl: bad ipv4 address " "(%s)", acl_str, acl->address); acl_cleanup(acl); return NULL; } if (acl->range_type == ACL_RANGE_MASK || acl->range_type == ACL_RANGE_MINMAX) { if (inet_pton(AF_INET, p, &acl->range_mask.addr) != 1) { ods_log_error("[%s] unable to create acl: bad ipv4 address" " mask (%s)", acl_str, p); acl_cleanup(acl); return NULL; } } else if (acl->range_type == ACL_RANGE_SUBNET) { status = acl_parse_range_subnet(p, &acl->range_mask.addr, 32); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to create acl: %s (%s)", acl_str, ods_status2str(status), p); acl_cleanup(acl); return NULL; } } } } acl->ixfr_disabled = 0; return acl; } /** * ACL matches address mask. * */ static int acl_addr_matches_mask(uint32_t* a, uint32_t* b, uint32_t* mask, size_t sz) { size_t i = 0; ods_log_assert(sz % 4 == 0); sz /= 4; for (i=0; i x[i]) { return 0; } if (checkmax && maxval[i] < x[i]) { return 0; } /* if x is equal to a bound, that bound needs further checks */ if (checkmin && minval[i] != x[i]) { checkmin = 0; } if (checkmax && maxval[i]!=x[i]) { checkmax = 0; } if (!checkmin && !checkmax) { return 1; /* will always match */ } } return 1; } /** * ACL matches address. * */ static int acl_addr_matches(acl_type* acl, struct sockaddr_storage* addr) { if (!acl) { return 0; } if (!acl->address) { /* all addresses match */ return 1; } if (acl->family == AF_INET6) { struct sockaddr_in6* addr6 = (struct sockaddr_in6*) addr; if (addr->ss_family != AF_INET6) { return 0; } if (acl->port != 0 && acl->port != ntohs(addr6->sin6_port)) { return 0; } switch(acl->range_type) { case ACL_RANGE_MASK: case ACL_RANGE_SUBNET: if (!acl_addr_matches_mask((uint32_t*)&acl->addr.addr6, (uint32_t*)&addr6->sin6_addr, (uint32_t*)&acl->range_mask.addr6, sizeof(struct in6_addr))) { return 0; } break; case ACL_RANGE_MINMAX: if (!acl_addr_matches_range((uint32_t*)&acl->addr.addr6, (uint32_t*)&addr6->sin6_addr, (uint32_t*)&acl->range_mask.addr6, sizeof(struct in6_addr))) { return 0; } break; case ACL_RANGE_SINGLE: default: if (memcmp(&addr6->sin6_addr, &acl->addr.addr6, sizeof(struct in6_addr)) != 0) { return 0; } break; } return 1; } else { struct sockaddr_in* addr4 = (struct sockaddr_in*)addr; if (addr4->sin_family != AF_INET) { return 0; } if (acl->port != 0 && acl->port != ntohs(addr4->sin_port)) { return 0; } switch (acl->range_type) { case ACL_RANGE_MASK: case ACL_RANGE_SUBNET: if (!acl_addr_matches_mask((uint32_t*)&acl->addr.addr, (uint32_t*)&addr4->sin_addr, (uint32_t*)&acl->range_mask.addr, sizeof(struct in_addr))) { return 0; } break; case ACL_RANGE_MINMAX: if (!acl_addr_matches_range((uint32_t*)&acl->addr.addr, (uint32_t*)&addr4->sin_addr, (uint32_t*)&acl->range_mask.addr, sizeof(struct in_addr))) { return 0; } break; case ACL_RANGE_SINGLE: default: if (memcmp(&addr4->sin_addr, &acl->addr.addr, sizeof(struct in_addr)) != 0) { return 0; } break; } return 1; } /* not reached */ return 0; } /** * ACL matches TSIG. * */ static int acl_tsig_matches(acl_type* acl, tsig_rr_type* tsig) { if (!acl || !tsig) { ods_log_debug("[%s] no match: no acl or tsig", acl_str); return 0; /* missing required elements */ } if (!acl->tsig) { if (tsig->status == TSIG_NOT_PRESENT) { return 1; } ods_log_debug("[%s] no match: tsig present but no config", acl_str); return 0; /* TSIG present but no config */ } if (tsig->status != TSIG_OK) { ods_log_debug("[%s] no match: tsig %s", acl_str, tsig_status2str(tsig->status)); return 0; /* query has no TSIG */ } if (tsig->error_code != LDNS_RCODE_NOERROR) { ods_log_debug("[%s] no match: tsig error %d", acl_str, tsig->error_code); return 0; /* query has bork TSIG */ } if (!tsig->key_name || !tsig->algo) { ods_log_debug("[%s] no match: missing key/algo", acl_str); return 0; } if (!acl->tsig->key) { ods_log_debug("[%s] no match: no config", acl_str); return 0; /* missing TSIG config */ } if (ldns_dname_compare(tsig->key_name, acl->tsig->key->dname) != 0) { ods_log_debug("[%s] no match: key names not the same", acl_str); return 0; /* wrong key name */ } if (ods_strlowercmp(tsig->algo->txt_name, acl->tsig->algorithm) != 0) { ods_log_debug("[%s] no match: algorithms not the same", acl_str); return 0; /* wrong algorithm name */ } /* tsig matches */ return 1; } /** * Address storage to IP string. * */ int addr2ip(struct sockaddr_storage addr, char* ip, size_t len) { if (addr.ss_family == AF_INET6) { if (!inet_ntop(AF_INET6, &((struct sockaddr_in6 *)&addr)->sin6_addr, ip, len)) { return 0; } } else { if (!inet_ntop(AF_INET, &((struct sockaddr_in *)&addr)->sin_addr, ip, len)) return 0; } return 1; } /** * Find ACL. * */ acl_type* acl_find(acl_type* acl, struct sockaddr_storage* addr, tsig_rr_type* trr) { acl_type* find = acl; while (find) { if (acl_addr_matches(find, addr) && acl_tsig_matches(find, trr)) { ods_log_debug("[%s] match %s", acl_str, find->address); return find; } find = find->next; } return NULL; } /** * Clean up ACL. * */ void acl_cleanup(acl_type* acl) { if (!acl) { return; } acl_cleanup(acl->next); free(acl->address); free(acl); } opendnssec-2.1.13/signer/src/wire/tsig.h0000644000077000001440000001674714446272525015052 00000000000000/* * Copyright (c) 2011 NLNet Labs. All rights reserved. * * Taken from NSD3 and adjusted for OpenDNSSEC, NLnet Labs. * * 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. * */ /** * TSIG. * */ #ifndef WIRE_TSIG_H #define WIRE_TSIG_H #include "config.h" #include "status.h" #include "wire/buffer.h" #include #define TSIG_ERROR_BADSIG 16 #define TSIG_ERROR_BADKEY 17 #define TSIG_ERROR_BADTIME 18 #define TSIG_HMAC_MD5 157 #define TSIG_HMAC_SHA1 158 #define TSIG_HMAC_SHA256 159 /** * TSIG status. * */ enum tsig_status_enum { TSIG_NOT_PRESENT, TSIG_OK, TSIG_ERROR }; typedef enum tsig_status_enum tsig_status; /** * TSIG lookup table. * */ typedef struct tsig_lookup_table_struct tsig_lookup_table; struct tsig_lookup_table_struct { uint8_t id; const char* short_name; }; /** * TSIG key. * */ typedef struct tsig_key_struct tsig_key_type; struct tsig_key_struct { ldns_rdf* dname; size_t size; const uint8_t* data; }; /** * TSIG algorithm. * */ typedef struct tsig_algo_struct tsig_algo_type; struct tsig_algo_struct { const char* txt_name; ldns_rdf* wf_name; size_t max_digest_size; const void* data; /* create a new HMAC context */ void*(*hmac_create)(void); /* initialize an HMAC context */ void(*hmac_init)(void* context, tsig_algo_type* algo, tsig_key_type* key); /* update the HMAC context */ void(*hmac_update)(void* context, const void* data, size_t size); /* finalize digest */ void(*hmac_final)(void* context, uint8_t* digest, size_t* size); }; /** * TSIG configuration. * */ typedef struct tsig_struct tsig_type; struct tsig_struct { tsig_type* next; const char* name; const char* algorithm; const char* secret; tsig_key_type* key; }; /** * TSIG RR. * */ typedef struct tsig_rr_struct tsig_rr_type; struct tsig_rr_struct { tsig_status status; size_t position; size_t response_count; size_t update_since_last_prepare; void* context; tsig_algo_type* algo; tsig_key_type* key; size_t prior_mac_size; uint8_t* prior_mac_data; ldns_rdf* key_name; ldns_rdf* algo_name; uint16_t signed_time_high; uint32_t signed_time_low; uint16_t signed_time_fudge; uint16_t mac_size; uint8_t* mac_data; uint16_t original_query_id; uint16_t error_code; uint16_t other_size; uint8_t* other_data; }; /** * Initialize TSIG handler. * \param[in] allocator memory allocator * \return ods_status status * */ extern ods_status tsig_handler_init(void); /** * Clean up TSIG handler. * */ extern void tsig_handler_cleanup(void); /** * Add key to TSIG handler. * \param[in] key tsig key * */ extern void tsig_handler_add_key(tsig_key_type* key); /** * Add algorithm to TSIG handler. * \param[in] algo tsig algorithm * */ extern void tsig_handler_add_algo(tsig_algo_type* algo); /** * Create new TSIG. * \param[in] allocator memory allocator * \param[in] name tsig name * \param[in] algo tsig algorithm * \param[in] secret tsig secret * \return tsig_type* TSIG * */ extern tsig_type* tsig_create(char* name, char* algo, char* secret); /** * Lookup TSIG by key name. * \param[in] tsig TSIG list * \param[in] naem TSIG name * \return tsig_type* TSIG * */ extern tsig_type* tsig_lookup_by_name(tsig_type* tsig, const char* name); /** * Lookup TSIG algorithm by name. * \param[in] name algorithm name * \return tsig_algo_type* TSIG algorithm * */ extern tsig_algo_type* tsig_lookup_algo(const char* name); /** * Create new TSIG RR. * \param[in] allocator memory allocator * \return tsig_rr_type* TSIG RR * */ extern tsig_rr_type* tsig_rr_create(void); /** * Reset TSIG RR. * \param[in] trr TSIG RR * \param[in] algo tsig algorithm * \param[in] key tsig key * */ extern void tsig_rr_reset(tsig_rr_type* trr, tsig_algo_type* algo, tsig_key_type* key); /** * Find TSIG RR. * \param[in] trr TSIG RR * \param[in] buffer packet buffer * \return int 1 if not present or present and valid, 0 otherwise. * */ extern int tsig_rr_find(tsig_rr_type* trr, buffer_type* buffer); /** * Parse TSIG RR. * \param[in] trr TSIG RR * \param[in] buffer packet buffer * \return int 1 if not TSIG RR or TSIG RR and valid, 0 otherwise. * */ extern int tsig_rr_parse(tsig_rr_type* trr, buffer_type* buffer); /** * Lookup TSIG RR. * \param[in] trr TSIG RR * \return int 1 if succeeded, 0 if unknown * */ extern int tsig_rr_lookup(tsig_rr_type* trr); /** * Prepare TSIG RR. * \param[in] trr TSIG RR * */ extern void tsig_rr_prepare(tsig_rr_type* trr); /** * Update TSIG RR. * \param[in] trr TSIG RR * \param[in] buffer packet buffer * \param[in] length number of octets of buffer to add to the TSIG hash, * replacing the buffer's id with the original * query idfrom TSIG. * */ extern void tsig_rr_update(tsig_rr_type* trr, buffer_type* buffer, size_t length); /** * Sign TSIG RR. * \param[in] trr TSIG RR * */ extern void tsig_rr_sign(tsig_rr_type* trr); /** * Verify TSIG RR. * \param[in] trr TSIG RR * \return int 1 if verified, 0 on error * */ extern int tsig_rr_verify(tsig_rr_type* trr); /** * Append TSIG RR. * \param[in] trr TSIG RR * \param[in] buffer packet buffer * */ extern void tsig_rr_append(tsig_rr_type* trr, buffer_type* buffer); /* * The amount of space to reserve in the response for the TSIG data. * \param[in] trr TSIG RR * \return size_t reserved space size * */ extern size_t tsig_rr_reserved_space(tsig_rr_type *trr); /** * Reply with error TSIG RR. * \param[in] trr TSIG RR * */ extern void tsig_rr_error(tsig_rr_type* trr); /** * Get human readable TSIG error code. * \param[in] status TSIG status * \return const char* TSIG status * */ extern const char* tsig_status2str(tsig_status status); /** * Get human readable TSIG error code. * \param[in] error TSIG error code * \return const char* readable error code * */ extern const char* tsig_strerror(uint16_t error); /** * Free TSIG RR. * \param[in] trr TSIG RR * */ extern void tsig_rr_free(tsig_rr_type* trr); /** * Cleanup TSIG RR * \param[in] trr TSIG RR * */ extern void tsig_rr_cleanup(tsig_rr_type* trr); /** * Clean up TSIG. * \param[in] tsig TSIG * \param[in] allocator memory allocator * */ extern void tsig_cleanup(tsig_type* tsig); #endif /* WIRE_TSIG_H */ opendnssec-2.1.13/signer/src/wire/axfr.h0000644000077000001440000000436714446272525015037 00000000000000/* * 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. * */ /** * AXFR. * */ #ifndef WIRE_AXFR_H #define WIRE_AXFR_H #include "config.h" #include "daemon/engine.h" #include "wire/query.h" #include /* NSD values */ #define MAX_COMPRESSION_OFFSET 16383 /* Compression pointers are 14 bit. */ #define AXFR_MAX_MESSAGE_LEN MAX_COMPRESSION_OFFSET /** * Handle SOA request. * \param[in] q soa request * \param[in] engine signer engine * \return query_state state of the query * */ extern query_state soa_request(query_type* q, engine_type* engine); /** * Do AXFR. * \param[in] q axfr request * \param[in] engine signer engine * \param[in] fallback fallback from ixfr? * \return query_state state of the query * */ extern query_state axfr(query_type* q, engine_type* engine, int fallback); /** * Do IXFR. * \param[in] q ixfr request * \param[in] engine signer engine * \return query_state state of the query * */ extern query_state ixfr(query_type* q, engine_type* engine); #endif /* WIRE_AXFR_H */ opendnssec-2.1.13/signer/src/wire/tsig-openssl.h0000644000077000001440000000346614446272525016525 00000000000000/* * 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. * */ /** * Interface to OpenSSL for TSIG support. * */ #ifndef WIRE_TSIG_OPENSSL_H #define WIRE_TSIG_OPENSSL_H #ifdef HAVE_SSL #include "status.h" #include #include /** * Initialize OpenSSL support for TSIG. * \param[in] allocator memory allocator * \return ods_status status * */ extern ods_status tsig_handler_openssl_init(void); /** * Finalize OpenSSL support for TSIG. * */ extern void tsig_handler_openssl_finalize(void); #endif /* HAVE_SSL */ #endif /* WIRE_TSIG_OPENSSL_H */ opendnssec-2.1.13/signer/src/wire/tcpset.h0000644000077000001440000000666314446272525015402 00000000000000/* * 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. * */ /** * TCP connections. * */ #ifndef WIRE_TCPSET_H #define WIRE_TCPSET_H #include "config.h" #include typedef struct tcp_conn_struct tcp_conn_type; typedef struct tcp_set_struct tcp_set_type; #include "status.h" #include "wire/buffer.h" #include "wire/xfrd.h" #define TCPSET_MAX 50 /** * tcp connection. * */ struct tcp_conn_struct { int fd; /* how many bytes have been read/written - total, incl. tcp length bytes */ uint32_t total_bytes; /* msg len bytes */ uint16_t msglen; /* packet buffer of connection */ buffer_type* packet; /* state: reading or writing */ unsigned is_reading : 1; }; /* * Set of tcp connections. * */ struct tcp_set_struct { tcp_conn_type* tcp_conn[TCPSET_MAX]; xfrd_type* tcp_waiting_first; xfrd_type* tcp_waiting_last; size_t tcp_count; }; /** * Create a tcp connection. * \param[in] allocator memory allocator * \return tcp_conn_type* TCP connection. * */ extern tcp_conn_type* tcp_conn_create(void); /** * Create a set of tcp connections. * \param[in] allocator memory allocator * \return tcp_set_type* set of tcp connection. * */ extern tcp_set_type* tcp_set_create(void); /** * Make tcp connection ready for reading. * \param[in] tcp tcp connection * */ extern void tcp_conn_ready(tcp_conn_type* tcp); /* * Read from a tcp connection. * On first call, make sure total_bytes = 0, msglen=0, buffer clear, * and the packet and fd need to be set. * \param[in] tcp tcp connection * \return int -1 on error, * 0 on short read, * 1 on completed read. * */ extern int tcp_conn_read(tcp_conn_type* tcp); /* * Write to a tcp connection. * On first call, make sure total_bytes=0, msglen=limit, buffer filled, * and the packet and fd need to be set. * \param[in] tcp tcp connection * \return int -1 on error, * 0 on short write, * 1 on completed write. * */ extern int tcp_conn_write(tcp_conn_type* tcp); /** * Clean up set of tcp connections. * \param[in] set set of tcp connections * \param[in] allocator memory allocator * */ extern void tcp_set_cleanup(tcp_set_type* set); #endif /* WIRE_TCPSET_H */ opendnssec-2.1.13/signer/src/wire/sock.h0000644000077000001440000000745414446272525015036 00000000000000/* * 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. * */ /** * Sockets. * */ #ifndef WIRE_SOCK_H #define WIRE_SOCK_H #include "config.h" #include "status.h" #include "wire/listener.h" #include "wire/netio.h" #include "wire/query.h" /** * Socket. * */ typedef struct sock_struct sock_type; struct sock_struct { struct addrinfo* addr; int s; }; /** * List of sockets. * */ typedef struct socklist_struct socklist_type; struct socklist_struct { sock_type tcp[MAX_INTERFACES]; sock_type udp[MAX_INTERFACES]; }; /** * Data for udp handlers. * */ struct udp_data { engine_type* engine; sock_type* socket; query_type* query; }; /** * Data for tcp accept handlers. * */ struct tcp_accept_data { engine_type* engine; sock_type* socket; size_t tcp_accept_handler_count; netio_handler_type* tcp_accept_handlers; }; /** * Data for tcp handlers. * */ struct tcp_data { engine_type* engine; query_type* query; size_t tcp_accept_handler_count; netio_handler_type* tcp_accept_handlers; query_state qstate; size_t bytes_transmitted; }; /** * Create sockets and listen. * \param[out] sockets sockets * \param[in] listener interfaces * \return ods_status status * */ extern ods_status sock_listen(socklist_type* sockets, listener_type* listener); /** * Handle incoming udp queries. * \param[in] netio network I/O event handler * \param[in] handler event handler * \param[in] event_types the types of events that should be checked for * */ extern void sock_handle_udp(netio_type* netio, netio_handler_type* handler, netio_events_type event_types); /** * Handle incoming tcp connections. * \param[in] netio network I/O event handler * \param[in] handler event handler * \param[in] event_types the types of events that should be checked for * */ extern void sock_handle_tcp_accept(netio_type* netio, netio_handler_type* handler, netio_events_type event_types); /** * Handle incoming tcp queries. * \param[in] netio network I/O event handler * \param[in] handler event handler * \param[in] event_types the types of events that should be checked for * */ extern void sock_handle_tcp_read(netio_type* netio, netio_handler_type* handler, netio_events_type event_types); /** * Handle outgoing tcp responses. * \param[in] netio network I/O event handler * \param[in] handler event handler * \param[in] event_types the types of events that should be checked for * */ extern void sock_handle_tcp_write(netio_type* netio, netio_handler_type* handler, netio_events_type event_types); #endif /* WIRE_SOCK_H */ opendnssec-2.1.13/signer/src/wire/buffer.c0000644000077000001440000005264414446272525015344 00000000000000/* * 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. * */ /** * Packet buffer. * * 1 1 1 1 1 1 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ * 01 | ID | * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ * 23 |QR| Opcode |AA|TC|RD|RA| Z|AD|CD| RCODE | * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ * 45 | QDCOUNT | * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ * 67 | ANCOUNT | * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ * 89 | NSCOUNT | * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ * 01 | ARCOUNT | * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ * */ #include "config.h" #include "log.h" #include "wire/buffer.h" #include static const char* buffer_str = "buffer"; ods_lookup_table ods_rcode_str[] = { { LDNS_RCODE_NOERROR, "NOERROR" }, { LDNS_RCODE_FORMERR, "FORMERR" }, { LDNS_RCODE_SERVFAIL, "SERVFAIL" }, { LDNS_RCODE_NXDOMAIN, "NXDOMAIN" }, { LDNS_RCODE_NOTIMPL, "NOTIMPL" }, { LDNS_RCODE_REFUSED, "REFUSED" }, { LDNS_RCODE_YXDOMAIN, "YXDOMAIN" }, { LDNS_RCODE_YXRRSET, "YXRRSET" }, { LDNS_RCODE_NXRRSET, "NXRRSET" }, { LDNS_RCODE_NOTAUTH, "NOTAUTH" }, { LDNS_RCODE_NOTZONE, "NOTZONE" }, { 0, NULL } }; /** * Create a new buffer with the specified capacity. * */ buffer_type* buffer_create(size_t capacity) { buffer_type* buffer = NULL; if (!capacity) { return NULL; } CHECKALLOC(buffer = (buffer_type *) malloc(sizeof(buffer_type))); buffer->data = (uint8_t*) calloc(capacity, sizeof(uint8_t)); buffer->position = 0; buffer->limit = capacity; buffer->capacity = capacity; buffer->fixed = 0; return buffer; } /** * Clear the buffer and make it ready for writing. * */ void buffer_clear(buffer_type* buffer) { ods_log_assert(buffer); buffer->position = 0; buffer->limit = buffer->capacity; } /** * Flip the buffer and make it ready for reading. * */ void buffer_flip(buffer_type* buffer) { ods_log_assert(buffer); buffer->limit = buffer->position; buffer->position = 0; } /** * Get the buffer's position. * */ size_t buffer_position(buffer_type* buffer) { ods_log_assert(buffer); return buffer->position; } /** * Set the buffer's position. * */ void buffer_set_position(buffer_type* buffer, size_t pos) { ods_log_assert(buffer); ods_log_assert(pos <= buffer->limit); buffer->position = pos; } /** * Change the buffer's position. * */ void buffer_skip(buffer_type* buffer, ssize_t count) { ods_log_assert(buffer); ods_log_assert(buffer->position + count <= buffer->limit); buffer->position += count; } /** * Get bit. * */ static int get_bit(uint8_t bits[], size_t index) { return bits[index / 8] & (1 << (7 - index % 8)); } /** * Set bit. * */ static void set_bit(uint8_t bits[], size_t index) { bits[index / 8] |= (1 << (7 - index % 8)); } /** * Is pointer label> * */ static int label_is_pointer(const uint8_t* label) { ods_log_assert(label); return (label[0] & 0xc0) == 0xc0; } /** * Pointer label location. * */ static uint16_t label_pointer_location(const uint8_t* label) { ods_log_assert(label); ods_log_assert(label_is_pointer(label)); return ((uint16_t) (label[0] & ~0xc0) << 8) | (uint16_t) label[1]; } /** * Is normal label? * */ static int label_is_normal(const uint8_t* label) { ods_log_assert(label); return (label[0] & 0xc0) == 0; } /* * Is root label? * */ static inline int label_is_root(const uint8_t* label) { ods_log_assert(label); return label[0] == 0; } /* * Label length. * */ static uint8_t label_length(const uint8_t* label) { ods_log_assert(label); ods_log_assert(label_is_normal(label)); return label[0]; } /** * Read dname from buffer. * */ size_t buffer_read_dname(buffer_type* buffer, uint8_t* dname, unsigned allow_pointers) { int done = 0; uint8_t visited[(MAX_PACKET_SIZE+7)/8]; size_t dname_length = 0; const uint8_t *label = NULL; ssize_t mark = -1; ods_log_assert(buffer); memset(visited, 0, (buffer_limit(buffer)+7)/8); while (!done) { if (!buffer_available(buffer, 1)) { return 0; } if (get_bit(visited, buffer_position(buffer))) { ods_log_error("[%s] dname loop!", buffer_str); return 0; } set_bit(visited, buffer_position(buffer)); label = buffer_current(buffer); if (label_is_pointer(label)) { size_t pointer = 0; if (!allow_pointers) { return 0; } if (!buffer_available(buffer, 2)) { return 0; } pointer = label_pointer_location(label); if (pointer >= buffer_limit(buffer)) { return 0; } buffer_skip(buffer, 2); if (mark == -1) { mark = buffer_position(buffer); } buffer_set_position(buffer, pointer); } else if (label_is_normal(label)) { size_t length = label_length(label) + 1; done = label_is_root(label); if (!buffer_available(buffer, length)) { return 0; } if (dname_length + length >= MAXDOMAINLEN+1) { return 0; } buffer_read(buffer, dname + dname_length, length); dname_length += length; } else { return 0; } } if (mark != -1) { buffer_set_position(buffer, mark); } return dname_length; } /** * Change the buffer's position so that one dname is skipped. * */ int buffer_skip_dname(buffer_type* buffer) { ods_log_assert(buffer); while (1) { uint8_t label_size = 0; if (!buffer_available(buffer, 1)) { return 0; } label_size = buffer_read_u8(buffer); if (label_size == 0) { break; } else if ((label_size & 0xc0) != 0) { if (!buffer_available(buffer, 1)) { return 0; } buffer_skip(buffer, 1); break; } else if (!buffer_available(buffer, label_size)) { return 0; } else { buffer_skip(buffer, label_size); } } return 1; } /** * Change the buffer's position so that one RR is skipped. * */ int buffer_skip_rr(buffer_type* buffer, unsigned qrr) { if (!buffer_skip_dname(buffer)) { return 0; } if (qrr) { if (!buffer_available(buffer, 4)) { return 0; } buffer_skip(buffer, 4); } else { uint16_t rdata_size; if (!buffer_available(buffer, 10)) { return 0; } buffer_skip(buffer, 8); rdata_size = buffer_read_u16(buffer); if (!buffer_available(buffer, rdata_size)) { return 0; } buffer_skip(buffer, rdata_size); } return 1; } /** * Get the buffer's limit. * */ size_t buffer_limit(buffer_type* buffer) { ods_log_assert(buffer); return buffer->limit; } /** * Set the buffer's limit. * */ void buffer_set_limit(buffer_type* buffer, size_t limit) { ods_log_assert(buffer); ods_log_assert(limit <= buffer->capacity); buffer->limit = limit; if (buffer->position > buffer->limit) { buffer->position = buffer->limit; } } /** * Get the buffer's capacity. * */ size_t buffer_capacity(buffer_type* buffer) { ods_log_assert(buffer); return buffer->capacity; } /** * Return a pointer to the data at the indicated position. * */ uint8_t* buffer_at(buffer_type* buffer, size_t at) { ods_log_assert(buffer); ods_log_assert(at <= buffer->limit); return buffer->data + at; } /** * Return a pointer to the data at the beginning of the buffer. * */ uint8_t* buffer_begin(buffer_type* buffer) { ods_log_assert(buffer); return buffer_at(buffer, 0); } /** * Return a pointer to the data at the buffer's current position. * */ uint8_t* buffer_current(buffer_type* buffer) { ods_log_assert(buffer); return buffer_at(buffer, buffer->position); } /** * The number of bytes remaining between the at and limit. * */ static size_t buffer_remaining_at(buffer_type* buffer, size_t at) { ods_log_assert(buffer); ods_log_assert(at <= buffer->limit); return buffer->limit - at; } /** * The number of bytes remaining between the buffer's position and limit. * */ size_t buffer_remaining(buffer_type* buffer) { ods_log_assert(buffer); return buffer_remaining_at(buffer, buffer->position); } /** * Check if the buffer has enough bytes available at indicated position. * */ static int buffer_available_at(buffer_type *buffer, size_t at, size_t count) { ods_log_assert(buffer); return count <= buffer_remaining_at(buffer, at); } /** * Check if the buffer has enough bytes available. * */ int buffer_available(buffer_type *buffer, size_t count) { ods_log_assert(buffer); return buffer_available_at(buffer, buffer->position, count); } /** * Write to buffer at indicated position. * */ static void buffer_write_u8_at(buffer_type* buffer, size_t at, uint8_t data) { ods_log_assert(buffer); ods_log_assert(buffer_available_at(buffer, at, sizeof(data))); buffer->data[at] = data; } /** * Write to buffer at indicated position. * */ void buffer_write_u16_at(buffer_type* buffer, size_t at, uint16_t data) { ods_log_assert(buffer); ods_log_assert(buffer_available_at(buffer, at, sizeof(data))); write_uint16(buffer->data + at, data); } /** * Write to buffer at indicated position. * */ static void buffer_write_u32_at(buffer_type* buffer, size_t at, uint32_t data) { ods_log_assert(buffer); ods_log_assert(buffer_available_at(buffer, at, sizeof(data))); write_uint32(buffer->data + at, data); } /** * Write to buffer. * */ void buffer_write(buffer_type* buffer, const void* data, size_t count) { ods_log_assert(buffer); ods_log_assert(buffer_available(buffer, count)); memcpy(buffer->data + buffer->position, data, count); buffer->position += count; } /** * Write uint8_t to buffer. * */ void buffer_write_u8(buffer_type* buffer, uint8_t data) { ods_log_assert(buffer); buffer_write_u8_at(buffer, buffer->position, data); buffer->position += sizeof(data); } /** * Write uint16_t to buffer. * */ void buffer_write_u16(buffer_type* buffer, uint16_t data) { ods_log_assert(buffer); buffer_write_u16_at(buffer, buffer->position, data); buffer->position += sizeof(data); } /** * Write uint32_t to buffer. * */ void buffer_write_u32(buffer_type* buffer, uint32_t data) { ods_log_assert(buffer); buffer_write_u32_at(buffer, buffer->position, data); buffer->position += sizeof(data); } /** * Write rdf to buffer. * */ void buffer_write_rdf(buffer_type* buffer, ldns_rdf* rdf) { ods_log_assert(buffer); ods_log_assert(rdf); buffer_write(buffer, ldns_rdf_data(rdf), ldns_rdf_size(rdf)); /* position updated by buffer_write() */ } /** * Write rr to buffer. * */ int buffer_write_rr(buffer_type* buffer, ldns_rr* rr) { size_t i = 0; size_t tc_mark = 0; size_t rdlength_pos = 0; uint16_t rdlength = 0; ods_log_assert(buffer); ods_log_assert(rr); /* set truncation mark, in case rr does not fit */ tc_mark = buffer_position(buffer); /* owner type class ttl */ if (!buffer_available(buffer, ldns_rdf_size(ldns_rr_owner(rr)))) { goto buffer_tc; } buffer_write_rdf(buffer, ldns_rr_owner(rr)); if (!buffer_available(buffer, sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t) + sizeof(rdlength))) { goto buffer_tc; } buffer_write_u16(buffer, (uint16_t) ldns_rr_get_type(rr)); buffer_write_u16(buffer, (uint16_t) ldns_rr_get_class(rr)); buffer_write_u32(buffer, (uint32_t) ldns_rr_ttl(rr)); /* skip rdlength */ rdlength_pos = buffer_position(buffer); buffer_skip(buffer, sizeof(rdlength)); /* write rdata */ for (i=0; i < ldns_rr_rd_count(rr); i++) { if (!buffer_available(buffer, ldns_rdf_size(ldns_rr_rdf(rr, i)))) { goto buffer_tc; } buffer_write_rdf(buffer, ldns_rr_rdf(rr, i)); } /* write rdlength */ rdlength = buffer_position(buffer) - rdlength_pos - sizeof(rdlength); buffer_write_u16_at(buffer, rdlength_pos, rdlength); /* position updated by buffer_write() */ return 1; buffer_tc: buffer_set_position(buffer, tc_mark); return 0; } /** * Read uint8_t from buffer at indicated position. * */ static uint8_t buffer_read_u8_at(buffer_type* buffer, size_t at) { ods_log_assert(buffer); ods_log_assert(at < buffer->capacity); return buffer->data[at]; } /** * Read uint16_t from buffer at indicated position. * */ static uint16_t buffer_read_u16_at(buffer_type* buffer, size_t at) { ods_log_assert(buffer); return read_uint16(buffer->data + at); } /** * Read uint32_t from buffer at indicated position. * */ static uint32_t buffer_read_u32_at(buffer_type* buffer, size_t at) { ods_log_assert(buffer); return read_uint32(buffer->data + at); } /** * Read from buffer. * */ void buffer_read(buffer_type* buffer, void* data, size_t count) { ods_log_assert(buffer); ods_log_assert(buffer_available(buffer, count)); memcpy(data, buffer->data + buffer->position, count); buffer->position += count; } /** * Read uint8_t from buffer. * */ uint8_t buffer_read_u8(buffer_type* buffer) { uint16_t result = 0; ods_log_assert(buffer); result = buffer_read_u8_at(buffer, buffer->position); buffer->position += sizeof(uint8_t); return result; } /** * Read uint16_t from buffer. * */ uint16_t buffer_read_u16(buffer_type* buffer) { uint16_t result = 0; ods_log_assert(buffer); result = buffer_read_u16_at(buffer, buffer->position); buffer->position += sizeof(uint16_t); return result; } /** * Read uint32_t from buffer. * */ uint32_t buffer_read_u32(buffer_type* buffer) { uint32_t result = 0; ods_log_assert(buffer); result = buffer_read_u32_at(buffer, buffer->position); buffer->position += sizeof(uint32_t); return result; } /** * Get query id from buffer. * */ uint16_t buffer_pkt_id(buffer_type* buffer) { ods_log_assert(buffer); return buffer_read_u16_at(buffer, 0); } /** * Get a random query id. * */ static uint16_t random_id(void) { return ldns_get_random(); } /** * Set random query id in buffer. * */ void buffer_pkt_set_random_id(buffer_type* buffer) { uint16_t qid = 0; ods_log_assert(buffer); qid = random_id(); buffer_write_u16_at(buffer, 0, qid); } /** * Get flags from buffer. * */ uint16_t buffer_pkt_flags(buffer_type* buffer) { ods_log_assert(buffer); return (uint16_t) buffer_read_u16_at(buffer, 2); } /** * Set flags in buffer. * */ void buffer_pkt_set_flags(buffer_type* buffer, uint16_t flags) { ods_log_assert(buffer); buffer_write_u16_at(buffer, 2, flags); } /** * Get QR bit from buffer. * */ int buffer_pkt_qr(buffer_type* buffer) { ods_log_assert(buffer); return (int) QR(buffer); } /** * Set QR bit in buffer. * */ void buffer_pkt_set_qr(buffer_type* buffer) { ods_log_assert(buffer); QR_SET(buffer); } /** * Clear QR bit in buffer. * */ void buffer_pkt_clear_qr(buffer_type* buffer) { ods_log_assert(buffer); QR_CLR(buffer); } /** * Get OPCODE from buffer. * */ ldns_pkt_opcode buffer_pkt_opcode(buffer_type* buffer) { ods_log_assert(buffer); return (ldns_pkt_opcode) OPCODE(buffer); } /** * Set OPCODE in buffer. * */ void buffer_pkt_set_opcode(buffer_type* buffer, ldns_pkt_opcode opcode) { ods_log_assert(buffer); OPCODE_SET(buffer, opcode); } /** * Get AA bit from buffer. * */ int buffer_pkt_aa(buffer_type* buffer) { ods_log_assert(buffer); return (int) AA(buffer); } /** * Set AA bit in buffer. * */ void buffer_pkt_set_aa(buffer_type* buffer) { ods_log_assert(buffer); AA_SET(buffer); } /** * Get TC bit from buffer. * */ int buffer_pkt_tc(buffer_type* buffer) { ods_log_assert(buffer); return (int) TC(buffer); } /** * Get RD bit from buffer. * */ int buffer_pkt_rd(buffer_type* buffer) { ods_log_assert(buffer); return (int) RD(buffer); } /** * Get RA bit from buffer. * */ int buffer_pkt_ra(buffer_type* buffer) { ods_log_assert(buffer); return (int) RA(buffer); } /** * Get AD bit from buffer. * */ int buffer_pkt_ad(buffer_type* buffer) { ods_log_assert(buffer); return (int) AD(buffer); } /** * Get CD bit from buffer. * */ int buffer_pkt_cd(buffer_type* buffer) { ods_log_assert(buffer); return (int) CD(buffer); } /** * Get RCODE from buffer. * */ ldns_pkt_rcode buffer_pkt_rcode(buffer_type* buffer) { ods_log_assert(buffer); return (ldns_pkt_rcode) RCODE(buffer); } /** * Set RCODE in buffer. * */ void buffer_pkt_set_rcode(buffer_type* buffer, ldns_pkt_rcode rcode) { ods_log_assert(buffer); RCODE_SET(buffer, rcode); } /** * Look up a descriptive text by each rcode. * */ const char* buffer_rcode2str(ldns_pkt_rcode rcode) { ods_lookup_table *lt; lt = ods_lookup_by_id(ods_rcode_str, rcode); if (lt) { return lt->name; } return NULL; } /** * Get QDCOUNT from buffer. * */ uint16_t buffer_pkt_qdcount(buffer_type* buffer) { ods_log_assert(buffer); return buffer_read_u16_at(buffer, 4); } /** * Set QDCOUNT in buffer. * */ void buffer_pkt_set_qdcount(buffer_type* buffer, uint16_t count) { ods_log_assert(buffer); buffer_write_u16_at(buffer, 4, count); } /** * Get ANCOUNT from buffer. * */ uint16_t buffer_pkt_ancount(buffer_type* buffer) { ods_log_assert(buffer); return buffer_read_u16_at(buffer, 6); } /** * Set ANCOUNT in buffer. * */ void buffer_pkt_set_ancount(buffer_type* buffer, uint16_t count) { ods_log_assert(buffer); buffer_write_u16_at(buffer, 6, count); } /** * Get NSCOUNT from buffer. * */ uint16_t buffer_pkt_nscount(buffer_type* buffer) { ods_log_assert(buffer); return buffer_read_u16_at(buffer, 8); } /** * Set NSCOUNT in buffer. * */ void buffer_pkt_set_nscount(buffer_type* buffer, uint16_t count) { ods_log_assert(buffer); buffer_write_u16_at(buffer, 8, count); } /** * Get ARCOUNT from buffer. * */ uint16_t buffer_pkt_arcount(buffer_type* buffer) { ods_log_assert(buffer); return buffer_read_u16_at(buffer, 10); } /** * Set ARCOUNT in buffer. * */ void buffer_pkt_set_arcount(buffer_type* buffer, uint16_t count) { ods_log_assert(buffer); buffer_write_u16_at(buffer, 10, count); } /** * Make a new packet. * */ static void buffer_pkt_new(buffer_type* buffer, ldns_rdf* qname, ldns_rr_type qtype, ldns_rr_class qclass, ldns_pkt_opcode opcode) { ods_log_assert(buffer); ods_log_assert(qname); ods_log_assert(qtype); ods_log_assert(qclass); /* The header */ buffer_clear(buffer); buffer_pkt_set_random_id(buffer); buffer_pkt_set_opcode(buffer, opcode); buffer_pkt_clear_qr(buffer); buffer_pkt_set_rcode(buffer, LDNS_RCODE_NOERROR); buffer_pkt_set_qdcount(buffer, 1); buffer_pkt_set_ancount(buffer, 0); buffer_pkt_set_nscount(buffer, 0); buffer_pkt_set_arcount(buffer, 0); buffer_skip(buffer, BUFFER_PKT_HEADER_SIZE); /* The question record */ buffer_write_rdf(buffer, qname); buffer_write_u16(buffer, qtype); buffer_write_u16(buffer, qclass); } /** * Make a new query. * */ void buffer_pkt_query(buffer_type* buffer, ldns_rdf* qname, ldns_rr_type qtype, ldns_rr_class qclass) { buffer_pkt_new(buffer, qname, qtype, qclass, LDNS_PACKET_QUERY); buffer_pkt_set_flags(buffer, 0); } /** * Make a new notify. * */ void buffer_pkt_notify(buffer_type* buffer, ldns_rdf* qname, ldns_rr_class qclass) { buffer_pkt_new(buffer, qname, LDNS_RR_TYPE_SOA, qclass, LDNS_PACKET_NOTIFY); } /** * Clean up buffer. * */ void buffer_cleanup(buffer_type* buffer) { if (!buffer) { return; } free(buffer->data); free(buffer); } opendnssec-2.1.13/signer/src/wire/listener.c0000644000077000001440000001027714446272525015714 00000000000000/* * 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. * */ /** * Listener. * */ #include "config.h" #include #include "log.h" #include "wire/listener.h" static const char* listener_str = "listener"; /** * Create listener. * */ listener_type* listener_create() { listener_type* listener = NULL; CHECKALLOC(listener = (listener_type*) malloc(sizeof(listener_type))); listener->count = 0; listener->interfaces = NULL; return listener; } /** * Push an interface to the listener. * */ interface_type* listener_push(listener_type* listener, char* address, int family, const char* port) { interface_type* ifs_old = NULL; ods_log_assert(listener); ods_log_assert(address); ifs_old = listener->interfaces; CHECKALLOC(listener->interfaces = (interface_type*) malloc((listener->count + 1) * sizeof(interface_type))); if (ifs_old) { memcpy(listener->interfaces, ifs_old, (listener->count) * sizeof(interface_type)); } free(ifs_old); listener->count++; listener->interfaces[listener->count -1].address = strdup(address); listener->interfaces[listener->count -1].family = family; if (port) { listener->interfaces[listener->count -1].port = strdup(port); } else{ listener->interfaces[listener->count -1].port = NULL; } memset(&listener->interfaces[listener->count -1].addr, 0, sizeof(union acl_addr_storage)); if (listener->interfaces[listener->count -1].family == AF_INET6 && strlen(listener->interfaces[listener->count -1].address) > 0) { if (inet_pton(listener->interfaces[listener->count -1].family, listener->interfaces[listener->count -1].address, &listener->interfaces[listener->count -1].addr.addr6) != 1) { ods_log_error("[%s] bad ip address '%s'", listener_str, listener->interfaces[listener->count -1].address); return NULL; } } else if (listener->interfaces[listener->count -1].family == AF_INET && strlen(listener->interfaces[listener->count -1].address) > 0) { if (inet_pton(listener->interfaces[listener->count -1].family, listener->interfaces[listener->count -1].address, &listener->interfaces[listener->count -1].addr.addr) != 1) { ods_log_error("[%s] bad ip address '%s'", listener_str, listener->interfaces[listener->count -1].address); return NULL; } } return &listener->interfaces[listener->count -1]; } /** * Clean up interface. * */ void interface_cleanup(interface_type* i) { if (!i) { return; } free((void*)i->port); free((void*)i->address); } /** * Clean up listener. * */ void listener_cleanup(listener_type* listener) { uint16_t i = 0; if (!listener) { return; } for (i=0; i < listener->count; i++) { interface_cleanup(&listener->interfaces[i]); } free(listener->interfaces); free(listener); } opendnssec-2.1.13/signer/src/wire/query.c0000644000077000001440000010115014446272525015223 00000000000000/* * 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. * */ /** * Query. * */ #include "config.h" #include "daemon/dnshandler.h" #include "daemon/engine.h" #include "file.h" #include "util.h" #include "wire/axfr.h" #include "wire/query.h" const char* query_str = "query"; /** * Create query. * */ query_type* query_create(void) { query_type* q = NULL; CHECKALLOC(q = (query_type*) malloc(sizeof(query_type))); q->buffer = NULL; q->tsig_rr = NULL; q->axfr_fd = NULL; q->buffer = buffer_create(PACKET_BUFFER_SIZE); if (!q->buffer) { query_cleanup(q); return NULL; } q->tsig_rr = tsig_rr_create(); if (!q->tsig_rr) { query_cleanup(q); return NULL; } q->edns_rr = edns_rr_create(); if (!q->edns_rr) { query_cleanup(q); return NULL; } query_reset(q, UDP_MAX_MESSAGE_LEN, 0); return q; } /** * Reset query. * */ void query_reset(query_type* q, size_t maxlen, int is_tcp) { if (!q) { return; } q->addrlen = sizeof(q->addr); q->maxlen = maxlen; q->reserved_space = 0; buffer_clear(q->buffer); tsig_rr_reset(q->tsig_rr, NULL, NULL); edns_rr_reset(q->edns_rr); q->tsig_prepare_it = 1; q->tsig_update_it = 1; q->tsig_sign_it = 1; q->tcp = is_tcp; /* qname, qtype, qclass */ q->zone = NULL; /* domain, opcode, cname count, delegation, compression, temp */ q->axfr_is_done = 0; if (q->axfr_fd) { ods_fclose(q->axfr_fd); q->axfr_fd = NULL; } q->serial = 0; q->startpos = 0; } /** * Error. * */ static query_state query_error(query_type* q, ldns_pkt_rcode rcode) { size_t limit = 0; if (!q) { return QUERY_DISCARDED; } limit = buffer_limit(q->buffer); buffer_clear(q->buffer); buffer_pkt_set_qr(q->buffer); buffer_pkt_set_rcode(q->buffer, rcode); buffer_pkt_set_ancount(q->buffer, 0); buffer_pkt_set_nscount(q->buffer, 0); buffer_pkt_set_arcount(q->buffer, 0); buffer_set_position(q->buffer, limit); return QUERY_PROCESSED; } /** * FORMERR. * */ static query_state query_formerr(query_type* q) { ldns_pkt_opcode opcode = LDNS_PACKET_QUERY; if (!q) { return QUERY_DISCARDED; } opcode = buffer_pkt_opcode(q->buffer); /* preserve the RD flag, clear the rest */ buffer_pkt_set_flags(q->buffer, buffer_pkt_flags(q->buffer) & 0x0100U); buffer_pkt_set_opcode(q->buffer, opcode); buffer_pkt_set_qdcount(q->buffer, 0); ods_log_debug("[%s] formerr", query_str); return query_error(q, LDNS_RCODE_FORMERR); } /** * SERVFAIL. * */ static query_state query_servfail(query_type* q) { if (!q) { return QUERY_DISCARDED; } ods_log_debug("[%s] servfail", query_str); buffer_set_position(q->buffer, 0); buffer_set_limit(q->buffer, BUFFER_PKT_HEADER_SIZE); buffer_pkt_set_qdcount(q->buffer, 0); return query_error(q, LDNS_RCODE_SERVFAIL); } /** * NOTIMPL. * */ static query_state query_notimpl(query_type* q) { if (!q) { return QUERY_DISCARDED; } ods_log_debug("[%s] notimpl", query_str); return query_error(q, LDNS_RCODE_NOTIMPL); } /** * REFUSED. * */ static query_state query_refused(query_type* q) { if (!q) { return QUERY_DISCARDED; } ods_log_debug("[%s] refused", query_str); return query_error(q, LDNS_RCODE_REFUSED); } /** * NOTAUTH. * */ static query_state query_notauth(query_type* q) { if (!q) { return QUERY_DISCARDED; } ods_log_debug("[%s] notauth", query_str); return query_error(q, LDNS_RCODE_NOTAUTH); } /** * Parse SOA RR in packet. * (kind of similar to xfrd_parse_soa) * */ static int query_parse_soa(buffer_type* buffer, uint32_t* serial) { ldns_rr_type type = 0; ods_log_assert(buffer); if (!buffer_available(buffer, 10)) { ods_log_error("[%s] bad soa: packet too short", query_str); return 0; } type = (ldns_rr_type) buffer_read_u16(buffer); if (type != LDNS_RR_TYPE_SOA) { ods_log_error("[%s] bad soa: rr is not soa (%d)", query_str, type); return 0; } (void)buffer_read_u16(buffer); (void)buffer_read_u32(buffer); /* rdata length */ if (!buffer_available(buffer, buffer_read_u16(buffer))) { ods_log_error("[%s] bad soa: missing rdlength", query_str); return 0; } /* MNAME */ if (!buffer_skip_dname(buffer)) { ods_log_error("[%s] bad soa: missing mname", query_str); return 0; } /* RNAME */ if (!buffer_skip_dname(buffer)) { ods_log_error("[%s] bad soa: missing rname", query_str); return 0; } if (serial) { *serial = buffer_read_u32(buffer); } return 1; } /** * NOTIFY. * Parse notify query and initiate zone transfer if received serial is * newer than serial on disk. On success return QUERY_PROCESSED and * prepare notify reply packet in q->buffer. */ static query_state query_process_notify(query_type* q, ldns_rr_type qtype, engine_type* engine) { dnsin_type* dnsin = NULL; uint16_t count = 0; uint16_t rrcount = 0; uint32_t serial = 0; size_t pos = 0; char address[128]; if (!engine || !q || !q->zone) { return QUERY_DISCARDED; } ods_log_assert(engine->dnshandler); ods_log_assert(q->zone->name); ods_log_verbose("[%s] incoming notify for zone %s", query_str, q->zone->name); if (buffer_pkt_rcode(q->buffer) != LDNS_RCODE_NOERROR || buffer_pkt_qr(q->buffer) || !buffer_pkt_aa(q->buffer) || buffer_pkt_tc(q->buffer) || buffer_pkt_rd(q->buffer) || buffer_pkt_ra(q->buffer) || buffer_pkt_ad(q->buffer) || buffer_pkt_cd(q->buffer) || buffer_pkt_qdcount(q->buffer) != 1 || buffer_pkt_ancount(q->buffer) > 1 || qtype != LDNS_RR_TYPE_SOA) { return query_formerr(q); } if (!q->zone->adinbound || q->zone->adinbound->type != ADAPTER_DNS) { ods_log_error("[%s] zone %s is not configured to have input dns " "adapter", query_str, q->zone->name); return query_notauth(q); } ods_log_assert(q->zone->adinbound->config); dnsin = (dnsin_type*) q->zone->adinbound->config; if (!acl_find(dnsin->allow_notify, &q->addr, q->tsig_rr)) { if (addr2ip(q->addr, address, sizeof(address))) { ods_log_info("[%s] unauthorized notify for zone %s from %s: " "no acl matches", query_str, q->zone->name, address); } else { ods_log_info("[%s] unauthorized notify for zone %s from unknown " "source: no acl matches", query_str, q->zone->name); } return query_notauth(q); } ods_log_assert(q->zone->xfrd); /* skip header and question section */ buffer_skip(q->buffer, BUFFER_PKT_HEADER_SIZE); count = buffer_pkt_qdcount(q->buffer); for (rrcount = 0; rrcount < count; rrcount++) { if (!buffer_skip_rr(q->buffer, 1)) { if (addr2ip(q->addr, address, sizeof(address))) { ods_log_info("[%s] dropped packet: zone %s received bad " "notify from %s (bad question section)", query_str, q->zone->name, address); } else { ods_log_info("[%s] dropped packet: zone %s received bad " "notify from unknown source (bad question section)", query_str, q->zone->name); } return QUERY_DISCARDED; } } pos = buffer_position(q->buffer); /* examine answer section */ count = buffer_pkt_ancount(q->buffer); if (count) { if (!buffer_skip_dname(q->buffer) || !query_parse_soa(q->buffer, &serial)) { if (addr2ip(q->addr, address, sizeof(address))) { ods_log_info("[%s] dropped packet: zone %s received bad " "notify from %s (bad soa in answer section)", query_str, q->zone->name, address); } else { ods_log_info("[%s] dropped packet: zone %s received bad " "notify from unknown source (bad soa in answer section)", query_str, q->zone->name); } return QUERY_DISCARDED; } pthread_mutex_lock(&q->zone->xfrd->serial_lock); if (!util_serial_gt(serial, q->zone->xfrd->serial_disk)) { if (addr2ip(q->addr, address, sizeof(address))) { ods_log_info("[%s] ignore notify from %s: already got " "zone %s serial %u on disk (received %u)", query_str, address, q->zone->name, q->zone->xfrd->serial_disk, serial); } else { ods_log_info("[%s] ignore notify: already got zone %s " "serial %u on disk (received %u)", query_str, q->zone->name, q->zone->xfrd->serial_disk, serial); } pthread_mutex_unlock(&q->zone->xfrd->serial_lock); } else if (q->zone->xfrd->serial_notify_acquired) { pthread_mutex_unlock(&q->zone->xfrd->serial_lock); if (addr2ip(q->addr, address, sizeof(address))) { ods_log_info("[%s] ignore notify from %s: zone %s " "transfer in progress", query_str, address, q->zone->name); } else { ods_log_info("[%s] ignore notify: zone %s transfer in " "progress", query_str, q->zone->name); } } else { q->zone->xfrd->serial_notify = serial; q->zone->xfrd->serial_notify_acquired = time_now(); pthread_mutex_unlock(&q->zone->xfrd->serial_lock); /* forward notify to xfrd */ if (addr2ip(q->addr, address, sizeof(address))) { ods_log_verbose("[%s] forward notify for zone %s from client %s", query_str, q->zone->name, address); } else { ods_log_verbose("[%s] forward notify for zone %s", query_str, q->zone->name); } xfrd_set_timer_now(q->zone->xfrd); dnshandler_fwd_notify(engine->dnshandler, buffer_begin(q->buffer), buffer_remaining(q->buffer)); } } else { /* Empty answer section, no SOA. We still need to process the notify according to the RFC */ /* forward notify to xfrd */ if (addr2ip(q->addr, address, sizeof(address))) { ods_log_verbose("[%s] forward notify for zone %s from client %s", query_str, q->zone->name, address); } else { ods_log_verbose("[%s] forward notify for zone %s", query_str, q->zone->name); } xfrd_set_timer_now(q->zone->xfrd); dnshandler_fwd_notify(engine->dnshandler, buffer_begin(q->buffer), buffer_remaining(q->buffer)); } /* send notify ok */ buffer_pkt_set_qr(q->buffer); buffer_pkt_set_aa(q->buffer); buffer_pkt_set_ancount(q->buffer, 0); buffer_clear(q->buffer); /* lim = pos, pos = 0; */ buffer_set_position(q->buffer, pos); buffer_set_limit(q->buffer, buffer_capacity(q->buffer)); q->reserved_space = edns_rr_reserved_space(q->edns_rr); q->reserved_space += tsig_rr_reserved_space(q->tsig_rr); return QUERY_PROCESSED; } /** * IXFR. * */ static query_state query_process_ixfr(query_type* q) { uint16_t count = 0; ods_log_assert(q); ods_log_assert(q->buffer); ods_log_assert(buffer_pkt_qdcount(q->buffer) == 1); /* skip header and question section */ buffer_skip(q->buffer, BUFFER_PKT_HEADER_SIZE); if (!buffer_skip_rr(q->buffer, 1)) { ods_log_error("[%s] dropped packet: zone %s received bad ixfr " "request (bad question section)", query_str, q->zone->name); return QUERY_DISCARDED; } /* answer section is empty */ ods_log_assert(buffer_pkt_ancount(q->buffer) == 0); /* examine auth section */ q->startpos = buffer_position(q->buffer); count = buffer_pkt_nscount(q->buffer); if (count) { if (!buffer_skip_dname(q->buffer) || !query_parse_soa(q->buffer, &(q->serial))) { ods_log_error("[%s] dropped packet: zone %s received bad ixfr " "request (bad soa in auth section)", query_str, q->zone->name); return QUERY_DISCARDED; } ods_log_debug("[%s] found ixfr request zone %s serial=%u", query_str, q->zone->name, q->serial); return QUERY_PROCESSED; } ods_log_debug("[%s] ixfr request zone %s has no auth section", query_str, q->zone->name); q->serial = 0; return QUERY_PROCESSED; } /** * Add RRset to response. * */ static int response_add_rrset(response_type* r, rrset_type* rrset, ldns_pkt_section section) { if (!r || !rrset || !section) { return 0; } /* duplicates? */ r->sections[r->rrset_count] = section; r->rrsets[r->rrset_count] = rrset; ++r->rrset_count; return 1; } /** * Encode RR. * */ static int response_encode_rr(query_type* q, ldns_rr* rr, ldns_pkt_section section) { uint8_t *data = NULL; size_t size = 0; ldns_status status = LDNS_STATUS_OK; ods_log_assert(q); ods_log_assert(rr); ods_log_assert(section); status = ldns_rr2wire(&data, rr, section, &size); if (status != LDNS_STATUS_OK) { ods_log_error("[%s] unable to send good response: ldns_rr2wire() " "failed (%s)", query_str, ldns_get_errorstr_by_id(status)); return 0; } buffer_write(q->buffer, (const void*) data, size); LDNS_FREE(data); return 1; } /** * Encode RRset. * */ static uint16_t response_encode_rrset(query_type* q, rrset_type* rrset, ldns_pkt_section section) { rrsig_type* rrsig; uint16_t i = 0; uint16_t added = 0; ods_log_assert(q); ods_log_assert(rrset); ods_log_assert(section); for (i = 0; i < rrset->rr_count; i++) { added += response_encode_rr(q, rrset->rrs[i].rr, section); } if (q->edns_rr && q->edns_rr->dnssec_ok) { while((rrsig = collection_iterator(rrset->rrsigs))) { added += response_encode_rr(q, rrsig->rr, section); } } /* truncation? */ return added; } /** * Encode response. * */ static void response_encode(query_type* q, response_type* r) { uint16_t counts[LDNS_SECTION_ANY]; ldns_pkt_section s = LDNS_SECTION_QUESTION; size_t i = 0; ods_log_assert(q); ods_log_assert(r); for (s = LDNS_SECTION_ANSWER; s < LDNS_SECTION_ANY; s++) { counts[s] = 0; } for (s = LDNS_SECTION_ANSWER; s < LDNS_SECTION_ANY; s++) { for (i = 0; i < r->rrset_count; i++) { if (r->sections[i] == s) { counts[s] += response_encode_rrset(q, r->rrsets[i], s); } } } buffer_pkt_set_ancount(q->buffer, counts[LDNS_SECTION_ANSWER]); buffer_pkt_set_nscount(q->buffer, counts[LDNS_SECTION_AUTHORITY]); buffer_pkt_set_arcount(q->buffer, counts[LDNS_SECTION_ADDITIONAL]); buffer_pkt_set_qr(q->buffer); buffer_pkt_set_aa(q->buffer); } /** * Query response. * */ static query_state query_response(query_type* q, ldns_rr_type qtype) { rrset_type* rrset = NULL; response_type r; if (!q || !q->zone) { return QUERY_DISCARDED; } r.rrset_count = 0; pthread_mutex_lock(&q->zone->zone_lock); rrset = zone_lookup_rrset(q->zone, q->zone->apex, qtype); if (rrset) { if (!response_add_rrset(&r, rrset, LDNS_SECTION_ANSWER)) { pthread_mutex_unlock(&q->zone->zone_lock); return query_servfail(q); } /* NS RRset goes into Authority Section */ rrset = zone_lookup_rrset(q->zone, q->zone->apex, LDNS_RR_TYPE_NS); if (rrset) { if (!response_add_rrset(&r, rrset, LDNS_SECTION_AUTHORITY)) { pthread_mutex_unlock(&q->zone->zone_lock); return query_servfail(q); } } /* else: not having NS RRs is not fatal */ } else if (qtype != LDNS_RR_TYPE_SOA) { rrset = zone_lookup_rrset(q->zone, q->zone->apex, LDNS_RR_TYPE_SOA); if (!rrset) { pthread_mutex_unlock(&q->zone->zone_lock); return query_servfail(q); } if (!response_add_rrset(&r, rrset, LDNS_SECTION_AUTHORITY)) { pthread_mutex_unlock(&q->zone->zone_lock); return query_servfail(q); } } else { pthread_mutex_unlock(&q->zone->zone_lock); return query_servfail(q); } pthread_mutex_unlock(&q->zone->zone_lock); response_encode(q, &r); /* compression */ return QUERY_PROCESSED; } /** * Prepare response. * */ void query_prepare(query_type* q) { uint16_t limit = 0; uint16_t flags = 0; ods_log_assert(q); ods_log_assert(q->buffer); limit = buffer_limit(q->buffer); flags = buffer_pkt_flags(q->buffer); flags &= 0x0100U; /* preserve the rd flag */ flags |= 0x8000U; /* set the qr flag */ buffer_pkt_set_flags(q->buffer, flags); buffer_clear(q->buffer); buffer_set_position(q->buffer, limit); buffer_set_limit(q->buffer, buffer_capacity(q->buffer)); q->reserved_space = edns_rr_reserved_space(q->edns_rr); q->reserved_space += tsig_rr_reserved_space(q->tsig_rr); } /** * QUERY. * */ static query_state query_process_query(query_type* q, ldns_rr_type qtype, engine_type* engine) { dnsout_type* dnsout = NULL; if (!q || !q->zone) { return QUERY_DISCARDED; } ods_log_assert(q->zone->name); ods_log_debug("[%s] incoming query qtype=%s for zone %s", query_str, rrset_type2str(qtype), q->zone->name); /* sanity checks */ if (buffer_pkt_qdcount(q->buffer) != 1 || buffer_pkt_tc(q->buffer)) { buffer_pkt_set_flags(q->buffer, 0); return query_formerr(q); } if (buffer_pkt_ancount(q->buffer) != 0 || (qtype != LDNS_RR_TYPE_IXFR && buffer_pkt_nscount(q->buffer) != 0)) { buffer_pkt_set_flags(q->buffer, 0); return query_formerr(q); } /* acl */ if (!q->zone->adoutbound || q->zone->adoutbound->type != ADAPTER_DNS) { ods_log_error("[%s] zone %s is not configured to have output dns " "adapter", query_str, q->zone->name); return query_refused(q); } ods_log_assert(q->zone->adoutbound->config); dnsout = (dnsout_type*) q->zone->adoutbound->config; /* acl also in use for soa and other queries */ if (!acl_find(dnsout->provide_xfr, &q->addr, q->tsig_rr)) { ods_log_debug("[%s] zone %s acl query refused", query_str, q->zone->name); return query_refused(q); } query_prepare(q); /* ixfr? */ if (qtype == LDNS_RR_TYPE_IXFR) { ods_log_assert(q->zone->name); ods_log_debug("[%s] incoming ixfr request serial=%u for zone %s", query_str, q->serial, q->zone->name); return ixfr(q, engine); } /* axfr? */ if (qtype == LDNS_RR_TYPE_AXFR) { ods_log_assert(q->zone->name); ods_log_debug("[%s] incoming axfr request for zone %s", query_str, q->zone->name); return axfr(q, engine, 0); } /* (soa) query */ if (qtype == LDNS_RR_TYPE_SOA) { ods_log_assert(q->zone->name); ods_log_debug("[%s] incoming soa request for zone %s", query_str, q->zone->name); return soa_request(q, engine); } /* other qtypes */ return query_response(q, qtype); } /** * UPDATE. * */ static query_state query_process_update(query_type* q) { if (!q || !q->zone) { return QUERY_DISCARDED; } ods_log_debug("[%s] dynamic update not implemented", query_str); return query_notimpl(q); } /** * Process TSIG RR. * */ static ldns_pkt_rcode query_process_tsig(query_type* q) { if (!q || !q->tsig_rr) { return LDNS_RCODE_SERVFAIL; } if (q->tsig_rr->status == TSIG_ERROR) { return LDNS_RCODE_FORMERR; } if (q->tsig_rr->status == TSIG_OK) { if (!tsig_rr_lookup(q->tsig_rr)) { ods_log_debug("[%s] tsig unknown key/algorithm", query_str); return LDNS_RCODE_REFUSED; } buffer_set_limit(q->buffer, q->tsig_rr->position); buffer_pkt_set_arcount(q->buffer, buffer_pkt_arcount(q->buffer)-1); tsig_rr_prepare(q->tsig_rr); tsig_rr_update(q->tsig_rr, q->buffer, buffer_limit(q->buffer)); if (!tsig_rr_verify(q->tsig_rr)) { ods_log_debug("[%s] bad tsig signature", query_str); return LDNS_RCODE_NOTAUTH; } } return LDNS_RCODE_NOERROR; } /** * Process EDNS OPT RR. * */ static ldns_pkt_rcode query_process_edns(query_type* q) { if (!q || !q->edns_rr) { return LDNS_RCODE_SERVFAIL; } if (q->edns_rr->status == EDNS_ERROR) { /* The only error is VERSION not implemented */ return LDNS_RCODE_FORMERR; } if (q->edns_rr->status == EDNS_OK) { /* Only care about UDP size larger than normal... */ if (!q->tcp && q->edns_rr->maxlen > UDP_MAX_MESSAGE_LEN) { if (q->edns_rr->maxlen < EDNS_MAX_MESSAGE_LEN) { q->maxlen = q->edns_rr->maxlen; } else { q->maxlen = EDNS_MAX_MESSAGE_LEN; } } /* Strip the OPT resource record off... */ buffer_set_position(q->buffer, q->edns_rr->position); buffer_set_limit(q->buffer, q->edns_rr->position); buffer_pkt_set_arcount(q->buffer, buffer_pkt_arcount(q->buffer) - 1); } return LDNS_RCODE_NOERROR; } /** * Find TSIG RR. * */ static int query_find_tsig(query_type* q) { size_t saved_pos = 0; size_t rrcount = 0; size_t i = 0; ods_log_assert(q); ods_log_assert(q->tsig_rr); ods_log_assert(q->buffer); if (buffer_pkt_arcount(q->buffer) == 0) { q->tsig_rr->status = TSIG_NOT_PRESENT; return 1; } saved_pos = buffer_position(q->buffer); rrcount = buffer_pkt_qdcount(q->buffer) + buffer_pkt_ancount(q->buffer) + buffer_pkt_nscount(q->buffer); buffer_set_position(q->buffer, BUFFER_PKT_HEADER_SIZE); for (i=0; i < rrcount; i++) { if (!buffer_skip_rr(q->buffer, i < buffer_pkt_qdcount(q->buffer))) { buffer_set_position(q->buffer, saved_pos); return 0; } } rrcount = buffer_pkt_arcount(q->buffer); ods_log_assert(rrcount != 0); if (!tsig_rr_parse(q->tsig_rr, q->buffer)) { ods_log_debug("[%s] got bad tsig", query_str); return 0; } if (q->tsig_rr->status != TSIG_NOT_PRESENT) { --rrcount; } if (rrcount) { if (edns_rr_parse(q->edns_rr, q->buffer)) { --rrcount; } } if (rrcount && q->tsig_rr->status == TSIG_NOT_PRESENT) { /* see if tsig is after the edns record */ if (!tsig_rr_parse(q->tsig_rr, q->buffer)) { ods_log_debug("[%s] got bad tsig", query_str); return 0; } if (q->tsig_rr->status != TSIG_NOT_PRESENT) { --rrcount; } } if (rrcount > 0) { ods_log_debug("[%s] too many additional rrs", query_str); return 0; } buffer_set_position(q->buffer, saved_pos); return 1; } /** * Process query. * */ query_state query_process(query_type* q, engine_type* engine) { ldns_status status = LDNS_STATUS_OK; ldns_pkt* pkt = NULL; ldns_rr* rr = NULL; ldns_pkt_rcode rcode = LDNS_RCODE_NOERROR; ldns_pkt_opcode opcode = LDNS_PACKET_QUERY; ldns_rr_type qtype = LDNS_RR_TYPE_SOA; ods_log_assert(engine); ods_log_assert(q); ods_log_assert(q->buffer); if (buffer_limit(q->buffer) < BUFFER_PKT_HEADER_SIZE) { ods_log_debug("[%s] drop query: packet too small", query_str); return QUERY_DISCARDED; /* too small */ } if (buffer_pkt_qr(q->buffer)) { ods_log_debug("[%s] drop query: qr bit set", query_str); return QUERY_DISCARDED; /* not a query */ } /* parse packet */ status = ldns_wire2pkt(&pkt, buffer_current(q->buffer), buffer_remaining(q->buffer)); if (status != LDNS_STATUS_OK) { ods_log_debug("[%s] got bad packet: %s", query_str, ldns_get_errorstr_by_id(status)); return query_formerr(q); } rr = ldns_rr_list_rr(ldns_pkt_question(pkt), 0); if (!rr) { ods_log_debug("[%s] no RRset in query section, ignoring", query_str); ldns_pkt_free(pkt); return QUERY_DISCARDED; /* no RRset in query */ } pthread_mutex_lock(&engine->zonelist->zl_lock); /* we can just lookup the zone, because we will only handle SOA queries, zone transfers, updates and notifies */ q->zone = zonelist_lookup_zone_by_dname(engine->zonelist, ldns_rr_owner(rr), ldns_rr_get_class(rr)); /* don't answer for zones that are just added */ if (q->zone && q->zone->zl_status == ZONE_ZL_ADDED) { ods_log_assert(q->zone->name); ods_log_warning("[%s] zone %s just added, don't answer for now", query_str, q->zone->name); q->zone = NULL; } pthread_mutex_unlock(&engine->zonelist->zl_lock); if (!q->zone) { ods_log_debug("[%s] zone not found", query_str); ldns_pkt_free(pkt); return query_servfail(q); } /* see if it is tsig signed */ if (!query_find_tsig(q)) { ldns_pkt_free(pkt); return query_formerr(q); } /* else: valid tsig, or no tsig present */ ods_log_debug("[%s] tsig %s", query_str, tsig_status2str(q->tsig_rr->status)); /* get opcode, qtype, ixfr=serial */ opcode = ldns_pkt_get_opcode(pkt); qtype = ldns_rr_get_type(rr); if (qtype == LDNS_RR_TYPE_IXFR) { ods_log_assert(q->zone->name); ods_log_debug("[%s] incoming ixfr request for zone %s", query_str, q->zone->name); if (query_process_ixfr(q) != QUERY_PROCESSED) { ldns_pkt_free(pkt); return query_formerr(q); } } /* process tsig */ rcode = query_process_tsig(q); if (rcode != LDNS_RCODE_NOERROR) { ldns_pkt_free(pkt); return query_error(q, rcode); } /* process edns */ rcode = query_process_edns(q); if (rcode != LDNS_RCODE_NOERROR) { /* We should not return FORMERR, but BADVERS (=16). * BADVERS is created with Ext. RCODE, followed by RCODE. * Ext. RCODE is set to 1, RCODE must be 0 (getting 0x10 = 16). * Thus RCODE = NOERROR = NSD_RC_OK. */ ldns_pkt_free(pkt); return query_error(q, LDNS_RCODE_NOERROR); } /* handle incoming request */ ldns_pkt_free(pkt); switch (opcode) { case LDNS_PACKET_NOTIFY: return query_process_notify(q, qtype, engine); case LDNS_PACKET_QUERY: return query_process_query(q, qtype, engine); case LDNS_PACKET_UPDATE: return query_process_update(q); default: break; } return query_notimpl(q); } /** * Check if query does not overflow. * */ static int query_overflow(query_type* q) { ods_log_assert(q); ods_log_assert(q->buffer); return buffer_position(q->buffer) > (q->maxlen - q->reserved_space); } /** * Add optional RRs to query. * */ void query_add_optional(query_type* q, engine_type* engine) { edns_data_type* edns = NULL; if (!q || !engine) { return; } /** First EDNS */ if (q->edns_rr) { edns = &engine->edns; switch (q->edns_rr->status) { case EDNS_NOT_PRESENT: break; case EDNS_OK: ods_log_debug("[%s] add edns opt ok", query_str); if (q->edns_rr->dnssec_ok) { edns->ok[7] = 0x80; } else { edns->ok[7] = 0x00; } buffer_write(q->buffer, edns->ok, OPT_LEN); /* fill with NULLs */ buffer_write(q->buffer, edns->rdata_none, OPT_RDATA); buffer_pkt_set_arcount(q->buffer, buffer_pkt_arcount(q->buffer) + 1); break; case EDNS_ERROR: ods_log_debug("[%s] add edns opt err", query_str); if (q->edns_rr->dnssec_ok) { edns->ok[7] = 0x80; } else { edns->ok[7] = 0x00; } buffer_write(q->buffer, edns->error, OPT_LEN); buffer_write(q->buffer, edns->rdata_none, OPT_RDATA); buffer_pkt_set_arcount(q->buffer, buffer_pkt_arcount(q->buffer) + 1); break; default: break; } } /** Then TSIG */ if (!q->tsig_rr) { return; } if (q->tsig_rr->status != TSIG_NOT_PRESENT) { if (q->tsig_rr->status == TSIG_ERROR || q->tsig_rr->error_code != LDNS_RCODE_NOERROR) { ods_log_debug("[%s] add tsig err", query_str); tsig_rr_error(q->tsig_rr); tsig_rr_append(q->tsig_rr, q->buffer); buffer_pkt_set_arcount(q->buffer, buffer_pkt_arcount(q->buffer)+1); } else if (q->tsig_rr->status == TSIG_OK && q->tsig_rr->error_code == LDNS_RCODE_NOERROR) { ods_log_debug("[%s] add tsig ok", query_str); if (q->tsig_prepare_it) tsig_rr_prepare(q->tsig_rr); if (q->tsig_update_it) tsig_rr_update(q->tsig_rr, q->buffer, buffer_position(q->buffer)); if (q->tsig_sign_it) { tsig_rr_sign(q->tsig_rr); tsig_rr_append(q->tsig_rr, q->buffer); buffer_pkt_set_arcount(q->buffer, buffer_pkt_arcount(q->buffer)+1); } } } } /** * Add RR to query. * */ int query_add_rr(query_type* q, ldns_rr* rr) { size_t i = 0; size_t tc_mark = 0; size_t rdlength_pos = 0; uint16_t rdlength = 0; ods_log_assert(q); ods_log_assert(q->buffer); ods_log_assert(rr); /* set truncation mark, in case rr does not fit */ tc_mark = buffer_position(q->buffer); /* owner type class ttl */ if (!buffer_available(q->buffer, ldns_rdf_size(ldns_rr_owner(rr)))) { goto query_add_rr_tc; } buffer_write_rdf(q->buffer, ldns_rr_owner(rr)); if (!buffer_available(q->buffer, sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t) + sizeof(rdlength))) { goto query_add_rr_tc; } buffer_write_u16(q->buffer, (uint16_t) ldns_rr_get_type(rr)); buffer_write_u16(q->buffer, (uint16_t) ldns_rr_get_class(rr)); buffer_write_u32(q->buffer, (uint32_t) ldns_rr_ttl(rr)); /* skip rdlength */ rdlength_pos = buffer_position(q->buffer); buffer_skip(q->buffer, sizeof(rdlength)); /* write rdata */ for (i=0; i < ldns_rr_rd_count(rr); i++) { if (!buffer_available(q->buffer, ldns_rdf_size(ldns_rr_rdf(rr, i)))) { goto query_add_rr_tc; } buffer_write_rdf(q->buffer, ldns_rr_rdf(rr, i)); } if (!query_overflow(q)) { /* write rdlength */ rdlength = buffer_position(q->buffer) - rdlength_pos - sizeof(rdlength); buffer_write_u16_at(q->buffer, rdlength_pos, rdlength); /* position updated by buffer_write() */ return 1; } query_add_rr_tc: buffer_set_position(q->buffer, tc_mark); ods_log_assert(!query_overflow(q)); return 0; } /** * Cleanup query. * */ void query_cleanup(query_type* q) { if (!q) { return; } if (q->axfr_fd) { ods_fclose(q->axfr_fd); q->axfr_fd = NULL; } buffer_cleanup(q->buffer); tsig_rr_cleanup(q->tsig_rr); edns_rr_cleanup(q->edns_rr); free(q); } opendnssec-2.1.13/signer/src/wire/acl.h0000644000077000001440000000643214446272525014631 00000000000000/* * 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. * */ /** * Access Control List. * */ #ifndef WIRE_ACL_H #define WIRE_ACL_H #include "config.h" #include "status.h" #include "wire/listener.h" #include "wire/tsig.h" /** * Address range type. * */ enum acl_range_enum { ACL_RANGE_SINGLE = 0, /* single adress */ ACL_RANGE_MASK = 1, /* 10.20.30.40&255.255.255.0 */ ACL_RANGE_SUBNET = 2, /* 10.20.30.40/28 */ ACL_RANGE_MINMAX = 3 /* 10.20.30.40-10.20.30.60 (mask=max) */ }; typedef enum acl_range_enum acl_range_type; /** * ACL. * */ typedef struct acl_struct acl_type; struct acl_struct { acl_type* next; /* address */ char* address; unsigned int port; int family; union acl_addr_storage addr; union acl_addr_storage range_mask; acl_range_type range_type; /* tsig */ const char* tsig_name; tsig_type* tsig; /* cache */ time_t ixfr_disabled; }; /** * Create ACL. * \param[in] allocator memory allocator * \param[in] address IP address * \param[in] port port * \param[in] tsig_name TSIG name * \param[in] tsig list of TSIGs * \return acl_type* ACL * */ extern acl_type* acl_create(char* address, char* port, char* tsig_name, tsig_type* tsig); /** * Find ACL. * \param[in] acl ACL * \param[in] addr remote address storage * \param[in] tsig tsig credentials * \return acl_type* ACL that matches * */ extern acl_type* acl_find(acl_type* acl, struct sockaddr_storage* addr, tsig_rr_type* tsig); /** * Parse family from address. * \param[in] a address in string format * \return int address family * */ extern int acl_parse_family(const char* a); /** * Address storage to IP string. * \param[in] addr socket address storage * \param[out] ip ip address * \param[in] len max strlen of ip address * \return int 0 if failed, 1 otherwise * */ extern int addr2ip(struct sockaddr_storage addr, char* ip, size_t len); /** * Clean up ACL. * \param[in] acl ACL * \param[in] allocator memory allocator * */ extern void acl_cleanup(acl_type* acl); #endif /* WIRE_ACL_H */ opendnssec-2.1.13/signer/src/wire/tsig-openssl.c0000644000077000001440000001314214446272525016510 00000000000000/* * 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. * */ /** * Interface to OpenSSL for TSIG support. * */ #include "config.h" #ifdef HAVE_SSL #include "log.h" #include "wire/tsig.h" #include "wire/tsig-openssl.h" static const char* tsig_str = "tsig-ssl"; /** helper funcgtions */ static void *create_context(); static void init_context(void *context, tsig_algo_type *algorithm, tsig_key_type *key); static void update(void *context, const void *data, size_t size); static void final(void *context, uint8_t *digest, size_t *size); typedef struct tsig_cleanup_table_struct tsig_cleanup_table_type; struct tsig_cleanup_table_struct { tsig_cleanup_table_type* next; void* cleanup; }; static tsig_cleanup_table_type* tsig_cleanup_table = NULL; /** * Initiallize algorithm. * */ static int tsig_openssl_init_algorithm(const char* digest, const char* name, const char* wireformat) { tsig_algo_type* algorithm = NULL; const EVP_MD *hmac_algorithm = NULL; ods_log_assert(digest); ods_log_assert(name); ods_log_assert(wireformat); hmac_algorithm = EVP_get_digestbyname(digest); if (!hmac_algorithm) { ods_log_error("[%s] %s digest not available", tsig_str, digest); return 0; } CHECKALLOC(algorithm = (tsig_algo_type *) malloc(sizeof(tsig_algo_type))); algorithm->txt_name = name; algorithm->wf_name = ldns_dname_new_frm_str(wireformat); if (!algorithm->wf_name) { ods_log_error("[%s] unable to parse %s algorithm", tsig_str, wireformat); free(algorithm); return 0; } algorithm->max_digest_size = EVP_MAX_MD_SIZE; algorithm->data = hmac_algorithm; algorithm->hmac_create = create_context; algorithm->hmac_init = init_context; algorithm->hmac_update = update; algorithm->hmac_final = final; tsig_handler_add_algo(algorithm); return 1; } /** * Initialize OpenSSL support for TSIG. * */ ods_status tsig_handler_openssl_init() { tsig_cleanup_table = NULL; OpenSSL_add_all_digests(); ods_log_debug("[%s] add md5", tsig_str); if (!tsig_openssl_init_algorithm("md5", "hmac-md5", "hmac-md5.sig-alg.reg.int.")) { return ODS_STATUS_ERR; } #ifdef HAVE_EVP_SHA1 ods_log_debug("[%s] add sha1", tsig_str); if (!tsig_openssl_init_algorithm("sha1", "hmac-sha1", "hmac-sha1.")) { return ODS_STATUS_ERR; } #endif /* HAVE_EVP_SHA1 */ #ifdef HAVE_EVP_SHA256 ods_log_debug("[%s] add sha256", tsig_str); if (!tsig_openssl_init_algorithm("sha256", "hmac-sha256", "hmac-sha256.")) { return ODS_STATUS_ERR; } #endif /* HAVE_EVP_SHA256 */ return ODS_STATUS_OK; } static void cleanup_context(void *data) { HMAC_CTX* context = (HMAC_CTX*) data; #ifdef HAVE_SSL_NEW_HMAC HMAC_CTX_free(context); #else HMAC_CTX_cleanup(context); #endif } static void context_add_cleanup(void* context) { tsig_cleanup_table_type* entry = NULL; if (!context) { return; } CHECKALLOC(entry = (tsig_cleanup_table_type *) malloc(sizeof(tsig_cleanup_table_type))); entry->cleanup = context; entry->next = tsig_cleanup_table; tsig_cleanup_table = entry; } static void* create_context() { HMAC_CTX* context; #ifdef HAVE_SSL_NEW_HMAC CHECKALLOC(context = HMAC_CTX_new()); HMAC_CTX_reset(context); #else CHECKALLOC(context = (HMAC_CTX*) malloc(sizeof(HMAC_CTX))); HMAC_CTX_init(context); #endif context_add_cleanup(context); return context; } static void init_context(void* context, tsig_algo_type *algorithm, tsig_key_type *key) { HMAC_CTX* ctx = (HMAC_CTX*) context; const EVP_MD* md = (const EVP_MD*) algorithm->data; HMAC_Init_ex(ctx, key->data, key->size, md, NULL); } static void update(void* context, const void* data, size_t size) { HMAC_CTX* ctx = (HMAC_CTX*) context; HMAC_Update(ctx, (unsigned char*) data, (int) size); } static void final(void* context, uint8_t* digest, size_t* size) { HMAC_CTX* ctx = (HMAC_CTX*) context; unsigned len = (unsigned) *size; HMAC_Final(ctx, digest, &len); *size = (size_t) len; } /** * Finalize OpenSSL support for TSIG. * */ void tsig_handler_openssl_finalize(void) { tsig_cleanup_table_type* entry = tsig_cleanup_table; while (entry) { cleanup_context(entry->cleanup); entry = entry->next; } EVP_cleanup(); } #endif /* HAVE_SSL */ opendnssec-2.1.13/signer/src/wire/tsig.c0000644000077000001440000005554614446272525015045 00000000000000/* * Copyright (c) 2011 NLNet Labs. All rights reserved. * * Taken from NSD3 and adjusted for OpenDNSSEC, NLnet Labs. * * 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. * */ /** * TSIG. * */ #include "config.h" #include "compat.h" #include "duration.h" #include "file.h" #include "log.h" #include "status.h" #include "util.h" #include "wire/buffer.h" #include "wire/tsig.h" #include "wire/tsig-openssl.h" #include #define TSIG_SIGNED_TIME_FUDGE 300 static const char* tsig_str = "tsig"; /** key table */ typedef struct tsig_key_table_struct tsig_key_table_type; struct tsig_key_table_struct { tsig_key_table_type* next; tsig_key_type* key; }; static tsig_key_table_type* tsig_key_table = NULL; /** algorithm table */ typedef struct tsig_algo_table_struct tsig_algo_table_type; struct tsig_algo_table_struct { tsig_algo_table_type* next; tsig_algo_type* algorithm; }; static tsig_algo_table_type* tsig_algo_table = NULL; /** maximum algorithm digest size */ static size_t max_algo_digest_size = 0; /** * Add key to TSIG handler. * */ void tsig_handler_add_key(tsig_key_type* key) { tsig_key_table_type* entry = NULL; if (!key) { return; } CHECKALLOC(entry = (tsig_key_table_type *) malloc(sizeof(tsig_key_table_type))); if (entry) { entry->key = key; entry->next = tsig_key_table; tsig_key_table = entry; } } /** * Add algorithm to TSIG handler. * */ void tsig_handler_add_algo(tsig_algo_type* algo) { tsig_algo_table_type* entry = NULL; if (!algo) { return; } CHECKALLOC(entry = (tsig_algo_table_type *) malloc(sizeof(tsig_algo_table_type))); if (entry) { entry->algorithm = algo; entry->next = tsig_algo_table; tsig_algo_table = entry; if (algo->max_digest_size > max_algo_digest_size) { max_algo_digest_size = algo->max_digest_size; } } } /** * Initialize TSIG handler. * */ ods_status tsig_handler_init() { tsig_key_table = NULL; tsig_algo_table = NULL; #ifdef HAVE_SSL ods_log_debug("[%s] init openssl", tsig_str); return tsig_handler_openssl_init(); #else ods_log_debug("[%s] openssl disabled", tsig_str); return ODS_STATUS_OK; #endif } /** * Clean up TSIG handler. * */ void tsig_handler_cleanup(void) { tsig_algo_table_type* aentry = NULL, *anext = NULL; tsig_key_table_type* kentry = NULL, *knext = NULL; #ifdef HAVE_SSL tsig_handler_openssl_finalize(); #endif aentry = tsig_algo_table; while (aentry) { anext = aentry->next; ldns_rdf_deep_free(aentry->algorithm->wf_name); free(aentry->algorithm); free(aentry); aentry = anext; } kentry = tsig_key_table; while (kentry) { knext = kentry->next; ldns_rdf_deep_free(kentry->key->dname); free((void*)kentry->key->data); free((void*)kentry->key); free(kentry); kentry = knext; } } /** * Create new TSIG key. * */ static tsig_key_type* tsig_key_create(tsig_type* tsig) { tsig_key_type* key = NULL; ldns_rdf* dname = NULL; uint8_t* data = NULL; int size = 0; if (!tsig || !tsig->name || !tsig->secret) { return NULL; } CHECKALLOC(key = (tsig_key_type*) malloc(sizeof(tsig_key_type))); dname = ldns_dname_new_frm_str(tsig->name); if (!dname) { free(key); return NULL; } CHECKALLOC(data = malloc(sizeof(uint8_t) * util_b64_pton_calculate_size(strlen(tsig->secret)))); size = b64_pton(tsig->secret, data, util_b64_pton_calculate_size(strlen(tsig->secret))); if (size < 0) { ods_log_error("[%s] unable to create tsig key %s: failed to parse " "secret", tsig_str, tsig->name); ldns_rdf_deep_free(dname); free(data); free(key); return NULL; } key->dname = dname; key->size = size; key->data = data; tsig_handler_add_key(key); return key; } /** * Create new TSIG. * */ tsig_type* tsig_create(char* name, char* algo, char* secret) { tsig_type* tsig = NULL; if (!name || !algo || !secret) { return NULL; } CHECKALLOC(tsig = (tsig_type*) malloc(sizeof(tsig_type))); tsig->next = NULL; tsig->name = strdup(name); tsig->algorithm = strdup(algo); tsig->secret = strdup(secret); tsig->key = tsig_key_create(tsig); if (!tsig->key) { ods_log_error("[%s] unable to create tsig: tsig_key_create() " "failed", tsig_str); tsig_cleanup(tsig); return NULL; } return tsig; } /** * Lookup TSIG by key name. * */ tsig_type* tsig_lookup_by_name(tsig_type* tsig, const char* name) { tsig_type* find = NULL; if (!tsig || !name) { return NULL; } find = tsig; while (find) { if (ods_strlowercmp(find->name, name) == 0) { return find; } find = find->next; } return NULL; } /** * Lookup TSIG algorithm by name. * */ tsig_algo_type* tsig_lookup_algo(const char* name) { tsig_algo_table_type* entry = NULL; for (entry = tsig_algo_table; entry; entry = entry->next) { if (ods_strlowercmp(name, entry->algorithm->txt_name) == 0) { return entry->algorithm; } } return NULL; } /** * Create new TSIG RR. * */ tsig_rr_type* tsig_rr_create() { tsig_rr_type* trr = NULL; CHECKALLOC(trr = (tsig_rr_type*) malloc(sizeof(tsig_rr_type))); trr->key_name = NULL; trr->algo_name = NULL; trr->mac_data = NULL; trr->other_data = NULL; tsig_rr_reset(trr, NULL, NULL); return trr; } /** * Reset TSIG RR. * */ void tsig_rr_reset(tsig_rr_type* trr, tsig_algo_type* algo, tsig_key_type* key) { if (!trr) { return; } tsig_rr_free(trr); trr->status = TSIG_NOT_PRESENT; trr->position = 0; trr->response_count = 0; trr->update_since_last_prepare = 0; trr->context = NULL; trr->algo = algo; trr->key = key; trr->prior_mac_size = 0; trr->prior_mac_data = NULL; trr->signed_time_high = 0; trr->signed_time_low = 0; trr->signed_time_fudge = 0; trr->mac_size = 0; trr->original_query_id = 0; trr->error_code = LDNS_RCODE_NOERROR; trr->other_size = 0; } /** * Parse TSIG RR. * */ int tsig_rr_parse(tsig_rr_type* trr, buffer_type* buffer) { uint16_t dname_len = 0; ldns_rr_type type = 0; ldns_rr_class klass = 0; uint32_t ttl = 0; uint16_t rdlen = 0; uint16_t curpos = 0; ods_log_assert(trr); ods_log_assert(buffer); trr->status = TSIG_NOT_PRESENT; trr->position = buffer_position(buffer); curpos = trr->position; if (!buffer_skip_dname(buffer)) { buffer_set_position(buffer, trr->position); ods_log_debug("[%s] parse: skip key name failed", tsig_str); return 0; } dname_len = buffer_position(buffer) - curpos; buffer_set_position(buffer, curpos); trr->key_name = ldns_dname_new_frm_data(dname_len, (const void*) buffer_current(buffer)); if (!trr->key_name) { buffer_set_position(buffer, trr->position); ods_log_debug("[%s] parse: read key name failed", tsig_str); return 0; } buffer_set_position(buffer, curpos + dname_len); if (!buffer_available(buffer, 10)) { ods_log_debug("[%s] parse: not enough available", tsig_str); buffer_set_position(buffer, trr->position); return 0; } type = (ldns_rr_type) buffer_read_u16(buffer); klass = (ldns_rr_class) buffer_read_u16(buffer); if (type != LDNS_RR_TYPE_TSIG || klass != LDNS_RR_CLASS_ANY) { /* not present */ ods_log_debug("[%s] parse: not TSIG or not ANY but %d:%d", tsig_str, klass, type); buffer_set_position(buffer, trr->position); return 1; } ttl = buffer_read_u32(buffer); rdlen = buffer_read_u16(buffer); /* default to error */ trr->status = TSIG_ERROR; trr->error_code = LDNS_RCODE_FORMERR; if (ttl || !buffer_available(buffer, rdlen)) { ods_log_debug("[%s] parse: TTL!=0 or RDLEN=0", tsig_str); buffer_set_position(buffer, trr->position); return 0; } curpos = buffer_position(buffer); if (!buffer_skip_dname(buffer)) { ods_log_debug("[%s] parse: skip algo name failed", tsig_str); buffer_set_position(buffer, trr->position); return 0; } dname_len = buffer_position(buffer) - curpos; buffer_set_position(buffer, curpos); trr->algo_name = ldns_dname_new_frm_data(dname_len, (const void*) buffer_current(buffer)); if (!trr->algo_name) { ods_log_debug("[%s] parse: read algo name failed", tsig_str); buffer_set_position(buffer, trr->position); return 0; } buffer_set_position(buffer, curpos + dname_len); if (!buffer_available(buffer, 10)) { ods_log_debug("[%s] parse: not enough available", tsig_str); buffer_set_position(buffer, trr->position); return 0; } trr->signed_time_high = buffer_read_u16(buffer); trr->signed_time_low = buffer_read_u32(buffer); trr->signed_time_fudge = buffer_read_u16(buffer); trr->mac_size = buffer_read_u16(buffer); if (!buffer_available(buffer, trr->mac_size)) { ods_log_debug("[%s] parse: wrong mac size", tsig_str); buffer_set_position(buffer, trr->position); trr->mac_size = 0; return 0; } CHECKALLOC(trr->mac_data = (uint8_t *) malloc(trr->mac_size)); memcpy(trr->mac_data, (const void*) buffer_current(buffer), trr->mac_size); buffer_skip(buffer, trr->mac_size); if (!buffer_available(buffer, 6)) { ods_log_debug("[%s] parse: not enough available", tsig_str); buffer_set_position(buffer, trr->position); return 0; } trr->original_query_id = buffer_read_u16(buffer); trr->error_code = buffer_read_u16(buffer); trr->other_size = buffer_read_u16(buffer); if (!buffer_available(buffer, trr->other_size) || trr->other_size > 16) { ods_log_debug("[%s] parse: not enough available", tsig_str); trr->other_size = 0; buffer_set_position(buffer, trr->position); return 0; } CHECKALLOC(trr->other_data = (uint8_t *) malloc(trr->other_size)); memcpy(trr->other_data, (const void*) buffer_current(buffer), trr->other_size); buffer_skip(buffer, trr->other_size); trr->status = TSIG_OK; return 1; } /** * Find TSIG RR. * */ int tsig_rr_find(tsig_rr_type* trr, buffer_type* buffer) { size_t saved_pos = 0; size_t rrcount = 0; size_t i = 0; int result = 0; ods_log_assert(trr); ods_log_assert(buffer); if (buffer_pkt_arcount(buffer) == 0) { trr->status = TSIG_NOT_PRESENT; return 1; } saved_pos = buffer_position(buffer); rrcount = buffer_pkt_qdcount(buffer) + buffer_pkt_ancount(buffer) + buffer_pkt_nscount(buffer) + buffer_pkt_arcount(buffer); rrcount &= 0x3FFFF; /* un-taint rrcount */ buffer_set_position(buffer, BUFFER_PKT_HEADER_SIZE); for (i=0; i < rrcount - 1; i++) { if (!buffer_skip_rr(buffer, i < (buffer_pkt_qdcount(buffer)&0xFFFF))) { buffer_set_position(buffer, saved_pos); return 0; } } result = tsig_rr_parse(trr, buffer); buffer_set_position(buffer, saved_pos); return result; } /** * Lookup TSIG RR. * */ int tsig_rr_lookup(tsig_rr_type* trr) { tsig_key_table_type* kentry = NULL; tsig_key_type* key = NULL; tsig_algo_table_type* aentry = NULL; tsig_algo_type* algorithm = NULL; uint64_t current_time = 0; uint64_t signed_time = 0; ods_log_assert(trr); ods_log_assert(trr->status == TSIG_OK); ods_log_assert(!trr->algo); ods_log_assert(!trr->key); for (kentry = tsig_key_table; kentry; kentry = kentry->next) { if (ldns_dname_compare(trr->key_name, kentry->key->dname) == 0) { key = kentry->key; break; } } for (aentry = tsig_algo_table; aentry; aentry = aentry->next) { if (ldns_dname_compare(trr->algo_name, aentry->algorithm->wf_name) == 0) { algorithm = aentry->algorithm; break; } } if (!key || !algorithm) { /* algorithm or key is unknown, cannot authenticate. */ ods_log_debug("[%s] algorithm or key missing", tsig_str); trr->error_code = TSIG_ERROR_BADKEY; return 0; } if ((trr->algo && algorithm != trr->algo) || (trr->key && key != trr->key)) { /* algorithm or key changed during a single connection, error. */ ods_log_debug("[%s] algorithm or key has changed", tsig_str); trr->error_code = TSIG_ERROR_BADKEY; return 0; } signed_time = ((((uint64_t) trr->signed_time_high) << 32) | ((uint64_t) trr->signed_time_low)); current_time = (uint64_t) time_now(); if ((current_time < signed_time - trr->signed_time_fudge) || (current_time > signed_time + trr->signed_time_fudge)) { uint16_t current_time_high; uint32_t current_time_low; trr->error_code = TSIG_ERROR_BADTIME; current_time_high = (uint16_t) (current_time >> 32); current_time_low = (uint32_t) current_time; trr->other_size = 6; CHECKALLOC(trr->other_data = (uint8_t *) malloc(sizeof(uint16_t) + sizeof(uint32_t))); write_uint16(trr->other_data, current_time_high); write_uint32(trr->other_data + 2, current_time_low); ods_log_debug("[%s] bad time", tsig_str); return 0; } trr->algo = algorithm; trr->key = key; trr->response_count = 0; trr->prior_mac_size = 0; return 1; } /** * Prepare TSIG RR. * */ void tsig_rr_prepare(tsig_rr_type* trr) { ods_log_assert(trr->algo); if (!trr->context) { trr->context = trr->algo->hmac_create(); CHECKALLOC(trr->prior_mac_data = (uint8_t *) malloc(trr->algo->max_digest_size)); } trr->algo->hmac_init(trr->context, trr->algo, trr->key); if (trr->prior_mac_size > 0) { uint16_t mac_size = htons(trr->prior_mac_size); trr->algo->hmac_update(trr->context, &mac_size, sizeof(mac_size)); trr->algo->hmac_update(trr->context, trr->prior_mac_data, trr->prior_mac_size); } trr->update_since_last_prepare = 0; } /** * Update TSIG RR. * */ void tsig_rr_update(tsig_rr_type* trr, buffer_type* buffer, size_t length) { uint16_t original_query_id = 0; ods_log_assert(trr); ods_log_assert(trr->algo); ods_log_assert(trr->context); ods_log_assert(buffer); ods_log_assert(length <= buffer_limit(buffer)); original_query_id = htons(trr->original_query_id); trr->algo->hmac_update(trr->context, &original_query_id, sizeof(original_query_id)); trr->algo->hmac_update(trr->context, buffer_at(buffer, sizeof(original_query_id)), length - sizeof(original_query_id)); if (buffer_pkt_qr(buffer)) { ++trr->response_count; } ++trr->update_since_last_prepare; } /** * Digest variables. * */ static void tsig_rr_digest_variables(tsig_rr_type* trr, int tsig_timers_only) { uint16_t klass = htons(LDNS_RR_CLASS_ANY); uint32_t ttl = htonl(0); uint16_t signed_time_high = htons(trr->signed_time_high); uint32_t signed_time_low = htonl(trr->signed_time_low); uint16_t signed_time_fudge = htons(trr->signed_time_fudge); uint16_t error_code = htons(trr->error_code); uint16_t other_size = htons(trr->other_size); ods_log_assert(trr->context); ods_log_assert(trr->algo); ods_log_assert(trr->key_name); if (!tsig_timers_only) { ods_log_assert(trr->key_name); ods_log_assert(trr->algo_name); trr->algo->hmac_update(trr->context, ldns_rdf_data(trr->key_name), ldns_rdf_size(trr->key_name)); trr->algo->hmac_update(trr->context, &klass, sizeof(klass)); trr->algo->hmac_update(trr->context, &ttl, sizeof(ttl)); trr->algo->hmac_update(trr->context, ldns_rdf_data(trr->algo_name), ldns_rdf_size(trr->algo_name)); } trr->algo->hmac_update(trr->context, &signed_time_high, sizeof(signed_time_high)); trr->algo->hmac_update(trr->context, &signed_time_low, sizeof(signed_time_low)); trr->algo->hmac_update(trr->context, &signed_time_fudge, sizeof(signed_time_fudge)); if (!tsig_timers_only) { trr->algo->hmac_update(trr->context, &error_code, sizeof(error_code)); trr->algo->hmac_update(trr->context, &other_size, sizeof(other_size)); trr->algo->hmac_update(trr->context, trr->other_data, trr->other_size); } } /** * Sign TSIG RR. * */ void tsig_rr_sign(tsig_rr_type* trr) { uint64_t current_time = (uint64_t) time_now(); ods_log_assert(trr); ods_log_assert(trr->context); trr->signed_time_high = (uint16_t) (current_time >> 32); trr->signed_time_low = (uint32_t) current_time; trr->signed_time_fudge = TSIG_SIGNED_TIME_FUDGE; tsig_rr_digest_variables(trr, trr->response_count > 1); trr->algo->hmac_final(trr->context, trr->prior_mac_data, &trr->prior_mac_size); trr->mac_size = trr->prior_mac_size; trr->mac_data = trr->prior_mac_data; } /** * Verify TSIG RR. * */ int tsig_rr_verify(tsig_rr_type* trr) { ods_log_assert(trr); ods_log_assert(trr->algo); tsig_rr_digest_variables(trr, trr->response_count > 1); trr->algo->hmac_final(trr->context, trr->prior_mac_data, &trr->prior_mac_size); if (trr->mac_size != trr->prior_mac_size || memcmp(trr->mac_data, trr->prior_mac_data, trr->mac_size) != 0) { /* digest is incorrect, cannot authenticate. */ trr->error_code = TSIG_ERROR_BADSIG; return 0; } return 1; } /** * Append TSIG RR. * */ void tsig_rr_append(tsig_rr_type* trr, buffer_type* buffer) { size_t rdlength_pos = 0; if (!trr || !buffer) { return; } /* [TODO] key name compression? */ if (trr->key_name) { buffer_write_rdf(buffer, trr->key_name); } else { buffer_write_u8(buffer, 0); } buffer_write_u16(buffer, (uint16_t)LDNS_RR_TYPE_TSIG); buffer_write_u16(buffer, (uint16_t)LDNS_RR_CLASS_ANY); buffer_write_u32(buffer, 0); /* TTL */ rdlength_pos = buffer_position(buffer); buffer_skip(buffer, sizeof(uint16_t)); if (trr->algo_name) { buffer_write_rdf(buffer, trr->algo_name); } else { buffer_write_u8(buffer, 0); } buffer_write_u16(buffer, trr->signed_time_high); buffer_write_u32(buffer, trr->signed_time_low); buffer_write_u16(buffer, trr->signed_time_fudge); buffer_write_u16(buffer, trr->mac_size); buffer_write(buffer, trr->mac_data, trr->mac_size); buffer_write_u16(buffer, trr->original_query_id); buffer_write_u16(buffer, trr->error_code); buffer_write_u16(buffer, trr->other_size); buffer_write(buffer, trr->other_data, trr->other_size); buffer_write_u16_at(buffer, rdlength_pos, buffer_position(buffer) - rdlength_pos - sizeof(uint16_t)); } /* * The amount of space to reserve in the response for the TSIG data. * */ size_t tsig_rr_reserved_space(tsig_rr_type* trr) { if (!trr || trr->status == TSIG_NOT_PRESENT) { return 0; } return ( (trr->key_name?ldns_rdf_size(trr->key_name):1) + sizeof(uint16_t) /* Type */ + sizeof(uint16_t) /* Class */ + sizeof(uint32_t) /* TTL */ + sizeof(uint16_t) /* RDATA length */ + (trr->algo_name?ldns_rdf_size(trr->algo_name):1) + sizeof(uint16_t) /* Signed time (high) */ + sizeof(uint32_t) /* Signed time (low) */ + sizeof(uint16_t) /* Signed time fudge */ + sizeof(uint16_t) /* MAC size */ + max_algo_digest_size /* MAC data */ + sizeof(uint16_t) /* Original query ID */ + sizeof(uint16_t) /* Error code */ + sizeof(uint16_t) /* Other size */ + trr->other_size); /* Other data */ } /** * Reply with error TSIG RR. * */ void tsig_rr_error(tsig_rr_type* trr) { if (!trr) { return; } if (trr->mac_data) { memset(trr->mac_data, 0, trr->mac_size); } trr->mac_size = 0; } /** * Print TSIG status. * */ const char* tsig_status2str(tsig_status status) { switch (status) { case TSIG_NOT_PRESENT: return "NOT PRESENT"; case TSIG_OK: return "OK"; case TSIG_ERROR: return "ERROR"; } return "UNKNOWN"; } /** * Get human readable TSIG error code. * */ const char* tsig_strerror(uint16_t error) { static char message[1000]; switch (error) { case 0: return "No Error"; break; case TSIG_ERROR_BADSIG: return "Bad Signature"; break; case TSIG_ERROR_BADKEY: return "Bad Key"; break; case TSIG_ERROR_BADTIME: return "Bad Time"; break; default: if (error < 16) { /* DNS rcodes */ return (const char*) ldns_pkt_rcode2str(error); } snprintf(message, sizeof(message), "Unknown Error %d", error); break; } return message; } /** * Free TSIG RR. * */ void tsig_rr_free(tsig_rr_type* trr) { if (!trr) { return; } ldns_rdf_deep_free(trr->key_name); ldns_rdf_deep_free(trr->algo_name); free(trr->mac_data); free(trr->other_data); trr->key_name = NULL; trr->algo_name = NULL; trr->mac_data = NULL; trr->other_data = NULL; } /** * Cleanup TSIG RR. * */ void tsig_rr_cleanup(tsig_rr_type* trr) { if (!trr) { return; } tsig_rr_free(trr); free(trr); } /** * Clean up TSIG. * */ void tsig_cleanup(tsig_type* tsig) { if (!tsig) { return; } tsig_cleanup(tsig->next); free((void*)tsig->name); free((void*)tsig->algorithm); free((void*)tsig->secret); free(tsig); } opendnssec-2.1.13/signer/src/wire/xfrd.h0000644000077000001440000001240514446272525015032 00000000000000/* * 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. * */ /** * Zone transfers. * */ #ifndef WIRE_XFRD_H #define WIRE_XFRD_H #include "config.h" #include #include /** * Packet status. * */ enum xfrd_pkt_enum { XFRD_PKT_BAD, /* drop the packet/connection */ XFRD_PKT_MORE, /* more packets to follow on tcp */ XFRD_PKT_NOTIMPL, /* server responded with NOTIMPL or FORMATERR */ XFRD_PKT_TC, /* try tcp connection */ XFRD_PKT_XFR, /* server responded with transfer*/ XFRD_PKT_NEWLEASE /* no changes, soa OK */ }; typedef enum xfrd_pkt_enum xfrd_pkt_status; typedef struct soa_struct soa_type; typedef struct xfrd_struct xfrd_type; #include "locks.h" #include "status.h" #include "wire/acl.h" #include "wire/buffer.h" #include "wire/netio.h" #include "wire/tsig.h" #include "daemon/xfrhandler.h" #define XFRD_MAX_ROUNDS 3 /* max number of rounds along the masters */ #define XFRD_MAX_UDP 100 /* max number of udp sockets at a time for ixfr */ #define XFRD_NO_IXFR_CACHE 172800 /* 48h before retrying ixfr after notimpl */ #define XFRD_TCP_TIMEOUT 120 /* seconds, before a tcp request times out */ #define XFRD_UDP_TIMEOUT 5 /* seconds, before a udp request times out */ /* * Zone transfer SOA information. */ struct soa_struct { /* owner equals zone apex */ /* class equals zone klass */ /* type is SOA */ uint32_t ttl; /* rdata count = 7 */ uint8_t mname[MAXDOMAINLEN + 2]; uint8_t rname[MAXDOMAINLEN + 2]; uint32_t serial; uint32_t refresh; uint32_t retry; uint32_t expire; uint32_t minimum; }; /** * Zone transfer state. * */ struct xfrd_struct { xfrhandler_type* xfrhandler; zone_type* zone; pthread_mutex_t serial_lock; /* mutexes soa serial management */ pthread_mutex_t rw_lock; /* mutexes .xfrd file */ /* transfer request handling */ int tcp_conn; int round_num; int master_num; int next_master; acl_type* master; /* soa serial management */ uint32_t serial_xfr; /* Last received serial via notify. Only valid if * serial_notify_acquired is not 0 */ uint32_t serial_notify; /* current serial on inbound side */ uint32_t serial_disk; time_t serial_xfr_acquired; /* time of last received notify that is being handled. If non-zero * it indicates a transfer is in progress */ time_t serial_notify_acquired; time_t serial_disk_acquired; uint8_t serial_retransfer; soa_type soa; /* timeout and event handling */ struct timespec timeout; netio_handler_type handler; /* packet handling */ uint16_t query_id; uint32_t msg_seq_nr; uint32_t msg_old_serial; uint32_t msg_new_serial; size_t msg_rr_count; uint8_t msg_is_ixfr; uint8_t msg_do_retransfer; tsig_rr_type* tsig_rr; xfrd_type* tcp_waiting_next; xfrd_type* udp_waiting_next; unsigned tcp_waiting : 1; unsigned udp_waiting : 1; }; /** * Create zone transfer structure. * \param[in] xfrhandler zone transfer handler * \param[in] zone zone reference * \return xfrd_type* zone transfer structure. * */ extern xfrd_type* xfrd_create(xfrhandler_type* xfrhandler, zone_type* zone); /** * Set timeout for zone transfer to now. * \param[in] xfrd zone transfer structure. * */ void xfrd_set_timer_now(xfrd_type* xfrd); /** * Set timeout for zone transfer to RETRY. * \param[in] xfrd zone transfer structure. * */ void xfrd_set_timer_retry(xfrd_type* xfrd); /** * Set timeout for zone transfer to REFRESH. * \param[in] xfrd zone transfer structure. * */ void xfrd_set_timer_refresh(xfrd_type* xfrd); /** * Use acl address to setup remote sockaddr struct. * \param[in] acl acl * \param[in] to remote address storage * \return socklen_t length of address * */ extern socklen_t xfrd_acl_sockaddr_to(acl_type* acl, struct sockaddr_storage* to); /** * Cleanup zone transfer structure. * \param[in] xfrd zone transfer structure. * \param[in] backup backup transfer variables. * */ extern void xfrd_cleanup(xfrd_type* xfrd, int backup); #endif /* WIRE_XFRD_H */ opendnssec-2.1.13/signer/src/wire/edns.c0000644000077000001440000001115314446272525015012 00000000000000/* * Copyright (c) 2011 NLNet Labs. All rights reserved. * * Taken from NSD3 and adjusted for OpenDNSSEC, NLnet Labs. * * 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. * */ /** * TSIG. * */ #include "config.h" #include "compat.h" #include "wire/buffer.h" #include "wire/edns.h" #include static const char* edns_str = "edns"; /** * Create new EDNS RR. * */ edns_rr_type* edns_rr_create() { edns_rr_type* err = NULL; CHECKALLOC(err = (edns_rr_type*) malloc(sizeof(edns_rr_type))) ; edns_rr_reset(err); return err; } /** * Initialize EDNS. * */ void edns_init(edns_data_type* data, uint16_t max_length) { if (!data) { return; } memset(data, 0, sizeof(edns_data_type)); /* record type: OPT */ data->ok[1] = (LDNS_RR_TYPE_OPT & 0xff00) >> 8; /* type_hi */ data->ok[2] = LDNS_RR_TYPE_OPT & 0x00ff; /* type_lo */ /* udp payload size */ data->ok[3] = (max_length & 0xff00) >> 8; /* size_hi */ data->ok[4] = max_length & 0x00ff; /* size_lo */ data->error[1] = (LDNS_RR_TYPE_OPT & 0xff00) >> 8; /* type_hi */ data->error[2] = LDNS_RR_TYPE_OPT & 0x00ff; /* type_lo */ data->error[3] = (max_length & 0xff00) >> 8; /* size_hi */ data->error[4] = max_length & 0x00ff; /* size_lo */ data->error[5] = 1; /* Extended RCODE=BAD VERS */ } /** * Reset EDNS OPT RR. * */ void edns_rr_reset(edns_rr_type* err) { if (!err) { return; } err->status = EDNS_NOT_PRESENT; err->position = 0; err->maxlen = 0; err->dnssec_ok = 0; } /** * Parse EDNS OPT RR. * */ int edns_rr_parse(edns_rr_type* err, buffer_type* buffer) { /* OPT record type... */ uint8_t opt_owner; uint16_t opt_type; uint16_t opt_class; uint8_t opt_version; uint16_t opt_flags; uint16_t opt_rdlen; if (!err || !buffer) { ods_log_debug("[%s] parse: no edns rr or no packet buffer available", edns_str); return 0; } err->position = buffer_position(buffer); if (!buffer_available(buffer, (OPT_LEN + OPT_RDATA))) { ods_log_debug("[%s] parse: edns rr too small", edns_str); return 0; } opt_owner = buffer_read_u8(buffer); opt_type = buffer_read_u16(buffer); if (opt_owner != 0 || opt_type != LDNS_RR_TYPE_OPT) { /* Not EDNS. */ ods_log_debug("[%s] parse: not OPT: owner=%02x, type=%02x", edns_str, opt_owner, opt_type); buffer_set_position(buffer, err->position); return 0; } opt_class = buffer_read_u16(buffer); (void)buffer_read_u8(buffer); /* opt_extended_rcode */ opt_version = buffer_read_u8(buffer); opt_flags = buffer_read_u16(buffer); opt_rdlen = buffer_read_u16(buffer); buffer_skip(buffer, opt_rdlen); if (opt_version != 0) { /* The only error is VERSION not implemented */ ods_log_debug("[%s] parse: wrong edns version", edns_str); err->status = EDNS_ERROR; return 1; } err->status = EDNS_OK; err->maxlen = opt_class; err->dnssec_ok = opt_flags & DNSSEC_OK_MASK; return 1; } /** * The amount of space to reserve in the response for the EDNS data. * */ size_t edns_rr_reserved_space(edns_rr_type* err) { if (!err) { return 0; } return err->status == EDNS_NOT_PRESENT ? 0 : (OPT_LEN + OPT_RDATA); } void edns_rr_cleanup(edns_rr_type* err) { if (!err) return; free(err); } opendnssec-2.1.13/signer/src/wire/notify.c0000644000077000001440000004425314446272525015400 00000000000000/* * 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. * */ /** * Notify sending. * */ #include "config.h" #include "adapter/addns.h" #include "daemon/xfrhandler.h" #include "signer/domain.h" #include "signer/zone.h" #include "wire/notify.h" #include "wire/xfrd.h" #include static const char* notify_str = "notify"; static void notify_handle_zone(netio_type* netio, netio_handler_type* handler, netio_events_type event_types); /** * Get time. * */ static time_t notify_time(notify_type* notify) { ods_log_assert(notify); ods_log_assert(notify->xfrhandler); return xfrhandler_time((xfrhandler_type*) notify->xfrhandler); } /** * Set timer. * */ static void notify_set_timer(notify_type* notify, time_t t) { if (!notify || !notify->xfrhandler) { return; } /** * Randomize the time, within 90%-100% of original. * Not later so zones cannot expire too late. */ if(t > notify_time(notify) + 10) { time_t extra = t - notify_time(notify); time_t base = extra*9/10; #ifdef HAVE_ARC4RANDOM_UNIFORM t = notify_time(notify) + base + arc4random_uniform(extra-base); #elif HAVE_ARC4RANDOM t = notify_time(notify) + base + arc4random()%(extra-base); #else t = notify_time(notify) + base + random()%(extra-base); #endif } notify->handler.timeout = ¬ify->timeout; notify->timeout.tv_sec = t; notify->timeout.tv_nsec = 0; } /** * Create notify structure. * */ notify_type* notify_create(xfrhandler_type* xfrhandler, zone_type* zone) { notify_type* notify = NULL; if (!xfrhandler || !zone) { return NULL; } CHECKALLOC(notify = (notify_type*) malloc(sizeof(notify_type))); if (!notify) { ods_log_error("[%s] unable to create notify structure: " " allocator_alloc() failed", notify_str); return NULL; } notify->zone = zone; notify->xfrhandler = xfrhandler; notify->waiting_next = NULL; notify->secondary = NULL; notify->soa = NULL; notify->tsig_rr = tsig_rr_create(); if (!notify->tsig_rr) { notify_cleanup(notify); return NULL; } notify->retry = 0; notify->query_id = 0; notify->is_waiting = 0; notify->handler.fd = -1; notify->timeout.tv_sec = 0; notify->timeout.tv_nsec = 0; notify->handler.timeout = NULL; notify->handler.user_data = notify; notify->handler.event_types = NETIO_EVENT_READ|NETIO_EVENT_TIMEOUT; notify->handler.event_handler = notify_handle_zone; return notify; } /** * Setup notify. * */ static void notify_setup(notify_type* notify) { zone_type* zone = NULL; dnsout_type* dnsout = NULL; if (!notify) { return; } zone = (zone_type*) notify->zone; ods_log_assert(zone); ods_log_assert(zone->adoutbound); ods_log_assert(zone->adoutbound->config); ods_log_assert(zone->adoutbound->type == ADAPTER_DNS); dnsout = (dnsout_type*) zone->adoutbound->config; notify->retry = 0; notify->secondary = dnsout->do_notify; ods_log_debug("[%s] setup notify for zone %s", notify_str, zone->name); notify_set_timer(notify, notify_time(notify)); } /** * Disable notify. * */ static void notify_disable(notify_type* notify) { xfrhandler_type* xfrhandler = NULL; zone_type* zone = NULL; if (!notify) { return; } xfrhandler = (xfrhandler_type*) notify->xfrhandler; ods_log_assert(xfrhandler); zone = (zone_type*) notify->zone; ods_log_assert(zone); ods_log_assert(zone->name); notify->secondary = NULL; notify->handler.timeout = NULL; if (notify->handler.fd != -1) { close(notify->handler.fd); notify->handler.fd = -1; } if (xfrhandler->notify_udp_num == NOTIFY_MAX_UDP) { while (xfrhandler->notify_waiting_first) { notify_type* wn = xfrhandler->notify_waiting_first; ods_log_assert(wn->is_waiting); wn->is_waiting = 0; xfrhandler->notify_waiting_first = wn->waiting_next; if (xfrhandler->notify_waiting_last == wn) { xfrhandler->notify_waiting_last = NULL; } if (wn->secondary) { ods_log_debug("[%s] zone %s notify off waiting list", notify_str, zone->name); notify_setup(wn); return; } } } ods_log_debug("[%s] notify for zone %s disabled", notify_str, zone->name); xfrhandler->notify_udp_num--; } /** * Next secondary. * */ static void notify_next(notify_type* notify) { if (!notify || !notify->secondary) { return; } notify->secondary = notify->secondary->next; notify->retry = 0; if (!notify->secondary) { zone_type* zone = (zone_type*) notify->zone; ods_log_assert(zone); ods_log_assert(zone->name); ods_log_debug("[%s] zone %s no more secondaries, disable notify", notify_str, zone->name); notify_disable(notify); } } /** * Read packet from udp. * */ static int notify_udp_read_packet(notify_type* notify) { xfrhandler_type* xfrhandler = NULL; ssize_t received = 0; ods_log_assert(notify); xfrhandler = (xfrhandler_type*) notify->xfrhandler; ods_log_assert(xfrhandler); buffer_clear(xfrhandler->packet); received = recvfrom(notify->handler.fd, buffer_begin(xfrhandler->packet), buffer_remaining(xfrhandler->packet), 0, NULL, NULL); if (received == -1) { ods_log_error("[%s] unable to read packet: recvfrom() failed fd %d " "(%s)", notify_str, notify->handler.fd, strerror(errno)); return 0; } buffer_set_limit(xfrhandler->packet, received); return 1; } /** * Handle notify reply. * */ static int notify_handle_reply(notify_type* notify) { xfrhandler_type* xfrhandler = NULL; zone_type* zone = NULL; ods_log_assert(notify); ods_log_assert(notify->secondary); ods_log_assert(notify->secondary->address); xfrhandler = (xfrhandler_type*) notify->xfrhandler; zone = (zone_type*) notify->zone; ods_log_assert(xfrhandler); ods_log_assert(zone); ods_log_assert(zone->name); if (xfrhandler->packet->limit < 3 || (buffer_pkt_opcode(xfrhandler->packet) != LDNS_PACKET_NOTIFY) || (buffer_pkt_qr(xfrhandler->packet) == 0)) { ods_log_error("[%s] zone %s received bad notify reply opcode/qr from %s", notify_str, zone->name, notify->secondary->address); return 0; } if (buffer_pkt_id(xfrhandler->packet) != notify->query_id) { ods_log_error("[%s] zone %s received bad notify reply id from %s", notify_str, zone->name, notify->secondary->address); return 0; } /* could check tsig */ if (buffer_pkt_rcode(xfrhandler->packet) != LDNS_RCODE_NOERROR) { const char* str = buffer_rcode2str(buffer_pkt_rcode(xfrhandler->packet)); ods_log_error("[%s] zone %s received bad notify rcode %s from %s", notify_str, zone->name, str?str:"UNKNOWN", notify->secondary->address); if (buffer_pkt_rcode(xfrhandler->packet) != LDNS_RCODE_NOTIMPL) { return 1; } return 0; } ods_log_debug("[%s] zone %s secondary %s notify reply ok", notify_str, zone->name, notify->secondary->address); return 1; } /** * Send notify over udp. * */ static int notify_send_udp(notify_type* notify, buffer_type* buffer) { struct sockaddr_storage to; socklen_t to_len = 0; int fd = -1; int family = PF_INET; ssize_t nb = 0; ods_log_assert(buffer); ods_log_assert(notify); ods_log_assert(notify->secondary); ods_log_assert(notify->secondary->address); /* this will set the remote port to acl->port or TCP_PORT */ to_len = xfrd_acl_sockaddr_to(notify->secondary, &to); /* get the address family of the remote host */ if (notify->secondary->family == AF_INET6) { family = PF_INET6; } /* create socket */ fd = socket(family, SOCK_DGRAM, IPPROTO_UDP); if (fd == -1) { ods_log_error("[%s] unable to send data over udp to %s: " "socket() failed (%s)", notify_str, notify->secondary->address, strerror(errno)); return -1; } /* bind it */ interface_type interface = notify->xfrhandler->engine->dnshandler->interfaces->interfaces[0]; if (!interface.address) { ods_log_error("[%s] unable to get the address of interface", notify_str); close(fd); return -1; } if (acl_parse_family(interface.address) == AF_INET) { struct sockaddr_in addr; addr.sin_family = acl_parse_family(interface.address); addr.sin_addr = interface.addr.addr; addr.sin_port = 0; if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) != 0) { ods_log_error("[%s] unable to bind address %s: bind failed %s", notify_str, interface.address, strerror(errno)); close(fd); return -1; } } else { struct sockaddr_in6 addr6; addr6.sin6_family = acl_parse_family(interface.address); addr6.sin6_addr = interface.addr.addr6; addr6.sin6_port = 0; if (bind(fd, (struct sockaddr *) &addr6, sizeof(addr6)) != 0) { ods_log_error("[%s] unable to bind address %s: bind() failed %s", notify_str, interface.address, strerror(errno)); close(fd); return -1; } } /* send it (udp) */ ods_log_deeebug("[%s] send %ld bytes over udp to %s", notify_str, (unsigned long)buffer_remaining(buffer), notify->secondary->address); nb = sendto(fd, buffer_current(buffer), buffer_remaining(buffer), 0, (struct sockaddr*)&to, to_len); if (nb == -1) { ods_log_error("[%s] unable to send data over udp to %s: " "sendto() failed (%s)", notify_str, notify->secondary->address, strerror(errno)); close(fd); return -1; } return fd; } /** * Sign notify. * */ static void notify_tsig_sign(notify_type* notify, buffer_type* buffer) { tsig_algo_type* algo = NULL; if (!notify || !notify->tsig_rr || !notify->secondary || !notify->secondary->tsig || !notify->secondary->tsig->key || !buffer) { return; /* no tsig configured */ } algo = tsig_lookup_algo(notify->secondary->tsig->algorithm); if (!algo) { ods_log_error("[%s] unable to sign notify: tsig unknown algorithm " "%s", notify_str, notify->secondary->tsig->algorithm); return; } ods_log_assert(algo); tsig_rr_reset(notify->tsig_rr, algo, notify->secondary->tsig->key); notify->tsig_rr->original_query_id = buffer_pkt_id(buffer); notify->tsig_rr->algo_name = ldns_rdf_clone(notify->tsig_rr->algo->wf_name); notify->tsig_rr->key_name = ldns_rdf_clone(notify->tsig_rr->key->dname); log_dname(notify->tsig_rr->key_name, "tsig sign notify with key", LOG_DEBUG); log_dname(notify->tsig_rr->algo_name, "tsig sign notify with algorithm", LOG_DEBUG); tsig_rr_prepare(notify->tsig_rr); tsig_rr_update(notify->tsig_rr, buffer, buffer_position(buffer)); tsig_rr_sign(notify->tsig_rr); ods_log_debug("[%s] tsig append rr to notify id=%u", notify_str, buffer_pkt_id(buffer)); tsig_rr_append(notify->tsig_rr, buffer); buffer_pkt_set_arcount(buffer, buffer_pkt_arcount(buffer)+1); tsig_rr_prepare(notify->tsig_rr); } /** * Send notify. * */ void notify_send(notify_type* notify) { xfrhandler_type* xfrhandler = NULL; zone_type* zone = NULL; ods_log_assert(notify); ods_log_assert(notify->secondary); ods_log_assert(notify->secondary->address); xfrhandler = (xfrhandler_type*) notify->xfrhandler; zone = (zone_type*) notify->zone; ods_log_assert(xfrhandler); ods_log_assert(zone); ods_log_assert(zone->name); if (notify->handler.fd != -1) { close(notify->handler.fd); } notify->handler.fd = -1; notify->timeout.tv_sec = notify_time(notify) + NOTIFY_RETRY_TIMEOUT; buffer_pkt_notify(xfrhandler->packet, zone->apex, LDNS_RR_CLASS_IN); notify->query_id = buffer_pkt_id(xfrhandler->packet); buffer_pkt_set_aa(xfrhandler->packet); /* add current SOA to answer section */ if (notify->soa) { if (buffer_write_rr(xfrhandler->packet, notify->soa)) { buffer_pkt_set_ancount(xfrhandler->packet, 1); } } if (notify->secondary->tsig) { notify_tsig_sign(notify, xfrhandler->packet); } buffer_flip(xfrhandler->packet); notify->handler.fd = notify_send_udp(notify, xfrhandler->packet); if (notify->handler.fd == -1) { ods_log_error("[%s] unable to send notify retry %u for zone %s to " "%s: notify_send_udp() failed", notify_str, notify->retry, zone->name, notify->secondary->address); return; } ods_log_verbose("[%s] notify retry %u for zone %s sent to %s", notify_str, notify->retry, zone->name, notify->secondary->address); } /** * Handle notify. * */ static void notify_handle_zone(netio_type* ATTR_UNUSED(netio), netio_handler_type* handler, netio_events_type event_types) { notify_type* notify = NULL; xfrhandler_type* xfrhandler = NULL; zone_type* zone = NULL; if (!handler) { return; } notify = (notify_type*) handler->user_data; ods_log_assert(notify); xfrhandler = (xfrhandler_type*) notify->xfrhandler; zone = (zone_type*) notify->zone; ods_log_assert(xfrhandler); ods_log_assert(zone); ods_log_assert(zone->name); ods_log_debug("[%s] handle notify for zone %s", notify_str, zone->name); if (notify->is_waiting) { ods_log_debug("[%s] already waiting, skipping notify for zone %s", notify_str, zone->name); ods_log_assert(notify->handler.fd == -1); return; } if (event_types & NETIO_EVENT_READ) { ods_log_debug("[%s] read notify ok for zone %s", notify_str, zone->name); ods_log_assert(notify->handler.fd != -1); if (notify_udp_read_packet(notify)) { if (notify_handle_reply(notify)) { notify_next(notify); } } } else if(event_types & NETIO_EVENT_TIMEOUT) { ods_log_debug("[%s] notify timeout for zone %s", notify_str, zone->name); /* timeout, try again */ } /* see if notify is still enabled */ if (notify->secondary) { ods_log_assert(notify->secondary->address); notify->retry++; if (notify->retry > NOTIFY_MAX_RETRY) { ods_log_verbose("[%s] notify max retry for zone %s, %s unreachable", notify_str, zone->name, notify->secondary->address); notify_next(notify); } else { notify_send(notify); } } } /** * Update current SOA. * */ static void notify_update_soa(notify_type* notify, ldns_rr* soa) { if (!notify) { return; } if (notify->soa) { ldns_rr_free(notify->soa); } notify->soa = soa; } /** * Enable notify. * */ void notify_enable(notify_type* notify, ldns_rr* soa) { xfrhandler_type* xfrhandler = NULL; zone_type* zone = NULL; dnsout_type* dnsout = NULL; if (!notify) { return; } xfrhandler = (xfrhandler_type*) notify->xfrhandler; ods_log_assert(xfrhandler); zone = (zone_type*) notify->zone; ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(zone->adoutbound); ods_log_assert(zone->adoutbound->config); ods_log_assert(zone->adoutbound->type == ADAPTER_DNS); dnsout = (dnsout_type*) zone->adoutbound->config; if (!dnsout->do_notify) { ods_log_warning("[%s] zone %s has no notify acl", notify_str, zone->name); return; /* nothing to do */ } if (notify->is_waiting || notify->handler.fd != -1) { ods_log_debug("[%s] zone %s already on waiting list", notify_str, zone->name); return; } notify_update_soa(notify, soa); if (xfrhandler->notify_udp_num < NOTIFY_MAX_UDP) { notify_setup(notify); xfrhandler->notify_udp_num++; ods_log_debug("[%s] zone %s notify enabled", notify_str, zone->name); return; } /* put it in waiting list */ notify->secondary = dnsout->do_notify; notify->is_waiting = 1; notify->waiting_next = NULL; if (xfrhandler->notify_waiting_last) { xfrhandler->notify_waiting_last->waiting_next = notify; } else { xfrhandler->notify_waiting_first = notify; } xfrhandler->notify_waiting_last = notify; notify->handler.timeout = NULL; ods_log_debug("[%s] zone %s notify on waiting list", notify_str, zone->name); } /** * Cleanup notify structure. * */ void notify_cleanup(notify_type* notify) { if (!notify) { return; } if (notify->handler.fd != -1) { close(notify->handler.fd); notify->handler.fd = -1; } if (notify->soa) { ldns_rr_free(notify->soa); } tsig_rr_cleanup(notify->tsig_rr); free(notify); } opendnssec-2.1.13/signer/src/wire/netio.h0000644000077000001440000001435514446272525015213 00000000000000/* * Copyright (c) 2001-2011, NLnet Labs. All rights reserved. * * See LICENSE for the license. * * * The netio module implements event based I/O handling using * pselect(2). Multiple event handlers can wait for a certain event * to occur simultaneously. Each event handler is called when an * event occurs that the event handler has indicated that it is * willing to handle. * * There are four types of events that can be handled: * * NETIO_EVENT_READ: reading will not block. * NETIO_EVENT_WRITE: writing will not block. * NETIO_EVENT_EXCEPT: an exception occurred. * NETIO_EVENT_TIMEOUT: the timeout expired. * * A file descriptor must be specified if the handler is interested in * the first three event types. A timeout must be specified if the * event handler is interested in timeouts. These event types can be * OR'ed together if the handler is willing to handle multiple types * of events. * * The special event type NETIO_EVENT_NONE is available if you wish to * temporarily disable the event handler without removing and adding * the handler to the netio structure. * * The event callbacks are free to modify the netio_handler_type * structure to change the file descriptor, timeout, event types, user * data, or handler functions. * * The main loop of the program must call netio_dispatch to check for * events and dispatch them to the handlers. An additional timeout * can be specified as well as the signal mask to install while * blocked in pselect(2). */ /** * Network I/O Support. * */ #ifndef WIRE_NETIO_H_ #define WIRE_NETIO_H_ #ifdef HAVE_SYS_SELECT_H #include #endif #include #include "config.h" #include "status.h" #ifndef PF_INET #define PF_INET AF_INET #endif #ifndef PF_INET6 #define PF_INET6 AF_INET6 #endif /* * The type of events a handler is interested in. * These can be OR'ed together to specify multiple event types. * */ enum netio_events_enum { NETIO_EVENT_NONE = 0, NETIO_EVENT_READ = 1, NETIO_EVENT_WRITE = 2, NETIO_EVENT_EXCEPT = 4, NETIO_EVENT_TIMEOUT = 8 }; typedef enum netio_events_enum netio_events_type; typedef struct netio_struct netio_type; typedef struct netio_handler_struct netio_handler_type; typedef struct netio_handler_list_struct netio_handler_list_type; /** * Network I/O event handler function. * */ typedef void (*netio_event_handler_type)(netio_type *netio, netio_handler_type* handler, netio_events_type event_types); /** * Network I/O event handler list. * */ struct netio_handler_list_struct { netio_handler_list_type* next; netio_handler_type* handler; }; /** * Network I/O event handler. * */ struct netio_handler_struct { /* * The file descriptor that should be checked for events. If * the file descriptor is negative only timeout events are * checked for. */ int fd; /* * The time when no events should be checked for and the * handler should be called with the NETIO_EVENT_TIMEOUT * event type. Unlike most timeout parameters the time should * be absolute, not relative! */ struct timespec* timeout; /* * User data. */ void* user_data; /* * The type of events that should be checked for. These types * can be OR'ed together to wait for multiple types of events. */ netio_events_type event_types; /* * The event handler. The event_types parameter contains the * OR'ed set of event types that actually triggered. The * event handler is allowed to modify this handler object. * The event handler SHOULD NOT block. */ netio_event_handler_type event_handler; int free_handler; }; /** * Network I/O instance. * */ struct netio_struct { netio_handler_list_type* handlers; /* * Cached value of the current time. The cached value is * cleared at the start of netio_dispatch to calculate the * relative timeouts of the event handlers and after calling * pselect(2) so handlers can use it to calculate a new * absolute timeout. * * Use netio_current_time() to read the current time. */ int have_current_time; struct timespec cached_current_time; /* * Next handler in the dispatch. Only valid during callbacks. * To make sure that deletes respect the state of the iterator. */ netio_handler_list_type* dispatch_next; }; /* * Create a new netio instance. * \param[in] allocator memory allocator * \return netio_type* netio instance * */ extern netio_type* netio_create(void); /* * Add a new handler to netio. * \param[in] netio netio instance * \param[in] handler handler * */ extern void netio_add_handler(netio_type* netio, netio_handler_type* handler); /* * Remove the handler from netio. * \param[in] netio netio instance * \param[in] handler handler * */ extern void netio_remove_handler(netio_type* netio, netio_handler_type* handler); /* * Retrieve the current time (using gettimeofday(2)). * \param[in] netio netio instance * \return const struct timespec* current time * */ extern const struct timespec* netio_current_time(netio_type* netio); /* * Check for events and dispatch them to the handlers. * \param[in] netio netio instance * \param[in] timeout if specified, the maximum time to wait for an * event to arrive. * \param[in] sigmask is passed to the underlying pselect(2) call * \return int the number of non-timeout events dispatched, 0 on timeout, * and -1 on error (with errno set appropriately). * */ extern int netio_dispatch(netio_type* netio, const struct timespec* timeout, const sigset_t* sigmask); /** * Clean up netio instance * \param[in] netio netio instance * */ extern void netio_cleanup(netio_type* netio); extern void netio_cleanup_shallow(netio_type* netio); /** * Add timespecs. * \param[in] left left * \param[in] right right * */ extern void timespec_add(struct timespec* left, const struct timespec* right); #ifdef __cplusplus inline netio_events_type operator | (netio_events_type lhs, netio_events_type rhs) { return (netio_events_type) (lhs | rhs); } inline netio_events_type operator |= (netio_events_type &lhs, netio_events_type rhs) { lhs = (netio_events_type) (lhs | rhs); return lhs; } #endif /* __cplusplus */ #endif /* WIRE_NETIO_H_ */ opendnssec-2.1.13/signer/src/wire/listener.h0000644000077000001440000000572114446272525015717 00000000000000/* * 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. * */ /** * Listener. * */ #ifndef WIRE_LISTENER_H #define WIRE_LISTENER_H #include "config.h" #include "status.h" #include #include #include #include #include #include #include #include #include #include #include #include #define DNS_PORT_STRING "53" #define INBUF_SIZE 4096 /* max size for incoming queries */ #define MAX_INTERFACES 32 /** * Access control. * */ union acl_addr_storage { struct in_addr addr; struct in6_addr addr6; }; /** * Interface. * */ typedef struct interface_struct interface_type; struct interface_struct { char* port; char* address; int family; union acl_addr_storage addr; }; /** * Listener. * */ typedef struct listener_struct listener_type; struct listener_struct { interface_type* interfaces; size_t count; }; /** * Create listener. * \param[in] allocator memory allocator * \return listener_type* listener * */ extern listener_type* listener_create(void); /** * Push an interface to the listener. * \param[in] listener listener * \param[in] address IP address * \param[in] family address family * \param[in] port port or NULL * \return interface_type* added interface * */ extern interface_type* listener_push(listener_type* list, char* address, int family, const char* port); /** * Clean up interface. * \param[in] i interface * */ extern void interface_cleanup(interface_type* i); /** * Clean up listener. * \param[in] listener listener to clean up * */ extern void listener_cleanup(listener_type* listener); #endif /* WIRE_LISTENER_H */ opendnssec-2.1.13/signer/src/hsm.c0000644000077000001440000001251514446272525013705 00000000000000/* * 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. * */ /** * Hardware Security Module support. * */ #include "daemon/engine.h" #include "hsm.h" #include "log.h" #include "cryptoki_compat/pkcs11.h" static const char* hsm_str = "hsm"; /** * Clear key cache. * */ static void lhsm_clear_key_cache(key_type* key) { if (!key) { return; } if (key->dnskey) { /* DNSKEY still exists in zone */ key->dnskey = NULL; } if (key->params) { hsm_sign_params_free(key->params); key->params = NULL; } } static const libhsm_key_t* keylookup(hsm_ctx_t* ctx, const char* locator) { const libhsm_key_t* key; key = keycache_lookup(ctx, locator); if (key == NULL) { char* error = hsm_get_error(ctx); if (error) { ods_log_error("[%s] %s", hsm_str, error); free((void*)error); } /* could not find key */ ods_log_error("[%s] unable to get key: key %s not found", hsm_str, locator); } return key; } /** * Get key from one of the HSMs. * */ ods_status lhsm_get_key(hsm_ctx_t* ctx, ldns_rdf* owner, key_type* key_id, int skip_hsm_access) { char *error = NULL; int retries = 0; if (!owner || !key_id) { ods_log_error("[%s] unable to get key: missing required elements", hsm_str); return ODS_STATUS_ASSERT_ERR; } llibhsm_key_start: /* set parameters */ if (!key_id->params) { key_id->params = hsm_sign_params_new(); if (key_id->params) { key_id->params->owner = ldns_rdf_clone(owner); key_id->params->algorithm = key_id->algorithm; key_id->params->flags = key_id->flags; } else { /* could not create params */ ods_log_error("[%s] unable to get key: create params for key %s " "failed", hsm_str, key_id->locator?key_id->locator:"(null)"); return ODS_STATUS_ERR; } } if (skip_hsm_access) return ODS_STATUS_OK; /* get dnskey */ if (!key_id->dnskey) { key_id->dnskey = hsm_get_dnskey(ctx, keylookup(ctx, key_id->locator), key_id->params); } if (!key_id->dnskey) { error = hsm_get_error(ctx); if (error) { ods_log_error("[%s] %s", hsm_str, error); free((void*)error); } else if (!retries) { lhsm_clear_key_cache(key_id); retries++; goto llibhsm_key_start; } ods_log_error("[%s] unable to get key: hsm failed to create dnskey", hsm_str); return ODS_STATUS_ERR; } key_id->params->keytag = ldns_calc_keytag(key_id->dnskey); return ODS_STATUS_OK; } /** * Get RRSIG from one of the HSMs, given a RRset and a key. * */ ldns_rr* lhsm_sign(hsm_ctx_t* ctx, ldns_rr_list* rrset, key_type* key_id, ldns_rdf* owner, time_t inception, time_t expiration) { char* error = NULL; ldns_rr* result = NULL; hsm_sign_params_t* params = NULL; if (!owner || !key_id || !rrset || !inception || !expiration) { ods_log_error("[%s] unable to sign: missing required elements", hsm_str); return NULL; } ods_log_assert(key_id->dnskey); ods_log_assert(key_id->params); /* adjust parameters */ params = hsm_sign_params_new(); params->owner = ldns_rdf_clone(key_id->params->owner); params->algorithm = key_id->algorithm; params->flags = key_id->flags; params->inception = inception; params->expiration = expiration; params->keytag = key_id->params->keytag; ods_log_deeebug("[%s] sign RRset[%i] with key %s tag %u", hsm_str, ldns_rr_get_type(ldns_rr_list_rr(rrset, 0)), key_id->locator?key_id->locator:"(null)", params->keytag); result = hsm_sign_rrset(ctx, rrset, keylookup(ctx, key_id->locator), params); hsm_sign_params_free(params); if (!result) { error = hsm_get_error(ctx); if (error) { ods_log_error("[%s] %s", hsm_str, error); free((void*)error); } ods_log_crit("[%s] error signing rrset with libhsm", hsm_str); } return result; } opendnssec-2.1.13/signer/src/daemon/0000755000077000001440000000000014446272546014274 500000000000000opendnssec-2.1.13/signer/src/daemon/signercommands.c0000644000077000001440000006065514446272525017402 00000000000000#include "config.h" #include "file.h" #include "str.h" #include "locks.h" #include "log.h" #include "status.h" #include "util.h" #include "longgetopt.h" #include "daemon/engine.h" #include "cmdhandler.h" #include "signercommands.h" #include "clientpipe.h" static char const * cmdh_str = "cmdhandler"; static const char* cmdargument(const char* cmd, const char* matchValue, const char* defaultValue) { const char* s = cmd; if (!s) return defaultValue; while(*s && !isspace(*s)) ++s; while(*s && isspace(*s)) ++s; if(matchValue) { if (!strcmp(s,matchValue)) return s; else return defaultValue; } else if(*s) { return s; } else { return defaultValue; } } /** * Handle the 'help' command. * */ static int cmdhandler_handle_cmd_help(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->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" ); client_printf(sockfd, "%s", 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" ); client_printf(sockfd, "%s", buf); (void) snprintf(buf, ODS_SE_MAXLINE, "update Update this zone signer " "configurations.\n" "update [--all] Update zone list and all signer " "configurations.\n" "retransfer Retransfer the zone from the master.\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" ); client_printf(sockfd, "%s", buf); return 0; } /** * Handle the 'zones' command. * */ static int cmdhandler_handle_cmd_zones(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->sockfd; engine_type* engine; char buf[ODS_SE_MAXLINE]; size_t i; ldns_rbnode_t* node = LDNS_RBTREE_NULL; zone_type* zone = NULL; engine = getglobalcontext(context); if (!engine->zonelist || !engine->zonelist->zones) { (void)snprintf(buf, ODS_SE_MAXLINE, "There are no zones configured\n"); client_printf(sockfd, "%s", buf); return 0; } /* how many zones */ pthread_mutex_lock(&engine->zonelist->zl_lock); (void)snprintf(buf, ODS_SE_MAXLINE, "There are %i zones configured\n", (int) engine->zonelist->zones->count); client_printf(sockfd, "%s", 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); client_printf(sockfd, "%s", buf); node = ldns_rbtree_next(node); } pthread_mutex_unlock(&engine->zonelist->zl_lock); return 0; } /** * Handle the 'update' command. * */ static int cmdhandler_handle_cmd_update(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->sockfd; engine_type* engine; char buf[ODS_SE_MAXLINE]; zone_type* zone = NULL; ods_status zl_changed = ODS_STATUS_OK; engine = getglobalcontext(context); ods_log_assert(engine); ods_log_assert(engine->taskq); if (cmdargument(cmd, "--all", NULL)) { pthread_mutex_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"); client_printf(sockfd, "%s", 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); client_printf(sockfd, "%s", buf); } else { pthread_mutex_unlock(&engine->zonelist->zl_lock); (void)snprintf(buf, ODS_SE_MAXLINE, "Zone list has errors.\n"); client_printf(sockfd, "%s", 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; pthread_mutex_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); } } else { /* look up zone */ pthread_mutex_lock(&engine->zonelist->zl_lock); zone = zonelist_lookup_zone_by_name(engine->zonelist, cmdargument(cmd, NULL, ""), 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; } pthread_mutex_unlock(&engine->zonelist->zl_lock); if (!zone) { (void)snprintf(buf, ODS_SE_MAXLINE, "Error: Zone %s not found.\n", cmdargument(cmd, NULL, "")); client_printf(sockfd, "%s", buf); /* update all */ cmdhandler_handle_cmd_update(context, "update --all"); return 1; } pthread_mutex_lock(&zone->zone_lock); schedule_scheduletask(engine->taskq, TASK_FORCESIGNCONF, zone->name, zone, &zone->zone_lock, schedule_PROMPTLY); pthread_mutex_unlock(&zone->zone_lock); (void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s config being updated.\n", cmdargument(cmd, NULL, "")); client_printf(sockfd, "%s", buf); ods_log_verbose("[%s] zone %s scheduled for immediate update signconf", cmdh_str, cmdargument(cmd, NULL, "")); engine_wakeup_workers(engine); } return 0; } /** * Handle the 'retransfer' command. * */ static int cmdhandler_handle_cmd_retransfer(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->sockfd; engine_type* engine; char buf[ODS_SE_MAXLINE]; zone_type* zone = NULL; engine = getglobalcontext(context); ods_log_assert(engine->taskq); /* look up zone */ pthread_mutex_lock(&engine->zonelist->zl_lock); zone = zonelist_lookup_zone_by_name(engine->zonelist, cmdargument(cmd, NULL, ""), LDNS_RR_CLASS_IN); /* If this zone is just added, don't retransfer (it might not have a * task yet) */ if (zone && zone->zl_status == ZONE_ZL_ADDED) { zone = NULL; } pthread_mutex_unlock(&engine->zonelist->zl_lock); if (!zone) { (void)snprintf(buf, ODS_SE_MAXLINE, "Error: Zone %s not found.\n", cmdargument(cmd, NULL, "")); client_printf(sockfd, "%s", buf); } else if (zone->adinbound->type != ADAPTER_DNS) { (void)snprintf(buf, ODS_SE_MAXLINE, "Error: Zone %s not configured to use DNS input adapter.\n", cmdargument(cmd, NULL, "")); client_printf(sockfd, "%s", buf); } else { zone->xfrd->serial_retransfer = 1; xfrd_set_timer_now(zone->xfrd); ods_log_debug("[%s] forward a notify", cmdh_str); dnshandler_fwd_notify(engine->dnshandler, (uint8_t*) ODS_SE_NOTIFY_CMD, strlen(ODS_SE_NOTIFY_CMD)); (void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s being re-transfered.\n", cmdargument(cmd, NULL, "")); client_printf(sockfd, "%s", buf); ods_log_verbose("[%s] zone %s being re-transfered", cmdh_str, cmdargument(cmd, NULL, "")); } return 0; } static uint32_t max(uint32_t a, uint32_t b) { return (azone_lock); if (force_serial) { ods_log_assert(zone->db); if (!util_serial_gt(serial, max(zone->db->outserial, zone->db->inbserial))) { pthread_mutex_unlock(&zone->zone_lock); client_printf(sockfd, "Error: Unable to enforce serial %u for zone %s.\n", serial, zone->name); return 1; } zone->db->altserial = serial; zone->db->force_serial = 1; } schedule_scheduletask(engine->taskq, TASK_FORCEREAD, zone->name, zone, &zone->zone_lock, schedule_IMMEDIATELY); pthread_mutex_unlock(&zone->zone_lock); return 0; } static struct option signoptions[] = { { "all", 0, NULL, 'a' }, { "zone", 1, NULL, 'z' }, { "serial", 1, NULL, 's' }, { "time", 1, NULL, 't' }, { NULL, 0, NULL, 0 } }; int getlong(char* s, char** endptr, long *result) { char *end; while(isspace(*s)) ++s; errno = 0; *result = strtol(s, &end, 0); if(errno == ERANGE) { *endptr = NULL; return -1; } if(end) { if(s == end) { if(endptr) *endptr = end; return -1; } while(isspace(*end)) ++end; if(endptr) { *endptr = end; return 0; } else if(*end) return -1; else return 0; } else { *endptr = end; return -1; } } static int cmdhandler_handle_cmd_sign(cmdhandler_ctx_type* context, int argc, char* argv[]) { engine_type* engine; struct longgetopt optctx; int allzones = 0; int longindex; char* zonename = NULL; zone_type *zone; int force_serial = 0; long serial = 0; char* signtime = NULL; int opt; engine = getglobalcontext(context); /* Skip the "sign" command itself, then parse options */ ++argv; --argc; for(opt = longgetopt(argc, argv, "az:s:t:", signoptions, &longindex, &optctx); opt != -1; opt = longgetopt(argc, argv, NULL, signoptions, &longindex, &optctx)) { switch(opt) { case 'a': allzones = 1; break; case 'z': zonename = optctx.optarg; break; case 's': getlong(optctx.optarg, NULL, &serial); force_serial = 1; break; case 't': signtime = optctx.optarg; break; default: client_printf_err(context->sockfd, "unknown arguments\n"); return -1; } } if(optctx.optind < argc) zonename = argv[optctx.optind]; if(!allzones && (zonename == NULL || *zonename == '\0')) { client_printf_err(context->sockfd, "No zone name provided to zone sign command.\n"); return -1; } if(allzones) { pthread_mutex_lock(&engine->zonelist->zl_lock); ldns_rbnode_t* node; for (node = ldns_rbtree_first(engine->zonelist->zones); node != LDNS_RBTREE_NULL && node != NULL; node = ldns_rbtree_next(node)) { zone = (zone_type*)node->data; forceread(engine, zone, 0, 0, context->sockfd); } pthread_mutex_unlock(&engine->zonelist->zl_lock); engine_wakeup_workers(engine); client_printf(context->sockfd, "All zones scheduled for immediate re-sign.\n"); } else { pthread_mutex_lock(&engine->zonelist->zl_lock); zone = zonelist_lookup_zone_by_name(engine->zonelist, zonename, 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; } pthread_mutex_unlock(&engine->zonelist->zl_lock); if (!zone) { client_printf(context->sockfd, "Error: Zone %s not found.\n", zonename); return 1; } forceread(engine, zone, force_serial, serial, context->sockfd); engine_wakeup_workers(engine); client_printf(context->sockfd, "Zone %s scheduled for immediate re-sign.\n", zonename); ods_log_verbose("zone %s scheduled for immediate re-sign", zonename); } return 0; } /** * 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); } } /** * Handle the 'clear' command. * */ static int cmdhandler_handle_cmd_clear(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->sockfd; engine_type* engine; char buf[ODS_SE_MAXLINE]; zone_type* zone = NULL; uint32_t inbserial = 0; uint32_t intserial = 0; uint32_t outserial = 0; engine = getglobalcontext(context); unlink_backup_file(cmdargument(cmd, NULL, ""), ".inbound"); unlink_backup_file(cmdargument(cmd, NULL, ""), ".backup"); unlink_backup_file(cmdargument(cmd, NULL, ""), ".axfr"); unlink_backup_file(cmdargument(cmd, NULL, ""), ".ixfr"); pthread_mutex_lock(&engine->zonelist->zl_lock); zone = zonelist_lookup_zone_by_name(engine->zonelist, cmdargument(cmd, NULL, ""), LDNS_RR_CLASS_IN); pthread_mutex_unlock(&engine->zonelist->zl_lock); if (zone) { pthread_mutex_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(); 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, cmdargument(cmd, NULL, "")); return 1; } /* restore serial management */ zone->db->inbserial = inbserial; zone->db->intserial = intserial; zone->db->outserial = outserial; zone->db->have_serial = 1; /* If a zone does not have a task we probably never read a signconf * for it. Skip reschedule step */ schedule_scheduletask(engine->taskq, TASK_FORCESIGNCONF, zone->name, zone, &zone->zone_lock, schedule_IMMEDIATELY); pthread_mutex_unlock(&zone->zone_lock); (void)snprintf(buf, ODS_SE_MAXLINE, "Internal zone information about " "%s cleared", cmdargument(cmd, NULL, "")); ods_log_info("[%s] internal zone information about %s cleared", cmdh_str, cmdargument(cmd, NULL, "")); } else { (void)snprintf(buf, ODS_SE_MAXLINE, "Cannot clear zone %s, zone not " "found", cmdargument(cmd, NULL, "")); ods_log_warning("[%s] cannot clear zone %s, zone not found", cmdh_str, cmdargument(cmd, NULL, "")); } client_printf(sockfd, "%s", buf); return 0; } /** * Handle the 'queue' command. * */ static int cmdhandler_handle_cmd_queue(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->sockfd; engine_type* engine; char* strtime = NULL; char buf[ODS_SE_MAXLINE]; char* taskdesc; size_t i = 0; time_t now = 0; ldns_rbnode_t* node = LDNS_RBTREE_NULL; task_type* task = NULL; engine = getglobalcontext(context); if (!engine->taskq || !engine->taskq->tasks) { (void)snprintf(buf, ODS_SE_MAXLINE, "There are no tasks scheduled.\n"); client_printf(sockfd, "%s", buf); return 0; } /* current time */ now = time_now(); strtime = ctime(&now); (void)snprintf(buf, ODS_SE_MAXLINE, "It is now %s", strtime?strtime:"(null)"); client_printf(sockfd, "%s", buf); /* current work */ pthread_mutex_lock(&engine->taskq->schedule_lock); /* how many tasks */ (void)snprintf(buf, ODS_SE_MAXLINE, "\nThere are %i tasks scheduled.\n", (int) engine->taskq->tasks->count); client_printf(sockfd, "%s", 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; } taskdesc = schedule_describetask(task); client_printf(sockfd, "%s", taskdesc); free(taskdesc); node = ldns_rbtree_next(node); } pthread_mutex_unlock(&engine->taskq->schedule_lock); return 0; } /** * Handle the 'flush' command. * */ static int cmdhandler_handle_cmd_flush(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->sockfd; engine_type* engine; char buf[ODS_SE_MAXLINE]; engine = getglobalcontext(context); ods_log_assert(engine->taskq); schedule_flush(engine->taskq); engine_wakeup_workers(engine); (void)snprintf(buf, ODS_SE_MAXLINE, "All tasks scheduled immediately.\n"); client_printf(sockfd, "%s", buf); ods_log_verbose("[%s] all tasks scheduled immediately", cmdh_str); return 0; } /** * Handle the 'reload' command. * */ static int cmdhandler_handle_cmd_reload(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->sockfd; engine_type* engine; char buf[ODS_SE_MAXLINE]; engine = getglobalcontext(context); ods_log_error("signer instructed to reload due to explicit command"); engine->need_to_reload = 1; pthread_mutex_lock(&engine->signal_lock); pthread_cond_signal(&engine->signal_cond); pthread_mutex_unlock(&engine->signal_lock); (void)snprintf(buf, ODS_SE_MAXLINE, "Reloading engine.\n"); client_printf(sockfd, "%s", buf); return 0; } /** * Handle the 'stop' command. * */ static int cmdhandler_handle_cmd_stop(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->sockfd; engine_type* engine; char buf[ODS_SE_MAXLINE]; engine = getglobalcontext(context); engine->need_to_exit = 1; pthread_mutex_lock(&engine->signal_lock); pthread_cond_signal(&engine->signal_cond); pthread_mutex_unlock(&engine->signal_lock); (void)snprintf(buf, ODS_SE_MAXLINE, ODS_SE_STOP_RESPONSE); client_printf(sockfd, "%s", buf); return 0; } /** * Handle the 'start' command. * */ static int cmdhandler_handle_cmd_start(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->sockfd; char buf[ODS_SE_MAXLINE]; (void)snprintf(buf, ODS_SE_MAXLINE, "Engine already running.\n"); client_printf(sockfd, "%s", buf); return 0; } /** * Handle the 'running' command. * */ static int cmdhandler_handle_cmd_running(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->sockfd; char buf[ODS_SE_MAXLINE]; (void)snprintf(buf, ODS_SE_MAXLINE, "Engine running.\n"); client_printf(sockfd, "%s", buf); return 0; } /** * Handle the 'verbosity' command. * */ static int cmdhandler_handle_cmd_verbosity(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->sockfd; char buf[ODS_SE_MAXLINE]; int val; val = atoi(cmdargument(cmd, NULL, "1")); ods_log_setverbosity(val); (void)snprintf(buf, ODS_SE_MAXLINE, "Verbosity level set to %i.\n", val); client_printf(sockfd, "%s", buf); return 0; } /** * Handle erroneous command. * */ static void cmdhandler_handle_cmd_error(int sockfd, cmdhandler_ctx_type* context, char* str) { char buf[ODS_SE_MAXLINE]; (void)snprintf(buf, ODS_SE_MAXLINE, "Error: %s.\n", str?str:"(null)"); client_printf(sockfd, "%s", buf); } /** * Handle the 'time leap' command. * */ static int cmdhandler_handle_cmd_timeleap(cmdhandler_ctx_type* context, char *cmd) { int sockfd = context->sockfd; struct tm strtime_struct; char strtime[64]; /* at least 26 according to docs plus a long integer */ time_t now = time_now(); time_t time_leap = 0; time_t next_leap = 0; struct tm tm; int taskcount; engine_type* engine = getglobalcontext(context); /* skip "time" and "leap" */ while(isspace(*cmd)) ++cmd; cmd = &cmd[4]; while(isspace(*cmd)) ++cmd; cmd = &cmd[4]; while(isspace(*cmd)) ++cmd; if (strptime(cmd, "%Y-%m-%d-%H:%M:%S", &tm)) { tm.tm_isdst = -1; time_leap = mktime(&tm); client_printf(sockfd, "Using %s parameter value as time to leap to\n", cmd); } else { client_printf_err(sockfd, "Time leap: Error - could not convert '%s' to a time. Format is YYYY-MM-DD-HH:MM:SS \n", cmd); return -1; } if (!engine->taskq || !engine->taskq->tasks) { client_printf(sockfd, "There are no tasks scheduled.\n"); return 1; } schedule_info(engine->taskq, &next_leap, NULL, &taskcount); now = time_now(); strftime(strtime, sizeof (strtime), "%c", localtime_r(&now, &strtime_struct)); client_printf(sockfd, "There are %i tasks scheduled.\nIt is now %s (%ld seconds since epoch)\n", taskcount, strtime, (long) now); set_time_now(time_leap); strftime(strtime, sizeof (strtime), "%c", localtime_r(&time_leap, &strtime_struct)); client_printf(sockfd, "Leaping to time %s (%ld seconds since epoch)\n", (strtime[0] ? strtime : "(null)"), (long) time_leap); ods_log_info("Time leap: Leaping to time %s\n", strtime); client_printf(sockfd, "Waking up workers\n"); engine_wakeup_workers(engine); return 0; } struct cmd_func_block helpCmdDef = { "help", NULL, NULL, NULL, &cmdhandler_handle_cmd_help, NULL }; struct cmd_func_block zonesCmdDef = { "zones", NULL, NULL, NULL, &cmdhandler_handle_cmd_zones, NULL }; struct cmd_func_block signCmdDef = { "sign", NULL, NULL, NULL, NULL, &cmdhandler_handle_cmd_sign }; struct cmd_func_block clearCmdDef = { "clear", NULL, NULL, NULL, &cmdhandler_handle_cmd_clear, NULL }; struct cmd_func_block queueCmdDef = { "queue", NULL, NULL, NULL, &cmdhandler_handle_cmd_queue, NULL }; struct cmd_func_block flushCmdDef = { "flush", NULL, NULL, NULL, &cmdhandler_handle_cmd_flush, NULL }; struct cmd_func_block updateCmdDef = { "update", NULL, NULL, NULL, &cmdhandler_handle_cmd_update, NULL }; struct cmd_func_block stopCmdDef = { "stop", NULL, NULL, NULL, &cmdhandler_handle_cmd_stop, NULL }; struct cmd_func_block startCmdDef = { "start", NULL, NULL, NULL, &cmdhandler_handle_cmd_start, NULL }; struct cmd_func_block reloadCmdDef = { "reload", NULL, NULL, NULL, &cmdhandler_handle_cmd_reload, NULL }; struct cmd_func_block retransferCmdDef = { "retransfer", NULL, NULL, NULL, &cmdhandler_handle_cmd_retransfer, NULL }; struct cmd_func_block runningCmdDef = { "running", NULL, NULL, NULL, &cmdhandler_handle_cmd_running, NULL }; struct cmd_func_block verbosityCmdDef = { "verbosity", NULL, NULL, NULL, &cmdhandler_handle_cmd_verbosity, NULL }; struct cmd_func_block timeleapCmdDef = { "time leap", NULL, NULL, NULL, &cmdhandler_handle_cmd_timeleap, NULL }; struct cmd_func_block* signcommands[] = { &helpCmdDef, &zonesCmdDef, &signCmdDef, &clearCmdDef, &queueCmdDef, &flushCmdDef, &updateCmdDef, &stopCmdDef, &startCmdDef, &reloadCmdDef, &retransferCmdDef, &runningCmdDef, &verbosityCmdDef, &timeleapCmdDef, NULL }; struct cmd_func_block** signercommands = signcommands; engine_type* getglobalcontext(cmdhandler_ctx_type* context) { return (engine_type*) context->globalcontext; } opendnssec-2.1.13/signer/src/daemon/xfrhandler.h0000644000077000001440000000625414446272525016526 00000000000000/* * 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" typedef struct xfrhandler_struct xfrhandler_type; #include "status.h" #include "locks.h" #include "wire/buffer.h" #include "wire/netio.h" #include "wire/notify.h" #include "wire/tcpset.h" #include "wire/xfrd.h" #include "engine.h" /** * Zone transfer handler. * */ struct xfrhandler_struct { /* Engine reference */ janitor_thread_t thread_id; engine_type* 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* tcp_waiting_first; 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 * */ extern xfrhandler_type* xfrhandler_create(void); /** * Start zone transfer handler. * \param[in] xfrhandler_type* zone transfer handler * */ extern 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 * */ extern time_t xfrhandler_time(xfrhandler_type* xfrhandler); /** * Signal zone transfer handler. * \param[in] xfrhandler_type* zone transfer handler * */ extern void xfrhandler_signal(xfrhandler_type* xfrhandler); /** * Cleanup zone transfer handler. * \param[in] xfrhandler_type* zone transfer handler * */ extern void xfrhandler_cleanup(xfrhandler_type* xfrhandler); #endif /* DAEMON_XFRHANDLER_H */ opendnssec-2.1.13/signer/src/daemon/engine.c0000644000077000001440000007371214446272525015634 00000000000000/* * 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 "duration.h" #include "file.h" #include "str.h" #include "hsm.h" #include "locks.h" #include "log.h" #include "privdrop.h" #include "status.h" #include "util.h" #include "signer/zonelist.h" #include "wire/tsig.h" #include "libhsm.h" #include "signertasks.h" #include "signercommands.h" #include #include #include #include #include #include #include #include #include #include #include #include #include static const char* engine_str = "engine"; static engine_type* engine = NULL; /** * Create engine. * */ static engine_type* engine_create(void) { engine_type* engine; CHECKALLOC(engine = (engine_type*) malloc(sizeof(engine_type))); engine->config = NULL; engine->workers = NULL; engine->cmdhandler = NULL; engine->dnshandler = NULL; engine->xfrhandler = NULL; engine->taskq = NULL; engine->pid = -1; engine->uid = -1; engine->gid = -1; engine->daemonize = 0; engine->need_to_exit = 0; engine->need_to_reload = 0; pthread_mutex_init(&engine->signal_lock, NULL); pthread_cond_init(&engine->signal_cond, NULL); engine->zonelist = zonelist_create(); if (!engine->zonelist) { engine_cleanup(engine); return NULL; } if (!(engine->taskq = schedule_create())) { engine_cleanup(engine); return NULL; } schedule_registertask(engine->taskq, TASK_CLASS_SIGNER, TASK_SIGNCONF, do_readsignconf); schedule_registertask(engine->taskq, TASK_CLASS_SIGNER, TASK_FORCESIGNCONF, do_forcereadsignconf); schedule_registertask(engine->taskq, TASK_CLASS_SIGNER, TASK_READ, do_readzone); schedule_registertask(engine->taskq, TASK_CLASS_SIGNER, TASK_FORCEREAD, do_forcereadzone); schedule_registertask(engine->taskq, TASK_CLASS_SIGNER, TASK_SIGN, do_signzone); schedule_registertask(engine->taskq, TASK_CLASS_SIGNER, TASK_WRITE, do_writezone); return engine; } static void engine_start_cmdhandler(engine_type* engine) { ods_log_debug("[%s] start command handler", engine_str); janitor_thread_create(&engine->cmdhandler->thread_id, workerthreadclass, (janitor_runfn_t)cmdhandler_start, engine->cmdhandler); } /** * Start/stop dnshandler. * */ 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; janitor_thread_create(&engine->dnshandler->thread_id, handlerthreadclass, (janitor_runfn_t)dnshandler_start, engine->dnshandler); } 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); janitor_thread_join(engine->dnshandler->thread_id); engine->dnshandler->engine = 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; /* 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; janitor_thread_create(&engine->xfrhandler->thread_id, handlerthreadclass, (janitor_runfn_t)xfrhandler_start, engine->xfrhandler); } 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) { janitor_thread_join(engine->xfrhandler->thread_id); engine->xfrhandler->started = 0; } engine->xfrhandler->engine = NULL; } /** * 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) { char* name; int i; int numTotalWorkers; int threadCount = 0; ods_log_assert(engine); ods_log_assert(engine->config); numTotalWorkers = engine->config->num_worker_threads + engine->config->num_signer_threads; CHECKALLOC(engine->workers = (worker_type**) malloc(numTotalWorkers * sizeof(worker_type*))); for (i=0; i < engine->config->num_worker_threads; i++) { asprintf(&name, "worker[%d]", i+1); engine->workers[threadCount++] = worker_create(name, engine->taskq); } for (i=0; i < engine->config->num_signer_threads; i++) { asprintf(&name, "drudger[%d]", i+1); engine->workers[threadCount++] = worker_create(name, engine->taskq); } } static void engine_start_workers(engine_type* engine) { int i; int threadCount = 0; struct worker_context* context; ods_log_assert(engine); ods_log_assert(engine->config); ods_log_debug("[%s] start workers", engine_str); for (i=0; i < engine->config->num_worker_threads; i++,threadCount++) { CHECKALLOC(context = malloc(sizeof(struct worker_context))); context->engine = engine; context->worker = engine->workers[threadCount]; context->signq = engine->taskq->signq; engine->workers[threadCount]->need_to_exit = 0; engine->workers[threadCount]->context = context; janitor_thread_create(&engine->workers[threadCount]->thread_id, workerthreadclass, (janitor_runfn_t)worker_start, engine->workers[threadCount]); } for (i=0; i < engine->config->num_signer_threads; i++,threadCount++) { engine->workers[threadCount]->need_to_exit = 0; janitor_thread_create(&engine->workers[threadCount]->thread_id, workerthreadclass, (janitor_runfn_t)drudge, engine->workers[threadCount]); } } static void engine_stop_threads(engine_type* engine) { int i; int numTotalWorkers; ods_log_assert(engine); ods_log_assert(engine->config); ods_log_debug("[%s] stop workers and drudgers", engine_str); numTotalWorkers = engine->config->num_worker_threads + engine->config->num_signer_threads; for (i=0; i < numTotalWorkers; i++) { engine->workers[i]->need_to_exit = 1; } ods_log_debug("[%s] notify workers and drudgers", engine_str); schedule_release_all(engine->taskq); for (i=0; i < numTotalWorkers; i++) { ods_log_debug("[%s] join worker %d", engine_str, i+1); janitor_thread_join(engine->workers[i]->thread_id); free(engine->workers[i]->context); } } /** * 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 */ schedule_release_all(engine->taskq); } static void * signal_handler(sig_atomic_t sig) { switch (sig) { case SIGHUP: if (engine) { engine->need_to_reload = 1; pthread_mutex_lock(&engine->signal_lock); pthread_cond_signal(&engine->signal_cond); pthread_mutex_unlock(&engine->signal_lock); } break; case SIGINT: case SIGTERM: if (engine) { engine->need_to_exit = 1; pthread_mutex_lock(&engine->signal_lock); pthread_cond_signal(&engine->signal_cond); pthread_mutex_unlock(&engine->signal_lock); } break; default: break; } return NULL; } /** * Set up engine. * */ static ods_status engine_setup(void) { ods_status status = ODS_STATUS_OK; struct sigaction action; int sockets[2] = {0,0}; int pipefd[2]; char buff = '\0'; int fd, error; 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->config->clisock_filename, signercommands, engine, NULL, NULL); if (!engine->cmdhandler) { return ODS_STATUS_CMDHANDLER_ERR; } engine->dnshandler = dnshandler_create(engine->config->interfaces); engine->xfrhandler = xfrhandler_create(); 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)); return ODS_STATUS_XFRHANDLER_ERR; } } /* 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) { if (pipe(pipefd)) { ods_log_error("[%s] unable to pipe: %s", engine_str, strerror(errno)); return ODS_STATUS_PIPE_ERR; } 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 */ close(pipefd[0]); break; default: /* parent */ engine_cleanup(engine); engine = NULL; xmlCleanupParser(); xmlCleanupGlobals(); close(pipefd[1]); while (read(pipefd[0], &buff, 1) != -1) { if (buff <= 1) break; printf("%c", buff); } close(pipefd[0]); if (buff == '\1') { ods_log_debug("[%s] signerd started successfully", engine_str); exit(0); } ods_log_error("[%s] fail to start signerd completely", engine_str); exit(1); } if (setsid() == -1) { ods_log_error("[%s] setup: unable to setsid daemon (%s)", engine_str, strerror(errno)); const char *err = "unable to setsid daemon: "; ods_writen(pipefd[1], err, strlen(err)); ods_writeln(pipefd[1], strerror(errno)); write(pipefd[1], "\0", 1); close(pipefd[1]); return ODS_STATUS_SETSID_ERR; } } engine->pid = getpid(); /* write pidfile */ if (util_write_pidfile(engine->config->pid_filename, engine->pid) == -1) { if (engine->daemonize) { ods_writeln(pipefd[1], "Unable to write pid file"); write(pipefd[1], "\0", 1); close(pipefd[1]); } return ODS_STATUS_WRITE_PIDFILE_ERR; } /* setup done */ ods_log_verbose("[%s] running as pid %lu", engine_str, (unsigned long) engine->pid); /* catch signals */ action.sa_handler = (void (*)(int))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); /* create workers/drudgers */ engine_create_workers(engine); /* start cmd/dns/xfr handlers */ engine_start_cmdhandler(engine); engine_start_dnshandler(engine); engine_start_xfrhandler(engine); tsig_handler_init(); if (engine->daemonize) { write(pipefd[1], "\1", 1); close(pipefd[1]); } return ODS_STATUS_OK; } /** * Run engine, run!. * */ static void engine_run(engine_type* engine) { if (!engine) { return; } engine_start_workers(engine); while (!engine->need_to_exit && !engine->need_to_reload) { /* We must use locking here to avoid race conditions. We want * to sleep indefinitely and want to wake up on signal. This * is to make sure we never mis the signal. */ pthread_mutex_lock(&engine->signal_lock); if (!engine->need_to_exit && !engine->need_to_reload) { /* TODO: this silly. We should be handling the commandhandler * connections. No reason to spawn that as a thread. * Also it would be easier to wake up the command hander * as signals will reach it if it is the main thread! */ ods_log_debug("[%s] taking a break", engine_str); pthread_cond_wait(&engine->signal_cond, &engine->signal_lock); } pthread_mutex_unlock(&engine->signal_lock); } ods_log_debug("[%s] signer halted", engine_str); engine_stop_threads(engine); } /** * 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, 1); 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); } } /** * 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, 0); 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; ods_status status = ODS_STATUS_OK; unsigned wake_up = 0; int warnings = 0; if (!engine || !engine->zonelist || !engine->zonelist->zones) { return; } ods_log_debug("[%s] commit zone list changes", engine_str); pthread_mutex_lock(&engine->zonelist->zl_lock); node = ldns_rbtree_first(engine->zonelist->zones); while (node && node != LDNS_RBTREE_NULL) { zone = (zone_type*) node->data; if (zone->zl_status == ZONE_ZL_REMOVED) { node = ldns_rbtree_next(node); pthread_mutex_lock(&zone->zone_lock); zonelist_del_zone(engine->zonelist, zone); schedule_unscheduletask(engine->taskq, schedule_WHATEVER, zone->name); pthread_mutex_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) { pthread_mutex_lock(&zone->zone_lock); /* set notify nameserver command */ if (engine->config->notify_command && !zone->notify_ns) { set_notify_ns(zone, engine->config->notify_command); } pthread_mutex_unlock(&zone->zone_lock); } /* 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) { schedule_scheduletask(engine->taskq, TASK_SIGNCONF, zone->name, zone, &zone->zone_lock, 0); } else if (zl_changed == ODS_STATUS_OK) { schedule_scheduletask(engine->taskq, TASK_FORCESIGNCONF, zone->name, zone, &zone->zone_lock, 0); } 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); } pthread_mutex_unlock(&engine->zonelist->zl_lock); if (engine->dnshandler) { ods_log_debug("[%s] forward notify for all zones", engine_str); 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); } } /** * 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); pthread_mutex_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); pthread_mutex_lock(&zone->zone_lock); status = zone_recover2(engine, zone); if (status == ODS_STATUS_OK) { 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); } if (status != ODS_STATUS_OK) { ods_log_crit("[%s] unable to schedule task for zone %s: %s", engine_str, zone->name, ods_status2str(status)); 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 */ } pthread_mutex_unlock(&zone->zone_lock); node = ldns_rbtree_next(node); } /* [UNLOCK] zonelist */ pthread_mutex_unlock(&engine->zonelist->zl_lock); return result; } /** * Start engine. * */ int engine_start(const char* cfgfile, int cmdline_verbosity, int daemonize, int info) { ods_status zl_changed = ODS_STATUS_UNCHANGED; ods_status status = ODS_STATUS_OK; engine = engine_create(); if (!engine) { ods_fatal_exit("[%s] create failed", engine_str); return 1; } engine->daemonize = daemonize; /* config */ engine->config = engine_config(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) { char* stacktrace; char* stacktraceptr; stacktrace = janitor_backtrace_string(); stacktraceptr = strchr(stacktrace,'\n'); if(stacktraceptr) *stacktraceptr = '\0'; stacktraceptr = stacktrace; while(*stacktraceptr && isspace(*stacktraceptr)) ++stacktraceptr; fprintf(stdout, "Stacktrace check: %s\n",stacktraceptr); free(stacktrace); fprintf(stdout, "Configuration:\n"); engine_config_print(stdout, engine->config); /* for debugging */ goto earlyexit; } /* check pidfile */ if (!util_check_pidfile(engine->config->pid_filename)) { exit(1); } /* setup */ status = engine_setup(); if (status != ODS_STATUS_OK) { ods_log_error("[%s] setup failed: %s", engine_str, ods_status2str(status)); goto earlyexit; } /* run */ while (engine->need_to_exit == 0) { /* update zone list */ pthread_mutex_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; pthread_mutex_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); if (hsm_open2(engine->config->repositories, hsm_check_pin) != HSM_OK) { char* error = hsm_get_error(NULL); if (error != NULL) { ods_log_error("[%s] %s", "hsm", error); free(error); } ods_log_error("[%s] opening hsm failed (for engine recover)", engine_str); break; } zl_changed = engine_recover(engine); hsm_close(); } if (zl_changed == ODS_STATUS_OK || zl_changed == ODS_STATUS_UNCHANGED) { engine_update_zones(engine, zl_changed); } if (hsm_open2(engine->config->repositories, hsm_check_pin) != HSM_OK) { char* error = hsm_get_error(NULL); if (error != NULL) { ods_log_error("[%s] %s", "hsm", error); free(error); } ods_log_error("[%s] opening hsm failed (for engine run)", engine_str); break; } engine_run(engine); hsm_close(); } /* shutdown */ ods_log_info("[%s] signer shutdown", engine_str); cmdhandler_stop(engine->cmdhandler); engine_stop_xfrhandler(engine); engine_stop_dnshandler(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; return status; } /** * Clean up engine. * */ void engine_cleanup(engine_type* engine) { int i; int numTotalWorkers; if (!engine) { return; } if (engine->config) { numTotalWorkers = engine->config->num_worker_threads + engine->config->num_signer_threads; if (engine->workers) { for (i=0; i < (size_t) numTotalWorkers; i++) { worker_cleanup(engine->workers[i]); } free(engine->workers); } zonelist_cleanup(engine->zonelist); schedule_cleanup(engine->taskq); cmdhandler_cleanup(engine->cmdhandler); dnshandler_cleanup(engine->dnshandler); xfrhandler_cleanup(engine->xfrhandler); engine_config_cleanup(engine->config); pthread_mutex_destroy(&engine->signal_lock); pthread_cond_destroy(&engine->signal_cond); } free(engine); } opendnssec-2.1.13/signer/src/daemon/engine.h0000644000077000001440000000604214446272525015631 00000000000000/* * 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 typedef struct engine_struct engine_type; #include "daemon/cfg.h" #include "cmdhandler.h" #include "daemon/dnshandler.h" #include "daemon/xfrhandler.h" #include "scheduler/worker.h" #include "scheduler/schedule.h" #include "status.h" #include "locks.h" #include "signer/zonelist.h" #include "wire/edns.h" struct engine_struct { engineconfig_type* config; worker_type** workers; schedule_type* taskq; cmdhandler_type* cmdhandler; pid_t pid; uid_t uid; gid_t gid; int daemonize; int need_to_exit; int need_to_reload; /* Main thread blocks on this condition when there is nothing to do */ pthread_cond_t signal_cond; pthread_mutex_t signal_lock; zonelist_type* zonelist; dnshandler_type* dnshandler; xfrhandler_type* xfrhandler; edns_data_type edns; }; /** * 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 * \return 0 if successful, 1 on error * */ extern int engine_start(const char* cfgfile, int cmdline_verbosity, int daemonize, int info); /** * Wake up workers. * \param[in] engine engine * */ extern void engine_wakeup_workers(engine_type* engine); /** * Update zones. * \param[in] engine engine * \param[in] zl_changed whether the zonelist has changed or not * */ extern void engine_update_zones(engine_type* engine, ods_status zl_changed); /** * Clean up engine. * \param[in] engine engine * */ extern void engine_cleanup(engine_type* engine); #endif /* DAEMON_ENGINE_H */ opendnssec-2.1.13/signer/src/daemon/xfrhandler.c0000644000077000001440000001331114446272525016511 00000000000000/* * 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 "duration.h" #include "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() { xfrhandler_type* xfrh = NULL; CHECKALLOC(xfrh = (xfrhandler_type*) malloc(sizeof(xfrhandler_type))); xfrh->engine = NULL; xfrh->packet = NULL; xfrh->netio = NULL; xfrh->tcp_set = NULL; xfrh->tcp_waiting_first = 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(); 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(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(); 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; xfrh->dnshandler.free_handler = 0; 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); } /** * 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) { janitor_thread_signal(xfrhandler->thread_id); } } /** * 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); received = read(xfrhandler->dnshandler.fd, &buf, MAX_PACKET_SIZE); ods_log_debug("[%s] read forwarded dns packet: %d bytes received", xfrh_str, (int) received); if (received == -1) { ods_log_error("[%s] unable to forward dns packet: %s", xfrh_str, strerror(errno)); } } /** * Cleanup zone transfer handler. * */ void xfrhandler_cleanup(xfrhandler_type* xfrhandler) { if (!xfrhandler) { return; } netio_cleanup_shallow(xfrhandler->netio); buffer_cleanup(xfrhandler->packet); tcp_set_cleanup(xfrhandler->tcp_set); free(xfrhandler); } opendnssec-2.1.13/signer/src/daemon/signertasks.c0000644000077000001440000004761514446272525016727 00000000000000/* * 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 /* time() */ #include "daemon/engine.h" #include "scheduler/worker.h" #include "scheduler/schedule.h" #include "signertasks.h" #include "duration.h" #include "hsm.h" #include "locks.h" #include "util.h" #include "log.h" #include "status.h" #include "signer/tools.h" #include "signer/zone.h" #include "util.h" #include "signertasks.h" /** * Queue RRset for signing. * */ static void worker_queue_rrset(struct worker_context* context, fifoq_type* q, rrset_type* rrset, long* nsubtasks) { ods_status status = ODS_STATUS_UNCHANGED; int tries = 0; ods_log_assert(q); ods_log_assert(rrset); pthread_mutex_lock(&q->q_lock); status = fifoq_push(q, (void*) rrset, context, &tries); while (status == ODS_STATUS_UNCHANGED) { tries++; if (context->worker->need_to_exit) { pthread_mutex_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. */ ods_thread_wait(&q->q_nonfull, &q->q_lock, 5); status = fifoq_push(q, (void*) rrset, context, &tries); } pthread_mutex_unlock(&q->q_lock); ods_log_assert(status == ODS_STATUS_OK); *nsubtasks += 1; } /** * Queue domain for signing. * */ static void worker_queue_domain(struct worker_context* context, fifoq_type* q, domain_type* domain, long* nsubtasks) { rrset_type* rrset = NULL; denial_type* denial = NULL; ods_log_assert(context); ods_log_assert(q); ods_log_assert(domain); rrset = domain->rrsets; while (rrset) { worker_queue_rrset(context, q, rrset, nsubtasks); rrset = rrset->next; } denial = (denial_type*) domain->denial; if (denial && denial->rrset) { worker_queue_rrset(context, q, denial->rrset, nsubtasks); } } /** * Queue zone for signing. * */ static void worker_queue_zone(struct worker_context* context, fifoq_type* q, zone_type* zone, long* nsubtasks) { ldns_rbnode_t* node = LDNS_RBTREE_NULL; domain_type* domain = NULL; ods_log_assert(context); ods_log_assert(q); ods_log_assert(zone); 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(context, q, domain, nsubtasks); node = ldns_rbtree_next(node); } } /** * Make sure that no appointed jobs have failed. * */ static ods_status worker_check_jobs(worker_type* worker, task_type* task, int ntasks, long ntasksfailed) { ods_log_assert(worker); ods_log_assert(task); if (ntasksfailed) { ods_log_error("[%s] sign zone %s failed: %ld RRsets failed", worker->name, task->owner, ntasksfailed); return ODS_STATUS_ERR; } else if (worker->need_to_exit) { ods_log_error("[%s] sign zone %s failed: worker needs to exit", worker->name, task->owner); return ODS_STATUS_ERR; } return ODS_STATUS_OK; } void drudge(worker_type* worker) { rrset_type* rrset; ods_status status; struct worker_context* superior; hsm_ctx_t* ctx = NULL; engine_type* engine; fifoq_type* signq = worker->taskq->signq; while (worker->need_to_exit == 0) { ods_log_deeebug("[%s] report for duty", worker->name); pthread_mutex_lock(&signq->q_lock); superior = NULL; rrset = (rrset_type*) fifoq_pop(signq, (void**)&superior); if (!rrset) { ods_log_deeebug("[%s] nothing to do, wait", worker->name); /** * 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). */ pthread_cond_wait(&signq->q_threshold, &signq->q_lock); if(worker->need_to_exit == 0) rrset = (rrset_type*) fifoq_pop(signq, (void**)&superior); } pthread_mutex_unlock(&signq->q_lock); /* do some work */ if (rrset) { ods_log_assert(superior); if (!ctx) { ods_log_debug("[%s] create hsm context", worker->name); ctx = hsm_create_context(); } if (!ctx) { engine = superior->engine; ods_log_crit("[%s] error creating libhsm context", worker->name); engine->need_to_reload = 1; pthread_mutex_lock(&engine->signal_lock); pthread_cond_signal(&engine->signal_cond); pthread_mutex_unlock(&engine->signal_lock); ods_log_error("signer instructed to reload due to hsm reset while signing"); status = ODS_STATUS_HSM_ERR; } else { status = rrset_sign(ctx, rrset, superior->clock_in); } fifoq_report(signq, superior->worker, status); } /* done work */ } /* cleanup open HSM sessions */ if (ctx) { hsm_destroy_context(ctx); } } time_t do_readsignconf(task_type* task, const char* zonename, void* zonearg, void *contextarg) { struct worker_context* context = contextarg; engine_type* engine = context->engine; zone_type* zone = zonearg; ods_status status; status = tools_signconf(zone); if (status == ODS_STATUS_UNCHANGED && !zone->signconf->last_modified) { ods_log_debug("No signconf.xml for zone %s yet", task->owner); status = ODS_STATUS_ERR; zone->zoneconfigvalid = 0; } if (status == ODS_STATUS_OK || status == ODS_STATUS_UNCHANGED) { /* status unchanged not really possible */ schedule_unscheduletask(engine->taskq, TASK_READ, zone->name); schedule_scheduletask(engine->taskq, TASK_READ, zone->name, zone, &zone->zone_lock, schedule_PROMPTLY); zone->zoneconfigvalid = 1; return schedule_SUCCESS; } else { zone->zoneconfigvalid = 0; if (!zone->signconf->last_modified) { ods_log_warning("WARNING: unable to sign zone %s, signconf is not ready", task->owner); } else { ods_log_crit("CRITICAL: failed to sign zone %s: %s", task->owner, ods_status2str(status)); } return schedule_DEFER; } } time_t do_forcereadsignconf(task_type* task, const char* zonename, void* zonearg, void *contextarg) { struct worker_context* context = contextarg; engine_type* engine = context->engine; zone_type* zone = zonearg; ods_status status; /* perform 'load signconf' task */ status = tools_signconf(zone); if (status == ODS_STATUS_UNCHANGED) { schedule_unscheduletask(engine->taskq, TASK_SIGNCONF, zone->name); if(!zone->zoneconfigvalid) { zone->zoneconfigvalid = 1; schedule_unscheduletask(engine->taskq, TASK_READ, zone->name); schedule_scheduletask(engine->taskq, TASK_READ, zone->name, zone, &zone->zone_lock, schedule_PROMPTLY); } return schedule_SUCCESS; } else if (status == ODS_STATUS_OK) { schedule_unscheduletask(engine->taskq, TASK_SIGNCONF, zone->name); schedule_unscheduletask(engine->taskq, TASK_READ, zone->name); schedule_unscheduletask(engine->taskq, TASK_SIGN, zone->name); schedule_unscheduletask(engine->taskq, TASK_WRITE, zone->name); schedule_scheduletask(engine->taskq, TASK_READ, zone->name, zone, &zone->zone_lock, schedule_PROMPTLY); return schedule_SUCCESS; } else { return schedule_SUCCESS; } } time_t do_signzone(task_type* task, const char* zonename, void* zonearg, void *contextarg) { struct worker_context* context = contextarg; engine_type* engine = context->engine; worker_type* worker = context->worker; zone_type* zone = zonearg; ods_status status; time_t start = 0; time_t end = 0; long nsubtasks = 0; long nsubtasksfailed = 0; context->clock_in = time_now(); status = zone_update_serial(zone); if (status != ODS_STATUS_OK) { if(!strcmp(zone->signconf->soa_serial,"keep") && (status == ODS_STATUS_FOPEN_ERR || status == ODS_STATUS_CONFLICT_ERR)) { if(task->backoff > 0) { ods_log_error("[%s] unable to sign zone %s: failed to increment serial", worker->name, task->owner); ods_log_crit("[%s] CRITICAL: repeatedly failed to sign zone %s: %s", worker->name, task->owner, ods_status2str(status)); } else { ods_log_warning("[%s] unable to sign zone %s: failed to increment serial", worker->name, task->owner); ods_log_warning("[%s] CRITICAL: failed to sign zone %s: %s", worker->name, task->owner, ods_status2str(status)); } task->backoff = duration2time(zone->signconf->sig_resign_interval); return time_now() + duration2time(zone->signconf->sig_resign_interval); } else { ods_log_error("[%s] unable to sign zone %s: failed to increment serial", worker->name, task->owner); ods_log_crit("[%s] CRITICAL: failed to sign zone %s: %s", worker->name, task->owner, ods_status2str(status)); return schedule_DEFER; } } /* start timer */ start = time(NULL); if (zone->stats) { pthread_mutex_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; pthread_mutex_unlock(&zone->stats->stats_lock); } /* check the HSM connection before queuing sign operations */ if (hsm_check_context()) { ods_log_error("signer instructed to reload due to hsm reset in sign task"); engine->need_to_reload = 1; pthread_mutex_lock(&engine->signal_lock); pthread_cond_signal(&engine->signal_cond); pthread_mutex_unlock(&engine->signal_lock); ods_log_crit("[%s] CRITICAL: failed to sign zone %s: %s", worker->name, task->owner, ods_status2str(status)); return schedule_DEFER; /* backoff */ } /* prepare keys */ status = zone_prepare_keys(zone); if (status == ODS_STATUS_OK) { /* queue menial, hard signing work */ worker_queue_zone(context, worker->taskq->signq, zone, &nsubtasks); ods_log_deeebug("[%s] wait until drudgers are finished " "signing zone %s", worker->name, task->owner); /* sleep until work is done */ fifoq_waitfor(context->signq, worker, nsubtasks, &nsubtasksfailed); } /* stop timer */ end = time(NULL); /* check status and jobs */ if (status == ODS_STATUS_OK) { status = worker_check_jobs(worker, task, nsubtasks, nsubtasksfailed); } if (status == ODS_STATUS_OK && zone->stats) { pthread_mutex_lock(&zone->stats->stats_lock); zone->stats->sig_time = (end - start); pthread_mutex_unlock(&zone->stats->stats_lock); } if (status != ODS_STATUS_OK) { ods_log_crit("[%s] CRITICAL: failed to sign zone %s: %s", worker->name, task->owner, ods_status2str(status)); return schedule_DEFER; /* backoff */ } schedule_scheduletask(engine->taskq, TASK_WRITE, zone->name, zone, &zone->zone_lock, schedule_PROMPTLY); return schedule_SUCCESS; } time_t do_readzone(task_type* task, const char* zonename, void* zonearg, void *contextarg) { ods_status status = ODS_STATUS_OK; struct worker_context* context = contextarg; engine_type* engine = context->engine; zone_type* zone = zonearg; /* perform 'read input adapter' task */ if (!zone->signconf->last_modified) { ods_log_debug("no signconf.xml for zone %s yet", task->owner); status = ODS_STATUS_ERR; } if (status == ODS_STATUS_OK) { status = tools_input(zone); if (status == ODS_STATUS_UNCHANGED) { ods_log_verbose("zone %s unsigned data not changed, continue", task->owner); status = ODS_STATUS_OK; } } if (status != ODS_STATUS_OK) { if (!zone->signconf->last_modified) { ods_log_warning("WARNING: unable to sign zone %s, signconf is not ready", task->owner); return schedule_DEFER; } else if (status != ODS_STATUS_XFR_NOT_READY) { /* other statuses is critical, and we know it is not ODS_STATUS_OK */ if(!strcmp(zone->signconf->soa_serial,"keep") && (status == ODS_STATUS_FOPEN_ERR || status == ODS_STATUS_CONFLICT_ERR)) { if(task->backoff > 0) { ods_log_crit("CRITICAL: repeatedly failed to sign zone %s: %s", task->owner, ods_status2str(status)); } else { ods_log_warning("Warning: failed to sign zone %s: %s", task->owner, ods_status2str(status)); } task->backoff = duration2time(zone->signconf->sig_resign_interval); return time_now() + duration2time(zone->signconf->sig_resign_interval); } else { ods_log_crit("CRITICAL: failed to sign zone %s: %s", task->owner, ods_status2str(status)); return schedule_DEFER; } } } else { /* unscheduling an existing sign task should no be necessary. After a read (this action) * the logical next step is a sign. No other regular procedure that does not explicitly * remove a sign task could create a sign task for this zone. So here we would be able * to assume there is no sign task. However it occurs. The original code before refactoring * also removed sign tasks. My premis this is caused by the locking code. A task actually * starts executing even though the zone is being processed from another task. So for * instance performing a force signconf just before a read task starts, can load to the read * task to start executing even though the signconf task was still running. The forced signconf * task cannot remove the read task (it is no longer queued), but will schedule a sign task. * The read task can then continue, finding the just created sign task in its path. */ schedule_unscheduletask(engine->taskq, TASK_SIGN, zone->name); schedule_scheduletask(engine->taskq, TASK_SIGN, zone->name, zone, &zone->zone_lock, schedule_PROMPTLY); return schedule_SUCCESS; } } time_t do_forcereadzone(task_type* task, const char* zonename, void* zonearg, void *contextarg) { ods_status status = ODS_STATUS_OK; struct worker_context* context = contextarg; engine_type* engine = context->engine; zone_type* zone = zonearg; /* perform 'read input adapter' task */ if (!zone->signconf->last_modified) { ods_log_debug("no signconf.xml for zone %s yet", task->owner); status = ODS_STATUS_ERR; } if (status == ODS_STATUS_OK) { status = tools_input(zone); if (status == ODS_STATUS_UNCHANGED) { ods_log_verbose("zone %s unsigned data not changed, continue", task->owner); status = ODS_STATUS_OK; } } if (status != ODS_STATUS_OK) { if (!zone->signconf->last_modified) { ods_log_warning("WARNING: unable to sign zone %s, signconf is not ready", task->owner); } else if (status != ODS_STATUS_XFR_NOT_READY) { /* other statuses is critical, and we know it is not ODS_STATUS_OK */ if(!strcmp(zone->signconf->soa_serial,"keep") && (status == ODS_STATUS_FOPEN_ERR || status == ODS_STATUS_CONFLICT_ERR)) { if(task->backoff > 0) { ods_log_crit("CRITICAL: repeatedly failed to sign zone %s: %s", task->owner, ods_status2str(status)); } else { ods_log_warning("Warning: failed to sign zone %s: %s", task->owner, ods_status2str(status)); } task->backoff = duration2time(zone->signconf->sig_resign_interval); return time_now() + duration2time(zone->signconf->sig_resign_interval); } else { ods_log_crit("CRITICAL: failed to sign zone %s: %s", task->owner, ods_status2str(status)); return schedule_DEFER; } } return schedule_SUCCESS; } else { schedule_unscheduletask(engine->taskq, TASK_SIGNCONF, zone->name); schedule_unscheduletask(engine->taskq, TASK_FORCEREAD, zone->name); schedule_unscheduletask(engine->taskq, TASK_READ, zone->name); schedule_unscheduletask(engine->taskq, TASK_SIGN, zone->name); schedule_unscheduletask(engine->taskq, TASK_WRITE, zone->name); schedule_scheduletask(engine->taskq, TASK_SIGN, zone->name, zone, &zone->zone_lock, schedule_PROMPTLY); return schedule_SUCCESS; } } time_t do_writezone(task_type* task, const char* zonename, void* zonearg, void *contextarg) { struct worker_context* context = contextarg; engine_type* engine = context->engine; worker_type* worker = context->worker; zone_type* zone = zonearg; ods_status status; time_t resign; context->clock_in = time_now(); /* TODO this means something different */ /* perform write to output adapter task */ status = tools_output(zone, engine); if (status != ODS_STATUS_OK) { ods_log_crit("[%s] CRITICAL: failed to sign zone %s: %s", worker->name, task->owner, ods_status2str(status)); return schedule_DEFER; } if (zone->signconf && duration2time(zone->signconf->sig_resign_interval)) { resign = context->clock_in + duration2time(zone->signconf->sig_resign_interval); } else { ods_log_error("[%s] unable to retrieve resign interval " "for zone %s: duration2time() failed", worker->name, task->owner); ods_log_info("[%s] defaulting to 1H resign interval for " "zone %s", worker->name, task->owner); resign = context->clock_in + 3600; } /* backup the last successful run */ status = zone_backup2(zone, resign); if (status != ODS_STATUS_OK) { ods_log_warning("[%s] unable to backup zone %s: %s", worker->name, task->owner, ods_status2str(status)); /* just a warning */ status = ODS_STATUS_OK; } schedule_scheduletask(engine->taskq, TASK_SIGN, zone->name, zone, &zone->zone_lock, resign); return schedule_SUCCESS; } opendnssec-2.1.13/signer/src/daemon/cfg.c0000644000077000001440000002066514446272525015125 00000000000000/* * 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 "file.h" #include "log.h" #include "status.h" #include #include #include static const char* conf_str = "config"; /** * Configure engine. * */ engineconfig_type* engine_config(const char* cfgfile, int cmdline_verbosity) { engineconfig_type* ecfg; const char* rngfile = ODS_SE_RNGDIR "/conf.rng"; FILE* cfgfd = NULL; if (!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 */ CHECKALLOC(ecfg = (engineconfig_type*) malloc(sizeof(engineconfig_type))); /* get values */ ecfg->cfg_filename = strdup(cfgfile); ecfg->zonelist_filename = parse_conf_zonelist_filename(cfgfile); ecfg->log_filename = parse_conf_log_filename(cfgfile); ecfg->pid_filename = parse_conf_pid_filename(cfgfile); ecfg->notify_command = parse_conf_notify_command(cfgfile); ecfg->clisock_filename = parse_conf_clisock_filename(cfgfile); ecfg->working_dir = parse_conf_working_dir(cfgfile); ecfg->username = parse_conf_username(cfgfile); ecfg->group = parse_conf_group(cfgfile); ecfg->chroot = parse_conf_chroot(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(cfgfile); ecfg->repositories = parse_conf_repositories(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\n"); /* Enforcer */ fprintf(out, "\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 */ } } /** * Clean up config. * */ void engine_config_cleanup(engineconfig_type* config) { if (!config) { return; } listener_cleanup(config->interfaces); hsm_repository_free(config->repositories); free((void*)config->notify_command); free((void*)config->cfg_filename); free((void*)config->zonelist_filename); free((void*)config->log_filename); free((void*)config->pid_filename); free((void*)config->clisock_filename); free((void*)config->working_dir); free((void*)config->username); free((void*)config->group); free((void*)config->chroot); free(config); } opendnssec-2.1.13/signer/src/daemon/cfg.h0000644000077000001440000000565214446272525015131 00000000000000/* * 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 DAEMON_CONFIG_H #define DAEMON_CONFIG_H #include "config.h" #include typedef struct engineconfig_struct engineconfig_type; #include "status.h" #include "hsm.h" #include "locks.h" #include "status.h" #include "wire/listener.h" /** * Engine configuration. * */ struct engineconfig_struct { listener_type* interfaces; hsm_repository_t* repositories; 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(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-2.1.13/signer/src/daemon/signercommands.h0000644000077000001440000000305114446272525017372 00000000000000/* * Copyright (c) 2016 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_SIGNERCOMMANDS_H #define DAEMON_SIGNERCOMMANDS_H #include "config.h" #include "cmdhandler.h" extern struct cmd_func_block** signercommands; extern engine_type* getglobalcontext(cmdhandler_ctx_type*); #endif opendnssec-2.1.13/signer/src/daemon/dnshandler.h0000644000077000001440000000611014446272525016502 00000000000000/* * 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 typedef struct dnshandler_struct dnshandler_type; #include "status.h" #include "locks.h" #include "status.h" #include "wire/listener.h" #include "wire/netio.h" #include "wire/query.h" #include "wire/sock.h" #define ODS_SE_NOTIFY_CMD "NOTIFY" #define ODS_SE_MAX_HANDLERS 5 struct dnshandler_struct { janitor_thread_t thread_id; engine_type* engine; listener_type* interfaces; socklist_type* socklist; netio_type* netio; query_type* query; netio_handler_type xfrhandler; unsigned need_to_exit; netio_handler_type *tcp_accept_handlers; }; /** * Create dns handler. * \param[in] allocator memory allocator * \param[in] interfaces list of interfaces * \return dnshandler_type* created dns handler * */ extern dnshandler_type* dnshandler_create(listener_type* interfaces); /** * Start dns handler listener. * \param[in] dnshandler_type* dns handler * \return ods_status status * */ extern ods_status dnshandler_listen(dnshandler_type* dnshandler); /** * Start dns handler. * \param[in] dnshandler_type* dns handler * */ extern void dnshandler_start(dnshandler_type* dnshandler); /** * Signal dns handler. * \param[in] dnshandler_type* dns handler * */ extern 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 * */ extern void dnshandler_fwd_notify(dnshandler_type* dnshandler, uint8_t* pkt, size_t len); /** * Cleanup dns handler. * \param[in] dnshandler_type* dns handler * */ extern void dnshandler_cleanup(dnshandler_type* dnshandler); #endif /* DAEMON_DNSHANDLER_H */ opendnssec-2.1.13/signer/src/daemon/dnshandler.c0000644000077000001440000002254314446272525016505 00000000000000/* * 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 "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(listener_type* interfaces) { dnshandler_type* dnsh = NULL; if (!interfaces || interfaces->count <= 0) { return NULL; } CHECKALLOC(dnsh = (dnshandler_type*) malloc(sizeof(dnshandler_type))); if (!dnsh) { ods_log_error("[%s] unable to create dnshandler: " "allocator_alloc() failed", dnsh_str); return NULL; } dnsh->need_to_exit = 0; dnsh->engine = NULL; dnsh->interfaces = interfaces; dnsh->socklist = NULL; dnsh->netio = NULL; dnsh->query = NULL; dnsh->tcp_accept_handlers = NULL; /* setup */ CHECKALLOC(dnsh->socklist = (socklist_type*) malloc(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(); 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; ods_log_assert(dnshandler); ods_log_assert(dnshandler->engine); ods_log_debug("[%s] start", dnsh_str); engine = dnshandler->engine; /* udp */ for (i=0; i < dnshandler->interfaces->count; i++) { struct udp_data* data = NULL; netio_handler_type* handler = NULL; CHECKALLOC(data = (struct udp_data*) malloc(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]; CHECKALLOC(handler = (netio_handler_type*) malloc(sizeof(netio_handler_type))); if (!handler) { ods_log_error("[%s] unable to start: allocator_alloc() " "failed", dnsh_str); free(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; handler->free_handler = 1; ods_log_debug("[%s] add udp network handler fd %u", dnsh_str, (unsigned) handler->fd); netio_add_handler(dnshandler->netio, handler); } /* tcp */ CHECKALLOC(dnshandler->tcp_accept_handlers = (netio_handler_type*) malloc(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; CHECKALLOC(data = (struct tcp_accept_data*) malloc(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 = dnshandler->tcp_accept_handlers; handler = &dnshandler->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; handler->free_handler = 0; 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); } /** * Signal dns handler. * */ void dnshandler_signal(dnshandler_type* dnshandler) { if (dnshandler && dnshandler->thread_id) { janitor_thread_signal(dnshandler->thread_id); } } /** * 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: %ld bytes sent", dnsh_str, (long)nb); } } /** * 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); received = read(dnshandler->xfrhandler.fd, &buf, MAX_PACKET_SIZE); ods_log_debug("[%s] read forwarded xfr packet: %d bytes received", dnsh_str, (int) received); if (received == -1) { ods_log_error("[%s] unable to forward xfr packet: %s", dnsh_str, strerror(errno)); } } /** * Cleanup dns handler. * */ void dnshandler_cleanup(dnshandler_type* dnshandler) { size_t i = 0; if (!dnshandler) { return; } netio_cleanup(dnshandler->netio); query_cleanup(dnshandler->query); for (i = 0; i < dnshandler->interfaces->count; i++) { if (dnshandler->tcp_accept_handlers) free(dnshandler->tcp_accept_handlers[i].user_data); 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); } } free(dnshandler->tcp_accept_handlers); free(dnshandler->socklist); free(dnshandler); } opendnssec-2.1.13/signer/src/daemon/signertasks.h0000644000077000001440000000463114446272525016723 00000000000000/* * 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 SIGNERTASKS_H #define SIGNERTASKS_H #include "config.h" #include #include "scheduler/task.h" #include "scheduler/fifoq.h" #include "status.h" #include "locks.h" struct worker_context { engine_type* engine; worker_type* worker; fifoq_type* signq; time_t clock_in; }; extern void drudge(worker_type* worker); extern void task_schedule_easy(const char* zonename, task_id class, task_id type, time_t(*fn)(task_type*,const char*,void*,void*), void*, time_t time); extern time_t do_readsignconf(task_type* task, const char* zonename, void* zonearg, void *contextarg); extern time_t do_forcereadsignconf(task_type* task, const char* zonename, void* zonearg, void *contextarg); extern time_t do_signzone(task_type* task, const char* zonename, void* zonearg, void *contextarg); extern time_t do_readzone(task_type* task, const char* zonename, void* zonearg, void *contextarg); extern time_t do_forcereadzone(task_type* task, const char* zonename, void* zonearg, void *contextarg); extern time_t do_writezone(task_type* task, const char* zonename, void* zonearg, void *contextarg); #endif /* SIGNERTASKS_H */ opendnssec-2.1.13/signer/src/signer/0000755000077000001440000000000014446272546014320 500000000000000opendnssec-2.1.13/signer/src/signer/denial.c0000644000077000001440000002372014446272525015641 00000000000000/* * 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. * */ /** * Denial of Existence. * */ #include "config.h" #include "log.h" #include "signer/denial.h" #include "signer/domain.h" #include "signer/zone.h" #define SE_MAX_RRTYPE_COUNT 65536 static const char* denial_str = "denial"; /** * Create new Denial of Existence data point. * */ denial_type* denial_create(zone_type* zone, ldns_rdf* dname) { denial_type* denial = NULL; if (!dname || !zone) { return NULL; } CHECKALLOC(denial = (denial_type*) malloc(sizeof(denial_type))); if (!denial) { ods_log_error("[%s] unable to create denial: allocator_alloc() " "failed", denial_str); return NULL; } denial->dname = dname; denial->zone = zone; denial->domain = NULL; /* no back reference yet */ denial->node = NULL; /* not in db yet */ denial->rrset = NULL; denial->bitmap_changed = 0; denial->nxt_changed = 0; return denial; } /** * Create NSEC(3) Type Bitmaps Field. * */ static void denial_create_bitmap(denial_type* denial, ldns_rr_type types[], size_t* types_count) { domain_type* domain = NULL; rrset_type* rrset = NULL; ods_log_assert(denial); ods_log_assert(denial->domain); domain = denial->domain; rrset = domain->rrsets; while (rrset) { ldns_rr_type dstatus = domain_is_occluded(domain); if (dstatus == LDNS_RR_TYPE_SOA) { /* Authoritative or delegation */ dstatus = domain_is_delegpt(domain); if (dstatus == LDNS_RR_TYPE_SOA || rrset->rrtype == LDNS_RR_TYPE_NS || rrset->rrtype == LDNS_RR_TYPE_DS) { types[*types_count] = rrset->rrtype; *types_count = *types_count + 1; } } rrset = rrset->next; } } /** * Create NSEC3 Next Hashed Owner Name Field. * */ static ldns_rdf* denial_create_nsec3_nxt(ldns_rdf* nxt) { ldns_status status = LDNS_STATUS_OK; ldns_rdf* next_owner_label = NULL; ldns_rdf* next_owner_rdf = NULL; char* next_owner_string = NULL; ods_log_assert(nxt); next_owner_label = ldns_dname_label(nxt, 0); if (!next_owner_label) { ods_log_alert("[%s] unable to create NSEC3 Next: " "ldns_dname_label() failed", denial_str); return NULL; } next_owner_string = ldns_rdf2str(next_owner_label); if (!next_owner_string) { ods_log_alert("[%s] unable to create NSEC3 Next: " "ldns_rdf2str() failed", denial_str); ldns_rdf_deep_free(next_owner_label); return NULL; } if (next_owner_string[strlen(next_owner_string)-1] == '.') { next_owner_string[strlen(next_owner_string)-1] = '\0'; } status = ldns_str2rdf_b32_ext(&next_owner_rdf, next_owner_string); if (status != LDNS_STATUS_OK) { ods_log_alert("[%s] unable to create NSEC3 Next: " "ldns_str2rdf_b32_ext() failed", denial_str); } free((void*)next_owner_string); ldns_rdf_deep_free(next_owner_label); return next_owner_rdf; } /** * Create NSEC(3) RR. * */ static ldns_rr* denial_create_nsec(denial_type* denial, denial_type* nxt, uint32_t ttl, ldns_rr_class klass, nsec3params_type* n3p) { ldns_rr* nsec_rr = NULL; ldns_rr_type rrtype = LDNS_RR_TYPE_NSEC; ldns_rr_type dstatus = LDNS_RR_TYPE_FIRST; ldns_rdf* rdf = NULL; domain_type* domain = NULL; ldns_rr_type types[SE_MAX_RRTYPE_COUNT]; size_t types_count = 0; int i = 0; ods_log_assert(denial); ods_log_assert(denial->dname); ods_log_assert(nxt); ods_log_assert(nxt->dname); nsec_rr = ldns_rr_new(); if (!nsec_rr) { ods_log_alert("[%s] unable to create NSEC(3) RR: " "ldns_rr_new() failed", denial_str); return NULL; } /* RRtype */ if (n3p) { rrtype = LDNS_RR_TYPE_NSEC3; } ldns_rr_set_type(nsec_rr, rrtype); /* owner */ rdf = ldns_rdf_clone(denial->dname); if (!rdf) { ods_log_alert("[%s] unable to create NSEC(3) RR: " "ldns_rdf_clone(owner) failed", denial_str); ldns_rr_free(nsec_rr); return NULL; } ldns_rr_set_owner(nsec_rr, rdf); /* NSEC3 parameters */ if (n3p) { /* set all to NULL first, then call nsec3_add_param_rdfs. */ for (i=0; i < SE_NSEC3_RDATA_NSEC3PARAMS; i++) { ldns_rr_push_rdf(nsec_rr, NULL); } ldns_nsec3_add_param_rdfs(nsec_rr, n3p->algorithm, n3p->flags, n3p->iterations, n3p->salt_len, n3p->salt_data); } /* NXT */ if (n3p) { rdf = denial_create_nsec3_nxt(nxt->dname); } else { rdf = ldns_rdf_clone(nxt->dname); } if (!rdf) { ods_log_alert("[%s] unable to create NSEC(3) RR: " "create next field failed", denial_str); ldns_rr_free(nsec_rr); return NULL; } ldns_rr_push_rdf(nsec_rr, rdf); /* Type Bit Maps */ denial_create_bitmap(denial, types, &types_count); if (n3p) { domain = (domain_type*) denial->domain; dstatus = domain_is_occluded(domain); if (dstatus == LDNS_RR_TYPE_SOA) { dstatus = domain_is_delegpt(domain); if (dstatus != LDNS_RR_TYPE_NS && domain->rrsets) { /* Authoritative domain, not empty: add RRSIGs */ types[types_count] = LDNS_RR_TYPE_RRSIG; types_count++; } } /* and don't add NSEC3 type... */ } else { types[types_count] = LDNS_RR_TYPE_RRSIG; types_count++; types[types_count] = LDNS_RR_TYPE_NSEC; types_count++; } rdf = ldns_dnssec_create_nsec_bitmap(types, types_count, rrtype); if (!rdf) { ods_log_alert("[%s] unable to create NSEC(3) RR: " "ldns_dnssec_create_nsec_bitmap() failed", denial_str); ldns_rr_free(nsec_rr); return NULL; } ldns_rr_push_rdf(nsec_rr, rdf); ldns_rr_set_ttl(nsec_rr, ttl); ldns_rr_set_class(nsec_rr, klass); return nsec_rr; } /** * Apply differences at denial. * */ void denial_diff(denial_type* denial) { if (denial && denial->rrset) { rrset_diff(denial->rrset, 0, 0); } } /** * Add NSEC(3) to the Denial of Existence data point. * */ void denial_add_rr(denial_type* denial, ldns_rr* rr) { rr_type* record = NULL; zone_type* zone = NULL; ods_log_assert(denial); ods_log_assert(rr); zone = (zone_type*) denial->zone; ods_log_assert(zone); ods_log_assert(zone->signconf); if (!denial->rrset) { if (zone->signconf->nsec3params) { denial->rrset = rrset_create(denial->zone, LDNS_RR_TYPE_NSEC3); } else { denial->rrset = rrset_create(denial->zone, LDNS_RR_TYPE_NSEC); } if (!denial->rrset) { ods_fatal_exit("[%s] unable to nsecify: rrset_create() failed", denial_str); } } ods_log_assert(denial->rrset); record = rrset_add_rr(denial->rrset, rr); ods_log_assert(record); ods_log_assert(record->rr); record->owner = (void*) denial; denial_diff(denial); denial->bitmap_changed = 0; denial->nxt_changed = 0; } /** * Nsecify Denial of Existence data point. * */ void denial_nsecify(denial_type* denial, denial_type* nxt, uint32_t* num_added) { ldns_rr* nsec_rr = NULL; zone_type* zone = NULL; uint32_t ttl = 0; ods_log_assert(denial); ods_log_assert(nxt); zone = (zone_type*) denial->zone; ods_log_assert(zone); ods_log_assert(zone->signconf); if (denial->nxt_changed || denial->bitmap_changed) { ttl = zone->default_ttl; /* SOA MINIMUM */ if (zone->signconf->soa_min) { ttl = (uint32_t) duration2time(zone->signconf->soa_min); } /* create new NSEC(3) rr */ nsec_rr = denial_create_nsec(denial, nxt, ttl, zone->klass, zone->signconf->nsec3params); if (!nsec_rr) { ods_fatal_exit("[%s] unable to nsecify: denial_create_nsec() " "failed", denial_str); } denial_add_rr(denial, nsec_rr); if (num_added) { (*num_added)++; } } } /** * Print Denial of Existence data point. * */ void denial_print(FILE* fd, denial_type* denial, ods_status* status) { if (!denial || !fd) { if (status) { ods_log_crit("[%s] unable to print denial: denial of fd missing", denial_str); *status = ODS_STATUS_ASSERT_ERR; } } else if (denial->rrset) { rrset_print(fd, denial->rrset, 0, status); } } /** * Cleanup Denial of Existence data point. * */ void denial_cleanup(denial_type* denial) { if (!denial) { return; } ldns_rdf_deep_free(denial->dname); rrset_cleanup(denial->rrset); free(denial); } opendnssec-2.1.13/signer/src/signer/denial.h0000644000077000001440000000613214446272525015644 00000000000000/* * 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. * */ /** * Denial of Existence. * */ #ifndef SIGNER_DENIAL_H #define SIGNER_DENIAL_H #include "config.h" #include #include typedef struct denial_struct denial_type; #include "status.h" #include "signer/nsec3params.h" #include "signer/rrset.h" #include "signer/domain.h" /** * Denial of Existence data point. * */ struct denial_struct { zone_type* zone; domain_type* domain; ldns_rbnode_t* node; ldns_rdf* dname; rrset_type* rrset; unsigned bitmap_changed : 1; unsigned nxt_changed : 1; }; /** * Create new Denial of Existence data point. * \param[in] zoneptr zone reference * \param[in] dname owner name * \return denial_type* denial of existence data point * */ denial_type* denial_create(zone_type* zoneptr, ldns_rdf* dname); /** * Apply differences at denial. * \param[in] denial Denial of Existence data point * */ void denial_diff(denial_type* denial); /** * Add NSEC(3) to the Denial of Existence data point. * \param[in] denial Denial of Existence data point * \param[in] rr NSEC(3) resource record * */ void denial_add_rr(denial_type* denial, ldns_rr* rr); /** * Nsecify Denial of Existence data point. * \param[in] denial Denial of Existence data point * \param[in] nxt next Denial of Existence data point * \param[out] num_added number of RRs added * */ void denial_nsecify(denial_type* denial, denial_type* nxt, uint32_t* num_added); /** * Print Denial of Existence data point. * \param[in] fd file descriptor * \param[in] denial denial of existence data point * \param[out] status status * */ void denial_print(FILE* fd, denial_type* denial, ods_status* status); /** * Cleanup Denial of Existence data point. * \param[in] denial denial of existence data point * */ void denial_cleanup(denial_type* denial); #endif /* SIGNER_DENIAL_H */ opendnssec-2.1.13/signer/src/signer/ixfr.h0000644000077000001440000000534014446272525015360 00000000000000/* * 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. * */ /** * Domain name database. * */ #ifndef SIGNER_IXFR_H #define SIGNER_IXFR_H #include "config.h" #include typedef struct part_struct part_type; typedef struct ixfr_struct ixfr_type; #include "locks.h" #include "zone.h" #define IXFR_MAX_PARTS 3 /** * Part of IXFR Journal. RRs in soamin and soaplus should be owned * by part and must be freed. * */ struct part_struct { ldns_rr* soamin; /* pointer to rr in min */ ldns_rr_list* min; ldns_rr* soaplus; /* pointer to rr in min */ ldns_rr_list* plus; }; /** * IXFR Journal. * */ struct ixfr_struct { part_type* part[IXFR_MAX_PARTS]; pthread_mutex_t ixfr_lock; }; /** * Create a new ixfr journal. * \param[in] zone zone reference * \return ixfr_type* ixfr * */ ixfr_type* ixfr_create(void); /** * Add +RR to ixfr journal. * \param[in] ixfr journal * \param[in] rr +RR * */ void ixfr_add_rr(ixfr_type* ixfr, ldns_rr* rr); /** * Add -RR to ixfr journal. * \param[in] ixfr journal * \param[in] rr -RR * */ void ixfr_del_rr(ixfr_type* ixfr, ldns_rr* rr); /** * Print the ixfr journal. * \param[in] fd file descriptor * \param[in] ixfr journal * */ int ixfr_print(FILE* fd, ixfr_type* ixfr); /** * Purge the ixfr journal. * \param[in] ixfr journal * */ void ixfr_purge(ixfr_type* ixfr, char const *zonename); /** * Cleanup the ixfr journal. * \param[in] ixfr journal * */ void ixfr_cleanup(ixfr_type* ixfr); #endif /* SIGNER_IXFR_H */ opendnssec-2.1.13/signer/src/signer/zone.h0000644000077000001440000001545114446272525015367 00000000000000/* * 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 SIGNER_ZONE_H #define SIGNER_ZONE_H #include "config.h" #include enum zone_zl_status_enum { ZONE_ZL_OK = 0, ZONE_ZL_ADDED, ZONE_ZL_UPDATED, ZONE_ZL_REMOVED }; typedef enum zone_zl_status_enum zone_zl_status; typedef struct zone_struct zone_type; #include "adapter/adapter.h" #include "scheduler/schedule.h" #include "locks.h" #include "status.h" #include "signer/ixfr.h" #include "signer/namedb.h" #include "signer/signconf.h" #include "signer/stats.h" #include "signer/rrset.h" #include "wire/buffer.h" #include "wire/notify.h" #include "wire/xfrd.h" #include "datastructure.h" #include "daemon/engine.h" struct schedule_struct; struct zone_struct { ldns_rdf* apex; /* wire format zone name */ ldns_rr_class klass; /* class */ uint32_t default_ttl; /* ttl */ /* from conf.xml */ char *notify_command; /* placeholder for the whole notify command */ const char* notify_ns; /* master name server reload command */ char** notify_args; /* reload command arguments */ /* from zonelist.xml */ const char* name; /* string format zone name */ const char* policy_name; /* policy identifier */ const char* signconf_filename; /* signconf filename */ zone_zl_status zl_status; /* zonelist status */ /* adapters */ adapter_type* adinbound; /* inbound adapter */ adapter_type* adoutbound; /* outbound adapter */ /* from signconf.xml */ signconf_type* signconf; /* signer configuration values */ /* zone data */ namedb_type* db; ixfr_type* ixfr; /* zone transfers */ xfrd_type* xfrd; notify_type* notify; /* statistics */ stats_type* stats; pthread_mutex_t zone_lock; pthread_mutex_t xfr_lock; /* backing store for rrsigs (both domain as denial) */ collection_class rrstore; int zoneconfigvalid; /* flag indicating whether the signconf has at least once been read */ }; /** * Create a new zone. * \param[in] name zone name * \param[in] klass zone class * \return zone_type* zone * */ extern zone_type* zone_create(char* name, ldns_rr_class klass); /** * Load signer configuration for zone. * \param[in] zone zone * \param[out] new_signconf new signer configuration * \return ods_status status * ODS_STATUS_OK: new signer configuration loaded * ODS_STATUS_UNCHANGED: signer configuration has not changed * other: signer configuration not loaded, error occurred * */ extern ods_status zone_load_signconf(zone_type* zone, signconf_type** new_signconf); /** * Reschedule task for zone. * \param[in] zone zone * \param[in] taskq task queue * \param[in] what new task identifier * \return ods_status status * */ extern ods_status zone_reschedule_task(zone_type* zone, schedule_type* taskq, task_id what); /** * Publish the keys as indicated by the signer configuration. * \param[in] zone zone * \return ods_status status * */ extern ods_status zone_publish_dnskeys(zone_type* zone, int skip_hsm_access); /** * Unlink DNSKEY RRs. * \param[in] zone zone * */ extern void zone_rollback_dnskeys(zone_type* zone); /** * Publish the NSEC3 parameters as indicated by the signer configuration. * \param[in] zone zone * \return ods_status status * */ extern ods_status zone_publish_nsec3param(zone_type* zone); /** * Unlink NSEC3PARAM RR. * \param[in] zone zone * */ extern void zone_rollback_nsec3param(zone_type* zone); /** * Prepare keys for signing. * \param[in] zone zone * \return ods_status status * */ extern ods_status zone_prepare_keys(zone_type* zone); /** * Update serial. * \param[in] zone zone * \return ods_status status * */ extern ods_status zone_update_serial(zone_type* zone); /** * Lookup RRset. * \param[in] zone zone * \param[in] owner RRset owner * \param[in] type RRtype * \return rrset_type* RRset, if found * */ extern rrset_type* zone_lookup_rrset(zone_type* zone, ldns_rdf* owner, ldns_rr_type type); /** * Add RR. * \param[in] zone zone * \param[in] rr rr * \param[in] do_stats true if we need to maintain statistics * \return ods_status status * ODS_STATUS_OK: rr to be added to zone * ODS_STATUS_UNCHANGED: rr not added to zone, rr already exists * other: rr not added to zone, error occurred * */ extern ods_status zone_add_rr(zone_type* zone, ldns_rr* rr, int do_stats); /** * Delete RR. * \param[in] zone zone * \param[in] rr rr * \param[in] do_stats true if we need to maintain statistics * \return ods_status status * ODS_STATUS_OK: rr to be removed from zone * ODS_STATUS_UNCHANGED: rr not removed from zone, rr does not exist * other: rr not removed from zone, error occurred * */ extern ods_status zone_del_rr(zone_type* zone, ldns_rr* rr, int do_stats); /** * Remove all NSEC3PARAM RRs from the zone * \return ODS_STATUS_UNCHANGED or ODS_STATUS_OK */ extern ods_status zone_del_nsec3params(zone_type* zone); /** * Merge zones. Values that are merged: * - policy name * - signconf filename * - input and output adapter * * \param[in] z1 zone * \param[in] z2 zone with new values * */ extern void zone_merge(zone_type* z1, zone_type* z2); /** * Clean up zone. * \param[in] zone zone * */ extern void zone_cleanup(zone_type* zone); /** * Backup zone. * \param[in] zone corresponding zone * \return ods_status status * */ extern ods_status zone_backup2(zone_type* zone, time_t nextResign); /** * Recover zone from backup. * \param[in] zone corresponding zone * */ extern ods_status zone_recover2(engine_type* engine, zone_type* zone); #endif /* SIGNER_ZONE_H */ opendnssec-2.1.13/signer/src/signer/keys.h0000644000077000001440000000725014446272525015365 00000000000000/* * 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 SIGNER_KEYS_H #define SIGNER_KEYS_H #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_UNISTD_H # include #endif #include typedef struct key_struct key_type; typedef struct keylist_struct keylist_type; #include "status.h" #include "libhsm.h" #include "libhsmdns.h" #include "signconf.h" /** * Key. * */ struct key_struct { ldns_rr* dnskey; hsm_sign_params_t* params; const char* locator; const char* resourcerecord; uint8_t algorithm; uint32_t flags; int publish; int ksk; int zsk; }; /** * Key list. * */ struct keylist_struct { signconf_type* sc; key_type* keys; size_t count; }; /** * Create a new key list. * \param[in] sc signer configuration reference * \return keylist_type* key list * */ extern keylist_type* keylist_create(signconf_type* sc); /** * Lookup a key in the key list by locator. * \param[in] kl key list * \param[in] locator key locator * \return key_type* key if it exists, NULL otherwise * */ extern key_type* keylist_lookup_by_locator(keylist_type* kl, const char* locator); /** * Push a key to the keylist. * \param[in] kl key list * \param[in] locator string that identifies location of key * \param[in] algorithm DNSKEY algorithm field value * \param[in] flags DNSKEY flags field value * \param[in] publish if true, publish key as a DNSKEY * \param[in] ksk if true, sign DNSKEY RRset with this key * \param[in] zsk if true, sign all but DNSKEY RRset with this key * \return key_type* key * */ extern key_type* keylist_push(keylist_type* kl, const char* locator, const char* resourcerecord, uint8_t algorithm, uint32_t flags, int publish, int ksk, int zsk); /** * Log key list. * \param[in] kl key list to print * \param[in] name zone name * */ extern void keylist_log(keylist_type* kl, const char* name); /** * Clean up key list. * \param[in] kl key list to clean up * */ extern void keylist_cleanup(keylist_type* kl); /** * Recover key from backup. * \param[in] fd file descriptor of key backup file * \param[in] kl key list to print * \return key_type* key * */ key_type* key_recover2(FILE* fd, keylist_type* kl); /** * Backup key list. * \param[in] fd file descriptor * \param[in] kl key list to print * \param[in] version version string * */ void keylist_backup(FILE* fd, keylist_type* kl, const char* version); #endif /* SIGNER_KEYS_H */ opendnssec-2.1.13/signer/src/signer/ixfr.c0000644000077000001440000001536314446272525015361 00000000000000/* * 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. * */ /** * IXFR Journal. * */ #include "config.h" #include "util.h" #include "signer/ixfr.h" #include "signer/rrset.h" #include "signer/zone.h" static const char* ixfr_str = "journal"; /** * Create a part of ixfr journal. * */ static part_type* part_create() { part_type* part = NULL; CHECKALLOC(part = (part_type*) malloc(sizeof(part_type))); part->soaplus = NULL; part->soamin = NULL; part->plus = ldns_rr_list_new(); if (!part->plus) { ods_log_error("[%s] unable to create ixfr part: " "ldns_rr_list_new() failed", ixfr_str); free(part); return NULL; } part->min = ldns_rr_list_new(); if (!part->min) { ods_log_error("[%s] unable to create ixfr part: " "ldns_rr_list_new() failed", ixfr_str); ldns_rr_list_free(part->plus); free(part); return NULL; } return part; } /** * Clean up a part of ixfr journal and free it. * */ static void part_free(part_type* part) { if (!part) return; ldns_rr_list_deep_free(part->min); ldns_rr_list_deep_free(part->plus); free(part); } /** * Create a new ixfr journal. * */ ixfr_type* ixfr_create() { ixfr_type* xfr; CHECKALLOC(xfr = (ixfr_type*) calloc(1, sizeof(ixfr_type))); pthread_mutex_init(&xfr->ixfr_lock, NULL); return xfr; } /** * Add +RR to ixfr journal. * */ void ixfr_add_rr(ixfr_type* ixfr, ldns_rr* rr) { ldns_rr* rr_copy = ldns_rr_clone(rr); ods_log_assert(ixfr) ods_log_assert(rr); ods_log_assert(ixfr->part[0]); ods_log_assert(ixfr->part[0]->plus); if (!ldns_rr_list_push_rr(ixfr->part[0]->plus, rr_copy)) { ldns_rr_free(rr_copy); ods_fatal_exit("[%s] fatal unable to +RR: ldns_rr_list_push_rr() failed", ixfr_str); } if (ldns_rr_get_type(rr_copy) == LDNS_RR_TYPE_SOA) { ixfr->part[0]->soaplus = rr_copy; } } /** * Add -RR to ixfr journal. * */ void ixfr_del_rr(ixfr_type* ixfr, ldns_rr* rr) { ldns_rr* rr_copy = ldns_rr_clone(rr); ods_log_assert(ixfr) ods_log_assert(rr); ods_log_assert(ixfr->part[0]); ods_log_assert(ixfr->part[0]->min); if (!ldns_rr_list_push_rr(ixfr->part[0]->min, rr_copy)) { ldns_rr_free(rr_copy); ods_fatal_exit("[%s] fatal unable to -RR: ldns_rr_list_push_rr() failed", ixfr_str); } if (ldns_rr_get_type(rr_copy) == LDNS_RR_TYPE_SOA) { ixfr->part[0]->soamin = rr_copy; } } /** * Print all RRs in list, except SOA RRs. * */ static int part_rr_list_print_nonsoa(FILE* fd, ldns_rr_list* list) { size_t i = 0; int error = 0; if (!list || !fd) { return 1; } for (i = 0; i < ldns_rr_list_rr_count(list); i++) { if (ldns_rr_get_type(ldns_rr_list_rr(list, i)) != LDNS_RR_TYPE_SOA) { if (util_rr_print(fd, ldns_rr_list_rr(list, i)) != ODS_STATUS_OK) { error = 1; } } } return error; } /** * Print part of the ixfr journal. * */ static int part_print(FILE* fd, ixfr_type* ixfr, size_t i) { part_type* part = NULL; ods_log_assert(ixfr); ods_log_assert(fd); part = ixfr->part[i]; if (!part || !part->soamin || !part->soaplus) { return 0; /* due to code buggyness this is not considered an error condition*/ } ods_log_assert(part->min); ods_log_assert(part->plus); ods_log_assert(part->soamin); ods_log_assert(part->soaplus); if (util_rr_print(fd, part->soamin) != ODS_STATUS_OK) { return 1; } else if (part_rr_list_print_nonsoa(fd, part->min)) { return 1; } else if (util_rr_print(fd, part->soaplus) != ODS_STATUS_OK) { return 1; } else if (part_rr_list_print_nonsoa(fd, part->plus)) { return 1; } return 0; } /** * Print the ixfr journal. * */ int ixfr_print(FILE* fd, ixfr_type* ixfr) { int i = 0; ods_log_assert(fd); ods_log_assert(ixfr); ods_log_debug("[%s] print ixfr", ixfr_str); for (i = IXFR_MAX_PARTS - 1; i >= 0; i--) { ods_log_deeebug("[%s] print ixfr part #%d", ixfr_str, i); if (part_print(fd, ixfr, i)) { return 1; } } return 0; } /** * Purge the ixfr journal. * */ void ixfr_purge(ixfr_type* ixfr, char const *zonename) { int i = 0; ods_log_assert(ixfr); ods_log_assert(zonename); if (ixfr->part[0] && (!ixfr->part[0]->soamin || !ixfr->part[0]->soaplus)) { /* Somehow the signer does a double purge without having used * this part. There is no need to create a new one. In fact, * we should not. It would cause an assertion later on when * printing to file */ return; } ods_log_debug("[%s] purge ixfr for zone %s", ixfr_str, zonename); for (i = IXFR_MAX_PARTS - 1; i >= 0; i--) { if (i == (IXFR_MAX_PARTS - 1)) { part_free(ixfr->part[i]); ixfr->part[i] = NULL; } else { ixfr->part[i+1] = ixfr->part[i]; ixfr->part[i] = NULL; } } ixfr->part[0] = part_create(); if (!ixfr->part[0]) { ods_fatal_exit("[%s] fatal unable to purge ixfr for zone %s: " "part_create() failed", ixfr_str, zonename); } } /** * Cleanup the ixfr journal. * */ void ixfr_cleanup(ixfr_type* ixfr) { int i = 0; if (!ixfr) { return; } for (i = IXFR_MAX_PARTS - 1; i >= 0; i--) { part_free(ixfr->part[i]); } pthread_mutex_destroy(&ixfr->ixfr_lock); free(ixfr); } opendnssec-2.1.13/signer/src/signer/backup.c0000644000077000001440000004351514446272525015656 00000000000000/* * Copyright (c) 2006-2010 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. * */ /** * Recover from backup. * */ #include "config.h" #include "adapter/adapi.h" #include "adapter/adutil.h" #include "duration.h" #include "file.h" #include "log.h" #include "status.h" #include "util.h" #include "signer/backup.h" #include "signer/zone.h" #include static const char* backup_str = "backup"; /** * Read token from backup file. * */ char* backup_read_token(FILE* in) { static char buf[4000]; buf[sizeof(buf)-1]=0; while (1) { if (fscanf(in, "%3990s", buf) != 1) { return 0; } if (buf[0] != '#') { return buf; } if (!fgets(buf, sizeof(buf), in)) { return 0; } } return 0; } /** * Read and match a string from backup file. * */ int backup_read_check_str(FILE* in, const char* str) { char *p = backup_read_token(in); if (!p) { ods_log_debug("[%s] cannot read check string \'%s\'", backup_str, str); return 0; } if (ods_strcmp(p, str) != 0) { if (!strcmp(p, "rfc5011") && !strcmp(str, "keytag")) { return 1; } if (!strcmp(p, "jitter") && !strcmp(str, "keyset")) { return fseek(in, -7, SEEK_CUR) == 0; } ods_log_debug("[%s] \'%s\' does not match \'%s\'", backup_str, p, str); return 0; } return 1; } /** * Read a string from backup file. * */ int backup_read_str(FILE* in, const char** str) { char *p = backup_read_token(in); if (!p) { ods_log_debug("[%s] cannot read string", backup_str); return 0; } *str = strdup(p); return 1; } /** * Read time from backup file. * */ int backup_read_time_t(FILE* in, time_t* v) { char* p = backup_read_token(in); if (!p) { ods_log_debug("[%s] cannot read time", backup_str); return 0; } *v=atol(p); return 1; } /** * Read duration from backup file. * */ int backup_read_duration(FILE* in, duration_type** v) { char* p = backup_read_token(in); if (!p) { ods_log_debug("[%s] cannot read duration", backup_str); return 0; } if (!strcmp(p, "jitter")) { return fseek(in, -7, SEEK_CUR) == 0; } *v=duration_create_from_string((const char*) p); return 1; } /** * Read rr type from backup file. * */ int backup_read_rr_type(FILE* in, ldns_rr_type* v) { char* p = backup_read_token(in); if (!p) { ods_log_debug("[%s] cannot read rr type", backup_str); return 0; } *v=(ldns_rr_type) atoi(p); return 1; } /** * Read integer from backup file. * */ int backup_read_int(FILE* in, int* v) { char* p = backup_read_token(in); if (!p) { ods_log_debug("[%s] cannot read integer", backup_str); return 0; } *v=atoi(p); return 1; } /** * Read 8bit unsigned integer from backup file. * */ int backup_read_uint8_t(FILE* in, uint8_t* v) { char* p = backup_read_token(in); if (!p) { ods_log_debug("[%s] cannot read uint8_t", backup_str); return 0; } *v= (uint8_t)atoi(p); return 1; } /** * Read 32bit unsigned integer from backup file. * */ int backup_read_uint32_t(FILE* in, uint32_t* v) { char* p = backup_read_token(in); if (!p) { ods_log_debug("[%s] cannot read uint32_t", backup_str); return 0; } *v= (uint32_t)atol(p); return 1; } /** * Read the next RR from the backup file. * */ static ldns_rr* backup_read_rr(FILE* in, zone_type* zone, char* line, ldns_rdf** orig, ldns_rdf** prev, ldns_status* status, unsigned int* l) { ldns_rr* rr = NULL; int len = 0; backup_read_line: len = adutil_readline_frm_file(in, line, l, 1); if (len >= 0) { switch (line[0]) { case ';': /* done */ *status = LDNS_STATUS_OK; return NULL; break; case '\n': case '\0': goto backup_read_line; /* perhaps next line is rr */ break; /* let's hope its a RR */ default: *status = ldns_rr_new_frm_str(&rr, line, zone->default_ttl, *orig, prev); if (*status == LDNS_STATUS_OK) { return rr; } else if (*status == LDNS_STATUS_SYNTAX_EMPTY) { if (rr) { ldns_rr_free(rr); rr = NULL; } *status = LDNS_STATUS_OK; goto backup_read_line; /* perhaps next line is rr */ break; } else { ods_log_error("[%s] error parsing RR #%i (%s): %s", backup_str, l&&*l?*l:0, ldns_get_errorstr_by_id(*status), line); if (rr) { ldns_rr_free(rr); rr = NULL; } return NULL; } break; } } /* -1, EOF */ *status = LDNS_STATUS_OK; return NULL; } /** * Get locator from string. * */ static char* replace_space_with_nul(char* str) { int i = 0; if (!str) { return NULL; } i = strlen(str); while (i>0) { --i; if (str[i] == ' ') { str[i] = '\0'; } } return strdup(str); } /** * Read namedb from backup file. * */ ods_status backup_read_namedb(FILE* in, void* zone) { zone_type* z = (zone_type*) zone; denial_type* denial = NULL; rrset_type* rrset = NULL; ods_status result = ODS_STATUS_OK; ldns_rr_type type_covered; ldns_rr* rr = NULL; ldns_rdf* prev = NULL; ldns_rdf* orig = NULL; ldns_rdf* dname = NULL; ldns_status status = LDNS_STATUS_OK; char line[SE_ADFILE_MAXLINE]; char* str = NULL; char* locator = NULL; uint32_t flags = 0; unsigned int l = 0; ods_log_assert(in); ods_log_assert(z); /* $ORIGIN */ dname = adapi_get_origin(z); if (!dname) { ods_log_error("[%s] error getting default value for $ORIGIN", backup_str); return ODS_STATUS_ERR; } orig = ldns_rdf_clone(dname); if (!orig) { ods_log_error("[%s] error setting default value for $ORIGIN", backup_str); return ODS_STATUS_ERR; } /* read RRs */ ods_log_debug("[%s] read RRs %s", backup_str, z->name); while ((rr = backup_read_rr(in, z, line, &orig, &prev, &status, &l)) != NULL) { /* check status */ if (status != LDNS_STATUS_OK) { ods_log_error("[%s] error reading RR #%i (%s): %s", backup_str, l, ldns_get_errorstr_by_id(status), line); result = ODS_STATUS_ERR; goto backup_namedb_done; } /* add to the database */ result = adapi_add_rr(z, rr, 1); if (result == ODS_STATUS_UNCHANGED) { ods_log_debug("[%s] skipping RR #%i (duplicate): %s", backup_str, l, line); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_OK; continue; } else if (result != ODS_STATUS_OK) { ods_log_error("[%s] error adding RR #%i: %s", backup_str, l, line); ldns_rr_free(rr); rr = NULL; goto backup_namedb_done; } } if (result == ODS_STATUS_OK && status != LDNS_STATUS_OK) { ods_log_error("[%s] error reading RR #%i (%s): %s", backup_str, l, ldns_get_errorstr_by_id(status), line); result = ODS_STATUS_ERR; goto backup_namedb_done; } namedb_diff(z->db, 0, 0); /* read NSEC(3)s */ ods_log_debug("[%s] read NSEC(3)s %s", backup_str, z->name); l = 0; while ((rr = backup_read_rr(in, z, line, &orig, &prev, &status, &l)) != NULL) { /* check status */ if (status != LDNS_STATUS_OK) { ods_log_error("[%s] error reading NSEC(3) #%i (%s): %s", backup_str, l, ldns_get_errorstr_by_id(status), line); result = ODS_STATUS_ERR; goto backup_namedb_done; } if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_NSEC && ldns_rr_get_type(rr) != LDNS_RR_TYPE_NSEC3) { ods_log_error("[%s] error NSEC(3) #%i is not NSEC(3): %s", backup_str, l, line); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_ERR; goto backup_namedb_done; } /* add to the denial chain */ denial = namedb_lookup_denial(z->db, ldns_rr_owner(rr)); if (!denial) { ods_log_error("[%s] error adding NSEC(3) #%i: %s", backup_str, l, line); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_ERR; goto backup_namedb_done; } denial_add_rr(denial, rr); } if (result == ODS_STATUS_OK && status != LDNS_STATUS_OK) { ods_log_error("[%s] error reading NSEC(3) #%i (%s): %s", backup_str, l, ldns_get_errorstr_by_id(status), line); result = ODS_STATUS_ERR; goto backup_namedb_done; } /* read RRSIGs */ ods_log_debug("[%s] read RRSIGs %s", backup_str, z->name); l = 0; while ((rr = backup_read_rr(in, z, line, &orig, &prev, &status, &l)) != NULL) { /* check status */ if (status != LDNS_STATUS_OK) { ods_log_error("[%s] error reading RRSIG #%i (%s): %s", backup_str, l, ldns_get_errorstr_by_id(status), line); result = ODS_STATUS_ERR; goto backup_namedb_done; } if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_RRSIG) { ods_log_error("[%s] error RRSIG #%i is not RRSIG: %s", backup_str, l, line); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_ERR; goto backup_namedb_done; } /* read locator and flags */ str = strstr(line, "flags"); if (str) { flags = (uint32_t) atoi(str+6); } str = strstr(line, "locator"); if (str) { locator = replace_space_with_nul(str+8); } /* add signatures */ type_covered = ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(rr)); if (type_covered == LDNS_RR_TYPE_NSEC || type_covered == LDNS_RR_TYPE_NSEC3) { denial = namedb_lookup_denial(z->db, ldns_rr_owner(rr)); if (!denial) { ods_log_error("[%s] error restoring RRSIG #%i (%s): %s", backup_str, l, ldns_get_errorstr_by_id(status), line); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_ERR; goto backup_namedb_done; } rrset = denial->rrset; } else { rrset = zone_lookup_rrset(z, ldns_rr_owner(rr), type_covered); } if (!rrset) { ods_log_error("[%s] error restoring RRSIG #%i (%s): %s", backup_str, l, ldns_get_errorstr_by_id(status), line); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_ERR; goto backup_namedb_done; } rrset_add_rrsig(rrset, rr, locator, flags); locator = NULL; /* Locator is owned by rrset now */ rrset->needs_signing = 0; } if (result == ODS_STATUS_OK && status != LDNS_STATUS_OK) { ods_log_error("[%s] error reading RRSIG #%i (%s): %s", backup_str, l, ldns_get_errorstr_by_id(status), line); result = ODS_STATUS_ERR; } backup_namedb_done: if (orig) { ldns_rdf_deep_free(orig); orig = NULL; } if (prev) { ldns_rdf_deep_free(prev); prev = NULL; } free(locator); /* if everything went well this is NULL. otherwise clean up. */ return result; } /** * Read ixfr journal from file. * * */ ods_status backup_read_ixfr(FILE* in, void* zone) { zone_type* z = (zone_type*) zone; ods_status result = ODS_STATUS_OK; ldns_rr* rr = NULL; ldns_rdf* prev = NULL; ldns_rdf* orig = NULL; ldns_rdf* dname = NULL; ldns_status status = LDNS_STATUS_OK; char line[SE_ADFILE_MAXLINE]; char *str; uint32_t serial = 0; unsigned l = 0; unsigned first_soa = 0; unsigned del_mode = 0; ods_log_assert(in); ods_log_assert(z); /* $ORIGIN */ dname = adapi_get_origin(z); if (!dname) { ods_log_error("[%s] error getting default value for $ORIGIN", backup_str); return ODS_STATUS_ERR; } orig = ldns_rdf_clone(dname); if (!orig) { ods_log_error("[%s] error setting default value for $ORIGIN", backup_str); return ODS_STATUS_ERR; } /* read RRs */ while ((rr = backup_read_rr(in, z, line, &orig, &prev, &status, &l)) != NULL) { /* check status */ if (status != LDNS_STATUS_OK) { ods_log_error("[%s] error reading RR #%i (%s): %s", backup_str, l, ldns_get_errorstr_by_id(status), line); result = ODS_STATUS_ERR; goto backup_ixfr_done; } if (first_soa == 2) { ods_log_error("[%s] bad ixfr journal: trailing RRs after final " "SOA", backup_str); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_ERR; goto backup_ixfr_done; } if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) { serial = ldns_rdf2native_int32( ldns_rr_rdf(rr, SE_SOA_RDATA_SERIAL)); if (!first_soa) { str = ldns_rr2str(rr); ods_log_debug("[%s] ixfr first SOA: %s", backup_str, str); LDNS_FREE(str); /* first SOA */ ldns_rr_free(rr); rr = NULL; if (z->db->outserial != serial) { ods_log_error("[%s] bad ixfr journal: first SOA wrong " "serial (was %u, expected %u)", backup_str, serial, z->db->outserial); result = ODS_STATUS_ERR; goto backup_ixfr_done; } first_soa = 1; continue; } ods_log_assert(first_soa); if (!del_mode) { if (z->db->outserial == serial) { /* final SOA */ str = ldns_rr2str(rr); ods_log_debug("[%s] ixfr final SOA: %s", backup_str, str); LDNS_FREE(str); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_OK; first_soa = 2; continue; } else { str = ldns_rr2str(rr); ods_log_debug("[%s] new part SOA: %s", backup_str, str); LDNS_FREE(str); pthread_mutex_lock(&z->ixfr->ixfr_lock); ixfr_purge(z->ixfr, z->name); pthread_mutex_unlock(&z->ixfr->ixfr_lock); } } else { str = ldns_rr2str(rr); ods_log_debug("[%s] second part SOA: %s", backup_str, str); LDNS_FREE(str); } del_mode = !del_mode; } /* ixfr add or del rr */ if (!first_soa) { ods_log_error("[%s] bad ixfr journal: first RR not SOA", backup_str); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_ERR; goto backup_ixfr_done; } ods_log_assert(first_soa); if (z->db->is_initialized) { str = ldns_rr2str(rr); pthread_mutex_lock(&z->ixfr->ixfr_lock); if (del_mode) { ods_log_deeebug("[%s] -IXFR: %s", backup_str, str); ixfr_del_rr(z->ixfr, rr); } else { ods_log_deeebug("[%s] +IXFR: %s", backup_str, str); ixfr_add_rr(z->ixfr, rr); } pthread_mutex_unlock(&z->ixfr->ixfr_lock); LDNS_FREE(str); } ldns_rr_free(rr); } if (result == ODS_STATUS_OK && status != LDNS_STATUS_OK) { ods_log_error("[%s] error reading RR #%i (%s): %s", backup_str, l, ldns_get_errorstr_by_id(status), line); result = ODS_STATUS_ERR; } backup_ixfr_done: if (orig) { ldns_rdf_deep_free(orig); orig = NULL; } if (prev) { ldns_rdf_deep_free(prev); prev = NULL; } return result; } opendnssec-2.1.13/signer/src/signer/signconf.h0000644000077000001440000001001514446272525016211 00000000000000/* * 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 SIGNER_SIGNCONF_H #define SIGNER_SIGNCONF_H #include #include typedef struct signconf_struct signconf_type; #include "scheduler/task.h" #include "status.h" #include "duration.h" #include "signer/keys.h" #include "signer/nsec3params.h" struct signconf_struct { /* Zone */ const char* name; int passthrough; /* Signatures */ duration_type* sig_resign_interval; duration_type* sig_refresh_interval; duration_type* sig_validity_default; duration_type* sig_validity_denial; duration_type* sig_validity_keyset; duration_type* sig_jitter; duration_type* sig_inception_offset; /* Denial of existence */ duration_type* nsec3param_ttl; ldns_rr_type nsec_type; int nsec3_optout; uint32_t nsec3_algo; uint32_t nsec3_iterations; const char* nsec3_salt; nsec3params_type* nsec3params; /* Keys */ duration_type* dnskey_ttl; const char** dnskey_signature; /* may be NULL and must be NULL terminated */ keylist_type* keys; /* Source of authority */ duration_type* soa_ttl; duration_type* soa_min; const char* soa_serial; /* Other useful information */ duration_type* max_zone_ttl; const char* filename; time_t last_modified; }; /** * Create a new signer configuration with the 'empty' settings. * \return signconf_type* signer configuration * */ extern signconf_type* signconf_create(void); /** * Update signer configuration. * \param[out] signconf signer configuration * \param[in] scfile signer configuration file name * \param[in] last_modified last known modification * \return ods_status status * */ extern ods_status signconf_update(signconf_type** signconf, const char* scfile, time_t last_modified); /** * Backup signer configuration. * \param[in] fd file descriptor * \param[in] sc signer configuration settings * \param[in] version version string * */ void signconf_backup(FILE* fd, signconf_type* sc, const char* version); /** * Check signer configuration. * \param signconf signer configuration * \return ods_status status * */ extern ods_status signconf_check(signconf_type* signconf); /** * Compare signer configurations on denial of existence material. * \param[in] a a signer configuration * \param[in] b another signer configuration * \return task_id what task needs to be scheduled * */ extern task_id signconf_compare_denial(signconf_type* a, signconf_type* b); /** * Log signer configuration. * \param[in] sc signconf to log * \param[in] name zone name * */ extern void signconf_log(signconf_type* sc, const char* name); /** * Clean up signer configuration. * \param[in] sc signconf to cleanup * */ extern void signconf_cleanup(signconf_type* sc); #endif /* SIGNER_SIGNCONF_H */ opendnssec-2.1.13/signer/src/signer/stats.c0000644000077000001440000000575014446272525015546 00000000000000/* * 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 statistics. * */ #include "log.h" #include "signer/stats.h" /** * Initialize statistics. * */ stats_type* stats_create(void) { stats_type* stats = (stats_type*) malloc(sizeof(stats_type)); stats_clear(stats); pthread_mutex_init(&stats->stats_lock, NULL); return stats; } /** * Clear statistics. * */ void stats_clear(stats_type* stats) { ods_log_assert(stats); stats->sort_count = 0; stats->sort_time = 0; stats->sort_done = 0; stats->nsec_count = 0; stats->nsec_time = 0; stats->sig_count = 0; stats->sig_soa_count = 0; stats->sig_reuse = 0; stats->sig_time = 0; stats->start_time = 0; stats->end_time = 0; } /** * Log statistics. * */ void stats_log(stats_type* stats, const char* name, uint32_t serial, ldns_rr_type nsec_type) { uint32_t avsign = 0; if (!stats) { return; } ods_log_assert(stats); if (stats->sig_time) { avsign = (uint32_t) (stats->sig_count/stats->sig_time); } ods_log_info("[STATS] %s %u RR[count=%u time=%lu(sec)] " "NSEC%s[count=%u time=%lu(sec)] " "RRSIG[new=%u reused=%u time=%lu(sec) avg=%u(sig/sec)] " "TOTAL[time=%u(sec)] ", name?name:"(null)", (unsigned) serial, stats->sort_count, (unsigned long)stats->sort_time, nsec_type==LDNS_RR_TYPE_NSEC3?"3":"", stats->nsec_count, (unsigned long)stats->nsec_time, stats->sig_count, stats->sig_reuse, (unsigned long)stats->sig_time, avsign, (uint32_t) (stats->end_time - stats->start_time)); } /** * Clean up statistics. * */ void stats_cleanup(stats_type* stats) { pthread_mutex_destroy(&stats->stats_lock); free((void*) stats); } opendnssec-2.1.13/signer/src/signer/rrset.h0000644000077000001440000001316514446272525015553 00000000000000/* * 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 SIGNER_RRSET_H #define SIGNER_RRSET_H #include "config.h" #include typedef struct rrsig_struct rrsig_type; typedef struct rr_struct rr_type; typedef struct rrset_struct rrset_type; #include "status.h" #include "signer/stats.h" #include "libhsm.h" #include "domain.h" #include "zone.h" #include "datastructure.h" struct rrsig_struct { ldns_rr* rr; domain_type* owner; const char* key_locator; uint32_t key_flags; }; struct rr_struct { ldns_rr* rr; domain_type* owner; unsigned exists : 1; unsigned is_added : 1; unsigned is_removed : 1; }; struct rrset_struct { rrset_type* next; zone_type* zone; domain_type* domain; ldns_rr_type rrtype; rr_type* rrs; size_t rr_count; collection_t rrsigs; unsigned needs_signing : 1; }; /** * Log RR. * \param[in] rr RR * \param[in] pre log message * \param[in] level log level * */ void log_rr(ldns_rr* rr, const char* pre, int level); /** * Log RRset. * \param[in] dname domain name * \param[in] type RRtype * \param[in] pre log message * \param[in] level log level * */ void log_rrset(ldns_rdf* dname, ldns_rr_type type, const char* pre, int level); /** * Get the string-format of RRtype. * \param[in] type RRtype * \return const char* string-format of RRtype * */ const char* rrset_type2str(ldns_rr_type type); /** * Create RRset. * \param[in] zoneptr zone reference * \param[in] type RRtype * \return rrset_type* RRset * */ rrset_type* rrset_create(zone_type* zone, ldns_rr_type type); /** * Lookup RR in RRset. * \param[in] rrset RRset * \param[in] rr RR * \return rr_type* RR if found * */ rr_type* rrset_lookup_rr(rrset_type* rrset, ldns_rr* rr); /** * What TTL should new RR's in this RRS get? * */ uint32_t rrset_lookup_ttl(rrset_type* rrset, uint32_t default_ttl); /** * Count the number of RRs in this RRset that have is_added. * \param[in] rrset RRset * \return size_t number of RRs * */ size_t rrset_count_rr_is_added(rrset_type* rrset); /** * Add RR to RRset. * \param[in] rrset RRset * \param[in] rr RR * \return rr_type* added RR * */ rr_type* rrset_add_rr(rrset_type* rrset, ldns_rr* rr); /** * Delete RR from RRset. * \param[in] rrset RRset * \param[in] rrnum position of RR * */ void rrset_del_rr(rrset_type* rrset, uint16_t rrnum); /** * Add RRSIG to RRset. * \param[in] rrset RRset * \param[in] rr RRSIG * \param[in] locator key locator * \param[in] flags key flags * */ void rrset_add_rrsig(rrset_type* rrset, ldns_rr* rr, const char* locator, uint32_t flags); /** * Delete all RRSIG from RRset and add then to the zone's outgoing IXFR as change. * \param[in] rrset RRset * \param[in] rrnum position of RRSIG * */ void rrset_drop_rrsigs(zone_type* zone, rrset_type* rrset); /** * Apply differences at RRset. * \param[in] rrset RRset * \param[in] is_ixfr true if incremental change * \param[in] more_coming more transactions possible * */ void rrset_diff(rrset_type* rrset, unsigned is_ixfr, unsigned more_coming); /** * Sign RRset. * \param[in] ctx HSM context * \param[in] rrset RRset * \param[in] signtime time when the zone is being signed * \return ods_status status * */ ods_status rrset_sign(hsm_ctx_t* ctx, rrset_type* rrset, time_t signtime); /** * Obtain a resource record (containing a signature of a dnskeyset or * a dnskeyset, but that is not a hard requirement), from a raw string * \param[out] dnskey the resulting resource record * \param[in] resourcerecord the string representation of the resource record * \param[in] ttl the time-to-live to use if non is specified * \param[in] apex the owner domain is none can be determined from input string */ ods_status rrset_getliteralrr(ldns_rr** dnskey, const char *resourcerecord, uint32_t ttl, ldns_rdf* apex); /** * Print RRset. * \param[in] fd file descriptor * \param[in] rrset RRset to be printed * \param[in] skip_rrsigs if true, don't print RRSIG records * \param[out] status status * */ void rrset_print(FILE* fd, rrset_type* rrset, int skip_rrsigs, ods_status* status); /** * Clean up RRset. * \param[in] rrset RRset to be cleaned up * */ void rrset_cleanup(rrset_type* rrset); /** * Backup RRset. * \param[in] fd file descriptor * \param[in] rrset RRset * */ void rrset_backup2(FILE* fd, rrset_type* rrset); collection_class rrset_store_initialize(void); #endif /* SIGNER_RRSET_H */ opendnssec-2.1.13/signer/src/signer/signconf.c0000644000077000001440000003732414446272525016220 00000000000000/* * 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 configuration. * */ #include "parser/signconfparser.h" #include "duration.h" #include "file.h" #include "log.h" #include "status.h" #include "signer/signconf.h" static const char* sc_str = "signconf"; /** * Create a new signer configuration with the 'empty' settings. * */ signconf_type* signconf_create(void) { signconf_type* sc = NULL; CHECKALLOC(sc = (signconf_type*) malloc(sizeof(signconf_type))); sc->filename = NULL; sc->passthrough = 0; /* Signatures */ sc->sig_resign_interval = NULL; sc->sig_refresh_interval = NULL; sc->sig_validity_default = NULL; sc->sig_validity_denial = NULL; sc->sig_validity_keyset = NULL; sc->sig_jitter = NULL; sc->sig_inception_offset = NULL; /* Denial of existence */ sc->nsec3param_ttl = NULL; sc->nsec_type = 0; sc->nsec3_optout = 0; sc->nsec3_algo = 0; sc->nsec3_iterations = 0; sc->nsec3_salt = NULL; sc->nsec3params = NULL; /* Keys */ sc->dnskey_ttl = NULL; sc->dnskey_signature = NULL; sc->keys = NULL; /* Source of authority */ sc->soa_ttl = NULL; sc->soa_min = NULL; sc->soa_serial = NULL; /* Other useful information */ sc->max_zone_ttl = NULL; sc->last_modified = 0; return sc; } /** * Read signer configuration. * */ static ods_status signconf_read(signconf_type* signconf, const char* scfile) { const char* rngfile = ODS_SE_RNGDIR "/signconf.rng"; ods_status status = ODS_STATUS_OK; FILE* fd = NULL; if (!scfile || !signconf) { return ODS_STATUS_ASSERT_ERR; } ods_log_debug("[%s] read signconf file %s", sc_str, scfile); status = parse_file_check(scfile, rngfile); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to read signconf: parse error in " "file %s (%s)", sc_str, scfile, ods_status2str(status)); return status; } fd = ods_fopen(scfile, NULL, "r"); if (fd) { signconf->filename = strdup(scfile); signconf->passthrough = parse_sc_passthrough(scfile); signconf->sig_resign_interval = parse_sc_sig_resign_interval(scfile); signconf->sig_refresh_interval = parse_sc_sig_refresh_interval(scfile); signconf->sig_validity_default = parse_sc_sig_validity_default(scfile); signconf->sig_validity_denial = parse_sc_sig_validity_denial(scfile); signconf->sig_validity_keyset = parse_sc_sig_validity_keyset(scfile); signconf->sig_jitter = parse_sc_sig_jitter(scfile); signconf->sig_inception_offset = parse_sc_sig_inception_offset(scfile); signconf->nsec_type = parse_sc_nsec_type(scfile); if (signconf->nsec_type == LDNS_RR_TYPE_NSEC3) { signconf->nsec3param_ttl = parse_sc_nsec3param_ttl(scfile); signconf->nsec3_optout = parse_sc_nsec3_optout(scfile); signconf->nsec3_algo = parse_sc_nsec3_algorithm(scfile); signconf->nsec3_iterations = parse_sc_nsec3_iterations(scfile); signconf->nsec3_salt = parse_sc_nsec3_salt(scfile); signconf->nsec3params = nsec3params_create((void*) signconf, (uint8_t) signconf->nsec3_algo, (uint8_t) signconf->nsec3_optout, (uint16_t)signconf->nsec3_iterations, signconf->nsec3_salt); if (!signconf->nsec3params) { ods_log_error("[%s] unable to read signconf %s: " "nsec3params_create() failed", sc_str, scfile); ods_fclose(fd); return ODS_STATUS_MALLOC_ERR; } } signconf->keys = parse_sc_keys((void*) signconf, scfile); signconf->dnskey_ttl = parse_sc_dnskey_ttl(scfile); signconf->dnskey_signature = parse_sc_dnskey_sigrrs(scfile); signconf->soa_ttl = parse_sc_soa_ttl(scfile); signconf->soa_min = parse_sc_soa_min(scfile); signconf->soa_serial = parse_sc_soa_serial(scfile); signconf->max_zone_ttl = parse_sc_max_zone_ttl(scfile); ods_fclose(fd); return ODS_STATUS_OK; } ods_log_error("[%s] unable to read signconf: failed to open file %s", sc_str, scfile); return ODS_STATUS_ERR; } /** * Update signer configuration. * */ ods_status signconf_update(signconf_type** signconf, const char* scfile, time_t last_modified) { signconf_type* new_sc = NULL; time_t st_mtime = 0; ods_status status = ODS_STATUS_OK; if (!scfile || !signconf) { return ODS_STATUS_UNCHANGED; } /* is the file updated? */ st_mtime = ods_file_lastmodified(scfile); if (st_mtime <= last_modified) { return ODS_STATUS_UNCHANGED; } /* if so, read the new signer configuration */ new_sc = signconf_create(); if (!new_sc) { ods_log_error("[%s] unable to update signconf: signconf_create() " "failed", sc_str); return ODS_STATUS_ERR; } status = signconf_read(new_sc, scfile); if (status == ODS_STATUS_OK) { new_sc->last_modified = st_mtime; if (signconf_check(new_sc) != ODS_STATUS_OK) { ods_log_error("[%s] unable to update signconf: signconf %s has " "errors", sc_str, scfile); signconf_cleanup(new_sc); return ODS_STATUS_CFG_ERR; } *signconf = new_sc; } else { ods_log_error("[%s] unable to update signconf: failed to read file " "%s (%s)", sc_str, scfile, ods_status2str(status)); signconf_cleanup(new_sc); } return status; } /** * Backup duration. * */ static void signconf_backup_duration(FILE* fd, const char* opt, duration_type* duration) { char* str = (duration == NULL ? NULL : duration2string(duration)); fprintf(fd, "%s %s ", opt, (str?str:"0")); free(str); } /** * Backup signconf values. * */ void signconf_backup(FILE* fd, signconf_type* sc, const char* version) { if (!fd || !sc) { return; } fprintf(fd, ";;Signconf: lastmod %u ", (unsigned) sc->last_modified); if (strcmp(version, ODS_SE_FILE_MAGIC_V2) && strcmp(version, ODS_SE_FILE_MAGIC_V1)) { /* version 3 and up */ fprintf(fd, "maxzonettl 0 "); /* prepare for enforcer ng */ } signconf_backup_duration(fd, "resign", sc->sig_resign_interval); signconf_backup_duration(fd, "refresh", sc->sig_refresh_interval); signconf_backup_duration(fd, "valid", sc->sig_validity_default); signconf_backup_duration(fd, "denial", sc->sig_validity_denial); signconf_backup_duration(fd, "keyset", sc->sig_validity_keyset); signconf_backup_duration(fd, "jitter", sc->sig_jitter); signconf_backup_duration(fd, "offset", sc->sig_inception_offset); fprintf(fd, "nsec %u ", (unsigned) sc->nsec_type); signconf_backup_duration(fd, "dnskeyttl", sc->dnskey_ttl); signconf_backup_duration(fd, "soattl", sc->soa_ttl); signconf_backup_duration(fd, "soamin", sc->soa_min); fprintf(fd, "serial %s ", sc->soa_serial?sc->soa_serial:"(null)"); if (strcmp(version, ODS_SE_FILE_MAGIC_V2) == 0) { fprintf(fd, "audit 0"); } fprintf(fd, "\n"); } /** * Check the SOA/Serial type. * */ static int signconf_soa_serial_check(const char* serial) { if (!serial) { return 1; } if (strlen(serial) == 4 && strncmp(serial, "keep", 4) == 0) { return 0; } if (strlen(serial) == 7 && strncmp(serial, "counter", 7) == 0) { return 0; } if (strlen(serial) == 8 && strncmp(serial, "unixtime", 8) == 0) { return 0; } if (strlen(serial) == 11 && strncmp(serial, "datecounter", 11) == 0) { return 0; } return 1; } /** * Check signer configuration settings. * */ ods_status signconf_check(signconf_type* sc) { ods_status status = ODS_STATUS_OK; if (!sc->sig_resign_interval) { ods_log_error("[%s] check failed: no signature resign interval found", sc_str); status = ODS_STATUS_CFG_ERR; } if (!sc->sig_refresh_interval) { ods_log_error("[%s] check failed: no signature resign interval found", sc_str); status = ODS_STATUS_CFG_ERR; } if (!sc->sig_validity_default) { ods_log_error("[%s] check failed: no signature default validity found", sc_str); status = ODS_STATUS_CFG_ERR; } if (!sc->sig_validity_denial) { ods_log_error("[%s] check failed: no signature denial validity found", sc_str); status = ODS_STATUS_CFG_ERR; } if (!sc->sig_jitter) { ods_log_error("[%s] check failed: no signature jitter found", sc_str); status = ODS_STATUS_CFG_ERR; } if (!sc->sig_inception_offset) { ods_log_error("[%s] check failed: no signature inception offset found", sc_str); status = ODS_STATUS_CFG_ERR; } if (sc->nsec_type == LDNS_RR_TYPE_NSEC3) { if (sc->nsec3_algo != LDNS_SHA1) { ods_log_error("[%s] check failed: invalid nsec3 algorithm", sc_str); status = ODS_STATUS_CFG_ERR; } /* iterations */ /* salt */ /* optout */ } else if (sc->nsec_type != LDNS_RR_TYPE_NSEC) { ods_log_error("[%s] check failed: wrong nsec type %i", sc_str, sc->nsec_type); status = ODS_STATUS_CFG_ERR; } if ((!sc->keys || sc->keys->count == 0) && !sc->passthrough) { ods_log_error("[%s] check failed: no keys found", sc_str); status = ODS_STATUS_CFG_ERR; } if (!sc->dnskey_ttl) { ods_log_error("[%s] check failed: no dnskey ttl found", sc_str); status = ODS_STATUS_CFG_ERR; } if (!sc->soa_ttl) { ods_log_error("[%s] check failed: no soa ttl found", sc_str); status = ODS_STATUS_CFG_ERR; } if (!sc->soa_min) { ods_log_error("[%s] check failed: no soa minimum found", sc_str); status = ODS_STATUS_CFG_ERR; } if (!sc->soa_serial) { ods_log_error("[%s] check failed: no soa serial type found", sc_str); status = ODS_STATUS_CFG_ERR; } else if (signconf_soa_serial_check(sc->soa_serial) != 0) { ods_log_error("[%s] check failed: wrong soa serial type %s", sc_str, sc->soa_serial); status = ODS_STATUS_CFG_ERR; } return status; } /** * Compare signer configurations on denial of existence material. * */ task_id signconf_compare_denial(signconf_type* a, signconf_type* b) { task_id new_task = TASK_NONE; if (!a || !b) { return TASK_NONE; } ods_log_assert(a); ods_log_assert(b); if (duration_compare(a->soa_min, b->soa_min)) { new_task = TASK_NSECIFY; } else if (a->nsec_type != b->nsec_type) { new_task = TASK_NSECIFY; } else if (a->nsec_type == LDNS_RR_TYPE_NSEC3) { if ((ods_strcmp(a->nsec3_salt, b->nsec3_salt) != 0) || (a->nsec3_algo != b->nsec3_algo) || (a->nsec3_iterations != b->nsec3_iterations) || (a->nsec3_optout != b->nsec3_optout)) { new_task = TASK_NSECIFY; } else if (duration_compare(a->nsec3param_ttl, b->nsec3param_ttl)) { new_task = TASK_READ; } } return new_task; } /** * Log sign configuration. * */ void signconf_log(signconf_type* sc, const char* name) { char* resign = NULL; char* refresh = NULL; char* validity = NULL; char* denial = NULL; char* keyset = NULL; char* jitter = NULL; char* offset = NULL; char* dnskeyttl = NULL; char* soattl = NULL; char* soamin = NULL; char* paramttl = NULL; if (sc) { resign = duration2string(sc->sig_resign_interval); refresh = duration2string(sc->sig_refresh_interval); validity = duration2string(sc->sig_validity_default); denial = duration2string(sc->sig_validity_denial); if (sc->sig_validity_keyset) { keyset = duration2string(sc->sig_validity_keyset); } jitter = duration2string(sc->sig_jitter); offset = duration2string(sc->sig_inception_offset); dnskeyttl = duration2string(sc->dnskey_ttl); paramttl = duration2string(sc->nsec3param_ttl); soattl = duration2string(sc->soa_ttl); soamin = duration2string(sc->soa_min); /* signconf */ ods_log_info("[%s] zone %s signconf: RESIGN[%s] REFRESH[%s] " "%sVALIDITY[%s] DENIAL[%s] KEYSET[%s] JITTER[%s] OFFSET[%s] NSEC[%i] " "DNSKEYTTL[%s] SOATTL[%s] MINIMUM[%s] SERIAL[%s]", sc_str, name?name:"(null)", resign?resign:"(null)", refresh?refresh:"(null)", sc->passthrough?"PASSTHROUGH ":"", validity?validity:"(null)", denial?denial:"(null)", keyset?keyset:"(null)", jitter?jitter:"(null)", offset?offset:"(null)", (int) sc->nsec_type, dnskeyttl?dnskeyttl:"(null)", soattl?soattl:"(null)", soamin?soamin:"(null)", sc->soa_serial?sc->soa_serial:"(null)"); /* nsec3 parameters */ if (sc->nsec_type == LDNS_RR_TYPE_NSEC3) { ods_log_debug("[%s] zone %s nsec3: PARAMTTL[%s] OPTOUT[%i] " "ALGORITHM[%u] ITERATIONS[%u] SALT[%s]", sc_str, name?name:"(null)", paramttl?paramttl:"PT0S", sc->nsec3_optout, sc->nsec3_algo, sc->nsec3_iterations, sc->nsec3_salt?sc->nsec3_salt:"(null)"); } /* keys */ keylist_log(sc->keys, name); /* cleanup */ free((void*)resign); free((void*)refresh); free((void*)validity); free((void*)denial); free((void*)keyset); free((void*)jitter); free((void*)offset); free((void*)dnskeyttl); free((void*)paramttl); free((void*)soattl); free((void*)soamin); } } /** * Clean up signer configuration. * */ void signconf_cleanup(signconf_type* sc) { if (!sc) { return; } duration_cleanup(sc->sig_resign_interval); duration_cleanup(sc->sig_refresh_interval); duration_cleanup(sc->sig_validity_default); duration_cleanup(sc->sig_validity_denial); duration_cleanup(sc->sig_validity_keyset); duration_cleanup(sc->sig_jitter); duration_cleanup(sc->sig_inception_offset); duration_cleanup(sc->dnskey_ttl); duration_cleanup(sc->soa_ttl); duration_cleanup(sc->soa_min); duration_cleanup(sc->max_zone_ttl); keylist_cleanup(sc->keys); nsec3params_cleanup(sc->nsec3params); free((void*)sc->filename); free((void*)sc->nsec3_salt); free((void*)sc->soa_serial); free(sc); } opendnssec-2.1.13/signer/src/signer/namedb.h0000644000077000001440000001264414446272525015643 00000000000000/* * 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. * */ /** * Domain name database. * */ #ifndef SIGNER_NAMEDB_H #define SIGNER_NAMEDB_H #include "config.h" #include typedef struct namedb_struct namedb_type; #include "signer/denial.h" #include "signer/domain.h" #include "signer/zone.h" #include "signer/nsec3params.h" /** * Domain name database. * */ struct namedb_struct { zone_type* zone; ldns_rbtree_t* domains; ldns_rbtree_t* denials; uint32_t inbserial; uint32_t intserial; uint32_t outserial; uint32_t altserial; unsigned is_initialized : 1; unsigned serial_updated : 1; unsigned force_serial : 1; unsigned have_serial : 1; }; /** * Initialize denial of existence chain. * \param[in] db namedb * */ void namedb_init_denials(namedb_type* db); /** * Create a new namedb. * \param[in] zone zone reference * \return namedb_type* namedb * */ namedb_type* namedb_create(void* zone); /** * Determine new SOA SERIAL. * \param[in] db namedb * \param[in] zone_name zone name * \param[in] format format from signer configuration * \param[in] inbound_serial inbound serial * \return ods_status status * */ ods_status namedb_update_serial(namedb_type* db, const char* zone_name, const char* format, uint32_t inbound_serial); /** * Add empty non-terminals for domain. * \param[in] db namedb * \param[in] domain domain * \param[in] apex apex domain name * \return ods_status status * */ ods_status namedb_domain_entize(namedb_type* db, domain_type* domain, ldns_rdf* apex); /** * Look up domain. * \param[in] db namedb * \param[in] dname domain name * \return domain_type* domain, if found * */ domain_type* namedb_lookup_domain(namedb_type* db, ldns_rdf* dname); /** * Add domain to namedb. * \param[in] db namedb * \param[in] dname domain name * \return domain_type* added domain * */ domain_type* namedb_add_domain(namedb_type* db, ldns_rdf* dname); /** * Delete domain from namedb * \param[in] db namedb * \param[in] domain domain * \return domain_type* deleted domain * */ domain_type* namedb_del_domain(namedb_type* db, domain_type* domain); /** * Lookup denial. * \param[in] db namedb * \param[in] dname domain name * \return denial_type* denial, if found * */ denial_type* namedb_lookup_denial(namedb_type* db, ldns_rdf* dname); /** * Add denial to namedb. * \param[in] db namedb * \param[in] dname domain name * \param[in] n3p NSEC3 parameters, NULL if we do NSEC * \return denial_type* added denial * */ denial_type* namedb_add_denial(namedb_type* db, ldns_rdf* dname, nsec3params_type* n3p); /** * Delete denial from namedb * \param[in] db namedb * \param[in] denial denial * \return denial_type* deleted denial * */ denial_type* namedb_del_denial(namedb_type* db, denial_type* denial); /** * Examine updates to namedb. * \param[in] db namedb * \return ods_status status * */ ods_status namedb_examine(namedb_type* db); /** * Apply differences in db. * \param[in] db namedb * \param[in] is_ixfr true if incremental change * \param[in] more_coming more transactions possible * */ void namedb_diff(namedb_type* db, unsigned is_ixfr, unsigned more_coming); /** * Rollback differences in db. * \param[in] db namedb * \param[in] keepsc keep RRs that did not came from the adapter. * */ void namedb_rollback(namedb_type* db, unsigned keepsc); /** * Nsecify db. * \param[in] db namedb * \param[out] num_added number of NSEC RRs added * */ void namedb_nsecify(namedb_type* db, uint32_t* num_added); /** * Export db to file. * \param[in] fd file descriptor * \param[in] namedb namedb * \param[out] status status * */ void namedb_export(FILE* fd, namedb_type* db, ods_status* status); /** * Wipe out all NSEC(3) RRsets. * \param[in] db namedb * */ void namedb_wipe_denial(namedb_type* db); /** * Clean up denial of existence chain. * \param[in] db namedb * */ void namedb_cleanup_denials(namedb_type* db); /** * Clean up namedb. * \param[in] namedb namedb * */ void namedb_cleanup(namedb_type* db); /** * Backup namedb. * \param[in] fd output file descriptor * \param[in] zd zone data * */ void namedb_backup2(FILE* fd, namedb_type* db); #endif /* SIGNER_NAMEDB_H */ opendnssec-2.1.13/signer/src/signer/stats.h0000644000077000001440000000522014446272525015543 00000000000000/* * 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 SIGNER_STATS_H #define SIGNER_STATS_H #include "config.h" #include #include #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_UNISTD_H # include #endif #include typedef struct stats_struct stats_type; #include "locks.h" /** * Statistics structure. */ struct stats_struct { uint32_t sort_count; time_t sort_time; int sort_done; uint32_t nsec_count; time_t nsec_time; uint32_t sig_count; uint32_t sig_soa_count; uint32_t sig_reuse; time_t sig_time; time_t audit_time; time_t start_time; time_t end_time; pthread_mutex_t stats_lock; }; /** * Initialize statistics. * \return the initialized stats; * */ extern stats_type* stats_create(void); /** * Log statistics. * \param[in] stats statistics * \param[in] name zone name * \param[in] serial serial * \param[in] nsec_type NSEC or NSEC3 * */ extern void stats_log(stats_type* stats, const char* name, uint32_t serial, ldns_rr_type nsec_type); /** * Clear statistics. * \param[in] stats statistics to be cleared * */ extern void stats_clear(stats_type* stats); /** * Clean up statistics. * \param[in] stats statistics to be deleted * */ extern void stats_cleanup(stats_type* stats); #endif /* SIGNER_STATS_H */ opendnssec-2.1.13/signer/src/signer/tools.c0000644000077000001440000002254314446272525015547 00000000000000/* * 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 signing tools. * */ #include "config.h" #include "daemon/dnshandler.h" #include "adapter/adapter.h" #include "log.h" #include "signer/tools.h" #include "signer/zone.h" #include #include #include #include static const char* tools_str = "tools"; /** * Load zone signconf. * */ ods_status tools_signconf(zone_type* zone) { ods_status status = ODS_STATUS_OK; signconf_type* new_signconf = NULL; ods_log_assert(zone); ods_log_assert(zone->name); status = zone_load_signconf(zone, &new_signconf); if (status == ODS_STATUS_OK) { ods_log_assert(new_signconf); /* Denial of Existence Rollover? */ if (signconf_compare_denial(zone->signconf, new_signconf) == TASK_NSECIFY) { /** * Or NSEC -> NSEC3, or NSEC3 -> NSEC, or NSEC3 params changed. * All NSEC(3)s become invalid. */ namedb_wipe_denial(zone->db); namedb_cleanup_denials(zone->db); namedb_init_denials(zone->db); } /* all ok, switch signer configuration */ signconf_cleanup(zone->signconf); ods_log_debug("[%s] zone %s switch to new signconf", tools_str, zone->name); zone->signconf = new_signconf; signconf_log(zone->signconf, zone->name); zone->default_ttl = (uint32_t) duration2time(zone->signconf->soa_min); } else if (status != ODS_STATUS_UNCHANGED) { ods_log_error("[%s] unable to load signconf for zone %s: %s", tools_str, zone->name, ods_status2str(status)); } return status; } /** * Read zone from input adapter. * */ ods_status tools_input(zone_type* zone) { ods_status status = ODS_STATUS_OK; time_t start = 0; time_t end = 0; ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(zone->adinbound); ods_log_assert(zone->signconf); /* Key Rollover? */ status = zone_publish_dnskeys(zone, 0); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to read zone %s: failed to " "publish dnskeys (%s)", tools_str, zone->name, ods_status2str(status)); zone_rollback_dnskeys(zone); zone_rollback_nsec3param(zone); namedb_rollback(zone->db, 0); return status; } /* Denial of Existence Rollover? */ if (!zone->signconf->passthrough) status = zone_publish_nsec3param(zone); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to read zone %s: failed to " "publish nsec3param (%s)", tools_str, zone->name, ods_status2str(status)); zone_rollback_dnskeys(zone); zone_rollback_nsec3param(zone); namedb_rollback(zone->db, 0); return status; } if (zone->stats) { pthread_mutex_lock(&zone->stats->stats_lock); zone->stats->sort_done = 0; zone->stats->sort_count = 0; zone->stats->sort_time = 0; pthread_mutex_unlock(&zone->stats->stats_lock); } /* Input Adapter */ start = time(NULL); status = adapter_read((void*)zone); if (status != ODS_STATUS_OK && status != ODS_STATUS_UNCHANGED) { if (status == ODS_STATUS_XFRINCOMPLETE) { ods_log_info("[%s] read zone %s: xfr in progress", tools_str, zone->name); } else { ods_log_error("[%s] unable to read zone %s: adapter failed (%s)", tools_str, zone->name, ods_status2str(status)); } zone_rollback_dnskeys(zone); zone_rollback_nsec3param(zone); namedb_rollback(zone->db, 0); } end = time(NULL); if ((status == ODS_STATUS_OK || status == ODS_STATUS_UNCHANGED) && zone->stats) { pthread_mutex_lock(&zone->stats->stats_lock); zone->stats->start_time = start; zone->stats->sort_time = (end-start); zone->stats->sort_done = 1; pthread_mutex_unlock(&zone->stats->stats_lock); } return status; } /** * Close file descriptors. * */ static void ods_closeall(int fd) { int fdlimit = sysconf(_SC_OPEN_MAX); while (fd < fdlimit) { close(fd++); } } /** * Write zone to output adapter. * */ ods_status tools_output(zone_type* zone, engine_type* engine) { ods_status status = ODS_STATUS_OK; ods_log_assert(engine); ods_log_assert(engine->config); ods_log_assert(zone); ods_log_assert(zone->db); ods_log_assert(zone->name); ods_log_assert(zone->signconf); ods_log_assert(zone->adoutbound); /* prepare */ if (zone->stats) { pthread_mutex_lock(&zone->stats->stats_lock); if (zone->stats->sort_done == 0 && (zone->stats->sig_count <= zone->stats->sig_soa_count)) { ods_log_verbose("[%s] skip write zone %s serial %u (zone not " "changed)", tools_str, zone->name?zone->name:"(null)", zone->db->intserial); stats_clear(zone->stats); pthread_mutex_unlock(&zone->stats->stats_lock); zone->db->intserial = zone->db->outserial; return ODS_STATUS_OK; } pthread_mutex_unlock(&zone->stats->stats_lock); } /* Output Adapter */ status = adapter_write((void*)zone); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to write zone %s: adapter failed (%s)", tools_str, zone->name, ods_status2str(status)); return status; } zone->db->outserial = zone->db->intserial; zone->db->is_initialized = 1; zone->db->have_serial = 1; pthread_mutex_lock(&zone->ixfr->ixfr_lock); ixfr_purge(zone->ixfr, zone->name); pthread_mutex_unlock(&zone->ixfr->ixfr_lock); /* kick the nameserver */ if (zone->notify_ns) { int pid_status; pid_t pid, wpid; ods_log_verbose("[%s] notify nameserver: %s", tools_str, zone->notify_ns); /** fork */ switch ((pid = fork())) { case -1: /* error */ ods_log_error("[%s] notify nameserver failed: unable to fork " "(%s)", tools_str, strerror(errno)); return ODS_STATUS_FORK_ERR; case 0: /* child */ /** close fds */ ods_closeall(0); /** execv */ execvp(zone->notify_ns, zone->notify_args); /** error */ ods_log_error("[%s] notify nameserver failed: execv() failed " "(%s)", tools_str, strerror(errno)); exit(1); break; default: /* parent */ ods_log_debug("[%s] notify nameserver process forked", tools_str); /** wait for completion */ while((wpid = waitpid(pid, &pid_status, 0)) <= 0) { if (errno != EINTR) { break; } } if (wpid == -1) { ods_log_error("[%s] notify nameserver failed: waitpid() " "failed (%s)", tools_str, strerror(errno)); } else if (!WIFEXITED(pid_status)) { ods_log_error("[%s] notify nameserver failed: notify " "command did not terminate normally", tools_str); } else { ods_log_verbose("[%s] notify nameserver ok", tools_str); } break; } } /* log stats */ if (zone->stats) { pthread_mutex_lock(&zone->stats->stats_lock); zone->stats->end_time = time(NULL); ods_log_debug("[%s] log stats for zone %s serial %u", tools_str, zone->name?zone->name:"(null)", (unsigned) zone->db->outserial); stats_log(zone->stats, zone->name, zone->db->outserial, zone->signconf->nsec_type); stats_clear(zone->stats); pthread_mutex_unlock(&zone->stats->stats_lock); } if (engine->dnshandler) { ods_log_debug("[%s] forward a notify", tools_str); dnshandler_fwd_notify(engine->dnshandler, (uint8_t*) ODS_SE_NOTIFY_CMD, strlen(ODS_SE_NOTIFY_CMD)); } return status; } opendnssec-2.1.13/signer/src/signer/backup.h0000644000077000001440000000733214446272525015660 00000000000000/* * Copyright (c) 2006-2010 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. * */ /** * Recover from backup. * */ #ifndef SIGNER_BACKUP_H #define SIGNER_BACKUP_H #include "config.h" #include "duration.h" #include "file.h" #include "status.h" #include /** * Read token from backup file. * \param[in] in input file descriptor * \return char* read token * */ char* backup_read_token(FILE* in); /** * Read and match a string from backup file. * \param[in] in input file descriptor * \param[in] str string to match * \return 1 if string was read and matched, 0 otherwise * */ int backup_read_check_str(FILE* in, const char* str); /** * Read a string from backup file. * \param[in] in input file descriptor * \param[out] string storage * \return int 1 on success, 0 otherwise * */ int backup_read_str(FILE* in, const char** str); /** * Read time from backup file. * \param[in] in input file descriptor * \param[out] v time_t storage * \return int 1 on success, 0 otherwise * */ int backup_read_time_t(FILE* in, time_t* v); /** * Read duration from backup file. * \param[in] in input file descriptor * \param[out] v duration storage * \return int 1 on success, 0 otherwise * */ int backup_read_duration(FILE* in, duration_type** v); /** * Read rr type from backup file. * \param[in] in input file descriptor * \param[out] v rr type storage * \return int 1 on success, 0 otherwise * */ int backup_read_rr_type(FILE* in, ldns_rr_type* v); /** * Read integer from backup file. * \param[in] in input file descriptor * \param[out] v integer storage * \return int 1 on success, 0 otherwise * */ int backup_read_int(FILE* in, int* v); /** * Read 8bit unsigned integer from backup file. * \param[in] in input file descriptor * \param[out] v uint8_t storage * \return int 1 on success, 0 otherwise * */ int backup_read_uint8_t(FILE* in, uint8_t* v); /** * Read 32bit unsigned integer from backup file. * \param[in] in input file descriptor * \param[out] v uint32_t storage * \return int 1 on success, 0 otherwise * */ int backup_read_uint32_t(FILE* in, uint32_t* v); /** * Read namedb from backup file. * \param[in] in input file descriptor * \param[in] zone zone reference * \return ods_status status * */ ods_status backup_read_namedb(FILE* in, void* zone); /** * Read ixfr journal from file. * \param[in] in input file descriptor * \param[in] zone zone reference * \return ods_status status * */ ods_status backup_read_ixfr(FILE* in, void* zone); #endif /* SIGNER_BACKUP_H */ opendnssec-2.1.13/signer/src/signer/rrset.c0000644000077000001440000007705114446272525015552 00000000000000/* * 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. * */ /** * RRset. * */ #include "config.h" #include "file.h" #include "hsm.h" #include "log.h" #include "util.h" #include "compat.h" #include "signer/rrset.h" #include "signer/zone.h" static const char* rrset_str = "rrset"; /** * Log RR. * */ void log_rr(ldns_rr* rr, const char* pre, int level) { char* str = NULL; size_t i = 0; if (ods_log_get_level() < level) { return; } str = ldns_rr2str(rr); if (!str) { ods_log_error("[%s] %s: Error converting RR to string", rrset_str, pre?pre:""); return; } str[(strlen(str))-1] = '\0'; /* replace tabs with white space */ for (i=0; i < strlen(str); i++) { if (str[i] == '\t') { str[i] = ' '; } } if (level == LOG_EMERG) { ods_fatal_exit("[%s] %s: %s", rrset_str, pre?pre:"", str); } else if (level == LOG_ALERT) { ods_log_alert("[%s] %s: %s", rrset_str, pre?pre:"", str); } else if (level == LOG_CRIT) { ods_log_crit("[%s] %s: %s", rrset_str, pre?pre:"", str); } else if (level == LOG_ERR) { ods_log_error("[%s] %s: %s", rrset_str, pre?pre:"", str); } else if (level == LOG_WARNING) { ods_log_warning("[%s] %s: %s", rrset_str, pre?pre:"", str); } else if (level == LOG_NOTICE) { ods_log_info("[%s] %s: %s", rrset_str, pre?pre:"", str); } else if (level == LOG_INFO) { ods_log_verbose("[%s] %s: %s", rrset_str, pre?pre:"", str); } else if (level == LOG_DEBUG) { ods_log_debug("[%s] %s: %s", rrset_str, pre?pre:"", str); } else if (level == LOG_DEEEBUG) { ods_log_deeebug("[%s] %s: %s", rrset_str, pre?pre:"", str); } else { ods_log_deeebug("[%s] %s: %s", rrset_str, pre?pre:"", str); } free((void*)str); } /** * Log RRset. * */ void log_rrset(ldns_rdf* dname, ldns_rr_type type, const char* pre, int level) { char* str = NULL; size_t i = 0; if (ods_log_get_level() < level) { return; } str = ldns_rdf2str(dname); if (!str) { return; } str[(strlen(str))-1] = '\0'; /* replace tabs with white space */ for (i=0; i < strlen(str); i++) { if (str[i] == '\t') { str[i] = ' '; } } if (level == LOG_EMERG) { ods_fatal_exit("[%s] %s: <%s,%s>", rrset_str, pre?pre:"", str, rrset_type2str(type)); } else if (level == LOG_ALERT) { ods_log_alert("[%s] %s: <%s,%s>", rrset_str, pre?pre:"", str, rrset_type2str(type)); } else if (level == LOG_CRIT) { ods_log_crit("[%s] %s: <%s,%s>", rrset_str, pre?pre:"", str, rrset_type2str(type)); } else if (level == LOG_ERR) { ods_log_error("[%s] %s: <%s,%s>", rrset_str, pre?pre:"", str, rrset_type2str(type)); } else if (level == LOG_WARNING) { ods_log_warning("[%s] %s: <%s,%s>", rrset_str, pre?pre:"", str, rrset_type2str(type)); } else if (level == LOG_NOTICE) { ods_log_info("[%s] %s: <%s,%s>", rrset_str, pre?pre:"", str, rrset_type2str(type)); } else if (level == LOG_INFO) { ods_log_verbose("[%s] %s: <%s,%s>", rrset_str, pre?pre:"", str, rrset_type2str(type)); } else if (level == LOG_DEBUG) { ods_log_debug("[%s] %s: <%s,%s>", rrset_str, pre?pre:"", str, rrset_type2str(type)); } else if (level == LOG_DEEEBUG) { ods_log_deeebug("[%s] %s: <%s,%s>", rrset_str, pre?pre:"", str, rrset_type2str(type)); } else { ods_log_deeebug("[%s] %s: <%s,%s>", rrset_str, pre?pre:"", str, rrset_type2str(type)); } free((void*)str); } /** * Get the string-format of RRtype. * */ const char* rrset_type2str(ldns_rr_type type) { if (type == LDNS_RR_TYPE_IXFR) { return "IXFR"; } else if (type == LDNS_RR_TYPE_AXFR) { return "AXFR"; } else if (type == LDNS_RR_TYPE_MAILB) { return "MAILB"; } else if (type == LDNS_RR_TYPE_MAILA) { return "MAILA"; } else if (type == LDNS_RR_TYPE_ANY) { return "ANY"; } else { const ldns_rr_descriptor* descriptor = ldns_rr_descript(type); if (descriptor && descriptor->_name) { return descriptor->_name; } } return "TYPE???"; } static int memberdestroy(void* dummy, void* member) { rrsig_type* sig = (rrsig_type*) member; (void)dummy; free((void*) sig->key_locator); sig->key_locator = NULL; /* The rrs may still be in use by IXFRs so cannot do ldns_rr_free(sig->rr); */ ldns_rr_free(sig->rr); sig->owner = NULL; sig->rr = NULL; return 0; } /** * Create RRset. * */ rrset_type* rrset_create(zone_type* zone, ldns_rr_type type) { rrset_type* rrset = NULL; if (!type || !zone) { return NULL; } CHECKALLOC(rrset = (rrset_type*) malloc(sizeof(rrset_type))); if (!rrset) { ods_log_error("[%s] unable to create RRset %u: allocator_alloc() " "failed", rrset_str, (unsigned) type); return NULL; } rrset->next = NULL; rrset->rrs = NULL; rrset->domain = NULL; rrset->zone = zone; rrset->rrtype = type; rrset->rr_count = 0; collection_create_array(&rrset->rrsigs, sizeof(rrsig_type), rrset->zone->rrstore); rrset->needs_signing = 0; return rrset; } collection_class rrset_store_initialize() { collection_class klass; collection_class_allocated(&klass, NULL, memberdestroy); return klass; } /** * Lookup RR in RRset. * */ rr_type* rrset_lookup_rr(rrset_type* rrset, ldns_rr* rr) { ldns_status lstatus = LDNS_STATUS_OK; int cmp = 0; size_t i = 0; if (!rrset || !rr || rrset->rr_count <= 0) { return NULL; } for (i=0; i < rrset->rr_count; i++) { lstatus = util_dnssec_rrs_compare(rrset->rrs[i].rr, rr, &cmp); if (lstatus != LDNS_STATUS_OK) { ods_log_error("[%s] unable to lookup RR: compare failed (%s)", rrset_str, ldns_get_errorstr_by_id(lstatus)); return NULL; } if (!cmp) { /* equal */ return &rrset->rrs[i]; } } return NULL; } /** * What TTL should new RR's in this RRS get? */ uint32_t rrset_lookup_ttl(rrset_type* rrset, uint32_t default_ttl) { for (int i = 0; i < rrset->rr_count; i++) { if (!rrset->rrs[i].is_added) continue; return ldns_rr_ttl(rrset->rrs[i].rr); } return default_ttl; } /** * Count the number of RRs in this RRset that have is_added. * */ size_t rrset_count_rr_is_added(rrset_type* rrset) { size_t i = 0; size_t count = 0; if (!rrset) { return 0; } for (i=0; i < rrset->rr_count; i++) { if (rrset->rrs[i].is_added) { count++; } } return count; } /** * Add RR to RRset. * */ rr_type* rrset_add_rr(rrset_type* rrset, ldns_rr* rr) { rr_type* rrs_old = NULL; ods_log_assert(rrset); ods_log_assert(rr); ods_log_assert(rrset->rrtype == ldns_rr_get_type(rr)); rrs_old = rrset->rrs; CHECKALLOC(rrset->rrs = (rr_type*) malloc((rrset->rr_count + 1) * sizeof(rr_type))); if (!rrset->rrs) { ods_fatal_exit("[%s] fatal unable to add RR: allocator_alloc() failed", rrset_str); } if (rrs_old) { memcpy(rrset->rrs, rrs_old, (rrset->rr_count) * sizeof(rr_type)); } free(rrs_old); rrset->rr_count++; rrset->rrs[rrset->rr_count - 1].owner = rrset->domain; rrset->rrs[rrset->rr_count - 1].rr = rr; rrset->rrs[rrset->rr_count - 1].exists = 0; rrset->rrs[rrset->rr_count - 1].is_added = 1; rrset->rrs[rrset->rr_count - 1].is_removed = 0; rrset->needs_signing = 1; log_rr(rr, "+RR", LOG_DEEEBUG); return &rrset->rrs[rrset->rr_count -1]; } /** * Delete RR from RRset. * */ void rrset_del_rr(rrset_type* rrset, uint16_t rrnum) { rr_type* rrs_orig = NULL; ods_log_assert(rrset); ods_log_assert(rrnum < rrset->rr_count); log_rr(rrset->rrs[rrnum].rr, "-RR", LOG_DEEEBUG); rrset->rrs[rrnum].owner = NULL; /* who owns owner? */ ldns_rr_free(rrset->rrs[rrnum].rr); while (rrnum < rrset->rr_count-1) { rrset->rrs[rrnum] = rrset->rrs[rrnum+1]; rrnum++; } memset(&rrset->rrs[rrset->rr_count-1], 0, sizeof(rr_type)); rrs_orig = rrset->rrs; CHECKALLOC(rrset->rrs = (rr_type*) malloc((rrset->rr_count - 1) * sizeof(rr_type))); if(!rrset->rrs) { ods_fatal_exit("[%s] fatal unable to delete RR: allocator_alloc() failed", rrset_str); } memcpy(rrset->rrs, rrs_orig, (rrset->rr_count -1) * sizeof(rr_type)); free(rrs_orig); rrset->rr_count--; rrset->needs_signing = 1; } /** * Apply differences at RRset. * */ void rrset_diff(rrset_type* rrset, unsigned is_ixfr, unsigned more_coming) { zone_type* zone = NULL; uint16_t i = 0; uint8_t del_sigs = 0; if (!rrset) { return; } zone = (zone_type*) rrset->zone; /* CAUTION: both iterator and condition (implicit) are changed * within the loop. */ for (i=0; i < rrset->rr_count; i++) { if (rrset->rrs[i].is_added) { if (!rrset->rrs[i].exists) { /* ixfr +RR */ if (zone->db->is_initialized) { pthread_mutex_lock(&zone->ixfr->ixfr_lock); ixfr_add_rr(zone->ixfr, rrset->rrs[i].rr); pthread_mutex_unlock(&zone->ixfr->ixfr_lock); } del_sigs = 1; } rrset->rrs[i].exists = 1; if ((rrset->rrtype == LDNS_RR_TYPE_DNSKEY) && more_coming) { continue; } rrset->rrs[i].is_added = 0; } else if (!is_ixfr || rrset->rrs[i].is_removed) { if (rrset->rrs[i].exists && zone->db->is_initialized) { /* ixfr -RR */ pthread_mutex_lock(&zone->ixfr->ixfr_lock); ixfr_del_rr(zone->ixfr, rrset->rrs[i].rr); pthread_mutex_unlock(&zone->ixfr->ixfr_lock); } rrset->rrs[i].exists = 0; rrset_del_rr(rrset, i); del_sigs = 1; i--; } } if (del_sigs) { rrset_drop_rrsigs(zone, rrset); } } /** * Remove signatures, deallocate storage and add then to the outgoing IFXR for that zone. * */ void rrset_drop_rrsigs(zone_type* zone, rrset_type* rrset) { rrsig_type* rrsig; while((rrsig = collection_iterator(rrset->rrsigs))) { /* ixfr -RRSIG */ if (zone->db->is_initialized) { pthread_mutex_lock(&zone->ixfr->ixfr_lock); ixfr_del_rr(zone->ixfr, rrsig->rr); pthread_mutex_unlock(&zone->ixfr->ixfr_lock); } collection_del_cursor(rrset->rrsigs); } } /** * Add RRSIG to RRset. * */ void rrset_add_rrsig(rrset_type* rrset, ldns_rr* rr, const char* locator, uint32_t flags) { rrsig_type rrsig; ods_log_assert(rrset); ods_log_assert(rr); ods_log_assert(ldns_rr_get_type(rr) == LDNS_RR_TYPE_RRSIG); rrsig.owner = rrset->domain; rrsig.rr = rr; rrsig.key_locator = locator; rrsig.key_flags = flags; collection_add(rrset->rrsigs, &rrsig); } /** * Transmogrify the RRset to a RRlist. * */ static ldns_rr_list* rrset2rrlist(rrset_type* rrset) { ldns_rr_list* rr_list = NULL; int ret = 0; size_t i = 0; rr_list = ldns_rr_list_new(); for (i=0; i < rrset->rr_count; i++) { if (!rrset->rrs[i].exists) { log_rr(rrset->rrs[i].rr, "RR does not exist", LOG_WARNING); continue; } ret = (int) ldns_rr_list_push_rr(rr_list, rrset->rrs[i].rr); if (!ret) { ldns_rr_list_free(rr_list); return NULL; } if (rrset->rrtype == LDNS_RR_TYPE_CNAME || rrset->rrtype == LDNS_RR_TYPE_DNAME) { /* singleton types */ return rr_list; } } ldns_rr_list_sort(rr_list); return rr_list; } /** * Calculate the signature validation period. * */ static void rrset_sigvalid_period(signconf_type* sc, ldns_rr_type rrtype, time_t signtime, time_t* inception, time_t* expiration) { time_t jitter = 0; time_t offset = 0; time_t validity = 0; time_t random_jitter = 0; if (!sc || !rrtype || !signtime) { return; } jitter = duration2time(sc->sig_jitter); if (jitter) { random_jitter = ods_rand(jitter*2); } offset = duration2time(sc->sig_inception_offset); switch (rrtype) { case LDNS_RR_TYPE_NSEC: case LDNS_RR_TYPE_NSEC3: validity = duration2time(sc->sig_validity_denial); break; case LDNS_RR_TYPE_DNSKEY: if (sc->sig_validity_keyset != NULL && duration2time(sc->sig_validity_keyset) > 0) { validity = duration2time(sc->sig_validity_keyset); } else { validity = duration2time(sc->sig_validity_default); } break; default: validity = duration2time(sc->sig_validity_default); } *inception = signtime - offset; *expiration = (signtime + validity + random_jitter) - jitter; } struct rrsigkeymatching { rrsig_type* signature; key_type* key; }; static int rrsigkeyismatching(rrsig_type* rrsig, key_type* key) { if(rrsig->key_flags == key->flags && !strcmp(rrsig->key_locator,key->locator)) { return 1; } else { return 0; } } static void rrsigkeymatching(signconf_type* signconf, int nrrsigs, rrsig_type** rrsigs, struct rrsigkeymatching** rrsigkeymatchingptr, int* nrrsigkeymatchingptr) { int nmatches = 0; struct rrsigkeymatching* matches = malloc(sizeof(struct rrsigkeymatching) * (signconf->keys->count + nrrsigs)); for(int i=0; ikeys->count; keyidx++) { int matchidx; for(matchidx=0; matchidxkeys->keys[keyidx])) { matches[matchidx].key = &signconf->keys->keys[keyidx]; break; } } if(matchidx==nmatches) { matches[nmatches].signature = NULL; matches[nmatches].key = &signconf->keys->keys[keyidx]; ++nmatches; } } *rrsigkeymatchingptr = matches; *nrrsigkeymatchingptr = nmatches; } /** * Sign RRset. * */ ods_status rrset_sign(hsm_ctx_t* ctx, rrset_type* rrset, time_t signtime) { ods_status status; zone_type* zone = NULL; uint32_t newsigs = 0; uint32_t reusedsigs = 0; ldns_rr* rrsig = NULL; rrsig_type* signature; ldns_rr_list* rr_list = NULL; ldns_rr_list* rr_list_clone = NULL; const char* locator = NULL; time_t inception = 0; time_t expiration = 0; size_t i = 0, j; domain_type* domain = NULL; ldns_rr_type dstatus = LDNS_RR_TYPE_FIRST; ldns_rr_type delegpt = LDNS_RR_TYPE_FIRST; uint8_t algorithm = 0; ods_log_assert(ctx); ods_log_assert(rrset); zone = (zone_type*) rrset->zone; ods_log_assert(zone); ods_log_assert(zone->signconf); /* Recycle signatures */ if (rrset->rrtype == LDNS_RR_TYPE_NSEC || rrset->rrtype == LDNS_RR_TYPE_NSEC3) { dstatus = LDNS_RR_TYPE_SOA; delegpt = LDNS_RR_TYPE_SOA; } else { domain = (domain_type*) rrset->domain; dstatus = domain_is_occluded(domain); delegpt = domain_is_delegpt(domain); } int nrrsigs; for(nrrsigs=0; (signature = collection_iterator(rrset->rrsigs)); nrrsigs++) ; rrsig_type** rrsigs = malloc(sizeof(rrsig_type*) * nrrsigs); for(i=0; (signature = collection_iterator(rrset->rrsigs)); i++) { assert(signature); rrsigs[i] = signature; } struct rrsigkeymatching* matchedsignatures = NULL; int nmatchedsignatures; rrsigkeymatching(zone->signconf, nrrsigs, rrsigs, &matchedsignatures, &nmatchedsignatures); rrset->needs_signing = 0; ods_log_assert(rrset->rrs); ods_log_assert(rrset->rrs[0].rr); /* Skip delegation, glue and occluded RRsets */ if (dstatus != LDNS_RR_TYPE_SOA) { log_rrset(ldns_rr_owner(rrset->rrs[0].rr), rrset->rrtype, "skip signing occluded RRset", LOG_DEEEBUG); free(rrsigs); free(matchedsignatures); return ODS_STATUS_OK; } if (delegpt != LDNS_RR_TYPE_SOA && rrset->rrtype != LDNS_RR_TYPE_DS) { log_rrset(ldns_rr_owner(rrset->rrs[0].rr), rrset->rrtype, "skip signing delegation RRset", LOG_DEEEBUG); free(rrsigs); free(matchedsignatures); return ODS_STATUS_OK; } log_rrset(ldns_rr_owner(rrset->rrs[0].rr), rrset->rrtype, "sign RRset", LOG_DEEEBUG); ods_log_assert(dstatus == LDNS_RR_TYPE_SOA || (delegpt == LDNS_RR_TYPE_SOA || rrset->rrtype == LDNS_RR_TYPE_DS)); /* Transmogrify rrset */ rr_list = rrset2rrlist(rrset); if (ldns_rr_list_rr_count(rr_list) <= 0) { /* Empty RRset, no signatures needed */ ldns_rr_list_free(rr_list); free(rrsigs); free(matchedsignatures); return ODS_STATUS_OK; } /* Use rr_list_clone for signing, keep the original rr_list untouched for case preservation */ rr_list_clone = ldns_rr_list_clone(rr_list); /* Further in the code the ORIG_TTL field for the signature will be set * to the TTL of the first RR in the list. We must make sure all RR's * have the same TTL when signing. We do not need to publish these TTLs. * We find the smallest TTL as other software seems to do this. **/ uint32_t min_ttl = ldns_rr_ttl(ldns_rr_list_rr(rr_list_clone, 0)); for (i = 1; i < ldns_rr_list_rr_count(rr_list_clone); i++) { uint32_t rr_ttl = ldns_rr_ttl(ldns_rr_list_rr(rr_list_clone, i)); if (rr_ttl < min_ttl) min_ttl = rr_ttl; } for (i = 0; i < ldns_rr_list_rr_count(rr_list_clone); i++) { ldns_rr_set_ttl(ldns_rr_list_rr(rr_list_clone, i), min_ttl); } assert(zone->signconf); /* Calculate signature validity */ rrset_sigvalid_period(zone->signconf, rrset->rrtype, signtime, &inception, &expiration); uint32_t refresh = 0; if (zone->signconf && zone->signconf->sig_refresh_interval) { refresh = (uint32_t) (signtime + duration2time(zone->signconf->sig_refresh_interval)); } /* for each signature-key pair, determine whether the signature is valid and/or the key * should produce a signature. */ for (int i = 0; i < nmatchedsignatures; i++) { if (matchedsignatures[i].signature) { assert(matchedsignatures[i].signature->rr); expiration = ldns_rdf2native_int32(ldns_rr_rrsig_expiration(matchedsignatures[i].signature->rr)); inception = ldns_rdf2native_int32(ldns_rr_rrsig_inception(matchedsignatures[i].signature->rr)); } if (matchedsignatures[i].key && matchedsignatures[i].key->ksk && !matchedsignatures[i].key->zsk && rrset->rrtype != LDNS_RR_TYPE_DNSKEY) { /* If KSK (not CSK) don't sign non-DNSKEY RRsets */ matchedsignatures[i].key = NULL; matchedsignatures[i].signature = NULL; } else if (matchedsignatures[i].key && !matchedsignatures[i].key->ksk && !matchedsignatures[i].key->zsk && rrset->rrtype != LDNS_RR_TYPE_DNSKEY && !matchedsignatures[i].signature) { /* Drop keys that aren't ZSK or KSK and still have signatures */ matchedsignatures[i].key = NULL; } else if (matchedsignatures[i].key && !matchedsignatures[i].key->ksk && !matchedsignatures[i].key->zsk && rrset->rrtype != LDNS_RR_TYPE_DNSKEY && !matchedsignatures[i].key->publish) { matchedsignatures[i].key = NULL; matchedsignatures[i].signature = NULL; } else if (matchedsignatures[i].key && !matchedsignatures[i].key->ksk && !matchedsignatures[i].key->zsk && rrset->rrtype == LDNS_RR_TYPE_DNSKEY) { matchedsignatures[i].key = NULL; matchedsignatures[i].signature = NULL; } else if (matchedsignatures[i].key && !matchedsignatures[i].key->ksk && matchedsignatures[i].key->zsk && rrset->rrtype == LDNS_RR_TYPE_DNSKEY) { /* If ZSK (not CSK) don't sign DNSKEY RRset */ matchedsignatures[i].key = NULL; matchedsignatures[i].signature = NULL; } else if (matchedsignatures[i].key && matchedsignatures[i].key->ksk && matchedsignatures[i].key->locator == NULL) { /* If key has no locator, and should be pre-signed dnskey RR, skip */ matchedsignatures[i].key = NULL; } else if (refresh <= (uint32_t) signtime) { /* If Refresh is disabled, drop all signatures */ matchedsignatures[i].signature = NULL; } else if (matchedsignatures[i].signature && expiration < refresh && matchedsignatures[i].key && !matchedsignatures[i].key->ksk && !matchedsignatures[i].key->zsk) { /* Signature has expired but key not used for signing anymore */ matchedsignatures[i].signature = NULL; matchedsignatures[i].key = NULL; } else if (matchedsignatures[i].signature && expiration < refresh) { /* Expiration - Refresh has passed */ matchedsignatures[i].signature = NULL; } else if (matchedsignatures[i].signature && inception > (uint32_t) signtime) { /* Inception has not yet passed */ matchedsignatures[i].signature = NULL; } else if (matchedsignatures[i].signature && !matchedsignatures[i].key) { /* Orphaned signatures */ matchedsignatures[i].signature = NULL; } else if (dstatus != LDNS_RR_TYPE_SOA || (delegpt != LDNS_RR_TYPE_SOA && rrset->rrtype != LDNS_RR_TYPE_DS)) { /* Skip delegation, glue and occluded RRsets */ matchedsignatures[i].key = NULL; matchedsignatures[i].signature = NULL; } else { ods_log_assert(dstatus == LDNS_RR_TYPE_SOA || (delegpt == LDNS_RR_TYPE_SOA || rrset->rrtype == LDNS_RR_TYPE_DS)); } } /* At this time, each signature, key pair is valid, if there is a signature and a key, it is valid, if there is * no key, there should be no signature, if there is no key, there should be no signature. However for DNS * optimization, there needs to be no signature, if there is a signature for another key with the same algorithm * that is still valid. */ for (int i = 0; i < nmatchedsignatures; i++) { if (!matchedsignatures[i].signature && matchedsignatures[i].key) { /* We now know this key doesn't sign the set, we will only * sign when there isn't already an active key for that algorithm */ int j; for (j = 0; j < nmatchedsignatures; j++) { if (j != i) { if (matchedsignatures[j].key && matchedsignatures[j].key->publish && matchedsignatures[j].signature && matchedsignatures[j].key->algorithm == matchedsignatures[i].key->algorithm) { break; } } } if (j < nmatchedsignatures) { matchedsignatures[i].key = NULL; matchedsignatures[i].signature = NULL; } } } /* For each of the existing signatures, if they are no longer present in the output, delete them * The rrsigs array is guaranteed to line up with the mathcedsignatures array */ if (zone->db->is_initialized) { pthread_mutex_lock(&zone->ixfr->ixfr_lock); for(i=0; iixfr, rrsigs[i]->rr); } } } pthread_mutex_unlock(&zone->ixfr->ixfr_lock); } for(i=0; irrsigs))) { if(signature == rrsigs[i]) { collection_del_cursor(rrset->rrsigs); } } } } else ++reusedsigs; } /* only at this time we have no need for the list anymore (just the list) */ free(rrsigs); /* Calculate signature validity for new signatures */ rrset_sigvalid_period(zone->signconf, rrset->rrtype, signtime, &inception, &expiration); /* for each missing signature (no signature, but with key in the tuplie list) produce a signature */ for (int i = 0; i < nmatchedsignatures; i++) { if (!matchedsignatures[i].signature && matchedsignatures[i].key) { /* Sign the RRset with this key */ ods_log_deeebug("[%s] signing RRset[%i] with key %s", rrset_str, rrset->rrtype, zone->signconf->keys->keys[i].locator); rrsig = lhsm_sign(ctx, rr_list_clone, matchedsignatures[i].key, zone->apex, inception, expiration); if (!rrsig) { ods_log_crit("[%s] unable to sign RRset[%i]: lhsm_sign() failed", rrset_str, rrset->rrtype); free(matchedsignatures); ldns_rr_list_free(rr_list); ldns_rr_list_free(rr_list_clone); return ODS_STATUS_HSM_ERR; } /* Add signature */ locator = strdup(matchedsignatures[i].key->locator); rrset_add_rrsig(rrset, rrsig, locator, matchedsignatures[i].key->flags); newsigs++; /* ixfr +RRSIG */ if (zone->db->is_initialized) { pthread_mutex_lock(&zone->ixfr->ixfr_lock); ixfr_add_rr(zone->ixfr, rrsig); pthread_mutex_unlock(&zone->ixfr->ixfr_lock); } } } /* Add signatures for DNSKEY if have been configured to be added explicitjy */ if(rrset->rrtype == LDNS_RR_TYPE_DNSKEY && zone->signconf->dnskey_signature) { for(i=0; zone->signconf->dnskey_signature[i]; i++) { rrsig = NULL; if ((status = rrset_getliteralrr(&rrsig, zone->signconf->dnskey_signature[i], duration2time(zone->signconf->dnskey_ttl), zone->apex)) != ODS_STATUS_OK) { ods_log_error("[%s] unable to publish dnskeys for zone %s: " "error decoding literal dnskey", rrset_str, zone->name); ldns_rr_list_deep_free(rr_list_clone); return status; } /* Add signature */ rrset_add_rrsig(rrset, rrsig, NULL, 0); newsigs++; /* ixfr +RRSIG */ if (zone->db->is_initialized) { pthread_mutex_lock(&zone->ixfr->ixfr_lock); ixfr_add_rr(zone->ixfr, rrsig); pthread_mutex_unlock(&zone->ixfr->ixfr_lock); } } } /* RRset signing completed */ free(matchedsignatures); ldns_rr_list_free(rr_list); ldns_rr_list_deep_free(rr_list_clone); pthread_mutex_lock(&zone->stats->stats_lock); if (rrset->rrtype == LDNS_RR_TYPE_SOA) { zone->stats->sig_soa_count += newsigs; } zone->stats->sig_count += newsigs; zone->stats->sig_reuse += reusedsigs; pthread_mutex_unlock(&zone->stats->stats_lock); return ODS_STATUS_OK; } ods_status rrset_getliteralrr(ldns_rr** dnskey, const char *resourcerecord, uint32_t ttl, ldns_rdf* apex) { uint8_t dnskeystring[4096]; ldns_status ldnsstatus; int len; if ((len = b64_pton(resourcerecord, dnskeystring, sizeof (dnskeystring) - 2)) < 0) { return ODS_STATUS_PARSE_ERR; } dnskeystring[len] = '\0'; if ((ldnsstatus = ldns_rr_new_frm_str(dnskey, (const char*) dnskeystring, ttl, apex, NULL)) != LDNS_STATUS_OK) { return ODS_STATUS_PARSE_ERR; } return ODS_STATUS_OK; } /** * Print RRset. * */ void rrset_print(FILE* fd, rrset_type* rrset, int skip_rrsigs, ods_status* status) { rrsig_type* rrsig; uint16_t i = 0; ods_status result = ODS_STATUS_OK; if (!rrset || !fd) { ods_log_crit("[%s] unable to print RRset: rrset or fd missing", rrset_str); if (status) { *status = ODS_STATUS_ASSERT_ERR; } } else { for (i=0; i < rrset->rr_count; i++) { if (rrset->rrs[i].exists) { result = util_rr_print(fd, rrset->rrs[i].rr); if (rrset->rrtype == LDNS_RR_TYPE_CNAME || rrset->rrtype == LDNS_RR_TYPE_DNAME) { /* singleton types */ break; } if (result != ODS_STATUS_OK) { zone_type* zone = (zone_type*) rrset->zone; log_rrset(ldns_rr_owner(rrset->rrs[i].rr), rrset->rrtype, "error printing RRset", LOG_CRIT); zone->adoutbound->error = 1; break; } } } if (! skip_rrsigs) { result = ODS_STATUS_OK; while((rrsig = collection_iterator(rrset->rrsigs))) { if (result == ODS_STATUS_OK) { result = util_rr_print(fd, rrsig->rr); if (result != ODS_STATUS_OK) { zone_type* zone = rrset->zone; log_rrset(ldns_rr_owner(rrset->rrs[i].rr), rrset->rrtype, "error printing RRset", LOG_CRIT); zone->adoutbound->error = 1; } } } } if (status) { *status = result; } } } /** * Clean up RRset. * */ void rrset_cleanup(rrset_type* rrset) { uint16_t i = 0; if (!rrset) { return; } rrset_cleanup(rrset->next); rrset->next = NULL; rrset->domain = NULL; for (i=0; i < rrset->rr_count; i++) { ldns_rr_free(rrset->rrs[i].rr); rrset->rrs[i].owner = NULL; } collection_destroy(&rrset->rrsigs); free(rrset->rrs); free(rrset); } /** * Backup RRset. * */ void rrset_backup2(FILE* fd, rrset_type* rrset) { rrsig_type* rrsig; char* str = NULL; if (!rrset || !fd) { return; } while((rrsig = collection_iterator(rrset->rrsigs))) { if ((str = ldns_rr2str(rrsig->rr))) { fprintf(fd, "%.*s; {locator %s flags %u}\n", (int)strlen(str)-1, str, rrsig->key_locator, rrsig->key_flags); free(str); } } } opendnssec-2.1.13/signer/src/signer/zone.c0000644000077000001440000011117014446272525015355 00000000000000/* * 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. * */ #include "adapter/adapter.h" #include "file.h" #include "hsm.h" #include "locks.h" #include "log.h" #include "status.h" #include "util.h" #include "signer/backup.h" #include "signer/zone.h" #include "wire/netio.h" #include "compat.h" #include "daemon/signertasks.h" #include static const char* zone_str = "zone"; /** * Create a new zone. * */ zone_type* zone_create(char* name, ldns_rr_class klass) { zone_type* zone = NULL; int err; if (!name || !klass) { return NULL; } CHECKALLOC(zone = (zone_type*) calloc(1, sizeof(zone_type))); /* [start] PS 9218653: Drop trailing dot in domain name */ if (strlen(name) > 1 && name[strlen(name)-1] == '.') { name[strlen(name)-1] = '\0'; } /* [end] PS 9218653 */ if (pthread_mutex_init(&zone->zone_lock, NULL)) { free(zone); return NULL; } if (pthread_mutex_init(&zone->xfr_lock, NULL)) { (void)pthread_mutex_destroy(&zone->zone_lock); free(zone); return NULL; } zone->name = strdup(name); if (!zone->name) { ods_log_error("[%s] unable to create zone %s: allocator_strdup() " "failed", zone_str, name); zone_cleanup(zone); return NULL; } zone->klass = klass; zone->default_ttl = 3600; /* TODO: configure --default-ttl option? */ zone->apex = ldns_dname_new_frm_str(name); /* check zone->apex? */ zone->notify_command = NULL; zone->notify_ns = NULL; zone->notify_args = NULL; zone->policy_name = NULL; zone->signconf_filename = NULL; zone->adinbound = NULL; zone->adoutbound = NULL; zone->zl_status = ZONE_ZL_OK; zone->xfrd = NULL; zone->notify = NULL; zone->db = namedb_create((void*)zone); if (!zone->db) { ods_log_error("[%s] unable to create zone %s: namedb_create() " "failed", zone_str, name); zone_cleanup(zone); return NULL; } zone->ixfr = ixfr_create(); if (!zone->ixfr) { ods_log_error("[%s] unable to create zone %s: ixfr_create() " "failed", zone_str, name); zone_cleanup(zone); return NULL; } zone->zoneconfigvalid = 0; zone->signconf = signconf_create(); if (!zone->signconf) { ods_log_error("[%s] unable to create zone %s: signconf_create() " "failed", zone_str, name); zone_cleanup(zone); return NULL; } zone->stats = stats_create(); zone->rrstore = rrset_store_initialize(); return zone; } /** * Load signer configuration for zone. * */ ods_status zone_load_signconf(zone_type* zone, signconf_type** new_signconf) { ods_status status = ODS_STATUS_OK; signconf_type* signconf = NULL; char* datestamp = NULL; if (!zone || !zone->name || !zone->signconf) { return ODS_STATUS_ASSERT_ERR; } if (!zone->signconf_filename) { ods_log_warning("[%s] zone %s has no signconf filename, treat as " "insecure?", zone_str, zone->name); return ODS_STATUS_INSECURE; } status = signconf_update(&signconf, zone->signconf_filename, zone->signconf->last_modified); if (status == ODS_STATUS_OK) { if (!signconf) { /* this is unexpected */ ods_log_alert("[%s] unable to load signconf for zone %s: signconf " "status ok but no signconf stored", zone_str, zone->name); return ODS_STATUS_ASSERT_ERR; } (void)time_datestamp(signconf->last_modified, "%Y-%m-%d %T", &datestamp); ods_log_debug("[%s] zone %s signconf file %s is modified since %s", zone_str, zone->name, zone->signconf_filename, datestamp?datestamp:"Unknown"); free((void*)datestamp); *new_signconf = signconf; } else if (status == ODS_STATUS_UNCHANGED) { /* OPENDNSSEC-686: changes happening within one second will not be * seen */ (void)time_datestamp(zone->signconf->last_modified, "%Y-%m-%d %T", &datestamp); ods_log_verbose("[%s] zone %s signconf file %s is unchanged since " "%s", zone_str, zone->name, zone->signconf_filename, datestamp?datestamp:"Unknown"); free((void*)datestamp); } else { ods_log_error("[%s] unable to load signconf for zone %s: signconf %s " "%s", zone_str, zone->name, zone->signconf_filename, ods_status2str(status)); } return status; } /** * Publish the keys as indicated by the signer configuration. * */ ods_status zone_publish_dnskeys(zone_type* zone, int skip_hsm_access) { hsm_ctx_t* ctx = NULL; uint32_t ttl = 0; unsigned int i; ods_status status = ODS_STATUS_OK; rrset_type* rrset = NULL; rr_type* dnskey = NULL; if (!zone || !zone->db || !zone->signconf || !zone->signconf->keys) { return ODS_STATUS_ASSERT_ERR; } ods_log_assert(zone->name); /* hsm access */ if (!skip_hsm_access) { ctx = hsm_create_context(); if (ctx == NULL) { ods_log_error("[%s] unable to publish keys for zone %s: " "error creating libhsm context", zone_str, zone->name); return ODS_STATUS_HSM_ERR; } } ttl = zone->default_ttl; /* dnskey ttl */ if (zone->signconf->dnskey_ttl) { ttl = (uint32_t) duration2time(zone->signconf->dnskey_ttl); } /* publish keys */ for (i=0; i < zone->signconf->keys->count; i++) { if (!zone->signconf->keys->keys[i].publish) { continue; } if (!zone->signconf->keys->keys[i].dnskey) { /* get dnskey */ if (zone->signconf->keys->keys[i].resourcerecord) { if ((status = rrset_getliteralrr(&zone->signconf->keys->keys[i].dnskey, zone->signconf->keys->keys[i].resourcerecord, ttl, zone->apex)) != ODS_STATUS_OK) { ods_log_error("[%s] unable to publish dnskeys for zone %s: " "error decoding literal dnskey", zone_str, zone->name); if (!skip_hsm_access) { hsm_destroy_context(ctx); } return status; } } else { status = lhsm_get_key(ctx, zone->apex, &zone->signconf->keys->keys[i], skip_hsm_access); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to publish dnskeys for zone %s: " "error creating dnskey", zone_str, zone->name); break; } } } ods_log_debug("[%s] publish %s DNSKEY locator %s", zone_str, zone->name, zone->signconf->keys->keys[i].locator); if (!skip_hsm_access) { ods_log_assert(zone->signconf->keys->keys[i].dnskey); ldns_rr_set_ttl(zone->signconf->keys->keys[i].dnskey, ttl); ldns_rr_set_class(zone->signconf->keys->keys[i].dnskey, zone->klass); status = zone_add_rr(zone, zone->signconf->keys->keys[i].dnskey, 0); if (status == ODS_STATUS_UNCHANGED) { /* rr already exists, adjust pointer */ rrset = zone_lookup_rrset(zone, zone->apex, LDNS_RR_TYPE_DNSKEY); ods_log_assert(rrset); dnskey = rrset_lookup_rr(rrset, zone->signconf->keys->keys[i].dnskey); ods_log_assert(dnskey); if (dnskey->rr != zone->signconf->keys->keys[i].dnskey) { ldns_rr_free(zone->signconf->keys->keys[i].dnskey); } zone->signconf->keys->keys[i].dnskey = dnskey->rr; status = ODS_STATUS_OK; } else if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to publish dnskeys for zone %s: " "error adding dnskey", zone_str, zone->name); break; } } } /* done */ if (!skip_hsm_access) { hsm_destroy_context(ctx); } return status; } /** * Unlink DNSKEY RRs. * */ void zone_rollback_dnskeys(zone_type* zone) { uint16_t i = 0; rrset_type* rrset = NULL; rr_type* dnskey = NULL; if (!zone || !zone->signconf || !zone->signconf->keys) { return; } rrset = zone_lookup_rrset(zone, zone->apex, LDNS_RR_TYPE_DNSKEY); /* unlink dnskey rrs */ for (i=0; i < zone->signconf->keys->count; i++) { if (rrset && zone->signconf->keys->keys[i].dnskey) { dnskey = rrset_lookup_rr(rrset, zone->signconf->keys->keys[i].dnskey); /* always remove the DNSKEY record when rollback is requested, as we don't know how to * distinguish reading an empty file or reading a failed input set. */ zone->signconf->keys->keys[i].dnskey = NULL; } } } /** * Publish the NSEC3 parameters as indicated by the signer configuration. * */ ods_status zone_publish_nsec3param(zone_type* zone) { rrset_type* rrset = NULL; rr_type* n3prr = NULL; ldns_rr* rr = NULL; ods_status status = ODS_STATUS_OK; if (!zone || !zone->name || !zone->db || !zone->signconf) { return ODS_STATUS_ASSERT_ERR; } if (!zone->signconf->nsec3params) { /* NSEC */ ods_log_assert(zone->signconf->nsec_type == LDNS_RR_TYPE_NSEC); return ODS_STATUS_OK; } if (!zone->signconf->nsec3params->rr) { uint32_t paramttl = (uint32_t) duration2time(zone->signconf->nsec3param_ttl); rr = ldns_rr_new_frm_type(LDNS_RR_TYPE_NSEC3PARAMS); if (!rr) { ods_log_error("[%s] unable to publish nsec3params for zone %s: " "error creating rr (%s)", zone_str, zone->name, ods_status2str(status)); return ODS_STATUS_MALLOC_ERR; } ldns_rr_set_class(rr, zone->klass); ldns_rr_set_ttl(rr, paramttl); ldns_rr_set_owner(rr, ldns_rdf_clone(zone->apex)); ldns_nsec3_add_param_rdfs(rr, zone->signconf->nsec3params->algorithm, 0, zone->signconf->nsec3params->iterations, zone->signconf->nsec3params->salt_len, zone->signconf->nsec3params->salt_data); /** * Always set bit 7 of the flags to zero, * according to rfc5155 section 11 */ ldns_set_bit(ldns_rdf_data(ldns_rr_rdf(rr, 1)), 7, 0); zone->signconf->nsec3params->rr = rr; } /* Delete all nsec3param rrs. */ (void) zone_del_nsec3params(zone); ods_log_assert(zone->signconf->nsec3params->rr); status = zone_add_rr(zone, ldns_rr_clone(zone->signconf->nsec3params->rr), 0); if (status == ODS_STATUS_UNCHANGED) { status = ODS_STATUS_OK; } else if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to publish nsec3params for zone %s: " "error adding nsec3params (%s)", zone_str, zone->name, ods_status2str(status)); } return status; } /** * Unlink NSEC3PARAM RR. * */ void zone_rollback_nsec3param(zone_type* zone) { rrset_type* rrset = NULL; rr_type* n3prr = NULL; if (!zone || !zone->signconf || !zone->signconf->nsec3params) { return; } rrset = zone_lookup_rrset(zone, zone->apex, LDNS_RR_TYPE_NSEC3PARAMS); if (rrset && zone->signconf->nsec3params->rr) { n3prr = rrset_lookup_rr(rrset, zone->signconf->nsec3params->rr); if (n3prr && !n3prr->exists && n3prr->rr == zone->signconf->nsec3params->rr) { zone->signconf->nsec3params->rr = NULL; } } } /** * Prepare keys for signing. * */ ods_status zone_prepare_keys(zone_type* zone) { hsm_ctx_t* ctx = NULL; int skip_hsm_access; uint16_t i = 0; ods_status status = ODS_STATUS_OK; if (!zone || !zone->db || !zone->signconf || !zone->signconf->keys) { return ODS_STATUS_ASSERT_ERR; } ods_log_assert(zone->name); /* hsm access */ ctx = hsm_create_context(); if (ctx == NULL) { ods_log_error("[%s] unable to prepare signing keys for zone %s: error creating libhsm context", zone_str, zone->name); return ODS_STATUS_HSM_ERR; } /* prepare keys */ for (i=0; i < zone->signconf->keys->count; i++) { if(zone->signconf->dnskey_signature != NULL && zone->signconf->keys->keys[i].ksk) continue; /* get dnskey */ skip_hsm_access = (zone->signconf->keys->keys[i].publish || zone->signconf->keys->keys[i].zsk || zone->signconf->keys->keys[i].ksk ? 0 : 1); status = lhsm_get_key(ctx, zone->apex, &zone->signconf->keys->keys[i], skip_hsm_access); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to prepare signing keys for zone %s: error getting dnskey", zone_str, zone->name); break; } ods_log_assert(zone->signconf->keys->keys[i].params); } /* done */ hsm_destroy_context(ctx); return status; } /** * Update serial. * */ ods_status zone_update_serial(zone_type* zone) { ods_status status = ODS_STATUS_OK; rrset_type* rrset = NULL; rr_type* soa = NULL; ldns_rr* rr = NULL; ldns_rdf* soa_rdata = NULL; ods_log_assert(zone); ods_log_assert(zone->apex); ods_log_assert(zone->name); ods_log_assert(zone->db); ods_log_assert(zone->signconf); if (zone->db->serial_updated) { /* already done, unmark and return ok */ ods_log_debug("[%s] zone %s soa serial already up to date", zone_str, zone->name); zone->db->serial_updated = 0; return ODS_STATUS_OK; } rrset = zone_lookup_rrset(zone, zone->apex, LDNS_RR_TYPE_SOA); if (!rrset || !rrset->rrs || !rrset->rrs[0].rr) { ods_log_error("[%s] unable to update zone %s soa serial: failed to " "find soa rrset", zone_str, zone->name); return ODS_STATUS_ERR; } ods_log_assert(rrset); ods_log_assert(rrset->rrs); ods_log_assert(rrset->rrs[0].rr); rr = ldns_rr_clone(rrset->rrs[0].rr); if (!rr) { ods_log_error("[%s] unable to update zone %s soa serial: failed to " "clone soa rr", zone_str, zone->name); return ODS_STATUS_ERR; } status = namedb_update_serial(zone->db, zone->name, zone->signconf->soa_serial, zone->db->inbserial); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to update zone %s soa serial: %s", zone_str, zone->name, ods_status2str(status)); if (status == ODS_STATUS_CONFLICT_ERR) { ods_log_error("[%s] If this is the result of a key rollover, " "please increment the serial in the unsigned zone %s", zone_str, zone->name); } ldns_rr_free(rr); return status; } ods_log_verbose("[%s] zone %s set soa serial to %u", zone_str, zone->name, zone->db->intserial); soa_rdata = ldns_rr_set_rdf(rr, ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, zone->db->intserial), SE_SOA_RDATA_SERIAL); if (soa_rdata) { ldns_rdf_deep_free(soa_rdata); soa_rdata = NULL; } else { ods_log_error("[%s] unable to update zone %s soa serial: failed to " "replace soa serial rdata", zone_str, zone->name); ldns_rr_free(rr); return ODS_STATUS_ERR; } soa = rrset_add_rr(rrset, rr); ods_log_assert(soa); rrset_diff(rrset, 0, 0); zone->db->serial_updated = 0; return ODS_STATUS_OK; } /** * Lookup RRset. * */ rrset_type* zone_lookup_rrset(zone_type* zone, ldns_rdf* owner, ldns_rr_type type) { domain_type* domain = NULL; if (!zone || !owner || !type) { return NULL; } domain = namedb_lookup_domain(zone->db, owner); if (!domain) { return NULL; } return domain_lookup_rrset(domain, type); } /** * Add RR. * */ ods_status zone_add_rr(zone_type* zone, ldns_rr* rr, int do_stats) { domain_type* domain = NULL; rrset_type* rrset = NULL; rr_type* record = NULL; ods_status status = ODS_STATUS_OK; ods_log_assert(rr); ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(zone->db); ods_log_assert(zone->signconf); /* If we already have this RR, return ODS_STATUS_UNCHANGED */ domain = namedb_lookup_domain(zone->db, ldns_rr_owner(rr)); if (!domain) { domain = namedb_add_domain(zone->db, ldns_rr_owner(rr)); if (!domain) { ods_log_error("[%s] unable to add RR to zone %s: " "failed to add domain", zone_str, zone->name); return ODS_STATUS_ERR; } if (ldns_dname_compare(domain->dname, zone->apex) == 0) { domain->is_apex = 1; } else { status = namedb_domain_entize(zone->db, domain, zone->apex); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to add RR to zone %s: " "failed to entize domain", zone_str, zone->name); return ODS_STATUS_ERR; } } } rrset = domain_lookup_rrset(domain, ldns_rr_get_type(rr)); if (!rrset) { rrset = rrset_create(domain->zone, ldns_rr_get_type(rr)); if (!rrset) { ods_log_error("[%s] unable to add RR to zone %s: " "failed to add RRset", zone_str, zone->name); return ODS_STATUS_ERR; } domain_add_rrset(domain, rrset); } record = rrset_lookup_rr(rrset, rr); uint32_t ttl_rr = ldns_rr_ttl(rr); uint32_t ttl_rrset = rrset_lookup_ttl(rrset, ttl_rr); if (record && ttl_rr == ttl_rrset && ttl_rr == ldns_rr_ttl(record->rr)) { record->is_added = 1; /* already exists, just mark added */ record->is_removed = 0; /* unset is_removed */ return ODS_STATUS_UNCHANGED; } else { record = rrset_add_rr(rrset, rr); ods_log_assert(record); ods_log_assert(record->rr); ods_log_assert(record->is_added); if (ttl_rr != ttl_rrset) { char *str = ldns_rr2str(rr); str[(strlen(str)) - 1] = '\0'; for (int i = 0; i < strlen(str); i++) { if (str[i] == '\t') { str[i] = ' '; } } ods_log_error("In zone file %s: TTL for the record '%s' (%d) not" " equal to recordset TTL (%d)", zone->name, str, ttl_rr, ttl_rrset); LDNS_FREE(str); } } /* update stats */ if (do_stats && zone->stats) { zone->stats->sort_count += 1; } return ODS_STATUS_OK; } /** * Delete RR. * */ ods_status zone_del_rr(zone_type* zone, ldns_rr* rr, int do_stats) { domain_type* domain = NULL; rrset_type* rrset = NULL; rr_type* record = NULL; ods_log_assert(rr); ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(zone->db); ods_log_assert(zone->signconf); domain = namedb_lookup_domain(zone->db, ldns_rr_owner(rr)); if (!domain) { ods_log_warning("[%s] unable to delete RR from zone %s: " "domain not found", zone_str, zone->name); return ODS_STATUS_UNCHANGED; } rrset = domain_lookup_rrset(domain, ldns_rr_get_type(rr)); if (!rrset) { ods_log_warning("[%s] unable to delete RR from zone %s: " "RRset not found", zone_str, zone->name); return ODS_STATUS_UNCHANGED; } record = rrset_lookup_rr(rrset, rr); if (!record) { ods_log_error("[%s] unable to delete RR from zone %s: " "RR not found", zone_str, zone->name); return ODS_STATUS_UNCHANGED; } record->is_removed = 1; record->is_added = 0; /* unset is_added */ /* update stats */ if (do_stats && zone->stats) { zone->stats->sort_count -= 1; } return ODS_STATUS_OK; } /** * Delete NSEC3PARAM RRs. * * Marks all NSEC3PARAM records as removed. */ ods_status zone_del_nsec3params(zone_type* zone) { domain_type* domain = NULL; rrset_type* rrset = NULL; int i; ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(zone->db); domain = namedb_lookup_domain(zone->db, zone->apex); if (!domain) { ods_log_verbose("[%s] unable to delete RR from zone %s: " "domain not found", zone_str, zone->name); return ODS_STATUS_UNCHANGED; } rrset = domain_lookup_rrset(domain, LDNS_RR_TYPE_NSEC3PARAMS); if (!rrset) { ods_log_verbose("[%s] NSEC3PARAM in zone %s not found: " "skipping delete", zone_str, zone->name); return ODS_STATUS_UNCHANGED; } /* We don't actually delete the record as we still need the * information in the IXFR. Just set it as removed. The code * inserting the new record may flip this flag when the record * hasn't changed. */ for (i=0; i < rrset->rr_count; i++) { rrset->rrs[i].is_removed = 1; } return ODS_STATUS_OK; } /** * Merge zones. * */ void zone_merge(zone_type* z1, zone_type* z2) { const char* str; adapter_type* adtmp = NULL; if (!z1 || !z2) { return; } /* policy name */ if (ods_strcmp(z2->policy_name, z1->policy_name) != 0) { if (z2->policy_name) { str = strdup(z2->policy_name); if (!str) { ods_log_error("[%s] failed to merge policy %s name to zone " "%s", zone_str, z2->policy_name, z1->name); } else { free((void*)z1->policy_name); z1->policy_name = str; z1->zl_status = ZONE_ZL_UPDATED; } } else { free((void*)z1->policy_name); z1->policy_name = NULL; z1->zl_status = ZONE_ZL_UPDATED; } } /* signconf filename */ if (ods_strcmp(z2->signconf_filename, z1->signconf_filename) != 0) { if (z2->signconf_filename) { str = strdup(z2->signconf_filename); if (!str) { ods_log_error("[%s] failed to merge signconf filename %s to " "zone %s", zone_str, z2->policy_name, z1->name); } else { free((void*)z1->signconf_filename); z1->signconf_filename = str; z1->zl_status = ZONE_ZL_UPDATED; } } else { free((void*)z1->signconf_filename); z1->signconf_filename = NULL; z1->zl_status = ZONE_ZL_UPDATED; } } /* adapters */ if (adapter_compare(z2->adinbound, z1->adinbound) != 0) { adtmp = z2->adinbound; z2->adinbound = z1->adinbound; z1->adinbound = adtmp; adtmp = NULL; } if (adapter_compare(z2->adoutbound, z1->adoutbound) != 0) { adtmp = z2->adoutbound; z2->adoutbound = z1->adoutbound; z1->adoutbound = adtmp; adtmp = NULL; } } /** * Clean up zone. * */ void zone_cleanup(zone_type* zone) { if (!zone) { return; } pthread_mutex_lock(&zone->zone_lock); ldns_rdf_deep_free(zone->apex); adapter_cleanup(zone->adinbound); adapter_cleanup(zone->adoutbound); namedb_cleanup(zone->db); ixfr_cleanup(zone->ixfr); xfrd_cleanup(zone->xfrd, 1); notify_cleanup(zone->notify); signconf_cleanup(zone->signconf); pthread_mutex_unlock(&zone->zone_lock); stats_cleanup(zone->stats); free(zone->notify_command); free(zone->notify_args); free((void*)zone->policy_name); free((void*)zone->signconf_filename); free((void*)zone->name); collection_class_destroy(&zone->rrstore); pthread_mutex_destroy(&zone->xfr_lock); pthread_mutex_destroy(&zone->zone_lock); free(zone); } /** * Recover zone from backup. * */ ods_status zone_recover2(engine_type* engine, zone_type* zone) { char* filename = NULL; FILE* fd = NULL; const char* token = NULL; time_t when = 0; ods_status status = ODS_STATUS_OK; /* zone part */ int klass = 0; uint32_t inbound = 0, internal = 0, outbound = 0; /* signconf part */ time_t lastmod = 0; /* nsec3params part */ const char* salt = NULL; ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(zone->signconf); ods_log_assert(zone->db); filename = ods_build_path(zone->name, ".backup2", 0, 1); if (!filename) { return ODS_STATUS_MALLOC_ERR; } fd = ods_fopen(filename, NULL, "r"); if (fd) { /* start recovery */ if (!backup_read_check_str(fd, ODS_SE_FILE_MAGIC_V3)) { ods_log_error("[%s] corrupted backup file zone %s: read magic " "error", zone_str, zone->name); goto recover_error2; } if (!backup_read_check_str(fd, ";;Time:") | !backup_read_time_t(fd, &when)) { ods_log_error("[%s] corrupted backup file zone %s: read time " "error", zone_str, zone->name); goto recover_error2; } /* zone stuff */ if (!backup_read_check_str(fd, ";;Zone:") | !backup_read_check_str(fd, "name") | !backup_read_check_str(fd, zone->name)) { ods_log_error("[%s] corrupted backup file zone %s: read name " "error", zone_str, zone->name); goto recover_error2; } if (!backup_read_check_str(fd, "class") | !backup_read_int(fd, &klass)) { ods_log_error("[%s] corrupted backup file zone %s: read class " "error", zone_str, zone->name); goto recover_error2; } if (!backup_read_check_str(fd, "inbound") | !backup_read_uint32_t(fd, &inbound) | !backup_read_check_str(fd, "internal") | !backup_read_uint32_t(fd, &internal) | !backup_read_check_str(fd, "outbound") | !backup_read_uint32_t(fd, &outbound)) { ods_log_error("[%s] corrupted backup file zone %s: read serial " "error", zone_str, zone->name); goto recover_error2; } zone->klass = (ldns_rr_class) klass; zone->db->inbserial = inbound; zone->db->intserial = internal; zone->db->outserial = outbound; /* signconf part */ if (!backup_read_check_str(fd, ";;Signconf:") | !backup_read_check_str(fd, "lastmod") | !backup_read_time_t(fd, &lastmod) | !backup_read_check_str(fd, "maxzonettl") | !backup_read_check_str(fd, "0") | !backup_read_check_str(fd, "resign") | !backup_read_duration(fd, &zone->signconf->sig_resign_interval) | !backup_read_check_str(fd, "refresh") | !backup_read_duration(fd, &zone->signconf->sig_refresh_interval) | !backup_read_check_str(fd, "valid") | !backup_read_duration(fd, &zone->signconf->sig_validity_default) | !backup_read_check_str(fd, "denial") | !backup_read_duration(fd,&zone->signconf->sig_validity_denial) | !backup_read_check_str(fd, "keyset") | !backup_read_duration(fd,&zone->signconf->sig_validity_keyset) | !backup_read_check_str(fd, "jitter") | !backup_read_duration(fd, &zone->signconf->sig_jitter) | !backup_read_check_str(fd, "offset") | !backup_read_duration(fd, &zone->signconf->sig_inception_offset) | !backup_read_check_str(fd, "nsec") | !backup_read_rr_type(fd, &zone->signconf->nsec_type) | !backup_read_check_str(fd, "dnskeyttl") | !backup_read_duration(fd, &zone->signconf->dnskey_ttl) | !backup_read_check_str(fd, "soattl") | !backup_read_duration(fd, &zone->signconf->soa_ttl) | !backup_read_check_str(fd, "soamin") | !backup_read_duration(fd, &zone->signconf->soa_min) | !backup_read_check_str(fd, "serial") | !backup_read_str(fd, &zone->signconf->soa_serial)) { ods_log_error("[%s] corrupted backup file zone %s: read signconf " "error", zone_str, zone->name); goto recover_error2; } /* nsec3params part */ if (zone->signconf->nsec_type == LDNS_RR_TYPE_NSEC3) { if (!backup_read_check_str(fd, ";;Nsec3parameters:") | !backup_read_check_str(fd, "salt") | !backup_read_str(fd, &salt) | !backup_read_check_str(fd, "algorithm") | !backup_read_uint32_t(fd, &zone->signconf->nsec3_algo) | !backup_read_check_str(fd, "optout") | !backup_read_int(fd, &zone->signconf->nsec3_optout) | !backup_read_check_str(fd, "iterations") | !backup_read_uint32_t(fd, &zone->signconf->nsec3_iterations)) { ods_log_error("[%s] corrupted backup file zone %s: read " "nsec3parameters error", zone_str, zone->name); goto recover_error2; } zone->signconf->nsec3_salt = strdup(salt); free((void*) salt); salt = NULL; zone->signconf->nsec3params = nsec3params_create( zone->signconf, (uint8_t) zone->signconf->nsec3_algo, (uint8_t) zone->signconf->nsec3_optout, (uint16_t) zone->signconf->nsec3_iterations, zone->signconf->nsec3_salt); if (!zone->signconf->nsec3params) { ods_log_error("[%s] corrupted backup file zone %s: unable to " "create nsec3param", zone_str, zone->name); goto recover_error2; } } zone->signconf->last_modified = lastmod; zone->zoneconfigvalid = 1; zone->default_ttl = (uint32_t) duration2time(zone->signconf->soa_min); /* keys part */ zone->signconf->keys = keylist_create((void*) zone->signconf); while (backup_read_str(fd, &token)) { if (ods_strcmp(token, ";;Key:") == 0) { if (!key_recover2(fd, zone->signconf->keys)) { ods_log_error("[%s] corrupted backup file zone %s: read " "key error", zone_str, zone->name); goto recover_error2; } } else if (ods_strcmp(token, ";;") == 0) { /* keylist done */ free((void*) token); token = NULL; break; } else { /* keylist corrupted */ goto recover_error2; } free((void*) token); token = NULL; } /* publish dnskeys */ status = zone_publish_dnskeys(zone, 1); if (status != ODS_STATUS_OK) { ods_log_error("[%s] corrupted backup file zone %s: unable to " "publish dnskeys (%s)", zone_str, zone->name, ods_status2str(status)); goto recover_error2; } /* publish nsec3param */ if (!zone->signconf->passthrough) status = zone_publish_nsec3param(zone); if (status != ODS_STATUS_OK) { ods_log_error("[%s] corrupted backup file zone %s: unable to " "publish nsec3param (%s)", zone_str, zone->name, ods_status2str(status)); goto recover_error2; } /* publish other records */ status = backup_read_namedb(fd, zone); if (status != ODS_STATUS_OK) { ods_log_error("[%s] corrupted backup file zone %s: unable to " "read resource records (%s)", zone_str, zone->name, ods_status2str(status)); goto recover_error2; } /* task */ schedule_scheduletask(engine->taskq, TASK_SIGN, zone->name, zone, &zone->zone_lock, schedule_PROMPTLY); free((void*)filename); ods_fclose(fd); zone->db->is_initialized = 1; zone->db->have_serial = 1; /* journal */ filename = ods_build_path(zone->name, ".ixfr", 0, 1); if (filename) { fd = ods_fopen(filename, NULL, "r"); } if (fd) { status = backup_read_ixfr(fd, zone); if (status != ODS_STATUS_OK) { ods_log_warning("[%s] corrupted journal file zone %s, " "skipping (%s)", zone_str, zone->name, ods_status2str(status)); (void)unlink(filename); ixfr_cleanup(zone->ixfr); zone->ixfr = ixfr_create(); } } pthread_mutex_lock(&zone->ixfr->ixfr_lock); ixfr_purge(zone->ixfr, zone->name); pthread_mutex_unlock(&zone->ixfr->ixfr_lock); /* all ok */ free((void*)filename); if (fd) { ods_fclose(fd); } if (zone->stats) { pthread_mutex_lock(&zone->stats->stats_lock); stats_clear(zone->stats); pthread_mutex_unlock(&zone->stats->stats_lock); } return ODS_STATUS_OK; } free(filename); return ODS_STATUS_UNCHANGED; recover_error2: free((void*)filename); ods_fclose(fd); /* signconf cleanup */ free((void*)salt); salt = NULL; signconf_cleanup(zone->signconf); zone->signconf = signconf_create(); ods_log_assert(zone->signconf); /* namedb cleanup */ namedb_cleanup(zone->db); zone->db = namedb_create((void*)zone); ods_log_assert(zone->db); /* stats reset */ if (zone->stats) { pthread_mutex_lock(&zone->stats->stats_lock); stats_clear(zone->stats); pthread_mutex_unlock(&zone->stats->stats_lock); } return ODS_STATUS_ERR; } /** * Backup zone. * */ ods_status zone_backup2(zone_type* zone, time_t nextResign) { char* filename = NULL; char* tmpfile = NULL; FILE* fd = NULL; int ret = 0; ods_status status = ODS_STATUS_OK; ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(zone->db); ods_log_assert(zone->signconf); tmpfile = ods_build_path(zone->name, ".backup2.tmp", 0, 1); filename = ods_build_path(zone->name, ".backup2", 0, 1); if (!tmpfile || !filename) { free(tmpfile); free(filename); return ODS_STATUS_MALLOC_ERR; } fd = ods_fopen(tmpfile, NULL, "w"); if (fd) { fprintf(fd, "%s\n", ODS_SE_FILE_MAGIC_V3); fprintf(fd, ";;Time: %u\n", (unsigned) nextResign); /** Backup zone */ fprintf(fd, ";;Zone: name %s class %i inbound %u internal %u " "outbound %u\n", zone->name, (int) zone->klass, (unsigned) zone->db->inbserial, (unsigned) zone->db->intserial, (unsigned) zone->db->outserial); /** Backup signconf */ signconf_backup(fd, zone->signconf, ODS_SE_FILE_MAGIC_V3); /** Backup NSEC3 parameters */ if (zone->signconf->nsec3params) { nsec3params_backup(fd, zone->signconf->nsec3_algo, zone->signconf->nsec3_optout, zone->signconf->nsec3_iterations, zone->signconf->nsec3_salt, zone->signconf->nsec3params->rr, ODS_SE_FILE_MAGIC_V3); } /** Backup keylist */ keylist_backup(fd, zone->signconf->keys, ODS_SE_FILE_MAGIC_V3); fprintf(fd, ";;\n"); /** Backup domains and stuff */ namedb_backup2(fd, zone->db); /** Done */ fprintf(fd, "%s\n", ODS_SE_FILE_MAGIC_V3); ods_fclose(fd); ret = rename(tmpfile, filename); if (ret != 0) { ods_log_error("[%s] unable to rename zone %s backup %s to %s: %s", zone_str, zone->name, tmpfile, filename, strerror(errno)); status = ODS_STATUS_RENAME_ERR; } } else { status = ODS_STATUS_FOPEN_ERR; } free((void*) tmpfile); free((void*) filename); return status; } opendnssec-2.1.13/signer/src/signer/nsec3params.c0000644000077000001440000001155014446272525016622 00000000000000/* * 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. * */ /** * NSEC3 Parameters. * */ #include "status.h" #include "log.h" #include "util.h" #include "signer/backup.h" #include "signer/nsec3params.h" #include "signer/signconf.h" #include #include #include #include static const char* nsec3_str = "nsec3"; /** * Create NSEC3 salt. * */ ods_status nsec3params_create_salt(const char* salt_str, uint8_t* salt_len, uint8_t** salt) { uint8_t c; uint8_t* salt_tmp; if (!salt_str) { *salt_len = 0; *salt = NULL; return ODS_STATUS_OK; } *salt_len = (uint8_t) strlen(salt_str); if (*salt_len == 1 && salt_str[0] == '-') { *salt_len = 0; *salt = NULL; return ODS_STATUS_OK; } else if (*salt_len % 2 != 0) { ods_log_error("[%s] invalid salt %s", nsec3_str, salt_str); *salt = NULL; return ODS_STATUS_ERR; } /* construct salt data */ salt_tmp = (uint8_t*) calloc(*salt_len / 2, sizeof(uint8_t)); if (!salt_tmp) { ods_log_error("[%s] construct salt data for %s failed", nsec3_str, salt_str); *salt = NULL; return ODS_STATUS_MALLOC_ERR; } for (c = 0; c < *salt_len; c += 2) { if (isxdigit((int) salt_str[c]) && isxdigit((int) salt_str[c+1])) { salt_tmp[c/2] = (uint8_t) ldns_hexdigit_to_int(salt_str[c]) * 16 + ldns_hexdigit_to_int(salt_str[c+1]); } else { ods_log_error("[%s] invalid salt %s", nsec3_str, salt_str); free((void*)salt_tmp); *salt = NULL; return ODS_STATUS_ERR; } } *salt_len = *salt_len / 2; /* update length */ *salt = salt_tmp; return ODS_STATUS_OK; } /** * Create new NSEC3 parameters. * */ nsec3params_type* nsec3params_create(void* sc, uint8_t algo, uint8_t flags, uint16_t iter, const char* salt) { nsec3params_type* nsec3params = NULL; uint8_t salt_len; /* calculate salt len */ uint8_t* salt_data; /* calculate salt data */ if (!sc) { return NULL; } CHECKALLOC(nsec3params = (nsec3params_type*) malloc(sizeof(nsec3params_type))); if (!nsec3params) { ods_log_error("[%s] unable to create: allocator_alloc() failed", nsec3_str); return NULL; } nsec3params->sc = sc; nsec3params->algorithm = algo; nsec3params->flags = flags; nsec3params->iterations = iter; /* construct the salt from the string */ if (nsec3params_create_salt(salt, &salt_len, &salt_data) != 0) { ods_log_error("[%s] unable to create: create salt failed", nsec3_str); free(nsec3params); return NULL; } nsec3params->salt_len = salt_len; nsec3params->salt_data = salt_data; nsec3params->rr = NULL; return nsec3params; } /** * Backup NSEC3 parameters. * */ void nsec3params_backup(FILE* fd, uint8_t algo, uint8_t flags, uint16_t iter, const char* salt, ldns_rr* rr, const char* version) { if (!fd) { return; } fprintf(fd, ";;Nsec3parameters: salt %s algorithm %u optout %u " "iterations %u\n", ((salt&&strlen(salt))?salt:"-"), (unsigned) algo, (unsigned) flags, (unsigned) iter); if (strcmp(version, ODS_SE_FILE_MAGIC_V2) == 0) { if (rr) { (void)util_rr_print(fd, rr); } fprintf(fd, ";;Nsec3done\n"); fprintf(fd, ";;\n"); } } /** * Clean up NSEC3 parameters. * */ void nsec3params_cleanup(nsec3params_type* nsec3params) { if (!nsec3params) { return; } free(nsec3params->salt_data); free(nsec3params); } opendnssec-2.1.13/signer/src/signer/nsec3params.h0000644000077000001440000000621314446272525016627 00000000000000/* * 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 SIGNER_NSEC3PARAMS_H #define SIGNER_NSEC3PARAMS_H #include "config.h" #include #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_UNISTD_H # include #endif #include typedef struct nsec3params_struct nsec3params_type; #include "status.h" #include "signconf.h" struct nsec3params_struct { signconf_type* sc; uint8_t algorithm; uint8_t flags; uint16_t iterations; uint8_t salt_len; uint8_t* salt_data; ldns_rr* rr; }; /** * Create NSEC3 salt. * \param[in] salt_str the salt in string format * \param[out] salt_len lenght of the salt data * \param[out] salt salt in raw data format * \return ods_status status * */ extern ods_status nsec3params_create_salt(const char* salt_str, uint8_t* salt_len, uint8_t** salt); /** * Create new NSEC3 parameters. * \param[in] sc signer configuration reference * \param[in] algo algorithm * \param[in] flags flags, Opt-Out or Opt-In * \param[in] iter number of iterations * \param[in] salt salt * \return nsec3params_type* the created nsec3params * */ extern nsec3params_type* nsec3params_create(void* sc, uint8_t algo, uint8_t flags, uint16_t iter, const char* salt); /** * Backup NSEC3 parameters. * \param[in] fd file descriptor * \param[in] algo algorithm * \param[in] flags glags, Opt-Out or Opt-In * \param[in] iter number of iterations * \param[in] salt salt * \param[in] rr NSEC3PARAM RR * \param[in] version version string * */ void nsec3params_backup(FILE* fd, uint8_t algo, uint8_t flags, uint16_t iter, const char* salt, ldns_rr* rr, const char* version); /** * Clean up the NSEC3 parameters. * \param[in] nsec3params the nsec3param to be deleted * */ extern void nsec3params_cleanup(nsec3params_type* nsec3params); #endif /* SIGNER_NSEC3PARAMS_H */ opendnssec-2.1.13/signer/src/signer/domain.h0000644000077000001440000001141514446272525015657 00000000000000/* * 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 SIGNER_DOMAIN_H #define SIGNER_DOMAIN_H #include "config.h" #include #include typedef struct domain_struct domain_type; #include "status.h" #include "signer/rrset.h" #include "signer/signconf.h" #include "signer/zone.h" #define SE_NSEC_RDATA_NXT 0 #define SE_NSEC_RDATA_BITMAP 1 #define SE_NSEC3_RDATA_NSEC3PARAMS 4 #define SE_NSEC3_RDATA_NXT 4 #define SE_NSEC3_RDATA_BITMAP 5 /** * Domain. * */ struct domain_struct { denial_type* denial; zone_type* zone; ldns_rbnode_t* node; ldns_rdf* dname; domain_type* parent; rrset_type* rrsets; unsigned is_new : 1; unsigned is_apex : 1; /* apex */ }; /** * Log domain name. * \param[in] rdf domain name * \param[in] pre log message * \param[in] level log level * */ void log_dname(ldns_rdf* rdf, const char* pre, int level); /** * Create domain. * \param[in] zoneptr zone reference * \param[in] dname owner name * \return domain_type* domain * */ domain_type* domain_create(zone_type* zone, ldns_rdf* dname); /** * Count the number of RRsets at this domain with RRs that have is_added. * \param[in] domain domain * \return size_t number of RRsets * */ size_t domain_count_rrset_is_added(domain_type* domain); /** * Look up RRset at this domain. * \param[in] domain the domain * \param[in] rrtype RRtype * \return rrset_type* RRset, if found * */ rrset_type* domain_lookup_rrset(domain_type* domain, ldns_rr_type rrtype); /** * Add RRset to domain. * \param[in] domain domain * \param[in] rrset RRset * */ void domain_add_rrset(domain_type* domain, rrset_type* rrset); /** * Apply differences at domain. * \param[in] domain domain * \param[in] is_ixfr true if incremental change * \param[in] more_coming more transactions possible * */ void domain_diff(domain_type* domain, unsigned is_ixfr, unsigned more_coming); /** * Rollback differences at domain. * \param[in] domain domain * \param[in] keepsc keep RRs that did not came from the adapter * */ void domain_rollback(domain_type* domain, int keepsc); /** * Check whether a domain is an empty non-terminal to an unsigned delegation. * \param[in] domain domain * \return int yes or no * */ int domain_ent2unsignedns(domain_type* domain); /** * Check whether a domain is a delegation, regardless of parent. * \param[in] domain domain * \return ldns_rr_type RRtype that hints whether the domain is occluded. * LDNS_RR_TYPE_NS Unsigned delegation * LDNS_RR_TYPE_DS Signed delegation * LDNS_RR_TYPE_SOA Authoritative data (or signed delegation) * */ ldns_rr_type domain_is_delegpt(domain_type* domain); /** * Check whether the domain is occluded. * \param[in] domain domain * \return ldns_rr_type RRtype that hints whether the domain is occluded. * LDNS_RR_TYPE_DNAME Occluded * LDNS_RR_TYPE_A Glue * LDNS_RR_TYPE_SOA Authoritative data or delegation * */ ldns_rr_type domain_is_occluded(domain_type* domain); /** * Print domain. * \param[in] fd file descriptor * \param[in] domain domain * \param[out] status status * */ void domain_print(FILE* fd, domain_type* domain, ods_status* status); /** * Clean up domain. * \param[in] domain domain to cleanup * */ void domain_cleanup(domain_type* domain); /** * Backup domain. * \param[in] fd file descriptor * \param[in] domain domain * \param[in] sigs do RRSIGS if true, otherwise do RRset * */ void domain_backup2(FILE* fd, domain_type* domain, int sigs); #endif /* SIGNER_DOMAIN_H */ opendnssec-2.1.13/signer/src/signer/domain.c0000644000077000001440000003235614446272525015661 00000000000000/* * 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. * */ /** * Domain. * */ #include "config.h" #include "log.h" #include "signer/backup.h" #include "signer/denial.h" #include "signer/domain.h" #include "signer/ixfr.h" #include "signer/zone.h" static const char* dname_str = "domain"; /** * Log domain name. * */ void log_dname(ldns_rdf *rdf, const char* pre, int level) { char* str = NULL; if (ods_log_get_level() < level) { return; } str = ldns_rdf2str(rdf); if (!str) { return; } if (level == LOG_EMERG) { ods_fatal_exit("[%s] %s: %s", dname_str, pre?pre:"", str); } else if (level == LOG_ALERT) { ods_log_alert("[%s] %s: %s", dname_str, pre?pre:"", str); } else if (level == LOG_CRIT) { ods_log_crit("[%s] %s: %s", dname_str, pre?pre:"", str); } else if (level == LOG_ERR) { ods_log_error("[%s] %s: %s", dname_str, pre?pre:"", str); } else if (level == LOG_WARNING) { ods_log_warning("[%s] %s: %s", dname_str, pre?pre:"", str); } else if (level == LOG_NOTICE) { ods_log_info("[%s] %s: %s", dname_str, pre?pre:"", str); } else if (level == LOG_INFO) { ods_log_verbose("[%s] %s: %s", dname_str, pre?pre:"", str); } else if (level == LOG_DEBUG) { ods_log_debug("[%s] %s: %s", dname_str, pre?pre:"", str); } else if (level == LOG_DEEEBUG) { ods_log_deeebug("[%s] %s: %s", dname_str, pre?pre:"", str); } else { ods_log_deeebug("[%s] %s: %s", dname_str, pre?pre:"", str); } free((void*)str); } /** * Create domain. * */ domain_type* domain_create(zone_type* zone, ldns_rdf* dname) { domain_type* domain = NULL; if (!dname || !zone) { return NULL; } CHECKALLOC(domain = (domain_type*) malloc(sizeof(domain_type))); domain->dname = ldns_rdf_clone(dname); if (!domain->dname) { ods_log_error("[%s] unable to create domain: ldns_rdf_clone() " "failed", dname_str); free(domain); return NULL; } domain->zone = zone; domain->denial = NULL; /* no reference yet */ domain->node = NULL; /* not in db yet */ domain->rrsets = NULL; domain->parent = NULL; domain->is_apex = 0; domain->is_new = 0; return domain; } /** * Count the number of RRsets at this domain with RRs that have is_added. * */ size_t domain_count_rrset_is_added(domain_type* domain) { rrset_type* rrset = NULL; size_t count = 0; if (!domain) { return 0; } rrset = domain->rrsets; while (rrset) { if (rrset_count_rr_is_added(rrset)) { count++; } rrset = rrset->next; } return count; } /** * Look up RRset at this domain. * */ rrset_type* domain_lookup_rrset(domain_type* domain, ldns_rr_type rrtype) { rrset_type* rrset = NULL; if (!domain || !domain->rrsets || !rrtype) { return NULL; } rrset = domain->rrsets; while (rrset && rrset->rrtype != rrtype) { rrset = rrset->next; } return rrset; } /** * Add RRset to domain. * */ void domain_add_rrset(domain_type* domain, rrset_type* rrset) { rrset_type** p = NULL; denial_type* denial = NULL; ods_log_assert(domain); ods_log_assert(rrset); if (!domain->rrsets) { domain->rrsets = rrset; } else { p = &domain->rrsets; while(*p) { p = &((*p)->next); } *p = rrset; rrset->next = NULL; } log_rrset(domain->dname, rrset->rrtype, "+RRSET", LOG_DEEEBUG); rrset->domain = (void*) domain; if (domain->denial) { denial = (denial_type*) domain->denial; denial->bitmap_changed = 1; } } /** * Apply differences at domain. * */ void domain_diff(domain_type* domain, unsigned is_ixfr, unsigned more_coming) { denial_type* denial = NULL; rrset_type* rrset = NULL; rrset_type* prev_rrset = NULL; if (!domain) { return; } rrset = domain->rrsets; while (rrset) { if (rrset->rrtype == LDNS_RR_TYPE_NSEC3PARAMS || rrset->rrtype == LDNS_RR_TYPE_DNSKEY) { /* always do full diff on NSEC3PARAMS | DNSKEY RRset */ rrset_diff(rrset, 0, more_coming); } else { rrset_diff(rrset, is_ixfr, more_coming); } if (rrset->rr_count <= 0) { /* delete entire rrset */ if (!prev_rrset) { domain->rrsets = rrset->next; } else { prev_rrset->next = rrset->next; } rrset->next = NULL; log_rrset(domain->dname, rrset->rrtype, "-RRSET", LOG_DEEEBUG); rrset_cleanup(rrset); if (!prev_rrset) { rrset = domain->rrsets; } else { rrset = prev_rrset->next; } if (domain->denial) { denial = (denial_type*) domain->denial; denial->bitmap_changed = 1; } } else { /* just go to next rrset */ prev_rrset = rrset; rrset = rrset->next; } } } /** * Rollback differences at domain. * */ void domain_rollback(domain_type* domain, int keepsc) { denial_type* denial = NULL; rrset_type* rrset = NULL; rrset_type* prev_rrset = NULL; int del_rrset = 0; uint16_t i = 0; if (!domain) { return; } rrset = domain->rrsets; while (rrset) { if (keepsc) { /* skip rollback for NSEC3PARAM and DNSKEY RRset */ if (rrset->rrtype == LDNS_RR_TYPE_NSEC3PARAMS || rrset->rrtype == LDNS_RR_TYPE_DNSKEY) { prev_rrset = rrset; rrset = rrset->next; continue; } } /* walk rrs */ for (i=0; i < rrset->rr_count; i++) { rrset->rrs[i].is_added = 0; rrset->rrs[i].is_removed = 0; if (!rrset->rrs[i].exists) { /* can we delete the RRset? */ if(rrset->rr_count == 1) { del_rrset = 1; } rrset_del_rr(rrset, i); i--; } } /* next rrset */ if (del_rrset) { /* delete entire rrset */ if (!prev_rrset) { domain->rrsets = rrset->next; } else { prev_rrset->next = rrset->next; } rrset->next = NULL; log_rrset(domain->dname, rrset->rrtype, "-RRSET", LOG_DEEEBUG); rrset_cleanup(rrset); if (!prev_rrset) { rrset = domain->rrsets; } else { rrset = prev_rrset->next; } if (domain->denial) { denial = (denial_type*) domain->denial; denial->bitmap_changed = 0; } del_rrset = 0; } else { /* just go to next rrset */ prev_rrset = rrset; rrset = rrset->next; } } } /** * Check whether a domain is an empty non-terminal to unsigned delegation. * */ int domain_ent2unsignedns(domain_type* domain) { ldns_rbnode_t* n = LDNS_RBTREE_NULL; domain_type* d = NULL; ods_log_assert(domain); if (domain->rrsets) { return 0; /* not an empty non-terminal */ } n = ldns_rbtree_next(domain->node); while (n && n != LDNS_RBTREE_NULL) { d = (domain_type*) n->data; if (!ldns_dname_is_subdomain(d->dname, domain->dname)) { break; } if (d->rrsets) { if (domain_is_delegpt(d) != LDNS_RR_TYPE_NS && domain_is_occluded(d) == LDNS_RR_TYPE_SOA) { /* domain has signed delegation/auth */ return 0; } } /* maybe there is data at the next domain */ n = ldns_rbtree_next(n); } return 1; } /** * Check whether the domain is a delegation point. * */ ldns_rr_type domain_is_delegpt(domain_type* domain) { ods_log_assert(domain); if (domain->is_apex) { return LDNS_RR_TYPE_SOA; } if (domain_lookup_rrset(domain, LDNS_RR_TYPE_NS)) { if (domain_lookup_rrset(domain, LDNS_RR_TYPE_DS)) { /* Signed delegation */ return LDNS_RR_TYPE_DS; } else { /* Unsigned delegation */ return LDNS_RR_TYPE_NS; } } /* Authoritative */ return LDNS_RR_TYPE_SOA; } /** * Check whether the domain is occluded. * */ ldns_rr_type domain_is_occluded(domain_type* domain) { domain_type* parent = NULL; ods_log_assert(domain); if (domain->is_apex) { return LDNS_RR_TYPE_SOA; } parent = domain->parent; while (parent && !parent->is_apex) { if (domain_lookup_rrset(parent, LDNS_RR_TYPE_NS)) { /* Glue / Empty non-terminal to Glue */ return LDNS_RR_TYPE_A; } if (domain_lookup_rrset(parent, LDNS_RR_TYPE_DNAME)) { /* Occluded data / Empty non-terminal to Occluded data */ return LDNS_RR_TYPE_DNAME; } parent = parent->parent; } /* Authoritative or delegation */ return LDNS_RR_TYPE_SOA; } /** * Print domain. * */ void domain_print(FILE* fd, domain_type* domain, ods_status* status) { char* str = NULL; rrset_type* rrset = NULL; rrset_type* soa_rrset = NULL; rrset_type* cname_rrset = NULL; if (!domain || !fd) { if (status) { ods_log_crit("[%s] unable to print domain: domain or fd missing", dname_str); *status = ODS_STATUS_ASSERT_ERR; } return; } /* empty non-terminal? */ if (!domain->rrsets) { str = ldns_rdf2str(domain->dname); fprintf(fd, ";;Empty non-terminal %s\n", str); free((void*)str); /* Denial of Existence */ if (domain->denial) { denial_print(fd, (denial_type*) domain->denial, status); } return; } /* no other data may accompany a CNAME */ cname_rrset = domain_lookup_rrset(domain, LDNS_RR_TYPE_CNAME); if (cname_rrset) { rrset_print(fd, cname_rrset, 0, status); } else { /* if SOA, print soa first */ if (domain->is_apex) { soa_rrset = domain_lookup_rrset(domain, LDNS_RR_TYPE_SOA); if (soa_rrset) { rrset_print(fd, soa_rrset, 0, status); if (status && *status != ODS_STATUS_OK) { return; } } } /* print other RRsets */ rrset = domain->rrsets; while (rrset) { /* skip SOA RRset */ if (rrset->rrtype != LDNS_RR_TYPE_SOA) { rrset_print(fd, rrset, 0, status); } if (status && *status != ODS_STATUS_OK) { ods_log_crit("[%s] failed to print one or more RRsets: %s", dname_str, ods_status2str(*status)); return; } rrset = rrset->next; } } /* Denial of Existence */ if (domain->denial) { denial_print(fd, (denial_type*) domain->denial, status); } } /** * Clean up domain. * */ void domain_cleanup(domain_type* domain) { if (!domain) { return; } ldns_rdf_deep_free(domain->dname); rrset_cleanup(domain->rrsets); free(domain); } /** * Backup domain. * */ void domain_backup2(FILE* fd, domain_type* domain, int sigs) { rrset_type* rrset = NULL; if (!domain || !fd) { return; } /* if SOA, print soa first */ if (domain->is_apex) { rrset = domain_lookup_rrset(domain, LDNS_RR_TYPE_SOA); if (rrset) { if (sigs) { rrset_backup2(fd, rrset); } else { rrset_print(fd, rrset, 1, NULL); } } } rrset = domain->rrsets; while (rrset) { /* skip SOA RRset */ if (rrset->rrtype != LDNS_RR_TYPE_SOA) { if (sigs) { rrset_backup2(fd, rrset); } else { rrset_print(fd, rrset, 1, NULL); } } rrset = rrset->next; } } opendnssec-2.1.13/signer/src/signer/namedb.c0000644000077000001440000007723414446272525015644 00000000000000/* * 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. * */ /** * Domain name database. * */ #include "config.h" #include "status.h" #include "file.h" #include "log.h" #include "util.h" #include "signer/backup.h" #include "signer/namedb.h" #include "signer/zone.h" const char* db_str = "namedb"; /** * Convert a domain to a tree node. * */ static ldns_rbnode_t* domain2node(domain_type* domain) { ldns_rbnode_t* node = (ldns_rbnode_t*) malloc(sizeof(ldns_rbnode_t)); if (!node) { return NULL; } node->key = domain->dname; node->data = domain; return node; } /** * Convert a denial to a tree node. * */ static ldns_rbnode_t* denial2node(denial_type* denial) { ldns_rbnode_t* node = (ldns_rbnode_t*) malloc(sizeof(ldns_rbnode_t)); if (!node) { return NULL; } node->key = denial->dname; node->data = denial; return node; } /** * Compare domains. * */ static int domain_compare(const void* a, const void* b) { ldns_rdf* x = (ldns_rdf*)a; ldns_rdf* y = (ldns_rdf*)b; return ldns_dname_compare(x, y); } /** * Initialize denials. * */ void namedb_init_denials(namedb_type* db) { if (db) { db->denials = ldns_rbtree_create(domain_compare); } } /** * Initialize domains. * */ static void namedb_init_domains(namedb_type* db) { if (db) { db->domains = ldns_rbtree_create(domain_compare); } } /** * Create a new namedb. * */ namedb_type* namedb_create(void* zone) { namedb_type* db = NULL; zone_type* z = (zone_type*) zone; ods_log_assert(z); ods_log_assert(z->name); CHECKALLOC(db = (namedb_type*) malloc(sizeof(namedb_type))); if (!db) { ods_log_error("[%s] unable to create namedb for zone %s: " "allocator_alloc() failed", db_str, z->name); return NULL; } db->zone = zone; namedb_init_domains(db); if (!db->domains) { ods_log_error("[%s] unable to create namedb for zone %s: " "init domains failed", db_str, z->name); namedb_cleanup(db); return NULL; } namedb_init_denials(db); if (!db->denials) { ods_log_error("[%s] unable to create namedb for zone %s: " "init denials failed", db_str, z->name); namedb_cleanup(db); return NULL; } db->inbserial = 0; db->intserial = 0; db->outserial = 0; db->altserial = 0; db->is_initialized = 0; db->have_serial = 0; db->serial_updated = 0; db->force_serial = 0; return db; } /** * Internal lookup domain function. * */ static void* namedb_domain_search(ldns_rbtree_t* tree, ldns_rdf* dname) { ldns_rbnode_t* node = LDNS_RBTREE_NULL; if (!tree || !dname) { return NULL; } node = ldns_rbtree_search(tree, dname); if (node && node != LDNS_RBTREE_NULL) { return (void*) node->data; } return NULL; } static uint32_t max(uint32_t a, uint32_t b) { return (aoutserial, inbound_serial); if (!db->have_serial) { prev = inbound_serial; } ods_log_debug("[%s] zone %s update serial: format=%s in=%u internal=%u " "out=%u now=%u", db_str, zone_name, format, db->inbserial, db->intserial, db->outserial, (uint32_t) time_now()); if (db->force_serial) { soa = db->altserial; if (!util_serial_gt(soa, prev)) { ods_log_warning("[%s] zone %s unable to enforce serial: %u does not " " increase %u. Serial set to %u", db_str, zone_name, soa, prev, (prev+1)); soa = prev + 1; } else { ods_log_info("[%s] zone %s enforcing serial %u", db_str, zone_name, soa); } db->force_serial = 0; } else if (ods_strcmp(format, "unixtime") == 0) { soa = (uint32_t) time_now(); if (!util_serial_gt(soa, prev)) { if (!db->have_serial) { ods_log_warning("[%s] zone %s unable to use unixtime as serial: " "%u does not increase %u. Serial set to %u", db_str, zone_name, soa, prev, (prev+1)); } soa = prev + 1; } } else if (ods_strcmp(format, "datecounter") == 0) { soa = (uint32_t) time_datestamp(0, "%Y%m%d", NULL) * 100; if (!util_serial_gt(soa, prev)) { if (!db->have_serial) { ods_log_info("[%s] zone %s unable to use datecounter as " "serial: %u does not increase %u. Serial set to %u", db_str, zone_name, soa, prev, (prev+1)); } soa = prev + 1; } } else if (ods_strcmp(format, "counter") == 0) { soa = inbound_serial + 1; if (db->have_serial && !util_serial_gt(soa, prev)) { soa = prev + 1; } } else if (ods_strcmp(format, "keep") == 0) { prev = db->outserial; soa = inbound_serial; if (db->have_serial && !util_serial_gt(soa, prev)) { ods_log_error("[%s] zone %s cannot keep SOA SERIAL from input zone " " (%u): previous output SOA SERIAL is %u", db_str, zone_name, soa, prev); return ODS_STATUS_CONFLICT_ERR; } } else { ods_log_error("[%s] zone %s unknown serial type %s", db_str, zone_name, format); return ODS_STATUS_ERR; } /* serial is stored in 32 bits */ update = soa - prev; if (update > 0x7FFFFFFF) { update = 0x7FFFFFFF; } if (!db->have_serial) { db->intserial = soa; } else { db->intserial = prev + update; /* automatically does % 2^32 */ } ods_log_debug("[%s] zone %s update serial: %u + %u = %u", db_str, zone_name, prev, update, db->intserial); return ODS_STATUS_OK; } /** * Add empty non-terminals for domain. * */ ods_status namedb_domain_entize(namedb_type* db, domain_type* domain, ldns_rdf* apex) { ldns_rdf* parent_rdf = NULL; domain_type* parent_domain = NULL; ods_log_assert(apex); ods_log_assert(domain); ods_log_assert(domain->dname); ods_log_assert(db); ods_log_assert(db->domains); if (domain->parent) { /* domain already has parent */ return ODS_STATUS_OK; } while (domain && ldns_dname_is_subdomain(domain->dname, apex) && ldns_dname_compare(domain->dname, apex) != 0) { /** * RFC5155: * 4. If the difference in number of labels between the apex and * the original owner name is greater than 1, additional NSEC3 * RRs need to be added for every empty non-terminal between * the apex and the original owner name. */ parent_rdf = ldns_dname_left_chop(domain->dname); if (!parent_rdf) { ods_log_error("[%s] unable to entize domain: left chop failed", db_str); return ODS_STATUS_ERR; } parent_domain = namedb_lookup_domain(db, parent_rdf); if (!parent_domain) { parent_domain = namedb_add_domain(db, parent_rdf); ldns_rdf_deep_free(parent_rdf); if (!parent_domain) { ods_log_error("[%s] unable to entize domain: failed to add " "parent domain", db_str); return ODS_STATUS_ERR; } domain->parent = parent_domain; /* continue with the parent domain */ domain = parent_domain; } else { ldns_rdf_deep_free(parent_rdf); domain->parent = parent_domain; /* domain has parent, entize done */ domain = NULL; } } return ODS_STATUS_OK; } /** * Lookup domain. * */ domain_type* namedb_lookup_domain(namedb_type* db, ldns_rdf* dname) { if (!db) { return NULL; } return (domain_type*) namedb_domain_search(db->domains, dname); } /** * Add domain to namedb. * */ domain_type* namedb_add_domain(namedb_type* db, ldns_rdf* dname) { domain_type* domain = NULL; ldns_rbnode_t* new_node = LDNS_RBTREE_NULL; if (!dname || !db || !db->domains) { return NULL; } domain = domain_create(db->zone, dname); if (!domain) { ods_log_error("[%s] unable to add domain: domain_create() failed", db_str); return NULL; } new_node = domain2node(domain); if (!new_node) { ods_log_error("[%s] unable to add domain: domain2node() failed", db_str); return NULL; } if (ldns_rbtree_insert(db->domains, new_node) == NULL) { ods_log_error("[%s] unable to add domain: already present", db_str); log_dname(domain->dname, "ERR +DOMAIN", LOG_ERR); domain_cleanup(domain); free((void*)new_node); return NULL; } domain = (domain_type*) new_node->data; domain->node = new_node; domain->is_new = 1; log_dname(domain->dname, "+DOMAIN", LOG_DEEEBUG); return domain; } /** * Delete domain from namedb * */ domain_type* namedb_del_domain(namedb_type* db, domain_type* domain) { ldns_rbnode_t* node = LDNS_RBTREE_NULL; if (!domain || !db || !db->domains) { ods_log_error("[%s] unable to delete domain: !db || !domain", db_str); return NULL; } if (domain->rrsets || domain->denial) { ods_log_error("[%s] unable to delete domain: domain in use", db_str); log_dname(domain->dname, "ERR -DOMAIN", LOG_ERR); return NULL; } node = ldns_rbtree_delete(db->domains, (const void*)domain->dname); if (node) { ods_log_assert(domain->node == node); ods_log_assert(!domain->rrsets); ods_log_assert(!domain->denial); free((void*)node); domain->node = NULL; log_dname(domain->dname, "-DOMAIN", LOG_DEEEBUG); return domain; } ods_log_error("[%s] unable to delete domain: not found", db_str); log_dname(domain->dname, "ERR -DOMAIN", LOG_ERR); return NULL; } /** * Lookup denial. * */ denial_type* namedb_lookup_denial(namedb_type* db, ldns_rdf* dname) { if (!db) { return NULL; } return (denial_type*) namedb_domain_search(db->denials, dname); } /** * See if a domain is an empty terminal * */ static int domain_is_empty_terminal(domain_type* domain) { ldns_rbnode_t* n = LDNS_RBTREE_NULL; domain_type* d = NULL; ods_log_assert(domain); if (domain->is_apex) { return 0; } if (domain->rrsets) { return 0; } n = ldns_rbtree_next(domain->node); if (n) { d = (domain_type*) n->data; } /* if it has children domains, do not delete it */ if(d && ldns_dname_is_subdomain(d->dname, domain->dname)) { return 0; } return 1; } /** * See if a domain can be deleted * */ static int domain_can_be_deleted(domain_type* domain) { ods_log_assert(domain); return (domain_is_empty_terminal(domain) && !domain->denial); } /** * Add NSEC data point. * */ static void namedb_add_nsec_trigger(namedb_type* db, domain_type* domain) { ldns_rr_type dstatus = LDNS_RR_TYPE_FIRST; denial_type* denial = NULL; ods_log_assert(db); ods_log_assert(domain); ods_log_assert(!domain->denial); dstatus = domain_is_occluded(domain); if (dstatus == LDNS_RR_TYPE_DNAME || dstatus == LDNS_RR_TYPE_A) { return; /* don't do occluded/glue domain */ } if (!domain->rrsets) { return; /* don't do empty domain */ } /* ok, nsecify this domain */ denial = namedb_add_denial(db, domain->dname, NULL); ods_log_assert(denial); denial->domain = (void*) domain; domain->denial = (void*) denial; domain->is_new = 0; } /** * Add NSEC3 data point. * */ static void namedb_add_nsec3_trigger(namedb_type* db, domain_type* domain, nsec3params_type* n3p) { ldns_rr_type dstatus = LDNS_RR_TYPE_FIRST; denial_type* denial = NULL; ods_log_assert(db); ods_log_assert(n3p); ods_log_assert(domain); ods_log_assert(!domain->denial); dstatus = domain_is_occluded(domain); if (dstatus == LDNS_RR_TYPE_DNAME || dstatus == LDNS_RR_TYPE_A) { return; /* don't do occluded/glue domain */ } /* Opt-Out? */ if (n3p->flags) { dstatus = domain_is_delegpt(domain); /* If Opt-Out is being used, owner names of unsigned delegations MAY be excluded. */ if (dstatus == LDNS_RR_TYPE_NS) { return; } } /* ok, nsecify3 this domain */ denial = namedb_add_denial(db, domain->dname, n3p); ods_log_assert(denial); denial->domain = (void*) domain; domain->denial = (void*) denial; domain->is_new = 0; } /** * See if denials need to be added. * */ static void namedb_add_denial_trigger(namedb_type* db, domain_type* domain) { zone_type* zone = NULL; ods_log_assert(db); ods_log_assert(domain); if (!domain->denial) { zone = domain->zone; ods_log_assert(zone); ods_log_assert(zone->signconf); if (!zone->signconf->passthrough) { if (zone->signconf->nsec_type == LDNS_RR_TYPE_NSEC) { namedb_add_nsec_trigger(db, domain); } else { ods_log_assert(zone->signconf->nsec_type == LDNS_RR_TYPE_NSEC3); namedb_add_nsec3_trigger(db, domain, zone->signconf->nsec3params); } } } } /** * Delete NSEC data point. * */ static void namedb_del_nsec_trigger(namedb_type* db, domain_type* domain) { ldns_rr_type dstatus = LDNS_RR_TYPE_FIRST; denial_type* denial = NULL; ods_log_assert(db); ods_log_assert(domain); ods_log_assert(domain->denial); dstatus = domain_is_occluded(domain); if (dstatus == LDNS_RR_TYPE_DNAME || dstatus == LDNS_RR_TYPE_A || domain_is_empty_terminal(domain) || !domain->rrsets) { /* domain has become occluded/glue or empty non-terminal*/ denial_diff((denial_type*) domain->denial); denial = namedb_del_denial(db, domain->denial); denial_cleanup(denial); domain->denial = NULL; } } /** * Delete NSEC3 data point. * */ static void namedb_del_nsec3_trigger(namedb_type* db, domain_type* domain, nsec3params_type* n3p) { ldns_rr_type dstatus = LDNS_RR_TYPE_FIRST; denial_type* denial = NULL; ods_log_assert(db); ods_log_assert(n3p); ods_log_assert(domain); ods_log_assert(domain->denial); dstatus = domain_is_occluded(domain); if (dstatus == LDNS_RR_TYPE_DNAME || dstatus == LDNS_RR_TYPE_A || domain_is_empty_terminal(domain)) { /* domain has become occluded/glue */ denial_diff((denial_type*) domain->denial); denial = namedb_del_denial(db, domain->denial); denial_cleanup(denial); domain->denial = NULL; } else if (n3p->flags) { dstatus = domain_is_delegpt(domain); /* If Opt-Out is being used, owner names of unsigned delegations MAY be excluded. */ if (dstatus == LDNS_RR_TYPE_NS) { denial_diff((denial_type*) domain->denial); denial = namedb_del_denial(db, domain->denial); denial_cleanup(denial); domain->denial = NULL; } } } /** * See if domains/denials can be deleted. * */ static int namedb_del_denial_trigger(namedb_type* db, domain_type* domain, int rollback) { domain_type* parent = NULL; zone_type* zone = NULL; unsigned is_deleted = 0; ods_log_assert(db); ods_log_assert(domain); ods_log_assert(domain->dname); zone = domain->zone; ods_log_assert(zone); ods_log_assert(zone->signconf); while(domain) { if (!rollback) { if (domain->denial) { if (zone->signconf->nsec_type == LDNS_RR_TYPE_NSEC) { namedb_del_nsec_trigger(db, domain); } else { ods_log_assert(zone->signconf->nsec_type == LDNS_RR_TYPE_NSEC3); namedb_del_nsec3_trigger(db, domain, zone->signconf->nsec3params); } } } parent = domain->parent; if (domain_can_be_deleted(domain)) { /* -DOMAIN */ domain = namedb_del_domain(db, domain); domain_cleanup(domain); is_deleted = 1; } /* continue with parent */ domain = parent; } return is_deleted; } /** * Hash domain name. * */ static ldns_rdf* dname_hash(ldns_rdf* dname, ldns_rdf* apex, nsec3params_type* nsec3params) { ldns_rdf* hashed_ownername = NULL; ldns_rdf* hashed_label = NULL; ods_log_assert(dname); ods_log_assert(apex); ods_log_assert(nsec3params); /** * The owner name of the NSEC3 RR is the hash of the original owner * name, prepended as a single label to the zone name. */ hashed_label = ldns_nsec3_hash_name(dname, nsec3params->algorithm, nsec3params->iterations, nsec3params->salt_len, nsec3params->salt_data); if (!hashed_label) { return NULL; } hashed_ownername = ldns_dname_cat_clone((const ldns_rdf*) hashed_label, (const ldns_rdf*) apex); if (!hashed_ownername) { return NULL; } ldns_rdf_deep_free(hashed_label); return hashed_ownername; } /** * Add denial to namedb. * */ denial_type* namedb_add_denial(namedb_type* db, ldns_rdf* dname, nsec3params_type* n3p) { zone_type* z = NULL; ldns_rbnode_t* new_node = LDNS_RBTREE_NULL; ldns_rbnode_t* pnode = LDNS_RBTREE_NULL; ldns_rdf* owner = NULL; denial_type* denial = NULL; denial_type* pdenial = NULL; ods_log_assert(db); ods_log_assert(db->denials); ods_log_assert(dname); /* nsec or nsec3 */ if (n3p) { z = (zone_type*) db->zone; owner = dname_hash(dname, z->apex, n3p); } else { owner = ldns_rdf_clone(dname); } if (!owner) { ods_log_error("[%s] unable to add denial: create owner failed", db_str); return NULL; } denial = denial_create(db->zone, owner); if (!denial) { ods_log_error("[%s] unable to add denial: denial_create() failed", db_str); return NULL; } new_node = denial2node(denial); if (!new_node) { ods_log_error("[%s] unable to add denial: denial2node() failed", db_str); return NULL; } if (!ldns_rbtree_insert(db->denials, new_node)) { ods_log_error("[%s] unable to add denial: already present", db_str); log_dname(denial->dname, "ERR +DENIAL", LOG_ERR); denial_cleanup(denial); free((void*)new_node); return NULL; } /* denial of existence data point added */ denial = (denial_type*) new_node->data; denial->node = new_node; denial->nxt_changed = 1; pnode = ldns_rbtree_previous(new_node); if (!pnode || pnode == LDNS_RBTREE_NULL) { pnode = ldns_rbtree_last(db->denials); } ods_log_assert(pnode); pdenial = (denial_type*) pnode->data; ods_log_assert(pdenial); pdenial->nxt_changed = 1; log_dname(denial->dname, "+DENIAL", LOG_DEEEBUG); return denial; } /** * Delete denial from namedb * */ denial_type* namedb_del_denial(namedb_type* db, denial_type* denial) { ldns_rbnode_t* node = LDNS_RBTREE_NULL; ldns_rbnode_t* pnode = LDNS_RBTREE_NULL; denial_type* pdenial = NULL; if (!denial || !db || !db->denials) { return NULL; } if (denial->rrset && denial->rrset->rr_count) { ods_log_error("[%s] unable to delete denial: denial in use [#%lu]", db_str, (unsigned long)denial->rrset->rr_count); log_dname(denial->dname, "ERR -DENIAL", LOG_ERR); return NULL; } pnode = ldns_rbtree_previous(denial->node); if (!pnode || pnode == LDNS_RBTREE_NULL) { pnode = ldns_rbtree_last(db->denials); } ods_log_assert(pnode); pdenial = (denial_type*) pnode->data; ods_log_assert(pdenial); node = ldns_rbtree_delete(db->denials, (const void*)denial->dname); if (!node) { ods_log_error("[%s] unable to delete denial: not found", db_str); log_dname(denial->dname, "ERR -DENIAL", LOG_ERR); return NULL; } ods_log_assert(denial->node == node); pdenial->nxt_changed = 1; free((void*)node); denial->domain = NULL; denial->node = NULL; log_dname(denial->dname, "-DENIAL", LOG_DEEEBUG); return denial; } /** * Apply differences in db. * */ void namedb_diff(namedb_type* db, unsigned is_ixfr, unsigned more_coming) { ldns_rbnode_t* node = LDNS_RBTREE_NULL; domain_type* domain = NULL; if (!db || !db->domains) { return; } node = ldns_rbtree_first(db->domains); if (!node || node == LDNS_RBTREE_NULL) { return; } while (node && node != LDNS_RBTREE_NULL) { domain = (domain_type*) node->data; node = ldns_rbtree_next(node); domain_diff(domain, is_ixfr, more_coming); } node = ldns_rbtree_first(db->domains); if (!node || node == LDNS_RBTREE_NULL) { return; } while (node && node != LDNS_RBTREE_NULL) { domain = (domain_type*) node->data; node = ldns_rbtree_next(node); if (!namedb_del_denial_trigger(db, domain, 0)) { /* del_denial did not delete domain */ namedb_add_denial_trigger(db, domain); } } } /** * Rollback differences in db. * */ void namedb_rollback(namedb_type* db, unsigned keepsc) { ldns_rbnode_t* node = LDNS_RBTREE_NULL; domain_type* domain = NULL; if (!db || !db->domains) { return; } node = ldns_rbtree_first(db->domains); if (!node || node == LDNS_RBTREE_NULL) { return; } while (node && node != LDNS_RBTREE_NULL) { domain = (domain_type*) node->data; node = ldns_rbtree_next(node); domain_rollback(domain, keepsc); (void) namedb_del_denial_trigger(db, domain, 1); } } /** * Nsecify db. * */ void namedb_nsecify(namedb_type* db, uint32_t* num_added) { ldns_rbnode_t* node = LDNS_RBTREE_NULL; ldns_rbnode_t* nxt_node = LDNS_RBTREE_NULL; denial_type* denial = NULL; denial_type* nxt = NULL; uint32_t nsec_added = 0; ods_log_assert(db); node = ldns_rbtree_first(db->denials); while (node && node != LDNS_RBTREE_NULL) { denial = (denial_type*) node->data; nxt_node = ldns_rbtree_next(node); if (!nxt_node || nxt_node == LDNS_RBTREE_NULL) { nxt_node = ldns_rbtree_first(db->denials); } nxt = (denial_type*) nxt_node->data; denial_nsecify(denial, nxt, &nsec_added); node = ldns_rbtree_next(node); } if (num_added) { *num_added = nsec_added; } } /** * Examine updates to db. * */ ods_status namedb_examine(namedb_type* db) { ods_status status = ODS_STATUS_OK; ldns_rbnode_t* node = LDNS_RBTREE_NULL; domain_type* domain = NULL; rrset_type* rrset = NULL; int soa_seen = 0; /* ldns_rr_type dstatus = LDNS_RR_TYPE_FIRST; ldns_rr_type delegpt = LDNS_RR_TYPE_FIRST; */ if (!db || !db->domains) { /* no db, no error */ return ODS_STATUS_OK; } if (db->domains->root != LDNS_RBTREE_NULL) { node = ldns_rbtree_first(db->domains); } while (node && node != LDNS_RBTREE_NULL) { domain = (domain_type*) node->data; rrset = domain_lookup_rrset(domain, LDNS_RR_TYPE_CNAME); if (rrset) { /* Thou shall not have other data next to CNAME */ if (domain_count_rrset_is_added(domain) > 1 && rrset_count_rr_is_added(rrset) > 0) { log_rrset(domain->dname, rrset->rrtype, "CNAME and other data at the same name", LOG_ERR); return ODS_STATUS_CONFLICT_ERR; } /* Thou shall have at most one CNAME per name */ if (rrset_count_rr_is_added(rrset) > 1) { log_rrset(domain->dname, rrset->rrtype, "multiple CNAMEs at the same name", LOG_ERR); return ODS_STATUS_CONFLICT_ERR; } } rrset = domain_lookup_rrset(domain, LDNS_RR_TYPE_DNAME); if (rrset) { /* Thou shall have at most one DNAME per name */ if (rrset_count_rr_is_added(rrset) > 1) { log_rrset(domain->dname, rrset->rrtype, "multiple DNAMEs at the same name", LOG_ERR); return ODS_STATUS_CONFLICT_ERR; } } if (!soa_seen && domain->is_apex) { rrset = domain_lookup_rrset(domain, LDNS_RR_TYPE_SOA); if (rrset) { /* Thou shall have one and only one SOA */ if (rrset_count_rr_is_added(rrset) != 1) { log_rrset(domain->dname, rrset->rrtype, "Wrong number of SOA records, should be 1", LOG_ERR); return ODS_STATUS_CONFLICT_ERR; } } else { log_rrset(domain->dname, LDNS_RR_TYPE_SOA, "missing SOA RRset", LOG_ERR); return ODS_STATUS_CONFLICT_ERR; } } /* dstatus = domain_is_occluded(domain); delegpt = domain_is_delegpt(domain); */ /* Thou shall not have occluded data in your zone file */ node = ldns_rbtree_next(node); } return status; } /** * Wipe out all NSEC RRsets. * */ void namedb_wipe_denial(namedb_type* db) { ldns_rbnode_t* node = LDNS_RBTREE_NULL; denial_type* denial = NULL; zone_type* zone = NULL; size_t i = 0; if (db && db->denials) { zone = (zone_type*) db->zone; ods_log_assert(zone); ods_log_assert(zone->name); ods_log_info("[%s] wipe denial of existence space zone %s", db_str, zone->name); node = ldns_rbtree_first(db->denials); while (node && node != LDNS_RBTREE_NULL) { denial = (denial_type*) node->data; if (!denial->rrset) { node = ldns_rbtree_next(node); continue; } for (i=0; i < denial->rrset->rr_count; i++) { if (denial->rrset->rrs[i].exists) { /* ixfr -RR */ pthread_mutex_lock(&zone->ixfr->ixfr_lock); if (zone->db->is_initialized) { ixfr_del_rr(zone->ixfr, denial->rrset->rrs[i].rr); } pthread_mutex_unlock(&zone->ixfr->ixfr_lock); } denial->rrset->rrs[i].exists = 0; rrset_del_rr(denial->rrset, i); i--; } rrset_drop_rrsigs(zone, denial->rrset); rrset_cleanup(denial->rrset); denial->rrset = NULL; node = ldns_rbtree_next(node); } } } /** * Export db to file. * */ void namedb_export(FILE* fd, namedb_type* db, ods_status* status) { ldns_rbnode_t* node = LDNS_RBTREE_NULL; domain_type* domain = NULL; if (!fd || !db || !db->domains) { if (status) { ods_log_error("[%s] unable to export namedb: file descriptor " "or name database missing", db_str); *status = ODS_STATUS_ASSERT_ERR; } return; } node = ldns_rbtree_first(db->domains); if (!node || node == LDNS_RBTREE_NULL) { fprintf(fd, "; empty zone\n"); if (status) { *status = ODS_STATUS_OK; } return; } while (node && node != LDNS_RBTREE_NULL) { domain = (domain_type*) node->data; if (domain) { domain_print(fd, domain, status); } node = ldns_rbtree_next(node); } } /** * Clean up domains in namedb. * */ static void domain_delfunc(ldns_rbnode_t* elem) { domain_type* domain = NULL; if (elem && elem != LDNS_RBTREE_NULL) { domain = (domain_type*) elem->data; domain_delfunc(elem->left); domain_delfunc(elem->right); domain_cleanup(domain); free((void*)elem); } } /** * Clean up denials. * */ static void denial_delfunc(ldns_rbnode_t* elem) { denial_type* denial = NULL; domain_type* domain = NULL; if (elem && elem != LDNS_RBTREE_NULL) { denial = (denial_type*) elem->data; denial_delfunc(elem->left); denial_delfunc(elem->right); domain = (domain_type*) denial->domain; if (domain) { domain->denial = NULL; } denial_cleanup(denial); free((void*)elem); } } /** * Clean up domains. * */ static void namedb_cleanup_domains(namedb_type* db) { if (db && db->domains) { domain_delfunc(db->domains->root); ldns_rbtree_free(db->domains); db->domains = NULL; } } /** * Clean up denials. * */ void namedb_cleanup_denials(namedb_type* db) { if (db && db->denials) { denial_delfunc(db->denials->root); ldns_rbtree_free(db->denials); db->denials = NULL; } } /** * Clean up namedb. * */ void namedb_cleanup(namedb_type* db) { zone_type* z = NULL; if (!db) { return; } z = (zone_type*) db->zone; if (!z) { return; } namedb_cleanup_denials(db); namedb_cleanup_domains(db); free(db); } /** * Backup namedb. * */ void namedb_backup2(FILE* fd, namedb_type* db) { ldns_rbnode_t* node = LDNS_RBTREE_NULL; domain_type* domain = NULL; denial_type* denial = NULL; if (!fd || !db) { return; } node = ldns_rbtree_first(db->domains); while (node && node != LDNS_RBTREE_NULL) { domain = (domain_type*) node->data; domain_backup2(fd, domain, 0); node = ldns_rbtree_next(node); } fprintf(fd, ";\n"); node = ldns_rbtree_first(db->denials); while (node && node != LDNS_RBTREE_NULL) { denial = (denial_type*) node->data; if (denial->rrset) { rrset_print(fd, denial->rrset, 1, NULL); } node = ldns_rbtree_next(node); } fprintf(fd, ";\n"); /* signatures */ node = ldns_rbtree_first(db->domains); while (node && node != LDNS_RBTREE_NULL) { domain = (domain_type*) node->data; domain_backup2(fd, domain, 1); node = ldns_rbtree_next(node); } node = ldns_rbtree_first(db->denials); while (node && node != LDNS_RBTREE_NULL) { denial = (denial_type*) node->data; if (denial->rrset) { rrset_backup2(fd, denial->rrset); } node = ldns_rbtree_next(node); } fprintf(fd, ";\n"); } opendnssec-2.1.13/signer/src/signer/zonelist.c0000644000077000001440000002717414446272525016263 00000000000000/* * 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 zonelist and all. */ #include "config.h" #include "parser/confparser.h" #include "parser/zonelistparser.h" #include "duration.h" #include "file.h" #include "log.h" #include "status.h" #include "signer/zone.h" #include "signer/zonelist.h" #include #include static const char* zl_str = "zonelist"; /** * Compare two zones. * */ static int zone_compare(const void* a, const void* b) { zone_type* x = (zone_type*)a; zone_type* y = (zone_type*)b; ods_log_assert(x); ods_log_assert(y); if (x->klass != y->klass) { if (x->klass < y->klass) { return -1; } return 1; } return ldns_dname_compare(x->apex, y->apex); } /** * Create a new zone list. * */ zonelist_type* zonelist_create() { zonelist_type* zlist = NULL; CHECKALLOC(zlist = (zonelist_type*) malloc(sizeof(zonelist_type))); if (!zlist) { ods_log_error("[%s] unable to create zonelist: allocator_alloc() " "failed", zl_str); return NULL; } zlist->zones = ldns_rbtree_create(zone_compare); if (!zlist->zones) { ods_log_error("[%s] unable to create zonelist: ldns_rbtree_create() " "failed", zl_str); free(zlist); return NULL; } zlist->last_modified = 0; pthread_mutex_init(&zlist->zl_lock, NULL); return zlist; } /** * Read a zonelist file. * */ static ods_status zonelist_read(zonelist_type* zl, const char* zlfile) { const char* rngfile = ODS_SE_RNGDIR "/zonelist.rng"; ods_status status = ODS_STATUS_OK; ods_log_assert(zlfile); ods_log_verbose("[%s] read file %s", zl_str, zlfile); status = parse_file_check(zlfile, rngfile); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to read file: parse error in %s", zl_str, zlfile); return status; } return parse_zonelist_zones((struct zonelist_struct*) zl, zlfile); } /** * Convert a zone to a tree node. * */ static ldns_rbnode_t* zone2node(zone_type* zone) { ldns_rbnode_t* node = (ldns_rbnode_t*) malloc(sizeof(ldns_rbnode_t)); if (!node) { return NULL; } node->key = zone; node->data = zone; return node; } /** * Lookup zone. * */ static zone_type* zonelist_lookup_zone(zonelist_type* zonelist, zone_type* zone) { ldns_rbnode_t* node = LDNS_RBTREE_NULL; if (zonelist && zonelist->zones && zone) { node = ldns_rbtree_search(zonelist->zones, zone); if (node) { return (zone_type*) node->data; } } return NULL; } /** * Lookup zone by name. * */ zone_type* zonelist_lookup_zone_by_name(zonelist_type* zonelist, const char* name, ldns_rr_class klass) { zone_type* zone = NULL; zone_type* result = NULL; if (zonelist && zonelist->zones && name && klass) { zone = zone_create((char*) name, klass); if (!zone) { ods_log_error("[%s] unable to lookup zone %s: " "zone_create() failed", zl_str, name); /* result stays NULL */ } else { result = zonelist_lookup_zone(zonelist, zone); zone_cleanup(zone); } } return result; } /** * Lookup zone by dname. * */ zone_type* zonelist_lookup_zone_by_dname(zonelist_type* zonelist, ldns_rdf* dname, ldns_rr_class klass) { char* name = NULL; zone_type* result = NULL; if (zonelist && zonelist->zones && dname && klass) { name = ldns_rdf2str(dname); result = zonelist_lookup_zone_by_name(zonelist, name, klass); free((void*)name); } return result; } /** * Add zone. * */ zone_type* zonelist_add_zone(zonelist_type* zlist, zone_type* zone) { ldns_rbnode_t* new_node = NULL; if (!zone) { return NULL; } if (!zlist || !zlist->zones) { zone_cleanup(zone); return NULL; } /* look up */ if (zonelist_lookup_zone(zlist, zone) != NULL) { ods_log_warning("[%s] unable to add zone %s: already present", zl_str, zone->name); zone_cleanup(zone); return NULL; } /* add */ new_node = zone2node(zone); if (ldns_rbtree_insert(zlist->zones, new_node) == NULL) { ods_log_error("[%s] unable to add zone %s: ldns_rbtree_insert() " "failed", zl_str, zone->name); free((void*) new_node); zone_cleanup(zone); return NULL; } zone->zl_status = ZONE_ZL_ADDED; zlist->just_added++; return zone; } /** * Delete zone. * */ void zonelist_del_zone(zonelist_type* zlist, zone_type* zone) { ldns_rbnode_t* old_node = LDNS_RBTREE_NULL; assert(zone); if (!zlist || !zlist->zones) { goto zone_not_present; } old_node = ldns_rbtree_delete(zlist->zones, zone); if (!old_node) { goto zone_not_present; } free((void*) old_node); return; zone_not_present: ods_log_warning("[%s] unable to delete zone %s: not present", zl_str, zone->name); } /** * Merge zone lists. * */ static void zonelist_merge(zonelist_type* zl1, zonelist_type* zl2) { zone_type* z1 = NULL; zone_type* z2 = NULL; ldns_rbnode_t* n1 = LDNS_RBTREE_NULL; ldns_rbnode_t* n2 = LDNS_RBTREE_NULL; int ret = 0; ods_log_assert(zl1); ods_log_assert(zl2); ods_log_assert(zl1->zones); ods_log_assert(zl2->zones); ods_log_debug("[%s] merge two zone lists", zl_str); n1 = ldns_rbtree_first(zl1->zones); n2 = ldns_rbtree_first(zl2->zones); while (n2 && n2 != LDNS_RBTREE_NULL) { z2 = (zone_type*) n2->data; if (n1 && n1 != LDNS_RBTREE_NULL) { z1 = (zone_type*) n1->data; } else { z1 = NULL; } if (!z2) { /* no more zones to merge into zl1 */ return; } else if (!z1) { /* just add remaining zones from zl2 */ z2 = zonelist_add_zone(zl1, z2); if (!z2) { ods_log_crit("[%s] merge failed: z2 not added", zl_str); return; } n2 = ldns_rbtree_next(n2); } else { /* compare the zones z1 and z2 */ ret = zone_compare(z1, z2); if (ret < 0) { /* remove zone z1, it is not present in the new list zl2 */ z1->zl_status = ZONE_ZL_REMOVED; zl1->just_removed++; n1 = ldns_rbtree_next(n1); } else if (ret > 0) { /* add the new zone z2 */ z2 = zonelist_add_zone(zl1, z2); if (!z2) { ods_log_crit("[%s] merge failed: z2 not added", zl_str); return; } n2 = ldns_rbtree_next(n2); } else { /* just update zone z1 */ n1 = ldns_rbtree_next(n1); n2 = ldns_rbtree_next(n2); zone_merge(z1, z2); zone_cleanup(z2); if (z1->zl_status == ZONE_ZL_UPDATED) { zl1->just_updated++; } z1->zl_status = ZONE_ZL_UPDATED; } } } /* remove remaining zones from z1 */ while (n1 && n1 != LDNS_RBTREE_NULL) { z1 = (zone_type*) n1->data; z1->zl_status = ZONE_ZL_REMOVED; zl1->just_removed++; n1 = ldns_rbtree_next(n1); } zl1->last_modified = zl2->last_modified; } /** * Update zone list. * */ ods_status zonelist_update(zonelist_type* zl, const char* zlfile) { zonelist_type* new_zlist = NULL; time_t st_mtime = 0; ods_status status = ODS_STATUS_OK; char* datestamp = NULL; ods_log_debug("[%s] update zone list", zl_str); if (!zl|| !zl->zones || !zlfile) { return ODS_STATUS_ASSERT_ERR; } /* is the file updated? */ /* OPENDNSSEC-686: changes happening within one second will not be * seen */ st_mtime = ods_file_lastmodified(zlfile); if (st_mtime <= zl->last_modified) { (void)time_datestamp(zl->last_modified, "%Y-%m-%d %T", &datestamp); ods_log_debug("[%s] zonelist file %s is unchanged since %s", zl_str, zlfile, datestamp?datestamp:"Unknown"); free((void*)datestamp); return ODS_STATUS_UNCHANGED; } /* create new zonelist */ new_zlist = zonelist_create(); if (!new_zlist) { ods_log_error("[%s] unable to update zonelist: zonelist_create() " "failed", zl_str); return ODS_STATUS_ERR; } /* read zonelist */ status = zonelist_read(new_zlist, zlfile); if (status == ODS_STATUS_OK) { zl->just_removed = 0; zl->just_added = 0; zl->just_updated = 0; new_zlist->last_modified = st_mtime; zonelist_merge(zl, new_zlist); (void)time_datestamp(zl->last_modified, "%Y-%m-%d %T", &datestamp); ods_log_debug("[%s] file %s is modified since %s", zl_str, zlfile, datestamp?datestamp:"Unknown"); free((void*)datestamp); } else { ods_log_error("[%s] unable to update zonelist: read file %s failed " "(%s)", zl_str, zlfile, ods_status2str(status)); } zonelist_free(new_zlist); return status; } /** * Internal zone cleanup function. * */ static void zone_delfunc(ldns_rbnode_t* elem) { zone_type* zone; if (elem && elem != LDNS_RBTREE_NULL) { zone = (zone_type*) elem->data; zone_delfunc(elem->left); zone_delfunc(elem->right); ods_log_deeebug("[%s] cleanup zone %s", zl_str, zone->name); zone_cleanup(zone); free((void*)elem); } } /** * Internal node cleanup function. * */ static void node_delfunc(ldns_rbnode_t* elem) { if (elem && elem != LDNS_RBTREE_NULL) { node_delfunc(elem->left); node_delfunc(elem->right); free((void*)elem); } } /** * Clean up a zonelist. * */ void zonelist_cleanup(zonelist_type* zl) { if (!zl) { return; } ods_log_debug("[%s] cleanup zonelist", zl_str); if (zl->zones) { zone_delfunc(zl->zones->root); ldns_rbtree_free(zl->zones); zl->zones = NULL; } pthread_mutex_destroy(&zl->zl_lock); free(zl); } /** * Free zonelist. * */ void zonelist_free(zonelist_type* zl) { if (!zl) { return; } if (zl->zones) { node_delfunc(zl->zones->root); ldns_rbtree_free(zl->zones); zl->zones = NULL; } pthread_mutex_destroy(&zl->zl_lock); free(zl); } opendnssec-2.1.13/signer/src/signer/keys.c0000644000077000001440000001561314446272525015362 00000000000000/* * 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. * */ /** * Signing keys. * */ #include "file.h" #include "log.h" #include "util.h" #include "signer/backup.h" #include "signer/keys.h" #include "signer/signconf.h" #include "status.h" static const char* key_str = "keys"; /** * Create a new key list. * */ keylist_type* keylist_create(signconf_type* signconf) { keylist_type* kl = NULL; if (!signconf) { return NULL; } CHECKALLOC(kl = (keylist_type*) malloc((sizeof(keylist_type)))); if (!kl) { ods_log_error("[%s] create list failed: allocator_alloc() failed", key_str); return NULL; } kl->sc = signconf; kl->count = 0; kl->keys = NULL; return kl; } /** * Lookup a key in the key list by locator. * */ key_type* keylist_lookup_by_locator(keylist_type* kl, const char* locator) { uint16_t i = 0; if (!kl || !locator || kl->count <= 0) { return NULL; } for (i=0; i < kl->count; i++) { if (&kl->keys[i] && kl->keys[i].locator) { if (ods_strcmp(kl->keys[i].locator, locator) == 0) { return &kl->keys[i]; } } } return NULL; } /** * Push a key to the key list. * */ key_type* keylist_push(keylist_type* kl, const char* locator, const char* resourcerecord, uint8_t algorithm, uint32_t flags, int publish, int ksk, int zsk) { key_type* keys_old = NULL; ods_log_assert(kl); keys_old = kl->keys; CHECKALLOC(kl->keys = (key_type*) malloc((kl->count + 1) * sizeof(key_type))); if (!kl->keys) { ods_fatal_exit("[%s] unable to add key: allocator_alloc() failed", key_str); } if (keys_old) { memcpy(kl->keys, keys_old, (kl->count) * sizeof(key_type)); } free(keys_old); kl->count++; kl->keys[kl->count -1].locator = locator; kl->keys[kl->count -1].resourcerecord = resourcerecord; kl->keys[kl->count -1].algorithm = algorithm; kl->keys[kl->count -1].flags = flags; kl->keys[kl->count -1].publish = publish; kl->keys[kl->count -1].ksk = ksk; kl->keys[kl->count -1].zsk = zsk; kl->keys[kl->count -1].dnskey = NULL; kl->keys[kl->count -1].params = NULL; return &kl->keys[kl->count -1]; } /** * Log key. * */ static void key_log(key_type* key, const char* name) { if (!key) { return; } ods_log_debug("[%s] zone %s key: LOCATOR[%s] FLAGS[%u] ALGORITHM[%u] " "KSK[%i] ZSK[%i] PUBLISH[%i]", key_str, name?name:"(null)", key->locator, key->flags, key->algorithm, key->ksk, key->zsk, key->publish); } /** * Log key list. * */ void keylist_log(keylist_type* kl, const char* name) { uint16_t i = 0; if (!kl || kl->count <= 0) { return; } for (i=0; i < kl->count; i++) { key_log(&kl->keys[i], name); } } /** * Clean up key. * */ static void key_delfunc(key_type* key) { if (!key) { return; } /*We leak this every time the signconf is reloaded. Although the IXFR structure*/ /*copies this RR there is a race condition between this func and the ixfr_del*/ /*function to copy / delete it. */ /*ldns_rr_free(key->dnskey);*/ hsm_sign_params_free(key->params); free((void*) key->locator); } /** * Clean up key list. * */ void keylist_cleanup(keylist_type* kl) { uint16_t i = 0; if (!kl) { return; } for (i=0; i < kl->count; i++) { key_delfunc(&kl->keys[i]); } free(kl->keys); free(kl); } /** * Backup key. * */ static void key_backup(FILE* fd, key_type* key, const char* version) { if (!fd || !key) { return; } fprintf(fd, ";;Key: locator %s algorithm %u flags %u publish %i ksk %i zsk %i keytag %d\n", key->locator, (unsigned) key->algorithm, (unsigned) key->flags, key->publish, key->ksk, key->zsk, ldns_calc_keytag(key->dnskey)); if (strcmp(version, ODS_SE_FILE_MAGIC_V2) == 0) { if (key->dnskey) { (void)util_rr_print(fd, key->dnskey); } fprintf(fd, ";;Keydone\n"); } } /** * Recover key from backup. * */ key_type* key_recover2(FILE* fd, keylist_type* kl) { const char* locator = NULL; const char* resourcerecord = NULL; uint8_t algorithm = 0; uint32_t flags = 0; int publish = 0; int ksk = 0; int zsk = 0; int keytag = 0; /* We are not actually interested but we must parse it to continue correctly in the stream. When reading 1.4.8 or later version backup file, the real value of keytag is rfc5011, but not importat due to not using it.*/ ods_log_assert(fd); if (!backup_read_check_str(fd, "locator") || !backup_read_str(fd, &locator) || !backup_read_check_str(fd, "algorithm") || !backup_read_uint8_t(fd, &algorithm) || !backup_read_check_str(fd, "flags") || !backup_read_uint32_t(fd, &flags) || !backup_read_check_str(fd, "publish") || !backup_read_int(fd, &publish) || !backup_read_check_str(fd, "ksk") || !backup_read_int(fd, &ksk) || !backup_read_check_str(fd, "zsk") || !backup_read_int(fd, &zsk) || !backup_read_check_str(fd, "keytag") || !backup_read_int(fd, &keytag)) { if (locator) { free((void*)locator); locator = NULL; } return NULL; } /* key ok */ return keylist_push(kl, locator, resourcerecord, algorithm, flags, publish, ksk, zsk); } /** * Backup key list. * */ void keylist_backup(FILE* fd, keylist_type* kl, const char* version) { uint16_t i = 0; if (!fd || !kl || kl->count <= 0) { return; } for (i=0; i < kl->count; i++) { key_backup(fd, &kl->keys[i], version); } } opendnssec-2.1.13/signer/src/signer/tools.h0000644000077000001440000000366714446272525015562 00000000000000/* * 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 SIGNER_TOOLS_H #define SIGNER_TOOLS_H #include "config.h" #include "daemon/engine.h" #include "status.h" #include "signer/zone.h" /** * Load zone signconf. * \param[in] zone zone * \return ods_status status * */ extern ods_status tools_signconf(zone_type* zone); /** * Read zone from input adapter. * \param[in] zone zone * \return ods_status status * */ extern ods_status tools_input(zone_type* zone); /** * Write zone to output adapter. * \param[in] zone zone * \param[in] engine signer engine * \return ods_status status * */ extern ods_status tools_output(zone_type* zone, engine_type* engine); #endif /* SIGNER_TOOLS_H */ opendnssec-2.1.13/signer/src/signer/zonelist.h0000644000077000001440000000627214446272525016264 00000000000000/* * 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 SIGNER_ZONELIST_H #define SIGNER_ZONELIST_H #include #include #include typedef struct zonelist_struct zonelist_type; #include "status.h" #include "locks.h" #include "signer/zone.h" /** * Zone list * */ struct zonelist_struct { ldns_rbtree_t* zones; time_t last_modified; int just_added; int just_updated; int just_removed; pthread_mutex_t zl_lock; }; /** * Create zone list. * \param[in] allocator memory allocator * \return zonelist_type* created zone list * */ extern zonelist_type* zonelist_create(void); /** * Lookup zone by name and class. * \param[in] zl zone list * \param[in] name zone name * \param[in] klass zone class * \return zone_type* found zone * */ extern zone_type* zonelist_lookup_zone_by_name(zonelist_type* zonelist, const char* name, ldns_rr_class klass); /** * Lookup zone by dname and class. * \param[in] zl zone list * \param[in] dname zone domain name * \param[in] klass zone class * \return zone_type* found zone * */ extern zone_type* zonelist_lookup_zone_by_dname(zonelist_type* zonelist, ldns_rdf* dname, ldns_rr_class klass); /** * Add zone. * \param[in] zl zone list * \param[in] zone zone * \return zone_type* added zone * */ extern zone_type* zonelist_add_zone(zonelist_type* zl, zone_type* zone); /** * Delete zone. * \param[in] zl zone list * \param[in] zone zone * */ extern void zonelist_del_zone(zonelist_type* zlist, zone_type* zone); /** * Update zonelist. * \param[in] zl zone list * \param[in] zlfile zone list filename * \return ods_status status * */ extern ods_status zonelist_update(zonelist_type* zl, const char* zlfile); /** * Clean up zone list. * \param[in] zl zone list * */ extern void zonelist_cleanup(zonelist_type* zl); /** * Free zone list. * \param[in] zl zone list * */ extern void zonelist_free(zonelist_type* zl); #endif /* SIGNER_ZONELIST_H */ opendnssec-2.1.13/signer/src/ods-signerd.c0000644000077000001440000001345014446272525015333 00000000000000/* * 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 daemon. * */ #include "config.h" #include "locks.h" #include "daemon/engine.h" #include #include #include #include #include "parser/confparser.h" #define AUTHOR_NAME "Matthijs Mekking" #define COPYRIGHT_STR "Copyright (C) 2008-2010 NLnet Labs OpenDNSSEC" /** * Prints usage. * */ static void usage(FILE* out) { fprintf(out, "Usage: %s [OPTIONS]\n", "ods-signerd"); fprintf(out, "Start the OpenDNSSEC signer engine daemon.\n\n"); fprintf(out, "Supported options:\n"); fprintf(out, " -c | --config Read configuration from file.\n"); fprintf(out, " -d | --no-daemon Do not daemonize the signer " "engine.\n"); fprintf(out, " -1 | --single-run Run once, then exit.\n"); fprintf(out, " -h | --help Show this help and exit.\n"); fprintf(out, " -i | --info Print configuration and exit.\n"); fprintf(out, " -v | --verbose Increase verbosity.\n"); fprintf(out, " -V | --version Show version and exit.\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); } /** * Prints version. * */ static void version(FILE* out) { fprintf(out, "%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION); fprintf(out, "Written by %s.\n\n", AUTHOR_NAME); fprintf(out, "%s. This is free software.\n", COPYRIGHT_STR); fprintf(out, "See source files for more license information\n"); exit(0); } static void program_setup(const char* cfgfile, int cmdline_verbosity) { const char* file = NULL; /* open log */ file = parse_conf_log_filename(cfgfile); ods_log_init("ods-signerd", parse_conf_use_syslog(cfgfile), file, cmdline_verbosity?cmdline_verbosity:parse_conf_verbosity(cfgfile)); ods_log_verbose("[engine] starting signer"); /* initialize */ xmlInitGlobals(); xmlInitParser(); xmlInitThreads(); tzset(); /* for portability */ free((void*)file); } static void program_teardown() { xmlCleanupParser(); xmlCleanupGlobals(); ods_log_close(); } /** * Main. start engine and run it. * */ int main(int argc, char* argv[]) { char* argv0; int c, returncode; int options_index = 0; int info = 0; int daemonize = 1; int cmdline_verbosity = 0; char *time_arg = NULL; const char* cfgfile = ODS_SE_CFGFILE; static struct option long_options[] = { {"config", required_argument, 0, 'c'}, {"no-daemon", no_argument, 0, 'd'}, {"help", no_argument, 0, 'h'}, {"info", no_argument, 0, 'i'}, {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, {"set-time", required_argument, 0, 256}, { 0, 0, 0, 0} }; if(argv[0][0] != '/') { char *path = getcwd(NULL,0); asprintf(&argv0, "%s/%s", path, argv[0]); free(path); } else { argv0 = strdup(argv[0]); } /* parse the commandline */ while ((c=getopt_long(argc, argv, "c:dhivV", long_options, &options_index)) != -1) { switch (c) { case 'c': cfgfile = optarg; break; case 'd': daemonize = 0; break; case 'h': usage(stdout); exit(0); break; case 'i': info = 1; break; case 'v': cmdline_verbosity++; break; case 'V': version(stdout); exit(0); break; case 256: time_arg = optarg; break; default: usage(stderr); exit(2); break; } } argc -= optind; argv += optind; if (argc != 0) { usage(stderr); exit(2); } if (time_arg) { if(set_time_now_str(time_arg)) { fprintf(stderr, "Error: Failed to interpret start time argument. Daemon not started.\n"); return 1; } } /* main stuff */ fprintf(stdout, "OpenDNSSEC signer engine version %s\n", PACKAGE_VERSION); ods_janitor_initialize(argv0); program_setup(cfgfile, cmdline_verbosity); returncode = engine_start(cfgfile, cmdline_verbosity, daemonize, info); program_teardown(); free(argv0); return returncode; } opendnssec-2.1.13/signer/src/adapter/0000755000077000001440000000000014446272546014451 500000000000000opendnssec-2.1.13/signer/src/adapter/addns.h0000644000077000001440000000726714446272525015644 00000000000000/* * 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 Adapters. * */ #ifndef ADAPTER_ADDNS_H #define ADAPTER_ADDNS_H #include "config.h" #include "status.h" #include "wire/acl.h" #include "wire/tsig.h" #include #include #include /** * DNS input adapter. * */ typedef struct dnsin_struct dnsin_type; struct dnsin_struct { acl_type* request_xfr; acl_type* allow_notify; tsig_type* tsig; time_t last_modified; }; /** * DNS output adapter. * */ typedef struct dnsout_struct dnsout_type; struct dnsout_struct { acl_type* provide_xfr; acl_type* do_notify; tsig_type* tsig; time_t last_modified; }; /** * Create DNS input adapter. * \return dnsin_type* DNS input adapter * */ extern dnsin_type* dnsin_create(void); /** * Create DNS output adapter. * \return dnsout_type* DNS output adapter * */ extern dnsout_type* dnsout_create(void); /** * Update DNS input adapter. * \param[out] addns DNS input adapter * \param[in] filename filename * \param[out] last_mod last modified * \return ods_status status * */ extern ods_status dnsin_update(dnsin_type** addns, const char* filename, time_t* last_mod); /** * Update DNS output adapter. * \param[out] addns DNS output adapter * \param[in] filename filename * \param[out] last_mod last modified * \return ods_status status * */ extern ods_status dnsout_update(dnsout_type** addns, const char* filename, time_t* last_mod); /** * Read the next RR from zone file. * \param[in] fd file descriptor * \param[in] line read line * \param[in] orig origin * \param[in] prev previous name * \param[in] ttl default ttl * \param[in] status status * \param[out] l line count * \return ldns_rr* RR * */ extern ldns_rr* addns_read_rr(FILE* fd, char* line, ldns_rdf** orig, ldns_rdf** prev, uint32_t* ttl, ldns_status* status, unsigned int* l); /** * Read zone from DNS input adapter. * \param[in] zone zone reference * \return ods_status status * */ extern ods_status addns_read(void* zone); /** * Write zone to DNS output adapter. * \param[in] zone zone reference * \return ods_status status * */ extern ods_status addns_write(void* zone); /** * Clean up DNS input adapter. * \param[in] addns DNS input adapter * */ extern void dnsin_cleanup(dnsin_type* addns); /** * Clean up DNS output adapter. * \param[in] addns DNS output adapter * */ extern void dnsout_cleanup(dnsout_type* addns); #endif /* ADAPTER_ADDNS_H */ opendnssec-2.1.13/signer/src/adapter/addns.c0000644000077000001440000007026014446272525015630 00000000000000/* * 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 Adapters. * */ #include "config.h" #include "adapter/adapi.h" #include "adapter/adapter.h" #include "adapter/addns.h" #include "adapter/adutil.h" #include "parser/addnsparser.h" #include "parser/confparser.h" #include "duration.h" #include "file.h" #include "log.h" #include "status.h" #include "util.h" #include "signer/zone.h" #include "wire/notify.h" #include "wire/xfrd.h" #include #include #include static const char* adapter_str = "adapter"; static ods_status addns_read_pkt(FILE* fd, zone_type* zone); static ods_status addns_read_file(FILE* fd, zone_type* zone); /** * Read the next RR from zone file. * */ ldns_rr* addns_read_rr(FILE* fd, char* line, ldns_rdf** orig, ldns_rdf** prev, uint32_t* ttl, ldns_status* status, unsigned int* l) { ldns_rr* rr = NULL; int len = 0; uint32_t new_ttl = 0; addns_read_line: if (ttl) { new_ttl = *ttl; } len = adutil_readline_frm_file(fd, line, l, 1); adutil_rtrim_line(line, &len); if (len >= 0) { switch (line[0]) { /* no directives */ /* comments, empty lines */ case ';': case '\n': if (ods_strcmp(";;ENDPACKET", line) == 0) { /* end of pkt */ *status = LDNS_STATUS_OK; return NULL; } if (ods_strcmp(";;BEGINPACKET", line) == 0) { /* begin packet but previous not ended, rollback */ *status = LDNS_STATUS_OK; return NULL; } goto addns_read_line; /* perhaps next line is rr */ break; /* let's hope its a RR */ default: if (adutil_whitespace_line(line, len)) { goto addns_read_line; /* perhaps next line is rr */ break; } *status = ldns_rr_new_frm_str(&rr, line, new_ttl, *orig, prev); if (*status == LDNS_STATUS_OK) { return rr; } else if (*status == LDNS_STATUS_SYNTAX_EMPTY) { if (rr) { ldns_rr_free(rr); rr = NULL; } *status = LDNS_STATUS_OK; goto addns_read_line; /* perhaps next line is rr */ break; } else { ods_log_error("[%s] error parsing RR at line %i (%s): %s", adapter_str, l&&*l?*l:0, ldns_get_errorstr_by_id(*status), line); while (len >= 0) { len = adutil_readline_frm_file(fd, line, l, 0); } if (rr) { ldns_rr_free(rr); rr = NULL; } return NULL; } break; } } /* -1, EOF */ *status = LDNS_STATUS_OK; return NULL; } /** * Read pkt from file. * */ static ods_status addns_read_pkt(FILE* fd, zone_type* zone) { ldns_rr* rr = NULL; long startpos = 0; long fpos = 0; int len = 0; uint32_t new_serial = 0; uint32_t old_serial = 0; uint32_t tmp_serial = 0; ldns_rdf* prev = NULL; ldns_rdf* orig = NULL; ldns_rdf* dname = NULL; uint32_t ttl = 0; size_t rr_count = 0; ods_status result = ODS_STATUS_OK; ldns_status status = LDNS_STATUS_OK; char line[SE_ADFILE_MAXLINE]; unsigned is_axfr = 0; unsigned del_mode = 0; unsigned soa_seen = 0; unsigned line_update_interval = 100000; unsigned line_update = line_update_interval; unsigned l = 0; char* xfrd; char* fin; char* fout; ods_log_assert(fd); ods_log_assert(zone); ods_log_assert(zone->name); fpos = ftell(fd); len = adutil_readline_frm_file(fd, line, &l, 1); if (len < 0) { /* -1 EOF */ return ODS_STATUS_EOF; } adutil_rtrim_line(line, &len); if (ods_strcmp(";;BEGINPACKET", line) != 0) { ods_log_error("[%s] bogus xfrd file zone %s, missing ;;BEGINPACKET (was %s)", adapter_str, zone->name, line); return ODS_STATUS_ERR; } startpos = fpos; fpos = ftell(fd); begin_pkt: rr_count = 0; is_axfr = 0; del_mode = 0; soa_seen = 0; /* $ORIGIN */ dname = adapi_get_origin(zone); if (!dname) { ods_log_error("[%s] error getting default value for $ORIGIN", adapter_str); return ODS_STATUS_ERR; } orig = ldns_rdf_clone(dname); if (!orig) { ods_log_error("[%s] error setting default value for $ORIGIN", adapter_str); return ODS_STATUS_ERR; } /* $TTL */ ttl = adapi_get_ttl(zone); /* read RRs */ while ((rr = addns_read_rr(fd, line, &orig, &prev, &ttl, &status, &l)) != NULL) { /* update file position */ fpos = ftell(fd); /* check status */ if (status != LDNS_STATUS_OK) { ods_log_error("[%s] error reading RR at line %i (%s): %s", adapter_str, l, ldns_get_errorstr_by_id(status), line); result = ODS_STATUS_ERR; break; } /* debug update */ if (l > line_update) { ods_log_debug("[%s] ...at line %i: %s", adapter_str, l, line); line_update += line_update_interval; } /* first RR: check if SOA and correct zone & serialno */ if (rr_count == 0) { rr_count++; if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_SOA) { ods_log_error("[%s] bad xfr, first rr is not soa", adapter_str); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_ERR; break; } soa_seen++; if (ldns_dname_compare(ldns_rr_owner(rr), zone->apex)) { ods_log_error("[%s] bad xfr, soa dname not equal to zone " "dname %s", adapter_str, zone->name); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_ERR; break; } tmp_serial = ldns_rdf2native_int32(ldns_rr_rdf(rr, SE_SOA_RDATA_SERIAL)); old_serial = adapi_get_serial(zone); /** * Do we need to make this check? It is already done by xfrd. * By not doing this check, retransfers will be taken into account. * if (!util_serial_gt(tmp_serial, old_serial) && zone->db->is_initialized) { ods_log_info("[%s] zone %s is already up to date, have " "serial %u, got serial %u", adapter_str, zone->name, old_serial, tmp_serial); new_serial = tmp_serial; ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_UPTODATE; while (len >= 0) { len = adutil_readline_frm_file(fd, line, &l, 1); if (len && ods_strcmp(";;ENDPACKET", line) == 0) { startpos = 0; break; } } break; } * **/ ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_OK; continue; } /* second RR: if not soa, this is an AXFR */ if (rr_count == 1) { if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_SOA) { ods_log_verbose("[%s] detected axfr serial=%u for zone %s", adapter_str, tmp_serial, zone->name); new_serial = tmp_serial; is_axfr = 1; del_mode = 0; } else { ods_log_verbose("[%s] detected ixfr serial=%u for zone %s", adapter_str, tmp_serial, zone->name); if (!util_serial_gt(tmp_serial, old_serial) && zone->db->is_initialized) { ods_log_error("[%s] bad ixfr for zone %s, bad start serial %lu", adapter_str, zone->name, (unsigned long)tmp_serial); result = ODS_STATUS_ERR; } new_serial = tmp_serial; tmp_serial = ldns_rdf2native_int32(ldns_rr_rdf(rr, SE_SOA_RDATA_SERIAL)); ldns_rr_free(rr); rr = NULL; rr_count++; if (tmp_serial < new_serial) { del_mode = 1; result = ODS_STATUS_OK; continue; } else { ods_log_error("[%s] bad ixfr for zone %s, bad soa serial %lu", adapter_str, zone->name, (unsigned long) tmp_serial); result = ODS_STATUS_ERR; break; } } } /* soa means swap */ rr_count++; if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) { if (!is_axfr) { tmp_serial = ldns_rdf2native_int32(ldns_rr_rdf(rr, SE_SOA_RDATA_SERIAL)); if (tmp_serial <= new_serial) { if (tmp_serial == new_serial) { soa_seen++; } del_mode = !del_mode; ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_OK; continue; } else { ods_log_assert(tmp_serial > new_serial); ods_log_error("[%s] bad xfr for zone %s, bad soa serial", adapter_str, zone->name); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_ERR; break; } } else { /* for axfr */ soa_seen++; } } /* [add to/remove from] the zone */ if (!is_axfr && del_mode) { ods_log_deeebug("[%s] delete RR #%lu at line %i: %s", adapter_str, (unsigned long)rr_count, l, line); result = adapi_del_rr(zone, rr, 0); ldns_rr_free(rr); rr = NULL; } else { ods_log_deeebug("[%s] add RR #%lu at line %i: %s", adapter_str, (unsigned long)rr_count, l, line); result = adapi_add_rr(zone, rr, 0); } if (result == ODS_STATUS_UNCHANGED) { ods_log_debug("[%s] skipping RR at line %i (%s): %s", adapter_str, l, del_mode?"not found":"duplicate", line); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_OK; continue; } else if (result != ODS_STATUS_OK) { ods_log_error("[%s] error %s RR at line %i: %s", adapter_str, del_mode?"deleting":"adding", l, line); ldns_rr_free(rr); rr = NULL; break; } } /* and done */ if (orig) { ldns_rdf_deep_free(orig); orig = NULL; } if (prev) { ldns_rdf_deep_free(prev); prev = NULL; } /* check again */ if (ods_strcmp(";;ENDPACKET", line) == 0) { ods_log_verbose("[%s] xfr zone %s on disk complete, commit to db", adapter_str, zone->name); startpos = 0; } else { ods_log_warning("[%s] xfr zone %s on disk incomplete, rollback", adapter_str, zone->name); namedb_rollback(zone->db, 1); if (ods_strcmp(";;BEGINPACKET", line) == 0) { result = ODS_STATUS_OK; startpos = fpos; goto begin_pkt; } else { result = ODS_STATUS_XFRINCOMPLETE; } } /* otherwise EOF */ if (result == ODS_STATUS_OK && status != LDNS_STATUS_OK) { ods_log_error("[%s] error reading RR at line %i (%s): %s", adapter_str, l, ldns_get_errorstr_by_id(status), line); result = ODS_STATUS_ERR; } /* check the number of SOAs seen */ if (result == ODS_STATUS_OK) { if ((is_axfr && soa_seen != 2) || (!is_axfr && soa_seen != 3)) { ods_log_error("[%s] bad %s, wrong number of SOAs (%u)", adapter_str, is_axfr?"axfr":"ixfr", soa_seen); result = ODS_STATUS_ERR; } } /* input zone ok, set inbound serial and apply differences */ if (result == ODS_STATUS_OK) { adapi_set_serial(zone, new_serial); if (is_axfr) { adapi_trans_full(zone, 1); } else { adapi_trans_diff(zone, 1); } } if (result == ODS_STATUS_UPTODATE) { /* do a transaction for DNSKEY and NSEC3PARAM */ adapi_trans_diff(zone, 1); result = ODS_STATUS_OK; } if (result == ODS_STATUS_XFRINCOMPLETE) { /** we have to restore the incomplete zone transfer: * xfrd = (xfrd.tmp + startpos) . (xfrd) */ xfrd = ods_build_path(zone->name, ".xfrd", 0, 1); fin = ods_build_path(zone->name, ".xfrd.tmp", 0, 1); fout = ods_build_path(zone->name, ".xfrd.bak", 0, 1); if (!xfrd || !fin || !fout) { return ODS_STATUS_MALLOC_ERR; } ods_log_debug("[%s] restore xfrd zone %s xfrd %s fin %s fout %s", adapter_str, zone->name, xfrd, fin, fout); result = ods_file_copy(fin, fout, startpos, 0); if (result != ODS_STATUS_OK) { ods_log_crit("[%s] unable to restore incomple xfr zone %s: %s", adapter_str, zone->name, ods_status2str(result)); } else { pthread_mutex_lock(&zone->xfrd->rw_lock); if (ods_file_lastmodified(xfrd)) { result = ods_file_copy(xfrd, fout, 0, 1); if (result != ODS_STATUS_OK) { ods_log_crit("[%s] unable to restore xfrd zone %s: %s", adapter_str, zone->name, ods_status2str(result)); } else if (rename(fout, xfrd) != 0) { result = ODS_STATUS_RENAME_ERR; ods_log_crit("[%s] unable to restore xfrd zone %s: %s", adapter_str, zone->name, ods_status2str(result)); } } else if (rename(fout, xfrd) != 0) { result = ODS_STATUS_RENAME_ERR; ods_log_crit("[%s] unable to restore xfrd zone %s: %s", adapter_str, zone->name, ods_status2str(result)); } pthread_mutex_unlock(&zone->xfrd->rw_lock); } free((void*) xfrd); free((void*) fin); free((void*) fout); result = ODS_STATUS_XFRINCOMPLETE; } return result; } /** * Read pkt from file. * */ static ods_status addns_read_file(FILE* fd, zone_type* zone) { ods_status status = ODS_STATUS_OK; while (status == ODS_STATUS_OK) { status = addns_read_pkt(fd, zone); if (status == ODS_STATUS_OK) { pthread_mutex_lock(&zone->xfrd->serial_lock); zone->xfrd->serial_xfr = adapi_get_serial(zone); zone->xfrd->serial_xfr_acquired = zone->xfrd->serial_disk_acquired; pthread_mutex_unlock(&zone->xfrd->serial_lock); } } if (status == ODS_STATUS_EOF) { status = ODS_STATUS_OK; } return status; } /** * Create DNS input adapter. * */ dnsin_type* dnsin_create(void) { dnsin_type* addns = NULL; CHECKALLOC(addns = (dnsin_type*) malloc(sizeof(dnsin_type))); addns->request_xfr = NULL; addns->allow_notify = NULL; addns->tsig = NULL; return addns; } /** * Create DNS output adapter. * */ dnsout_type* dnsout_create(void) { dnsout_type* addns = NULL; CHECKALLOC(addns = (dnsout_type*) malloc(sizeof(dnsout_type))); addns->provide_xfr = NULL; addns->do_notify = NULL; addns->tsig = NULL; return addns; } /** * Read DNS input adapter. * */ static ods_status dnsin_read(dnsin_type* addns, const char* filename) { const char* rngfile = ODS_SE_RNGDIR "/addns.rng"; ods_status status = ODS_STATUS_OK; FILE* fd = NULL; if (!filename || !addns) { return ODS_STATUS_ASSERT_ERR; } ods_log_debug("[%s] read dnsin file %s", adapter_str, filename); status = parse_file_check(filename, rngfile); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to read dnsin: parse error in " "file %s (%s)", adapter_str, filename, ods_status2str(status)); return status; } fd = ods_fopen(filename, NULL, "r"); if (fd) { addns->tsig = parse_addns_tsig(filename); addns->request_xfr = parse_addns_request_xfr(filename, addns->tsig); addns->allow_notify = parse_addns_allow_notify(filename, addns->tsig); ods_fclose(fd); return ODS_STATUS_OK; } ods_log_error("[%s] unable to read dnsout: failed to open file %s", adapter_str, filename); return ODS_STATUS_ERR; } /** * Update DNS input adapter. * */ ods_status dnsin_update(dnsin_type** addns, const char* filename, time_t* last_mod) { dnsin_type* new_addns = NULL; time_t st_mtime = 0; ods_status status = ODS_STATUS_OK; if (!filename || !addns || !last_mod) { return ODS_STATUS_UNCHANGED; } /* read the new signer configuration */ status = dnsin_read(*addns, filename); if (status == ODS_STATUS_OK) { *last_mod = st_mtime; } else { ods_log_error("[%s] unable to update dnsin: dnsin_read(%s) " "failed (%s)", adapter_str, filename, ods_status2str(status)); } return status; } /** * Read DNS output adapter. * */ static ods_status dnsout_read(dnsout_type* addns, const char* filename) { const char* rngfile = ODS_SE_RNGDIR "/addns.rng"; ods_status status = ODS_STATUS_OK; FILE* fd = NULL; if (!filename || !addns) { return ODS_STATUS_ASSERT_ERR; } ods_log_debug("[%s] read dnsout file %s", adapter_str, filename); status = parse_file_check(filename, rngfile); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to read dnsout: parse error in " "file %s (%s)", adapter_str, filename, ods_status2str(status)); return status; } fd = ods_fopen(filename, NULL, "r"); if (fd) { addns->tsig = parse_addns_tsig(filename); addns->provide_xfr = parse_addns_provide_xfr(filename, addns->tsig); addns->do_notify = parse_addns_do_notify(filename, addns->tsig); ods_fclose(fd); return ODS_STATUS_OK; } ods_log_error("[%s] unable to read dnsout: failed to open file %s", adapter_str, filename); return ODS_STATUS_ERR; } /** * Update DNS output adapter. * */ ods_status dnsout_update(dnsout_type** addns, const char* filename, time_t* last_mod) { time_t st_mtime = 0; ods_status status = ODS_STATUS_OK; if (!filename || !addns || !last_mod) { return ODS_STATUS_UNCHANGED; } /* read the new signer configuration */ status = dnsout_read(*addns, filename); if (status == ODS_STATUS_OK) { *last_mod = st_mtime; } else { ods_log_error("[%s] unable to update dnsout: dnsout_read(%s) " "failed (%s)", adapter_str, filename, ods_status2str(status)); /* Don't do this cleanup. Signer will crash on exit and will * access the wrong memory runtime. Leak is only once per badly * configured adapter. */ /* dnsout_cleanup(*addns); */ } return status; } /** * Send notifies. * */ static void dnsout_send_notify(void* zone) { zone_type* z = (zone_type*) zone; rrset_type* rrset = NULL; ldns_rr* soa = NULL; if (!z->notify) { ods_log_error("[%s] unable to send notify for zone %s: no notify " "handler", adapter_str, z->name); return; } ods_log_assert(z->adoutbound); ods_log_assert(z->adoutbound->config); ods_log_assert(z->adoutbound->type == ADAPTER_DNS); ods_log_assert(z->db); ods_log_assert(z->name); ods_log_debug("[%s] enable notify for zone %s serial %u", adapter_str, z->name, z->db->intserial); rrset = zone_lookup_rrset(z, z->apex, LDNS_RR_TYPE_SOA); ods_log_assert(rrset); soa = ldns_rr_clone(rrset->rrs[0].rr); notify_enable(z->notify, soa); } /** * Read zone from DNS Input Adapter. * */ ods_status addns_read(void* zone) { zone_type* z = (zone_type*) zone; ods_status status = ODS_STATUS_OK; char* xfrfile = NULL; char* file = NULL; FILE* fd = NULL; ods_log_assert(z); ods_log_assert(z->name); ods_log_assert(z->xfrd); ods_log_assert(z->db); ods_log_assert(z->adinbound); ods_log_assert(z->adinbound->type == ADAPTER_DNS); pthread_mutex_lock(&z->xfrd->rw_lock); pthread_mutex_lock(&z->xfrd->serial_lock); /* did we already store a new zone transfer on disk? */ if (!z->xfrd->serial_disk_acquired || z->xfrd->serial_disk_acquired <= z->xfrd->serial_xfr_acquired) { if (!z->xfrd->serial_disk_acquired) { pthread_mutex_unlock(&z->xfrd->serial_lock); pthread_mutex_unlock(&z->xfrd->rw_lock); return ODS_STATUS_XFR_NOT_READY; } pthread_mutex_unlock(&z->xfrd->serial_lock); pthread_mutex_unlock(&z->xfrd->rw_lock); /* do a transaction for DNSKEY and NSEC3PARAM */ adapi_trans_diff(z, 0); ods_log_verbose("[%s] no new xfr ready for zone %s", adapter_str, z->name); return ODS_STATUS_UNCHANGED; } /* copy zone transfers */ xfrfile = ods_build_path(z->name, ".xfrd", 0, 1); file = ods_build_path(z->name, ".xfrd.tmp", 0, 1); if (!xfrfile || !file) { free(xfrfile); free(file); pthread_mutex_unlock(&z->xfrd->serial_lock); pthread_mutex_unlock(&z->xfrd->rw_lock); ods_log_error("[%s] unable to build paths to xfrd files", adapter_str); return ODS_STATUS_MALLOC_ERR; } if (rename(xfrfile, file) != 0) { pthread_mutex_unlock(&z->xfrd->serial_lock); pthread_mutex_unlock(&z->xfrd->rw_lock); ods_log_error("[%s] unable to rename file %s to %s: %s", adapter_str, xfrfile, file, strerror(errno)); free((void*) xfrfile); free((void*) file); return ODS_STATUS_RENAME_ERR; } pthread_mutex_unlock(&z->xfrd->serial_lock); /* open copy of zone transfers to read */ fd = ods_fopen(file, NULL, "r"); free((void*) xfrfile); if (!fd) { pthread_mutex_unlock(&z->xfrd->rw_lock); free((void*) file); return ODS_STATUS_FOPEN_ERR; } pthread_mutex_unlock(&z->xfrd->rw_lock); status = addns_read_file(fd, z); if (status == ODS_STATUS_OK) { /* clean up copy of zone transfer */ if (unlink((const char*) file) != 0) { ods_log_error("[%s] unable to unlink zone transfer copy file %s: " " %s", adapter_str, file, strerror(errno)); /* should be no issue */ } } free((void*) file); ods_fclose(fd); return status; } /** * Write to DNS Output Adapter. * */ ods_status addns_write(void* zone) { FILE* fd = NULL; char* atmpfile = NULL; char* axfrfile = NULL; char* itmpfile = NULL; char* ixfrfile = NULL; zone_type* z = (zone_type*) zone; int ret = 0; ods_status status = ODS_STATUS_OK; ods_log_assert(z); ods_log_assert(z->name); ods_log_assert(z->adoutbound); ods_log_assert(z->adoutbound->type == ADAPTER_DNS); atmpfile = ods_build_path(z->name, ".axfr.tmp", 0, 1); if (!atmpfile) { return ODS_STATUS_MALLOC_ERR; } fd = ods_fopen(atmpfile, NULL, "w"); if (!fd) { free((void*) atmpfile); return ODS_STATUS_FOPEN_ERR; } status = adapi_printaxfr(fd, z); ods_fclose(fd); if (status != ODS_STATUS_OK) { free((void*) atmpfile); return status; } if (z->db->is_initialized && z->ixfr->part[0] && z->ixfr->part[0]->soamin && z->ixfr->part[0]->soaplus) { itmpfile = ods_build_path(z->name, ".ixfr.tmp", 0, 1); if (!itmpfile) { free((void*) atmpfile); return ODS_STATUS_MALLOC_ERR; } fd = ods_fopen(itmpfile, NULL, "w"); if (!fd) { free((void*) atmpfile); free((void*) itmpfile); return ODS_STATUS_FOPEN_ERR; } status = adapi_printixfr(fd, z); ods_fclose(fd); if (status != ODS_STATUS_OK) { free((void*) atmpfile); free((void*) itmpfile); return status; } } if (status == ODS_STATUS_OK) { if (z->adoutbound->error) { ods_log_error("[%s] unable to write zone %s axfr: one or " "more RR print failed", adapter_str, z->name); /* clear error */ z->adoutbound->error = 0; free((void*) atmpfile); free((void*) itmpfile); return ODS_STATUS_FWRITE_ERR; } } /* lock and move */ axfrfile = ods_build_path(z->name, ".axfr", 0, 1); if (!axfrfile) { free((void*) atmpfile); free((void*) itmpfile); return ODS_STATUS_MALLOC_ERR; } pthread_mutex_lock(&z->xfr_lock); ret = rename(atmpfile, axfrfile); if (ret != 0) { ods_log_error("[%s] unable to rename file %s to %s: %s", adapter_str, atmpfile, axfrfile, strerror(errno)); pthread_mutex_unlock(&z->xfr_lock); free((void*) atmpfile); free((void*) axfrfile); free((void*) itmpfile); return ODS_STATUS_RENAME_ERR; } free((void*) axfrfile); free((void*) atmpfile); axfrfile = NULL; atmpfile = NULL; if (z->db->is_initialized && z->ixfr->part[0] && z->ixfr->part[0]->soamin && z->ixfr->part[0]->soaplus) { ixfrfile = ods_build_path(z->name, ".ixfr", 0, 1); if (!ixfrfile) { pthread_mutex_unlock(&z->xfr_lock); free((void*) axfrfile); free((void*) atmpfile); free((void*) itmpfile); return ODS_STATUS_MALLOC_ERR; } ret = rename(itmpfile, ixfrfile); if (ret != 0) { ods_log_error("[%s] unable to rename file %s to %s: %s", adapter_str, itmpfile, ixfrfile, strerror(errno)); pthread_mutex_unlock(&z->xfr_lock); free((void*) itmpfile); free((void*) ixfrfile); return ODS_STATUS_RENAME_ERR; } free((void*) ixfrfile); } free((void*) itmpfile); pthread_mutex_unlock(&z->xfr_lock); dnsout_send_notify(zone); return ODS_STATUS_OK; } /** * Clean up DNS input adapter. * */ void dnsin_cleanup(dnsin_type* addns) { if (!addns) { return; } acl_cleanup(addns->request_xfr); acl_cleanup(addns->allow_notify); tsig_cleanup(addns->tsig); free(addns); } /** * Clean up DNS output adapter. * */ void dnsout_cleanup(dnsout_type* addns) { if (!addns) { return; } acl_cleanup(addns->provide_xfr); acl_cleanup(addns->do_notify); tsig_cleanup(addns->tsig); free(addns); } opendnssec-2.1.13/signer/src/adapter/adfile.c0000644000077000001440000003041314446272525015757 00000000000000/* * 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 Adapters. * */ #include "config.h" #include "adapter/adapi.h" #include "adapter/adapter.h" #include "adapter/adfile.h" #include "adapter/adutil.h" #include "duration.h" #include "file.h" #include "log.h" #include "status.h" #include "util.h" #include "signer/zone.h" #include #include #include static const char* adapter_str = "adapter"; static ods_status adfile_read_file(FILE* fd, zone_type* zone); /** * Read the next RR from zone file. * */ static ldns_rr* adfile_read_rr(FILE* fd, zone_type* zone, char* line, ldns_rdf** orig, ldns_rdf** prev, uint32_t* ttl, ldns_status* status, unsigned int* l) { ldns_rr* rr = NULL; ldns_rdf* tmp = NULL; FILE* fd_include = NULL; int len = 0; ods_status s = ODS_STATUS_OK; uint32_t new_ttl = 0; const char *endptr; /* unused */ int offset = 0; adfile_read_line: if (ttl) { new_ttl = *ttl; } len = adutil_readline_frm_file(fd, line, l, 0); adutil_rtrim_line(line, &len); if (len >= 0) { switch (line[0]) { /* directive */ case '$': if (strncmp(line, "$ORIGIN", 7) == 0 && isspace((int)line[7])) { /* copy from ldns */ if (*orig) { ldns_rdf_deep_free(*orig); *orig = NULL; } offset = 8; while (isspace((int)line[offset])) { offset++; } tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, line + offset); if (!tmp) { /* could not parse what next to $ORIGIN */ *status = LDNS_STATUS_SYNTAX_DNAME_ERR; return NULL; } *orig = tmp; /* end copy from ldns */ goto adfile_read_line; /* perhaps next line is rr */ break; } else if (strncmp(line, "$TTL", 4) == 0 && isspace((int)line[4])) { /* override default ttl */ offset = 5; while (isspace((int)line[offset])) { offset++; } if (ttl) { *ttl = ldns_str2period(line + offset, &endptr); new_ttl = *ttl; } goto adfile_read_line; /* perhaps next line is rr */ break; } else if (strncmp(line, "$INCLUDE", 8) == 0 && isspace((int)line[8])) { /* dive into this file */ offset = 9; while (isspace((int)line[offset])) { offset++; } fd_include = ods_fopen(line + offset, NULL, "r"); if (fd_include) { s = adfile_read_file(fd_include, zone); ods_fclose(fd_include); } else { ods_log_error("[%s] unable to open include file %s", adapter_str, (line+offset)); *status = LDNS_STATUS_SYNTAX_ERR; return NULL; } if (s != ODS_STATUS_OK) { *status = LDNS_STATUS_SYNTAX_ERR; ods_log_error("[%s] error in include file %s", adapter_str, (line+offset)); return NULL; } /* restore current ttl */ if (ttl) { *ttl = new_ttl; } goto adfile_read_line; /* perhaps next line is rr */ break; } goto adfile_read_rr; /* this can be an owner name */ break; /* comments, empty lines */ case ';': case '\n': goto adfile_read_line; /* perhaps next line is rr */ break; /* let's hope its a RR */ default: adfile_read_rr: if (adutil_whitespace_line(line, len)) { goto adfile_read_line; /* perhaps next line is rr */ break; } *status = ldns_rr_new_frm_str(&rr, line, new_ttl, *orig, prev); if (*status == LDNS_STATUS_OK) { return rr; } else if (*status == LDNS_STATUS_SYNTAX_EMPTY) { if (rr) { ldns_rr_free(rr); rr = NULL; } *status = LDNS_STATUS_OK; goto adfile_read_line; /* perhaps next line is rr */ break; } else { ods_log_error("[%s] error parsing RR at line %i (%s): %s", adapter_str, l&&*l?*l:0, ldns_get_errorstr_by_id(*status), line); while (len >= 0) { len = adutil_readline_frm_file(fd, line, l, 0); } if (rr) { ldns_rr_free(rr); rr = NULL; } return NULL; } break; } } /* -1, EOF */ *status = LDNS_STATUS_OK; return NULL; } /** * Read zone file. * */ static ods_status adfile_read_file(FILE* fd, zone_type* zone) { ods_status result = ODS_STATUS_OK; ldns_rr* rr = NULL; ldns_rdf* prev = NULL; ldns_rdf* orig = NULL; ldns_rdf* dname = NULL; uint32_t ttl = 0; uint32_t new_serial = 0; ldns_status status = LDNS_STATUS_OK; char line[SE_ADFILE_MAXLINE]; unsigned int line_update_interval = 100000; unsigned int line_update = line_update_interval; unsigned int l = 0; ods_log_assert(fd); ods_log_assert(zone); /* $ORIGIN */ dname = adapi_get_origin(zone); if (!dname) { ods_log_error("[%s] error getting default value for $ORIGIN", adapter_str); return ODS_STATUS_ERR; } orig = ldns_rdf_clone(dname); if (!orig) { ods_log_error("[%s] error setting default value for $ORIGIN", adapter_str); return ODS_STATUS_ERR; } /* $TTL */ ttl = adapi_get_ttl(zone); /* read RRs */ while ((rr = adfile_read_rr(fd, zone, line, &orig, &prev, &ttl, &status, &l)) != NULL) { /* check status */ if (status != LDNS_STATUS_OK) { ods_log_error("[%s] error reading RR at line %i (%s): %s", adapter_str, l, ldns_get_errorstr_by_id(status), line); result = ODS_STATUS_ERR; break; } /* debug update */ if (l > line_update) { ods_log_debug("[%s] ...at line %i: %s", adapter_str, l, line); line_update += line_update_interval; } /* SOA? */ if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) { new_serial = ldns_rdf2native_int32(ldns_rr_rdf(rr, SE_SOA_RDATA_SERIAL)); } /* add to the database */ result = adapi_add_rr(zone, rr, 0); if (result == ODS_STATUS_UNCHANGED) { ods_log_debug("[%s] skipping RR at line %i (duplicate): %s", adapter_str, l, line); ldns_rr_free(rr); rr = NULL; result = ODS_STATUS_OK; continue; } else if (result != ODS_STATUS_OK) { ods_log_error("[%s] error adding RR at line %i: %s", adapter_str, l, line); ldns_rr_free(rr); rr = NULL; break; } } /* and done */ if (orig) { ldns_rdf_deep_free(orig); orig = NULL; } if (prev) { ldns_rdf_deep_free(prev); prev = NULL; } if (result == ODS_STATUS_OK && status != LDNS_STATUS_OK) { ods_log_error("[%s] error reading RR at line %i (%s): %s", adapter_str, l, ldns_get_errorstr_by_id(status), line); result = ODS_STATUS_ERR; } /* input zone ok, set inbound serial and apply differences */ if (result == ODS_STATUS_OK) { result = namedb_examine(zone->db); if (result != ODS_STATUS_OK) { ods_log_error("[%s] unable to read file: zonefile contains errors", adapter_str); return result; } adapi_set_serial(zone, new_serial); } return result; } /** * Read zone from zonefile. * */ ods_status adfile_read(void* zone) { FILE* fd = NULL; zone_type* adzone = (zone_type*) zone; ods_status status = ODS_STATUS_OK; if (!adzone || !adzone->adinbound || !adzone->adinbound->configstr) { ods_log_error("[%s] unable to read file: no input adapter", adapter_str); return ODS_STATUS_ASSERT_ERR; } fd = ods_fopen(adzone->adinbound->configstr, NULL, "r"); if (!fd) { return ODS_STATUS_FOPEN_ERR; } status = adfile_read_file(fd, adzone); ods_fclose(fd); if (status == ODS_STATUS_OK) { adapi_trans_full(zone, 0); } return status; } /** * Write zonefile. * */ ods_status adfile_write(void* zone, const char* filename) { FILE* fd = NULL; char* tmpname = NULL; zone_type* adzone = (zone_type*) zone; ods_status status = ODS_STATUS_OK; /* [start] sanity parameter checking */ if (!adzone || !adzone->adoutbound) { ods_log_error("[%s] unable to write file: no output adapter", adapter_str); return ODS_STATUS_ASSERT_ERR; } if (!filename) { ods_log_error("[%s] unable to write file: no filename given", adapter_str); return ODS_STATUS_ASSERT_ERR; } /* [end] sanity parameter checking */ /* [start] write zone */ tmpname = ods_build_path(filename, ".tmp", 0, 0); if (!tmpname) { return ODS_STATUS_MALLOC_ERR; } fd = ods_fopen(tmpname, NULL, "w"); if (fd) { status = adapi_printzone(fd, adzone); ods_fclose(fd); if (status == ODS_STATUS_OK) { if (adzone->adoutbound->error) { ods_log_error("[%s] unable to write zone %s file %s: one or " "more RR print failed", adapter_str, adzone->name, filename); /* clear error */ adzone->adoutbound->error = 0; status = ODS_STATUS_FWRITE_ERR; } } } else { status = ODS_STATUS_FOPEN_ERR; } if (status == ODS_STATUS_OK) { if (rename((const char*) tmpname, filename) != 0) { ods_log_error("[%s] unable to write file: failed to rename %s " "to %s (%s)", adapter_str, tmpname, filename, strerror(errno)); status = ODS_STATUS_RENAME_ERR; } } free(tmpname); /* [end] write zone */ return status; } opendnssec-2.1.13/signer/src/adapter/adapi.h0000644000077000001440000000650214446272525015620 00000000000000/* * Copyright (c) 2009-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. * */ /** * * Adapter API. */ #ifndef ADAPTER_ADAPI_H #define ADAPTER_ADAPI_H #include "config.h" #include "status.h" #include "signer/zone.h" #include /** * Get the inbound serial. * \param[in] zone zone * \return uint32_t inbound serial * */ uint32_t adapi_get_serial(zone_type* zone); /** * Set the inbound serial. * \param[in] zone zone * \param[in] serial inbound serial * */ void adapi_set_serial(zone_type* zone, uint32_t serial); /** * Get origin. * \param[in] zone zone * \return ldns_rdf* origin * */ extern ldns_rdf* adapi_get_origin(zone_type* zone); /** * Get ttl. * \param[in] zone zone * \return uint32_t ttl * */ extern uint32_t adapi_get_ttl(zone_type* zone); /* * Do full zone transaction. * \param[in] zone zone * \param[in] more_coming more transactions are possible * */ extern void adapi_trans_full(zone_type* zone, unsigned more_coming); /* * Do incremental zone transaction. * \param[in] zone zone * \param[in] more_coming more transactions are possible * */ extern void adapi_trans_diff(zone_type* zone, unsigned more_coming); /** * Add RR. * \param[in] zone zone * \param[in] rr RR * \param[in] backup from backup * \return ods_status status * */ extern ods_status adapi_add_rr(zone_type* zone, ldns_rr* rr, int backup); /** * Delete RR. * \param[in] zone zone * \param[in] rr RR * \param[in] backup from backup * \return ods_status status * */ extern ods_status adapi_del_rr(zone_type* zone, ldns_rr* rr, int backup); /** * Print zonefile. * \param[in] fd file descriptor * \param[in] zone zone * \return ods_status status * */ extern ods_status adapi_printzone(FILE* fd, zone_type* zone); /** * Print axfr. * \param[in] fd file descriptor * \param[in] zone zone * \return ods_status status * */ extern ods_status adapi_printaxfr(FILE* fd, zone_type* zone); /** * Print ixfr. * \param[in] fd file descriptor * \param[in] zone zone * \return ods_status status * */ extern ods_status adapi_printixfr(FILE* fd, zone_type* zone); #endif /* ADAPTER_ADAPI_H */ opendnssec-2.1.13/signer/src/adapter/adutil.h0000644000077000001440000000430314446272525016021 00000000000000/* * Copyright (c) 2009-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. * */ /** * * Adapter utilities. */ #ifndef ADAPTER_ADUTIL_H #define ADAPTER_ADUTIL_H #include "config.h" #include #include #define SE_ADFILE_MAXLINE 65535 /** * Read one line from file. * \param[in] fd file descriptor of zonefile * \param[out] line the one line * \param[out] l keeps track of line numbers * \param[in] keep_comments if true, keep comments * \return int number of characters read * */ extern int adutil_readline_frm_file(FILE* fd, char* line, unsigned int* l, int keep_comments); /* * Trim trailing whitespace. * \param[in] line line to be trimmed * \param[out] line_len maintain line length * */ extern void adutil_rtrim_line(char* line, int* line_len); /** * Check for white space. * \param[in] line line to be checked * \param[in] line_len line length * */ extern int adutil_whitespace_line(char* line, int line_len); #endif /* ADAPTER_ADUTIL_H */ opendnssec-2.1.13/signer/src/adapter/adapter.c0000644000077000001440000001644214446272525016161 00000000000000/* * 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. * */ /** * Inbound and Outbound Adapters. * */ #include "adapter/adapter.h" #include "file.h" #include "log.h" #include "status.h" #include "signer/zone.h" #include static const char* adapter_str = "adapter"; /** * Create a new adapter. * */ adapter_type* adapter_create(const char* str, adapter_mode type, unsigned in) { adapter_type* adapter = NULL; CHECKALLOC(adapter = (adapter_type*) malloc(sizeof(adapter_type))); adapter->type = type; adapter->inbound = in; adapter->error = 0; adapter->config = NULL; adapter->config_last_modified = 0; adapter->configstr = strdup(str); if (!adapter->configstr) { ods_log_error("[%s] unable to create adapter: allocator_strdup() " "failed", adapter_str); adapter_cleanup(adapter); return NULL; } /* type specific */ switch(adapter->type) { case ADAPTER_FILE: break; case ADAPTER_DNS: if (adapter->inbound) { adapter->config = (void*) dnsin_create(); if (!adapter->config) { ods_log_error("[%s] unable to create adapter: " "dnsin_create() failed", adapter_str); adapter_cleanup(adapter); return NULL; } } else { adapter->config = (void*) dnsout_create(); if (!adapter->config) { ods_log_error("[%s] unable to create adapter: " "dnsout_create() failed", adapter_str); adapter_cleanup(adapter); return NULL; } } break; default: break; } return adapter; } /** * Load ACL. * */ ods_status adapter_load_config(adapter_type* adapter) { dnsin_type* dnsin = NULL; dnsout_type* dnsout = NULL; ods_status status = ODS_STATUS_OK; if (!adapter || !adapter->configstr) { return ODS_STATUS_ASSERT_ERR; } /* type specific */ switch(adapter->type) { case ADAPTER_FILE: break; case ADAPTER_DNS: ods_log_assert(adapter->config); if (adapter->inbound) { dnsin = (dnsin_type*)adapter->config; status = dnsin_update(&dnsin, adapter->configstr, &adapter->config_last_modified); if (status == ODS_STATUS_OK) { ods_log_assert(dnsin); } else if (status != ODS_STATUS_UNCHANGED) { return status; } return ODS_STATUS_OK; } else { /* outbound */ dnsout = (dnsout_type*)adapter->config; status = dnsout_update(&dnsout, adapter->configstr, &adapter->config_last_modified); if (status == ODS_STATUS_OK) { ods_log_assert(dnsout); } else if (status != ODS_STATUS_UNCHANGED) { return status; } } break; default: break; } return ODS_STATUS_OK; } /* * Read zone from input adapter. * */ ods_status adapter_read(zone_type* zone) { if (!zone || !zone->adinbound) { ods_log_error("[%s] unable to read zone: no input adapter", adapter_str); return ODS_STATUS_ASSERT_ERR; } ods_log_assert(zone->adinbound->configstr); switch (zone->adinbound->type) { case ADAPTER_FILE: ods_log_verbose("[%s] read zone %s from file input adapter %s", adapter_str, zone->name, zone->adinbound->configstr); return adfile_read(zone); case ADAPTER_DNS: ods_log_verbose("[%s] read zone %s from dns input adapter %s", adapter_str, zone->name, zone->adinbound->configstr); return addns_read(zone); default: ods_log_error("[%s] unable to read zone %s from adapter: unknown " "adapter", adapter_str, zone->name); return ODS_STATUS_ERR; } /* not reached */ return ODS_STATUS_ERR; } /** * Write zone to output adapter. * */ ods_status adapter_write(zone_type* zone) { if (!zone || !zone->db || !zone->adoutbound) { ods_log_error("[%s] unable to write zone: no output adapter", adapter_str); return ODS_STATUS_ASSERT_ERR; } ods_log_assert(zone->name); ods_log_assert(zone->adoutbound->configstr); switch(zone->adoutbound->type) { case ADAPTER_FILE: ods_log_verbose("[%s] write zone %s serial %u to output file " "adapter %s", adapter_str, zone->name, zone->db->intserial, zone->adoutbound->configstr); return adfile_write(zone, zone->adoutbound->configstr); case ADAPTER_DNS: return addns_write(zone); default: ods_log_error("[%s] unable to write zone %s to adapter: unknown " "adapter", adapter_str, zone->name); return ODS_STATUS_ERR; } /* not reached */ return ODS_STATUS_ERR; } /** * Compare adapters. * */ int adapter_compare(adapter_type* a1, adapter_type* a2) { if (!a1 && !a2) { return 0; } else if (!a1) { return -1; } else if (!a2) { return 1; } else if (a1->inbound != a2->inbound) { return a1->inbound - a2->inbound; } else if (a1->type != a2->type) { return a1->type - a2->type; } return ods_strcmp(a1->configstr, a2->configstr); } /** * Clean up adapter. * */ void adapter_cleanup(adapter_type* adapter) { if (!adapter) { return; } free((void*)adapter->configstr); switch(adapter->type) { case ADAPTER_FILE: break; case ADAPTER_DNS: if (adapter->inbound) { dnsin_cleanup((dnsin_type*) adapter->config); } else { /* outbound */ dnsout_cleanup((dnsout_type*) adapter->config); } break; default: break; } free(adapter); } opendnssec-2.1.13/signer/src/adapter/adfile.h0000644000077000001440000000357614446272525015776 00000000000000/* * 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 Adapters. * */ #ifndef ADAPTER_ADFILE_H #define ADAPTER_ADFILE_H #include "config.h" #include "status.h" #include /** * File adapter. * */ /** NULL */ /** * Read zone from input file adapter. * \param[in] zone zone reference * \return ods_status status * */ extern ods_status adfile_read(void* zone); /** * Write zone to output file adapter. * \param[in] zone zone reference * \param[in] filename write to this specific file * \return ods_status status * */ extern ods_status adfile_write(void* zone, const char* filename); #endif /* ADAPTER_ADFILE_H */ opendnssec-2.1.13/signer/src/adapter/adapter.h0000644000077000001440000000601514446272525016161 00000000000000/* * 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. * */ /** * Inbound and Outbound Adapters. * */ #ifndef ADAPTER_ADAPTER_H #define ADAPTER_ADAPTER_H #include "config.h" #include /** Adapter mode. */ enum adapter_mode_enum { ADAPTER_FILE = 1, ADAPTER_DNS }; typedef enum adapter_mode_enum adapter_mode; typedef struct adapter_struct adapter_type; #include "adapter/addns.h" #include "adapter/adfile.h" #include "status.h" #include "signer/zone.h" /** * Adapter. * */ struct adapter_struct { adapter_mode type; time_t config_last_modified; const char* configstr; void* config; /* TODO used either as dnsin_t* or dnsout_t* */ unsigned inbound : 1; unsigned error : 1; }; /** * Create new adapter. * \param[in] str configuration string * \param[in] type type of adapter * \param[in] in inbound or not (thus outbound) * \return adapter_type* created adapter * */ extern adapter_type* adapter_create(const char* str, adapter_mode type, unsigned in); /** * Load configuration. * \param[in] adapter adapter * \return ods_status status * */ extern ods_status adapter_load_config(adapter_type* adapter); /** * Compare adapters. * \param[in] a1 adapter 1 * \param[in] a2 adapter 2 * \return int 0 on equal, -1 if a1 < a2, 1 if a1 > a2 * */ extern int adapter_compare(adapter_type* a1, adapter_type* a2); /** * Read zone from input adapter. * \param[in] zone zone * \return ods_status status * */ extern ods_status adapter_read(zone_type* zone); /** * Write zone to output adapter. * \param[in] zone zone * \return ods_status status * */ extern ods_status adapter_write(zone_type* zone); /** * Clean up adapter. * \param[in] adapter adapter to cleanup * */ extern void adapter_cleanup(adapter_type* adapter); #endif /* ADAPTER_ADAPTER_H */ opendnssec-2.1.13/signer/src/adapter/adapi.c0000644000077000001440000003001014446272525015602 00000000000000/* * Copyright (c) 2009-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. * */ /** * * Adapter API. */ #include "config.h" #include "adapter/adapi.h" #include "duration.h" #include "log.h" #include "status.h" #include "util.h" #include "signer/zone.h" #include static const char* adapi_str = "adapter"; /** * Get the inbound serial. * */ uint32_t adapi_get_serial(zone_type* zone) { if (!zone || !zone->db) { return 0; } return zone->db->inbserial; } /** * Set the inbound serial. * */ void adapi_set_serial(zone_type* zone, uint32_t serial) { if (!zone || !zone->db) { return; } zone->db->inbserial = serial; } /** * Get origin. * */ ldns_rdf* adapi_get_origin(zone_type* zone) { if (!zone) { return NULL; } return zone->apex; } /** * Get ttl. * */ uint32_t adapi_get_ttl(zone_type* zone) { if (!zone) { return 0; } return zone->default_ttl; } /* * Do full zone transaction. * */ void adapi_trans_full(zone_type* zone, unsigned more_coming) { time_t start = 0; time_t end = 0; uint32_t num_added = 0; if (!zone || !zone->db) { return; } namedb_diff(zone->db, 0, more_coming); if (zone->stats) { pthread_mutex_lock(&zone->stats->stats_lock); zone->stats->nsec_time = 0; zone->stats->nsec_count = 0; pthread_mutex_unlock(&zone->stats->stats_lock); } start = time(NULL); /* nsecify(3) */ namedb_nsecify(zone->db, &num_added); end = time(NULL); if (zone->stats) { pthread_mutex_lock(&zone->stats->stats_lock); if (!zone->stats->start_time) { zone->stats->start_time = start; } zone->stats->nsec_time = (end-start); zone->stats->nsec_count = num_added; pthread_mutex_unlock(&zone->stats->stats_lock); } } /* * Do incremental zone transaction. * */ void adapi_trans_diff(zone_type* zone, unsigned more_coming) { time_t start = 0; time_t end = 0; uint32_t num_added = 0; if (!zone || !zone->db) { return; } namedb_diff(zone->db, 1, more_coming); if (zone->stats) { pthread_mutex_lock(&zone->stats->stats_lock); zone->stats->nsec_time = 0; zone->stats->nsec_count = 0; pthread_mutex_unlock(&zone->stats->stats_lock); } start = time(NULL); /* nsecify(3) */ namedb_nsecify(zone->db, &num_added); end = time(NULL); if (zone->stats) { pthread_mutex_lock(&zone->stats->stats_lock); if (!zone->stats->start_time) { zone->stats->start_time = start; } zone->stats->nsec_time = (end-start); zone->stats->nsec_count = num_added; pthread_mutex_unlock(&zone->stats->stats_lock); } } /** * Process SOA. * */ static ods_status adapi_process_soa(zone_type* zone, ldns_rr* rr, int add, int backup) { uint32_t tmp = 0; ldns_rdf* soa_rdata = NULL; ods_status status = ODS_STATUS_OK; ods_log_assert(rr); ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(zone->signconf); if (backup) { /* no need to do processing */ return ODS_STATUS_OK; } if (zone->signconf->soa_ttl) { tmp = (uint32_t) duration2time(zone->signconf->soa_ttl); ods_log_verbose("[%s] zone %s set soa ttl to %u", adapi_str, zone->name, tmp); ldns_rr_set_ttl(rr, tmp); } if (zone->signconf->soa_min) { tmp = (uint32_t) duration2time(zone->signconf->soa_min); ods_log_verbose("[%s] zone %s set soa minimum to %u", adapi_str, zone->name, tmp); soa_rdata = ldns_rr_set_rdf(rr, ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, tmp), SE_SOA_RDATA_MINIMUM); if (soa_rdata) { ldns_rdf_deep_free(soa_rdata); soa_rdata = NULL; } else { ods_log_error("[%s] unable to %s soa to zone %s: failed to replace " "soa minimum rdata", adapi_str, add?"add":"delete", zone->name); return ODS_STATUS_ASSERT_ERR; } } if (!add) { /* we are done */ return ODS_STATUS_OK; } tmp = ldns_rdf2native_int32(ldns_rr_rdf(rr, SE_SOA_RDATA_SERIAL)); status = namedb_update_serial(zone->db, zone->name, zone->signconf->soa_serial, tmp); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to add soa to zone %s: failed to replace " "soa serial rdata (%s)", adapi_str, zone->name, ods_status2str(status)); if (status == ODS_STATUS_CONFLICT_ERR) { ods_log_error("[%s] If this is the result of a key rollover, " "please increment the serial in the unsigned zone %s", adapi_str, zone->name); } return status; } ods_log_verbose("[%s] zone %s set soa serial to %u", adapi_str, zone->name, zone->db->intserial); soa_rdata = ldns_rr_set_rdf(rr, ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, zone->db->intserial), SE_SOA_RDATA_SERIAL); if (soa_rdata) { ldns_rdf_deep_free(soa_rdata); soa_rdata = NULL; } else { ods_log_error("[%s] unable to add soa to zone %s: failed to replace " "soa serial rdata", adapi_str, zone->name); return ODS_STATUS_ERR; } zone->db->serial_updated = 1; return ODS_STATUS_OK; } /** * Process DNSKEY. * */ static void adapi_process_dnskey(zone_type* zone, ldns_rr* rr) { uint32_t tmp = 0; ods_log_assert(rr); ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(zone->signconf); tmp = (uint32_t) duration2time(zone->signconf->dnskey_ttl); ods_log_verbose("[%s] zone %s set dnskey ttl to %u", adapi_str, zone->name, tmp); ldns_rr_set_ttl(rr, tmp); } /** * Process RR. * */ static ods_status adapi_process_rr(zone_type* zone, ldns_rr* rr, int add, int backup) { ods_status status = ODS_STATUS_OK; uint32_t tmp = 0; ods_log_assert(rr); ods_log_assert(zone); ods_log_assert(zone->name); ods_log_assert(zone->db); ods_log_assert(zone->signconf); /* We only support IN class */ if (ldns_rr_get_class(rr) != LDNS_RR_CLASS_IN) { ods_log_warning("[%s] only class in is supported, changing class " "to in", adapi_str); ldns_rr_set_class(rr, LDNS_RR_CLASS_IN); } /* RR processing */ if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) { if (ldns_dname_compare(ldns_rr_owner(rr), zone->apex)) { ods_log_error("[%s] unable to %s rr to zone: soa record has " "invalid owner name", adapi_str, add?"add":"delete"); return ODS_STATUS_ERR; } status = adapi_process_soa(zone, rr, add, backup); if (status != ODS_STATUS_OK) { ods_log_error("[%s] unable to %s rr: failed to process soa " "record", adapi_str, add?"add":"delete"); return status; } } else { if (ldns_dname_compare(ldns_rr_owner(rr), zone->apex) && !ldns_dname_is_subdomain(ldns_rr_owner(rr), zone->apex)) { ods_log_warning("[%s] zone %s contains out-of-zone data, " "skipping", adapi_str, zone->name); return ODS_STATUS_UNCHANGED; } else if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_DNSKEY) { adapi_process_dnskey(zone, rr); } else if (util_is_dnssec_rr(rr) && !backup) { ods_log_warning("[%s] zone %s contains dnssec data (type=%u), " "skipping", adapi_str, zone->name, (unsigned) ldns_rr_get_type(rr)); return ODS_STATUS_UNCHANGED; } else if (zone->signconf->max_zone_ttl) { /* Convert MaxZoneTTL */ tmp = (uint32_t) duration2time(zone->signconf->max_zone_ttl); } } /* //MaxZoneTTL. Only set for RRtype != SOA && RRtype != DNSKEY */ if (tmp && tmp < ldns_rr_ttl(rr)) { char* str = ldns_rdf2str(ldns_rr_owner(rr)); if (str) { str[(strlen(str))-1] = '\0'; /* replace tabs with white space */ for (int i = 0; i < strlen(str); i++) { if (str[i] == '\t') { str[i] = ' '; } } ods_log_warning("[%s] TTL %u exceeds MaxZoneTTL %u for rrset " "<%s,%s>", adapi_str, ldns_rr_ttl(rr), tmp, str, rrset_type2str(ldns_rr_get_type(rr))); LDNS_FREE(str); } } /* TODO: DNAME and CNAME checks */ /* TODO: NS and DS checks */ if (add) { return zone_add_rr(zone, rr, 1); } else { return zone_del_rr(zone, rr, 1); } /* not reached */ return ODS_STATUS_ERR; } /** * Add RR. * */ ods_status adapi_add_rr(zone_type* zone, ldns_rr* rr, int backup) { return adapi_process_rr(zone, rr, 1, backup); } /** * Delete RR. * */ ods_status adapi_del_rr(zone_type* zone, ldns_rr* rr, int backup) { return adapi_process_rr(zone, rr, 0, backup); } /** * Print zone. * */ ods_status adapi_printzone(FILE* fd, zone_type* zone) { ods_status status = ODS_STATUS_OK; if (!fd || !zone || !zone->db) { ods_log_error("[%s] unable to print zone: file descriptor, zone or " "name database missing", adapi_str); return ODS_STATUS_ASSERT_ERR; } namedb_export(fd, zone->db, &status); return status; } /** * Print axfr. * */ ods_status adapi_printaxfr(FILE* fd, zone_type* zone) { rrset_type* rrset = NULL; ods_status status = ODS_STATUS_OK; if (!fd || !zone || !zone->db) { ods_log_error("[%s] unable to print axfr: file descriptor, zone or " "name database missing", adapi_str); return ODS_STATUS_ASSERT_ERR; } namedb_export(fd, zone->db, &status); if (status == ODS_STATUS_OK) { rrset = zone_lookup_rrset(zone, zone->apex, LDNS_RR_TYPE_SOA); ods_log_assert(rrset); rrset_print(fd, rrset, 1, &status); } return status; } /** * Print ixfr. * */ ods_status adapi_printixfr(FILE* fd, zone_type* zone) { rrset_type* rrset = NULL; ods_status status = ODS_STATUS_OK; if (!fd || !zone || !zone->db || !zone->ixfr) { ods_log_error("[%s] unable to print ixfr: file descriptor, zone or " "name database missing", adapi_str); return ODS_STATUS_ASSERT_ERR; } if (!zone->db->is_initialized) { /* no ixfr yet */ return ODS_STATUS_OK; } rrset = zone_lookup_rrset(zone, zone->apex, LDNS_RR_TYPE_SOA); ods_log_assert(rrset); rrset_print(fd, rrset, 1, &status); if (status != ODS_STATUS_OK) { return status; } pthread_mutex_lock(&zone->ixfr->ixfr_lock); if (ixfr_print(fd, zone->ixfr)) { zone->adoutbound->error = 1; } pthread_mutex_unlock(&zone->ixfr->ixfr_lock); rrset_print(fd, rrset, 1, &status); return status; } opendnssec-2.1.13/signer/src/adapter/adutil.c0000644000077000001440000001202314446272525016012 00000000000000/* * Copyright (c) 2009-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. * */ /** * * Adapter utilities. */ #include "config.h" #include "adapter/adutil.h" #include "file.h" #include "log.h" #include static const char* adapter_str = "adapter"; /** * Read one line from zone file. * */ int adutil_readline_frm_file(FILE* fd, char* line, unsigned int* l, int keep_comments) { int i = 0; int li = 0; int in_string = 0; int depth = 0; int comments = 0; int c = 0; int lc = 0; for (i = 0; i < SE_ADFILE_MAXLINE; i++) { c = ods_fgetc(fd, l); if (comments) { while (c != EOF && (char)c != '\n') { c = ods_fgetc(fd, l); } } if (c == EOF) { if (depth != 0) { ods_log_error("[%s] read line: bracket mismatch discovered at " "line %i, missing ')'", adapter_str, l&&*l?*l:0); } if (li > 0) { line[li] = '\0'; return li; } else { return -1; } } else if ((char)c == '"' && (char)lc != '\\') { in_string = 1 - in_string; /* swap status */ line[li] = (char)c; li++; } else if ((char)c == '(') { if (in_string) { line[li] = (char)c; li++; } else if ((char)lc != '\\') { depth++; line[li] = ' '; li++; } else { line[li] = (char)c; li++; } } else if ((char)c == ')') { if (in_string) { line[li] = (char)c; li++; } else if ((char)lc != '\\') { if (depth < 1) { ods_log_error("[%s] read line: bracket mismatch " "discovered at line %i, missing '('", adapter_str, l&&*l?*l:0); line[li] = '\0'; return li; } depth--; line[li] = ' '; li++; } else { line[li] = (char)c; li++; } } else if ((char)c == ';') { if (in_string) { line[li] = (char)c; li++; } else if ((char)lc != '\\' && !keep_comments) { comments = 1; } else { line[li] = (char)c; li++; } } else if ((char)c == '\n' && (char)lc != '\\') { comments = 0; /* if no depth issue, we are done */ if (depth == 0) { break; } line[li] = ' '; li++; } else { line[li] = (char)c; li++; } /* continue with line */ lc = c; } /* done */ if (depth != 0) { ods_log_error("[%s] read line: bracket mismatch discovered at line %i," " missing ')'", adapter_str, l&&*l?*l:0); return li; } line[li] = '\0'; return li; } /* * Trim trailing whitespace. * */ void adutil_rtrim_line(char* line, int* line_len) { int i = strlen(line), nl = 0; int trimmed = 0; while (i>0) { --i; if (line[i] == '\n') { nl = 1; } if (line[i] == ' ' || line[i] == '\t' || line[i] == '\n') { line[i] = '\0'; trimmed++; } else { break; } } if (nl) { line[++i] = '\n'; } *line_len -= trimmed; } /** * Check for white space. * */ int adutil_whitespace_line(char* line, int line_len) { int i; for (i = 0; i < line_len; i++) { if (!isspace((int)line[i])) { return 0; } } return 1; } opendnssec-2.1.13/signer/src/Makefile.in0000644000077000001440000012141314446272532015013 00000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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@ target_triplet = @target@ sbin_PROGRAMS = ods-signerd$(EXEEXT) ods-signer$(EXEEXT) subdir = signer/src 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_dlopen.m4 \ $(top_srcdir)/m4/acx_enforcer_database.m4 \ $(top_srcdir)/m4/acx_ldns.m4 $(top_srcdir)/m4/acx_libc.m4 \ $(top_srcdir)/m4/acx_libreadline.m4 \ $(top_srcdir)/m4/acx_libxml2.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_ssl.m4 \ $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 \ $(top_srcdir)/m4/ax_lib_sqlite3.m4 \ $(top_srcdir)/m4/ax_prepend_flag.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.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)/m4/pkg.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/common/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" PROGRAMS = $(sbin_PROGRAMS) am_ods_signer_OBJECTS = ods-signer.$(OBJEXT) ods_signer_OBJECTS = $(am_ods_signer_OBJECTS) ods_signer_DEPENDENCIES = $(LIBHSM) $(LIBCOMPAT) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am__dirstamp = $(am__leading_dot)dirstamp am_ods_signerd_OBJECTS = ods-signerd.$(OBJEXT) adapter/adapi.$(OBJEXT) \ adapter/adapter.$(OBJEXT) adapter/addns.$(OBJEXT) \ adapter/adfile.$(OBJEXT) adapter/adutil.$(OBJEXT) \ daemon/cfg.$(OBJEXT) daemon/signercommands.$(OBJEXT) \ daemon/dnshandler.$(OBJEXT) daemon/xfrhandler.$(OBJEXT) \ daemon/engine.$(OBJEXT) daemon/signertasks.$(OBJEXT) \ parser/addnsparser.$(OBJEXT) parser/confparser.$(OBJEXT) \ parser/signconfparser.$(OBJEXT) \ parser/zonelistparser.$(OBJEXT) signer/backup.$(OBJEXT) \ hsm.$(OBJEXT) signer/denial.$(OBJEXT) signer/domain.$(OBJEXT) \ signer/ixfr.$(OBJEXT) signer/keys.$(OBJEXT) \ signer/namedb.$(OBJEXT) signer/nsec3params.$(OBJEXT) \ signer/rrset.$(OBJEXT) signer/signconf.$(OBJEXT) \ signer/stats.$(OBJEXT) signer/tools.$(OBJEXT) \ signer/zone.$(OBJEXT) signer/zonelist.$(OBJEXT) \ wire/acl.$(OBJEXT) wire/axfr.$(OBJEXT) wire/buffer.$(OBJEXT) \ wire/edns.$(OBJEXT) wire/listener.$(OBJEXT) \ wire/netio.$(OBJEXT) wire/notify.$(OBJEXT) \ wire/query.$(OBJEXT) wire/sock.$(OBJEXT) wire/tcpset.$(OBJEXT) \ wire/tsig.$(OBJEXT) wire/tsig-openssl.$(OBJEXT) \ wire/xfrd.$(OBJEXT) ods_signerd_OBJECTS = $(am_ods_signerd_OBJECTS) ods_signerd_DEPENDENCIES = $(LIBHSM) $(LIBCOMPAT) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/hsm.Po ./$(DEPDIR)/ods-signer.Po \ ./$(DEPDIR)/ods-signerd.Po adapter/$(DEPDIR)/adapi.Po \ adapter/$(DEPDIR)/adapter.Po adapter/$(DEPDIR)/addns.Po \ adapter/$(DEPDIR)/adfile.Po adapter/$(DEPDIR)/adutil.Po \ daemon/$(DEPDIR)/cfg.Po daemon/$(DEPDIR)/dnshandler.Po \ daemon/$(DEPDIR)/engine.Po daemon/$(DEPDIR)/signercommands.Po \ daemon/$(DEPDIR)/signertasks.Po daemon/$(DEPDIR)/xfrhandler.Po \ parser/$(DEPDIR)/addnsparser.Po parser/$(DEPDIR)/confparser.Po \ parser/$(DEPDIR)/signconfparser.Po \ parser/$(DEPDIR)/zonelistparser.Po signer/$(DEPDIR)/backup.Po \ signer/$(DEPDIR)/denial.Po signer/$(DEPDIR)/domain.Po \ signer/$(DEPDIR)/ixfr.Po signer/$(DEPDIR)/keys.Po \ signer/$(DEPDIR)/namedb.Po signer/$(DEPDIR)/nsec3params.Po \ signer/$(DEPDIR)/rrset.Po signer/$(DEPDIR)/signconf.Po \ signer/$(DEPDIR)/stats.Po signer/$(DEPDIR)/tools.Po \ signer/$(DEPDIR)/zone.Po signer/$(DEPDIR)/zonelist.Po \ wire/$(DEPDIR)/acl.Po wire/$(DEPDIR)/axfr.Po \ wire/$(DEPDIR)/buffer.Po wire/$(DEPDIR)/edns.Po \ wire/$(DEPDIR)/listener.Po wire/$(DEPDIR)/netio.Po \ wire/$(DEPDIR)/notify.Po wire/$(DEPDIR)/query.Po \ wire/$(DEPDIR)/sock.Po wire/$(DEPDIR)/tcpset.Po \ wire/$(DEPDIR)/tsig-openssl.Po wire/$(DEPDIR)/tsig.Po \ wire/$(DEPDIR)/xfrd.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(ods_signer_SOURCES) $(ods_signerd_SOURCES) DIST_SOURCES = $(ods_signer_SOURCES) $(ods_signerd_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CP = @CP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CUNIT_INCLUDES = @CUNIT_INCLUDES@ CUNIT_LIBS = @CUNIT_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ C_LIBS = @C_LIBS@ 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@ ENFORCER_DB_DATABASE = @ENFORCER_DB_DATABASE@ ENFORCER_DB_HOST = @ENFORCER_DB_HOST@ ENFORCER_DB_INCLUDES = @ENFORCER_DB_INCLUDES@ ENFORCER_DB_LIBS = @ENFORCER_DB_LIBS@ ENFORCER_DB_PASSWORD = @ENFORCER_DB_PASSWORD@ ENFORCER_DB_PORT = @ENFORCER_DB_PORT@ ENFORCER_DB_PORT_TEXT = @ENFORCER_DB_PORT_TEXT@ ENFORCER_DB_USERNAME = @ENFORCER_DB_USERNAME@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_SSL = @HAVE_SSL@ HAVE_SSL_NEW_HMAC = @HAVE_SSL_NEW_HMAC@ INSTALL = @INSTALL@ INSTALLATIONCOND = @INSTALLATIONCOND@ INSTALLATIONGROUP = @INSTALLATIONGROUP@ INSTALLATIONGROUPARG = @INSTALLATIONGROUPARG@ INSTALLATIONUSER = @INSTALLATIONUSER@ INSTALLATIONUSERARG = @INSTALLATIONUSERARG@ 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@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MYSQL_CFLAGS = @MYSQL_CFLAGS@ MYSQL_CONFIG = @MYSQL_CONFIG@ MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ MYSQL_VERSION = @MYSQL_VERSION@ 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_ENFORCER_SOCKETFILE = @OPENDNSSEC_ENFORCER_SOCKETFILE@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ READLINE_LIBS = @READLINE_LIBS@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_VERSION = @SQLITE3_VERSION@ SSL_INCLUDES = @SSL_INCLUDES@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ 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_CXX = @ac_ct_CXX@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in LIBHSM = ${top_builddir}/libhsm/src/lib/libhsm.a LIBCOMPAT = ${top_builddir}/common/libcompat.a AM_CPPFLAGS = \ -I$(top_srcdir)/common \ -I$(top_builddir)/common \ -I$(top_srcdir)/libhsm/src/lib \ @SSL_INCLUDES@ \ @XML2_INCLUDES@ \ @LDNS_INCLUDES@ signerdir = @libdir@/opendnssec/signer # man8_MANS = man/ods-signer.8 man/ods-signerd.8 ods_signerd_SOURCES = ods-signerd.c \ adapter/adapi.c adapter/adapi.h \ adapter/adapter.c adapter/adapter.h \ adapter/addns.c adapter/addns.h \ adapter/adfile.c adapter/adfile.h \ adapter/adutil.c adapter/adutil.h \ daemon/cfg.c daemon/cfg.h \ daemon/signercommands.c daemon/signercommands.h \ daemon/dnshandler.c daemon/dnshandler.h \ daemon/xfrhandler.c daemon/xfrhandler.h \ daemon/engine.c daemon/engine.h \ daemon/signertasks.c daemon/signertasks.h \ parser/addnsparser.c parser/addnsparser.h \ parser/confparser.c parser/confparser.h \ parser/signconfparser.c parser/signconfparser.h \ parser/zonelistparser.c parser/zonelistparser.h \ signer/backup.c signer/backup.h \ hsm.c hsm.h \ signer/denial.c signer/denial.h \ signer/domain.c signer/domain.h \ signer/ixfr.c signer/ixfr.h \ signer/keys.c signer/keys.h \ signer/namedb.c signer/namedb.h \ signer/nsec3params.c signer/nsec3params.h \ signer/rrset.c signer/rrset.h \ signer/signconf.c signer/signconf.h \ signer/stats.c signer/stats.h \ signer/tools.c signer/tools.h \ signer/zone.c signer/zone.h \ signer/zonelist.c signer/zonelist.h \ wire/acl.c wire/acl.h \ wire/axfr.c wire/axfr.h \ wire/buffer.c wire/buffer.h \ wire/edns.c wire/edns.h \ wire/listener.c wire/listener.h \ wire/netio.c wire/netio.h \ wire/notify.c wire/notify.h \ wire/query.c wire/query.h \ wire/sock.c wire/sock.h \ wire/tcpset.c wire/tcpset.h \ wire/tsig.c wire/tsig.h \ wire/tsig-openssl.c wire/tsig-openssl.h \ wire/xfrd.c wire/xfrd.h ods_signerd_LDADD = $(LIBHSM) $(LIBCOMPAT) @LDNS_LIBS@ @XML2_LIBS@ \ @PTHREAD_LIBS@ @RT_LIBS@ @SSL_LIBS@ @C_LIBS@ $(am__empty) ods_signer_SOURCES = ods-signer.c ods_signer_LDADD = $(LIBHSM) $(LIBCOMPAT) @LDNS_LIBS@ @XML2_LIBS@ \ @READLINE_LIBS@ $(am__empty) 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 signer/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign signer/src/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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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): install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ fi; \ 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)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || 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)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: @list='$(sbin_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-signer$(EXEEXT): $(ods_signer_OBJECTS) $(ods_signer_DEPENDENCIES) $(EXTRA_ods_signer_DEPENDENCIES) @rm -f ods-signer$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ods_signer_OBJECTS) $(ods_signer_LDADD) $(LIBS) adapter/$(am__dirstamp): @$(MKDIR_P) adapter @: > adapter/$(am__dirstamp) adapter/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) adapter/$(DEPDIR) @: > adapter/$(DEPDIR)/$(am__dirstamp) adapter/adapi.$(OBJEXT): adapter/$(am__dirstamp) \ adapter/$(DEPDIR)/$(am__dirstamp) adapter/adapter.$(OBJEXT): adapter/$(am__dirstamp) \ adapter/$(DEPDIR)/$(am__dirstamp) adapter/addns.$(OBJEXT): adapter/$(am__dirstamp) \ adapter/$(DEPDIR)/$(am__dirstamp) adapter/adfile.$(OBJEXT): adapter/$(am__dirstamp) \ adapter/$(DEPDIR)/$(am__dirstamp) adapter/adutil.$(OBJEXT): adapter/$(am__dirstamp) \ adapter/$(DEPDIR)/$(am__dirstamp) daemon/$(am__dirstamp): @$(MKDIR_P) daemon @: > daemon/$(am__dirstamp) daemon/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) daemon/$(DEPDIR) @: > daemon/$(DEPDIR)/$(am__dirstamp) daemon/cfg.$(OBJEXT): daemon/$(am__dirstamp) \ daemon/$(DEPDIR)/$(am__dirstamp) daemon/signercommands.$(OBJEXT): daemon/$(am__dirstamp) \ daemon/$(DEPDIR)/$(am__dirstamp) daemon/dnshandler.$(OBJEXT): daemon/$(am__dirstamp) \ daemon/$(DEPDIR)/$(am__dirstamp) daemon/xfrhandler.$(OBJEXT): daemon/$(am__dirstamp) \ daemon/$(DEPDIR)/$(am__dirstamp) daemon/engine.$(OBJEXT): daemon/$(am__dirstamp) \ daemon/$(DEPDIR)/$(am__dirstamp) daemon/signertasks.$(OBJEXT): daemon/$(am__dirstamp) \ daemon/$(DEPDIR)/$(am__dirstamp) parser/$(am__dirstamp): @$(MKDIR_P) parser @: > parser/$(am__dirstamp) parser/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) parser/$(DEPDIR) @: > parser/$(DEPDIR)/$(am__dirstamp) parser/addnsparser.$(OBJEXT): parser/$(am__dirstamp) \ parser/$(DEPDIR)/$(am__dirstamp) parser/confparser.$(OBJEXT): parser/$(am__dirstamp) \ parser/$(DEPDIR)/$(am__dirstamp) parser/signconfparser.$(OBJEXT): parser/$(am__dirstamp) \ parser/$(DEPDIR)/$(am__dirstamp) parser/zonelistparser.$(OBJEXT): parser/$(am__dirstamp) \ parser/$(DEPDIR)/$(am__dirstamp) signer/$(am__dirstamp): @$(MKDIR_P) signer @: > signer/$(am__dirstamp) signer/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) signer/$(DEPDIR) @: > signer/$(DEPDIR)/$(am__dirstamp) signer/backup.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) signer/denial.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) signer/domain.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) signer/ixfr.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) signer/keys.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) signer/namedb.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) signer/nsec3params.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) signer/rrset.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) signer/signconf.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) signer/stats.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) signer/tools.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) signer/zone.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) signer/zonelist.$(OBJEXT): signer/$(am__dirstamp) \ signer/$(DEPDIR)/$(am__dirstamp) wire/$(am__dirstamp): @$(MKDIR_P) wire @: > wire/$(am__dirstamp) wire/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) wire/$(DEPDIR) @: > wire/$(DEPDIR)/$(am__dirstamp) wire/acl.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) wire/axfr.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) wire/buffer.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) wire/edns.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) wire/listener.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) wire/netio.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) wire/notify.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) wire/query.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) wire/sock.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) wire/tcpset.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) wire/tsig.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) wire/tsig-openssl.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) wire/xfrd.$(OBJEXT): wire/$(am__dirstamp) \ wire/$(DEPDIR)/$(am__dirstamp) ods-signerd$(EXEEXT): $(ods_signerd_OBJECTS) $(ods_signerd_DEPENDENCIES) $(EXTRA_ods_signerd_DEPENDENCIES) @rm -f ods-signerd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ods_signerd_OBJECTS) $(ods_signerd_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f adapter/*.$(OBJEXT) -rm -f daemon/*.$(OBJEXT) -rm -f parser/*.$(OBJEXT) -rm -f signer/*.$(OBJEXT) -rm -f wire/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hsm.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ods-signer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ods-signerd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@adapter/$(DEPDIR)/adapi.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@adapter/$(DEPDIR)/adapter.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@adapter/$(DEPDIR)/addns.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@adapter/$(DEPDIR)/adfile.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@adapter/$(DEPDIR)/adutil.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@daemon/$(DEPDIR)/cfg.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@daemon/$(DEPDIR)/dnshandler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@daemon/$(DEPDIR)/engine.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@daemon/$(DEPDIR)/signercommands.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@daemon/$(DEPDIR)/signertasks.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@daemon/$(DEPDIR)/xfrhandler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@parser/$(DEPDIR)/addnsparser.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@parser/$(DEPDIR)/confparser.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@parser/$(DEPDIR)/signconfparser.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@parser/$(DEPDIR)/zonelistparser.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/backup.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/denial.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/domain.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/ixfr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/keys.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/namedb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/nsec3params.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/rrset.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/signconf.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/stats.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/tools.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/zone.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@signer/$(DEPDIR)/zonelist.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/acl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/axfr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/buffer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/edns.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/listener.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/netio.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/notify.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/query.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/sock.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/tcpset.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/tsig-openssl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/tsig.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@wire/$(DEPDIR)/xfrd.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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: for dir in "$(DESTDIR)$(sbindir)"; 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) -rm -f adapter/$(DEPDIR)/$(am__dirstamp) -rm -f adapter/$(am__dirstamp) -rm -f daemon/$(DEPDIR)/$(am__dirstamp) -rm -f daemon/$(am__dirstamp) -rm -f parser/$(DEPDIR)/$(am__dirstamp) -rm -f parser/$(am__dirstamp) -rm -f signer/$(DEPDIR)/$(am__dirstamp) -rm -f signer/$(am__dirstamp) -rm -f wire/$(DEPDIR)/$(am__dirstamp) -rm -f wire/$(am__dirstamp) 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-sbinPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/hsm.Po -rm -f ./$(DEPDIR)/ods-signer.Po -rm -f ./$(DEPDIR)/ods-signerd.Po -rm -f adapter/$(DEPDIR)/adapi.Po -rm -f adapter/$(DEPDIR)/adapter.Po -rm -f adapter/$(DEPDIR)/addns.Po -rm -f adapter/$(DEPDIR)/adfile.Po -rm -f adapter/$(DEPDIR)/adutil.Po -rm -f daemon/$(DEPDIR)/cfg.Po -rm -f daemon/$(DEPDIR)/dnshandler.Po -rm -f daemon/$(DEPDIR)/engine.Po -rm -f daemon/$(DEPDIR)/signercommands.Po -rm -f daemon/$(DEPDIR)/signertasks.Po -rm -f daemon/$(DEPDIR)/xfrhandler.Po -rm -f parser/$(DEPDIR)/addnsparser.Po -rm -f parser/$(DEPDIR)/confparser.Po -rm -f parser/$(DEPDIR)/signconfparser.Po -rm -f parser/$(DEPDIR)/zonelistparser.Po -rm -f signer/$(DEPDIR)/backup.Po -rm -f signer/$(DEPDIR)/denial.Po -rm -f signer/$(DEPDIR)/domain.Po -rm -f signer/$(DEPDIR)/ixfr.Po -rm -f signer/$(DEPDIR)/keys.Po -rm -f signer/$(DEPDIR)/namedb.Po -rm -f signer/$(DEPDIR)/nsec3params.Po -rm -f signer/$(DEPDIR)/rrset.Po -rm -f signer/$(DEPDIR)/signconf.Po -rm -f signer/$(DEPDIR)/stats.Po -rm -f signer/$(DEPDIR)/tools.Po -rm -f signer/$(DEPDIR)/zone.Po -rm -f signer/$(DEPDIR)/zonelist.Po -rm -f wire/$(DEPDIR)/acl.Po -rm -f wire/$(DEPDIR)/axfr.Po -rm -f wire/$(DEPDIR)/buffer.Po -rm -f wire/$(DEPDIR)/edns.Po -rm -f wire/$(DEPDIR)/listener.Po -rm -f wire/$(DEPDIR)/netio.Po -rm -f wire/$(DEPDIR)/notify.Po -rm -f wire/$(DEPDIR)/query.Po -rm -f wire/$(DEPDIR)/sock.Po -rm -f wire/$(DEPDIR)/tcpset.Po -rm -f wire/$(DEPDIR)/tsig-openssl.Po -rm -f wire/$(DEPDIR)/tsig.Po -rm -f wire/$(DEPDIR)/xfrd.Po -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-sbinPROGRAMS 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 ./$(DEPDIR)/hsm.Po -rm -f ./$(DEPDIR)/ods-signer.Po -rm -f ./$(DEPDIR)/ods-signerd.Po -rm -f adapter/$(DEPDIR)/adapi.Po -rm -f adapter/$(DEPDIR)/adapter.Po -rm -f adapter/$(DEPDIR)/addns.Po -rm -f adapter/$(DEPDIR)/adfile.Po -rm -f adapter/$(DEPDIR)/adutil.Po -rm -f daemon/$(DEPDIR)/cfg.Po -rm -f daemon/$(DEPDIR)/dnshandler.Po -rm -f daemon/$(DEPDIR)/engine.Po -rm -f daemon/$(DEPDIR)/signercommands.Po -rm -f daemon/$(DEPDIR)/signertasks.Po -rm -f daemon/$(DEPDIR)/xfrhandler.Po -rm -f parser/$(DEPDIR)/addnsparser.Po -rm -f parser/$(DEPDIR)/confparser.Po -rm -f parser/$(DEPDIR)/signconfparser.Po -rm -f parser/$(DEPDIR)/zonelistparser.Po -rm -f signer/$(DEPDIR)/backup.Po -rm -f signer/$(DEPDIR)/denial.Po -rm -f signer/$(DEPDIR)/domain.Po -rm -f signer/$(DEPDIR)/ixfr.Po -rm -f signer/$(DEPDIR)/keys.Po -rm -f signer/$(DEPDIR)/namedb.Po -rm -f signer/$(DEPDIR)/nsec3params.Po -rm -f signer/$(DEPDIR)/rrset.Po -rm -f signer/$(DEPDIR)/signconf.Po -rm -f signer/$(DEPDIR)/stats.Po -rm -f signer/$(DEPDIR)/tools.Po -rm -f signer/$(DEPDIR)/zone.Po -rm -f signer/$(DEPDIR)/zonelist.Po -rm -f wire/$(DEPDIR)/acl.Po -rm -f wire/$(DEPDIR)/axfr.Po -rm -f wire/$(DEPDIR)/buffer.Po -rm -f wire/$(DEPDIR)/edns.Po -rm -f wire/$(DEPDIR)/listener.Po -rm -f wire/$(DEPDIR)/netio.Po -rm -f wire/$(DEPDIR)/notify.Po -rm -f wire/$(DEPDIR)/query.Po -rm -f wire/$(DEPDIR)/sock.Po -rm -f wire/$(DEPDIR)/tcpset.Po -rm -f wire/$(DEPDIR)/tsig-openssl.Po -rm -f wire/$(DEPDIR)/tsig.Po -rm -f wire/$(DEPDIR)/xfrd.Po -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-sbinPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-sbinPROGRAMS cscopelist-am \ ctags ctags-am 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-sbinPROGRAMS 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 tags-am uninstall uninstall-am uninstall-sbinPROGRAMS .PRECIOUS: Makefile # 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-2.1.13/signer/src/hsm.h0000644000077000001440000000454414446272525013715 00000000000000/* * 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. * */ /** * Hardware Security Module support. * */ #ifndef SHARED_HSM_H #define SHARED_HSM_H #include "config.h" #include "status.h" #include "signer/keys.h" #include "libhsm.h" #include #include #include #include /** * Get key from one of the HSMs, store the DNSKEY and HSM key. * \param[in] ctx HSM context * \param[in] owner the zone owner name * \param[in] key_id key credentials * \return ods_status status * */ extern ods_status lhsm_get_key(hsm_ctx_t* ctx, ldns_rdf* owner, key_type* key_id, int skip_hsm_access); /** * Get RRSIG from one of the HSMs, given a RRset and a key. * \param[in] ctx HSM context * \param[in] rrset RRset to be signed * \param[in] key_id key credentials * \param[in] owner owner of the keys * \param[in] inception signature inception * \param[in] expiration signature expiration * \return ldns_rr* RRSIG record * */ extern ldns_rr* lhsm_sign(hsm_ctx_t* ctx, ldns_rr_list* rrset, key_type* key_id, ldns_rdf* owner, time_t inception, time_t expiration); #endif /* SHARED_HSM_H */ opendnssec-2.1.13/signer/src/parser/0000755000077000001440000000000014446272546014325 500000000000000opendnssec-2.1.13/signer/src/parser/addnsparser.c0000644000077000001440000002643614446272525016727 00000000000000/* * 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 "log.h" #include #include #include #include static const char* parser_str = "parser"; /** * Parse the remote servers. * */ static acl_type* parse_addns_remote(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 (!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(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(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 (!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(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(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 (!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(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(const char* filename, tsig_type* tsig) { return parse_addns_remote(filename, tsig, (char *)"//Adapter/DNS/Inbound/RequestTransfer/Remote"); } /** * Parse . * */ acl_type* parse_addns_allow_notify(const char* filename, tsig_type* tsig) { return parse_addns_acl(filename, tsig, (char *)"//Adapter/DNS/Inbound/AllowNotify/Peer"); } /** * Parse . * */ acl_type* parse_addns_provide_xfr(const char* filename, tsig_type* tsig) { return parse_addns_acl(filename, tsig, (char *)"//Adapter/DNS/Outbound/ProvideTransfer/Peer"); } /** * Parse . * */ acl_type* parse_addns_do_notify(const char* filename, tsig_type* tsig) { return parse_addns_remote(filename, tsig, (char *)"//Adapter/DNS/Outbound/Notify/Remote"); } /** * Parse . * */ tsig_type* parse_addns_tsig(const char* filename) { return parse_addns_tsig_static(filename, (char *)"//Adapter/DNS/TSIG"); } opendnssec-2.1.13/signer/src/parser/signconfparser.c0000644000077000001440000003506714446272525017444 00000000000000/* * Copyright (c) 2009-2016 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 "duration.h" #include "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* resourcerecord; char* locator; char* flags; char* algorithm; int configerr; 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++) { resourcerecord = NULL; locator = NULL; flags = NULL; algorithm = NULL; ksk = 0; zsk = 0; publish = 0; configerr = 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; } else if (xmlStrEqual(curNode->name, (const xmlChar *)"ResourceRecord")) { resourcerecord = (char *) xmlNodeGetContent(curNode); } curNode = curNode->next; } if (!algorithm) configerr = 1; if (!flags) configerr = 1; if (!locator && !resourcerecord) configerr = 1; if (!configerr) { /* 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, resourcerecord, (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*)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_validity_keyset(const char* cfgfile) { duration_type* duration = NULL; const char* str = parse_conf_string(cfgfile, "//SignerConfiguration/Zone/Signatures/Validity/Keyset", 0); /* Even if the value is 0 or NULL we want to write it in duration format. The value is written in backup file and read during startup*/ /*if (!str || *str == 0 || *str == '0') { 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; } const char** parse_sc_dnskey_sigrrs(const char* cfgfile) { xmlDocPtr doc = NULL; xmlXPathContextPtr xpathCtx = NULL; xmlXPathObjectPtr xpathObj = NULL; xmlNode* curNode = NULL; xmlChar* xexpr = NULL; const char **signatureresourcerecords; int i; if (!cfgfile) { 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/SignatureResourceRecord"; 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 */ if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) { signatureresourcerecords = malloc(sizeof(char*) * (xpathObj->nodesetval->nodeNr + 1)); for (i = 0; i < xpathObj->nodesetval->nodeNr; i++) { curNode = xpathObj->nodesetval->nodeTab[i]; signatureresourcerecords[i] = (char *) xmlNodeGetContent(curNode); } signatureresourcerecords[i] = NULL; } else { signatureresourcerecords = NULL; } xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathCtx); if (doc) { xmlFreeDoc(doc); } return signatureresourcerecords; } 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; } duration_type* parse_sc_max_zone_ttl(const char* cfgfile) { duration_type* duration = NULL; const char* str = parse_conf_string(cfgfile, "//SignerConfiguration/Zone/Signatures/MaxZoneTTL", 0); 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; } int parse_sc_passthrough(const char* cfgfile) { int ret = 0; const char* str = parse_conf_string(cfgfile, "//SignerConfiguration/Zone/Passthrough", 0); if (str) { ret = 1; free((void*)str); } return ret; } /** * Parse elements from the configuration file. * */ const char* parse_sc_soa_serial(const char* cfgfile) { const char* dup = NULL; const char* str = parse_conf_string( cfgfile, "//SignerConfiguration/Zone/SOA/Serial", 1); if (str) { dup = strdup(str); free((void*)str); } return dup; } const char* parse_sc_nsec3_salt(const char* cfgfile) { const char* dup = NULL; const char* str = parse_conf_string( cfgfile, "//SignerConfiguration/Zone/Denial/NSEC3/Hash/Salt", 1); if (str) { dup = strdup(str); free((void*)str); } return dup; } opendnssec-2.1.13/signer/src/parser/signconfparser.h0000644000077000001440000000765214446272525017450 00000000000000/* * 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 "status.h" #include "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 * */ extern 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 * */ extern duration_type* parse_sc_sig_resign_interval(const char* cfgfile); extern duration_type* parse_sc_sig_refresh_interval(const char* cfgfile); extern duration_type* parse_sc_sig_validity_default(const char* cfgfile); extern duration_type* parse_sc_sig_validity_denial(const char* cfgfile); extern duration_type* parse_sc_sig_validity_keyset(const char* cfgfile); extern duration_type* parse_sc_sig_jitter(const char* cfgfile); extern duration_type* parse_sc_sig_inception_offset(const char* cfgfile); extern duration_type* parse_sc_dnskey_ttl(const char* cfgfile); extern const char** parse_sc_dnskey_sigrrs(const char* cfgfile); extern duration_type* parse_sc_nsec3param_ttl(const char* cfgfile); extern duration_type* parse_sc_soa_ttl(const char* cfgfile); extern duration_type* parse_sc_soa_min(const char* cfgfile); extern duration_type* parse_sc_max_zone_ttl(const char* cfgfile); /** * Parse elements from the configuration file. * \param[in] cfgfile the configuration file name. * \return ldns_rr_type rr type * */ extern 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 * */ extern uint32_t parse_sc_nsec3_algorithm(const char* cfgfile); extern 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 * */ extern int parse_sc_nsec3_optout(const char* cfgfile); /** * Parse elements from the configuration file. * \param[in] cfgfile the configuration file name. * \return boolean */ extern int parse_sc_passthrough(const char* cfgfile); /** * Parse elements from the configuration file. * \param[in] cfgfile the configuration file name. * \return const char* string * */ extern const char* parse_sc_soa_serial(const char* cfgfile); extern const char* parse_sc_nsec3_salt(const char* cfgfile); #endif /* PARSER_SIGNCONFPARSER_H */ opendnssec-2.1.13/signer/src/parser/zonelistparser.h0000644000077000001440000000337314446272525017505 00000000000000/* * 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 "status.h" #include #include /** * Parse the zonelist file. * \param[in] zlist zone list storage * \param[in] zlfile zonelist file name * \return ods_status status * */ extern ods_status parse_zonelist_zones(void* zlist, const char* zlfile); #endif /* PARSER_ZONELISTPARSER_H */ opendnssec-2.1.13/signer/src/parser/confparser.c0000644000077000001440000004547414446272525016566 00000000000000/* * 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 "config.h" #include "compat.h" #include "parser/confparser.h" #include "parser/zonelistparser.h" #include "log.h" #include "status.h" #include "wire/acl.h" #include #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 repositories. * */ hsm_repository_t* parse_conf_repositories(const char* cfgfile) { xmlDocPtr doc = NULL; xmlXPathContextPtr xpathCtx = NULL; xmlXPathObjectPtr xpathObj = NULL; xmlNode* curNode = NULL; xmlChar* xexpr = NULL; int i; char* name; char* module; char* tokenlabel; char* pin; uint8_t use_pubkey; uint8_t allowextract; int require_backup; hsm_repository_t* rlist = NULL; hsm_repository_t* repo = NULL; /* 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/RepositoryList/Repository"; 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 repositories */ if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) { for (i = 0; i < xpathObj->nodesetval->nodeNr; i++) { repo = NULL; name = NULL; module = NULL; tokenlabel = NULL; pin = NULL; use_pubkey = 1; allowextract = 0; require_backup = 0; curNode = xpathObj->nodesetval->nodeTab[i]->xmlChildrenNode; name = (char *) xmlGetProp(xpathObj->nodesetval->nodeTab[i], (const xmlChar *)"name"); while (curNode) { if (xmlStrEqual(curNode->name, (const xmlChar *)"RequireBackup")) require_backup = 1; if (xmlStrEqual(curNode->name, (const xmlChar *)"Module")) module = (char *) xmlNodeGetContent(curNode); if (xmlStrEqual(curNode->name, (const xmlChar *)"TokenLabel")) tokenlabel = (char *) xmlNodeGetContent(curNode); if (xmlStrEqual(curNode->name, (const xmlChar *)"PIN")) pin = (char *) xmlNodeGetContent(curNode); if (xmlStrEqual(curNode->name, (const xmlChar *)"SkipPublicKey")) use_pubkey = 0; if (xmlStrEqual(curNode->name, (const xmlChar *)"AllowExtraction")) allowextract = 1; curNode = curNode->next; } if (name && module && tokenlabel) { repo = hsm_repository_new(name, module, tokenlabel, pin, use_pubkey, allowextract, require_backup); } if (!repo) { ods_log_error("[%s] unable to add %s repository: " "hsm_repository_new() failed", parser_str, name?name:"-"); } else { repo->next = rlist; rlist = repo; ods_log_debug("[%s] added %s repository to repositorylist", parser_str, name); } free((void*)name); free((void*)module); free((void*)tokenlabel); free((void*)pin); } } xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathCtx); if (doc) { xmlFreeDoc(doc); } return rlist; } /** * Parse the listener interfaces. * */ listener_type* parse_conf_listener(const char* cfgfile) { listener_type* listener = NULL; interface_type* interface = NULL; int i = 0; char* address = NULL; const char* port = NULL; xmlDocPtr doc = NULL; xmlXPathContextPtr xpathCtx = NULL; xmlXPathObjectPtr xpathObj = NULL; xmlNode* curNode = NULL; xmlChar* xexpr = NULL; 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(); ods_log_assert(listener); /* If port is not set in Listener in the conf file, default value is used. * default port: 15354 */ if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) { for (i = 0; i < xpathObj->nodesetval->nodeNr; i++) { address = NULL; port = strdup("15354"); 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")) { free((char *)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, (char *)"", AF_INET, port); if (interface) { interface = listener_push(listener, (char *)"", AF_INET6, port); } } if (!interface) { ods_log_error("[%s] unable to add %s:%s interface: " "listener_push() failed", parser_str, address?address:"", port); } else { ods_log_debug("[%s] added %s:%s interface to listener", parser_str, address?address:"", port); } free((void*)port); free((void*)address); } } else { interface = listener_push(listener, (char *)"", AF_INET, "15354"); if (interface) { interface = listener_push(listener, (char *)"", AF_INET6, "15354"); } } 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; } /* * TODO all parse routines parse the complete file. Yuk! * TODO make a parse_conf_bool for testing existence of empty elements * instead of abusing parse_conf_string * */ const char* parse_conf_zonelist_filename(const char* cfgfile) { int lwd = 0; int lzl = 0; int found = 0; char* dup = NULL; const char* str = parse_conf_string( cfgfile, "//Configuration/Enforcer/WorkingDirectory", 0); if (str) { found = 1; } else { str = OPENDNSSEC_ENFORCER_WORKINGDIR; } lwd = strlen(str); lzl = strlen(OPENDNSSEC_ENFORCER_ZONELIST); if (lwd>0 && strncmp(str + (lwd-1), "/", 1) != 0) { CHECKALLOC(dup = malloc(sizeof(char)*(lwd+lzl+2))); memcpy(dup, str, sizeof(char)*(lwd+1)); strlcat(dup, "/", sizeof(char)*(lwd+2)); strlcat(dup, OPENDNSSEC_ENFORCER_ZONELIST, sizeof(char)*(lwd+lzl+2)); lwd += (lzl+1); } else { CHECKALLOC(dup = malloc(sizeof(char)*(lwd+lzl+1))); memcpy(dup, str, sizeof(char)*(lwd+1)); strlcat(dup, OPENDNSSEC_ENFORCER_ZONELIST, sizeof(char)*(lwd+lzl+1)); lwd += (lzl+1); } if (found) { free((void*)str); } ods_log_assert(dup); return (const char*) dup; } const char* parse_conf_log_filename(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 = strdup(str); free((void*)str); } return dup; /* NULL, Facility or Filename */ } const char* parse_conf_pid_filename(const char* cfgfile) { const char* dup = NULL; const char* str = parse_conf_string( cfgfile, "//Configuration/Signer/PidFile", 0); if (str) { dup = strdup(str); free((void*)str); } else { dup = strdup(ODS_SE_PIDFILE); } return dup; } const char* parse_conf_notify_command(const char* cfgfile) { const char* dup = NULL; const char* str = parse_conf_string( cfgfile, "//Configuration/Signer/NotifyCommand", 0); if (str) { dup = strdup(str); free((void*)str); } return dup; } const char* parse_conf_clisock_filename(const char* cfgfile) { char* dup = NULL; const char* str = parse_conf_string( cfgfile, "//Configuration/Signer/SocketFile", 0); if (str) { dup = strdup(str); free((void*)str); } else { dup = strdup(ODS_SE_SOCKFILE); } if (strlen(dup) >= sizeof(((struct sockaddr_un*)0)->sun_path)) { dup[sizeof(((struct sockaddr_un*)0)->sun_path)-1] = '\0'; /* don't worry about just a few bytes 'lost' */ ods_log_warning("[%s] SocketFile path too long, truncated to %s", parser_str, dup); } return dup; } const char* parse_conf_working_dir(const char* cfgfile) { const char* dup = NULL; const char* str = parse_conf_string( cfgfile, "//Configuration/Signer/WorkingDirectory", 0); if (str) { dup = strdup(str); free((void*)str); } else { dup = strdup(ODS_SE_WORKDIR); } ods_log_assert(dup); return dup; } const char* parse_conf_username(const char* cfgfile) { const char* dup = NULL; const char* str = parse_conf_string( cfgfile, "//Configuration/Signer/Privileges/User", 0); if (str) { dup = strdup(str); free((void*)str); } return dup; } const char* parse_conf_group(const char* cfgfile) { const char* dup = NULL; const char* str = parse_conf_string( cfgfile, "//Configuration/Signer/Privileges/Group", 0); if (str) { dup = strdup(str); free((void*)str); } return dup; } const char* parse_conf_chroot(const char* cfgfile) { const char* dup = NULL; const char* str = parse_conf_string( cfgfile, "//Configuration/Signer/Privileges/Directory", 0); if (str) { dup = strdup(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-2.1.13/signer/src/parser/addnsparser.h0000644000077000001440000000526114446272525016725 00000000000000/* * 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 * */ extern acl_type* parse_addns_request_xfr(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 * */ extern acl_type* parse_addns_allow_notify(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 * */ extern acl_type* parse_addns_provide_xfr(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 * */ extern acl_type* parse_addns_do_notify(const char* filename, tsig_type* tsig); /** * Parse . * \param[in] allocator memory allocator * \param[in] filename filename * \return tsig_type* TSIG * */ extern tsig_type* parse_addns_tsig(const char* filename); #endif /* PARSER_ADDNSPARSER_H */ opendnssec-2.1.13/signer/src/parser/confparser.h0000644000077000001440000000715514446272525016565 00000000000000/* * 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 "hsm.h" #include "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 repository list. * \param[in] cfgfile the configuration file name * \return hsm_repository_t* repositories * */ hsm_repository_t* parse_conf_repositories(const char* cfgfile); /** * 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(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(const char* cfgfile); const char* parse_conf_log_filename(const char* cfgfile); /** Signer specific */ const char* parse_conf_pid_filename(const char* cfgfile); const char* parse_conf_notify_command(const char* cfgfile); const char* parse_conf_clisock_filename(const char* cfgfile); const char* parse_conf_working_dir(const char* cfgfile); const char* parse_conf_username(const char* cfgfile); const char* parse_conf_group(const char* cfgfile); const char* parse_conf_chroot(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-2.1.13/signer/src/parser/zonelistparser.c0000644000077000001440000002255714446272525017505 00000000000000/* * 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 "file.h" #include "log.h" #include "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. * */ static 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) { xmlXPathFreeObject(xpathObj); return adapter; } curNode = curNode->next; } } } xmlXPathFreeObject(xpathObj); return NULL; } /** * 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); } /** * 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) { ods_log_error("[%s] unable to parse zonelist: no storage or no filename", parser_str); 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-2.1.13/signer/src/Makefile.am0000644000077000001440000000453314446272525015007 00000000000000MAINTAINERCLEANFILES = $(srcdir)/Makefile.in LIBHSM = ${top_builddir}/libhsm/src/lib/libhsm.a LIBCOMPAT = ${top_builddir}/common/libcompat.a AM_CPPFLAGS = \ -I$(top_srcdir)/common \ -I$(top_builddir)/common \ -I$(top_srcdir)/libhsm/src/lib \ @SSL_INCLUDES@ \ @XML2_INCLUDES@ \ @LDNS_INCLUDES@ signerdir = @libdir@/opendnssec/signer sbin_PROGRAMS = ods-signerd ods-signer # man8_MANS = man/ods-signer.8 man/ods-signerd.8 ods_signerd_SOURCES= ods-signerd.c \ adapter/adapi.c adapter/adapi.h \ adapter/adapter.c adapter/adapter.h \ adapter/addns.c adapter/addns.h \ adapter/adfile.c adapter/adfile.h \ adapter/adutil.c adapter/adutil.h \ daemon/cfg.c daemon/cfg.h \ daemon/signercommands.c daemon/signercommands.h \ daemon/dnshandler.c daemon/dnshandler.h \ daemon/xfrhandler.c daemon/xfrhandler.h \ daemon/engine.c daemon/engine.h \ daemon/signertasks.c daemon/signertasks.h \ parser/addnsparser.c parser/addnsparser.h \ parser/confparser.c parser/confparser.h \ parser/signconfparser.c parser/signconfparser.h \ parser/zonelistparser.c parser/zonelistparser.h \ signer/backup.c signer/backup.h \ hsm.c hsm.h \ signer/denial.c signer/denial.h \ signer/domain.c signer/domain.h \ signer/ixfr.c signer/ixfr.h \ signer/keys.c signer/keys.h \ signer/namedb.c signer/namedb.h \ signer/nsec3params.c signer/nsec3params.h \ signer/rrset.c signer/rrset.h \ signer/signconf.c signer/signconf.h \ signer/stats.c signer/stats.h \ signer/tools.c signer/tools.h \ signer/zone.c signer/zone.h \ signer/zonelist.c signer/zonelist.h \ wire/acl.c wire/acl.h \ wire/axfr.c wire/axfr.h \ wire/buffer.c wire/buffer.h \ wire/edns.c wire/edns.h \ wire/listener.c wire/listener.h \ wire/netio.c wire/netio.h \ wire/notify.c wire/notify.h \ wire/query.c wire/query.h \ wire/sock.c wire/sock.h \ wire/tcpset.c wire/tcpset.h \ wire/tsig.c wire/tsig.h \ wire/tsig-openssl.c wire/tsig-openssl.h \ wire/xfrd.c wire/xfrd.h ods_signerd_LDADD= $(LIBHSM) ods_signerd_LDADD+= $(LIBCOMPAT) ods_signerd_LDADD+= @LDNS_LIBS@ @XML2_LIBS@ @PTHREAD_LIBS@ @RT_LIBS@ @SSL_LIBS@ @C_LIBS@ ods_signer_SOURCES= ods-signer.c ods_signer_LDADD= $(LIBHSM) ods_signer_LDADD+= $(LIBCOMPAT) ods_signer_LDADD+= @LDNS_LIBS@ @XML2_LIBS@ @READLINE_LIBS@ opendnssec-2.1.13/signer/src/ods-signer.c0000644000077000001440000003450014446272525015166 00000000000000/* * 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 #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() */ #include /* According to earlier standards, we need sys/time.h, sys/types.h, unistd.h for select() */ #include #include #include #include #ifdef HAVE_READLINE /* cmd history */ #include #include #endif #include "file.h" #include "log.h" #include "str.h" #include "clientpipe.h" static const char* PROMPT = "cmd> "; static const char* cli_str = "client"; /** * Prints usage. * */ static void usage(char* argv0, FILE* out) { fprintf(out, "Usage: %s []\n", argv0); 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, "\nSupported options:\n"); fprintf(out, " -h | --help Show this help and exit.\n"); fprintf(out, " -V | --version Show version and exit.\n"); fprintf(out, " -s | --socket Daemon socketfile \n" " | (default %s).\n", ODS_SE_SOCKFILE); 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); } /** * Prints version. * */ static void version(FILE* out) { fprintf(out, "%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION); } /** * Consume messages in buffer * * Read all complete messages in the buffer or until EXIT message * is read. Messages larger than ODS_SE_MAXLINE can be handled but * will be truncated. * * \param buf: buffer to read from. Must not be NULL. * \param pos: length of valid data in buffer, must never exceed buflen. * Must not be NULL. * \param buflen: Capacity of buf, must not exeed ODS_SE_MAXLINE. * \param exitcode[out]: Return code from the daemon, only valid * when returned 1. Must not be NULL. * \return: -1 An error occured * 1 daemon done handling command, exitcode is set, * 0 otherwise */ /* return 0 or (1 and exit code set) or -1*/ static int extract_msg(char* buf, int *pos, int buflen, int *exitcode, int sockfd) { char data[ODS_SE_MAXLINE+1], opc; int datalen; assert(buf); assert(pos); assert(exitcode); assert(*pos <= buflen); assert(ODS_SE_MAXLINE >= buflen); while (1) { /* Do we have a complete header? */ if (*pos < 3) return 0; opc = buf[0]; datalen = (buf[1]<<8) | (buf[2]&0xFF); datalen &= 0xFFFF; /* hopefully sooth tainted data checker */ if (datalen+3 <= *pos) { /* a complete message */ memset(data, 0, ODS_SE_MAXLINE+1); memcpy(data, buf+3, datalen); *pos -= datalen+3; memmove(buf, buf+datalen+3, *pos); if (opc == CLIENT_OPC_EXIT) { fflush(stdout); if (datalen != 1) return -1; *exitcode = (int)buf[3]; return 1; } switch (opc) { case CLIENT_OPC_STDOUT: fprintf(stdout, "%s", data); break; case CLIENT_OPC_STDERR: fprintf(stdout, "%s", data); break; case CLIENT_OPC_PROMPT: fprintf(stdout, "%s", data); fflush(stdout); /* listen for input here */ if (!client_handleprompt(sockfd)) { fprintf(stdout, "\n"); *exitcode = 300; return 1; } default: break; } continue; } else if (datalen+3 > buflen) { /* Message is not going to fit! Discard the data already * received */ fprintf(stderr, "Daemon message to big, truncating.\n"); datalen -= *pos - 3; buf[1] = datalen >> 8; buf[2] = datalen & 0xFF; *pos = 3; return 0; } return 0; /* waiting for more data */ } } /** * Start interface - Set up connection and handle communication * * \param cmd: command to exec, NULL for interactive mode. * \param servsock_filename: name of pipe to connect to daemon. Must * not be NULL. * \return exit code for client */ static int interface_start(const char* cmd, const char* servsock_filename) { struct sockaddr_un servaddr; fd_set rset; int sockfd, flags, exitcode = 0; int ret, n, r, error = 0, inbuf_pos = 0; char userbuf[ODS_SE_MAXLINE], inbuf[ODS_SE_MAXLINE]; assert(servsock_filename); /* Create a socket */ if ((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { fprintf(stderr, "Socket creation failed: %s\n", strerror(errno)); return 200; } bzero(&servaddr, sizeof(servaddr)); servaddr.sun_family = AF_UNIX; strncpy(servaddr.sun_path, servsock_filename, sizeof(servaddr.sun_path) - 1); if (connect(sockfd, (const struct sockaddr*) &servaddr, sizeof(servaddr)) == -1) { if (cmd) { if (strncmp(cmd, "start", 5) == 0) { exitcode = system(ODS_SE_ENGINE); if (exitcode == 0) { close(sockfd); return 0; } fprintf(stderr, "Failed to start signer engine\n"); close(sockfd); return 1; } else if (strcmp(cmd, "running\n") == 0) { fprintf(stdout, "Engine not running.\n"); close(sockfd); return 209; } } fprintf(stderr, "Unable to connect to engine. connect() failed: " "%s (\"%s\")\n", strerror(errno), servsock_filename); close(sockfd); return 201; } /* set socket to non-blocking */ if ((flags = fcntl(sockfd, F_GETFL, 0)) == -1) { ods_log_error("[%s] unable to start interface, fcntl(F_GETFL) " "failed: %s", cli_str, strerror(errno)); close(sockfd); return 202; } else if (fcntl(sockfd, F_SETFL, flags|O_NONBLOCK) == -1) { ods_log_error("[%s] unable to start interface, fcntl(F_SETFL) " "failed: %s", cli_str, strerror(errno)); close(sockfd); return 203; } /* If we have a cmd send it to the daemon, otherwise display a * prompt */ if (cmd) client_stdin(sockfd, cmd, strlen(cmd)+1); userbuf[0] = 0; do { if (!cmd) { #ifdef HAVE_READLINE char *icmd_ptr; if ((icmd_ptr = readline(PROMPT)) == NULL) { /* eof */ printf("\n"); break; } if (snprintf(userbuf, ODS_SE_MAXLINE, "%s", icmd_ptr) >= ODS_SE_MAXLINE) { break; } free(icmd_ptr); ods_str_trim(userbuf,0); if (strlen(userbuf) > 0) add_history(userbuf); #else fprintf(stdout, "%s", PROMPT); fflush(stdout); n = read(fileno(stdin), userbuf, ODS_SE_MAXLINE); if (n == 0) { /* eof */ printf("\n"); break; } else if (n == -1) { error = 205; break; } userbuf[n] = 0; ods_str_trim(userbuf,0); #endif /* These commands don't go through the pipe */ if (strcmp(userbuf, "exit") == 0 || strcmp(userbuf, "quit") == 0) break; /* send cmd through pipe */ if (!client_stdin(sockfd, userbuf, strlen(userbuf))) { /* only try start on fail to send */ if (strcmp(userbuf, "start") == 0) { if (system(ODS_EN_ENGINE) != 0) { fprintf(stderr, "Error: Daemon reported a failure starting. " "Please consult the logfiles.\n"); error = 209; } continue; } } } while (1) { /* Clean the readset and add the pipe to the daemon */ FD_ZERO(&rset); FD_SET(sockfd, &rset); ret = select(sockfd+1, &rset, NULL, NULL, NULL); if (ret < 0) { /* *SHRUG* just some interrupt*/ if (errno == EINTR) continue; /* anything else is an actual error */ perror("select()"); error = 204; break; } /* Handle data coming from the daemon */ if (FD_ISSET(sockfd, &rset)) { /*daemon pipe is readable*/ n = read(sockfd, inbuf+inbuf_pos, ODS_SE_MAXLINE-inbuf_pos); if (n == 0) { /* daemon closed pipe */ fprintf(stderr, "[Remote closed connection]\n"); error = 206; break; } else if (n == -1) { /* an error */ if (errno == EAGAIN || errno == EWOULDBLOCK) continue; perror("read()"); error = 207; break; } inbuf_pos += n; r = extract_msg(inbuf, &inbuf_pos, ODS_SE_MAXLINE, &exitcode, sockfd); if (r == -1) { fprintf(stderr, "Error handling message from daemon\n"); error = 208; break; } else if (r == 1) { if (cmd) error = exitcode; else if (strlen(userbuf) != 0) /* we are interactive so print response. * But also suppress when no command is given. */ fprintf(stderr, "Daemon exit code: %d\n", exitcode); break; } } } if (strlen(userbuf) != 0 && !strncmp(userbuf, "stop", 4)) break; } while (error == 0 && !cmd); close(sockfd); if ((cmd && !strncmp(cmd, "stop", 4)) || (strlen(userbuf) != 0 && !strncmp(userbuf, "stop", 4))) { char line[80]; FILE *cmd2 = popen("pgrep ods-signerd","r"); fgets(line, 80, cmd2); (void) pclose(cmd2); pid_t pid = strtoul(line, NULL, 10); fprintf(stdout, "pid %d\n", pid); int time = 0; error = 0; while (pid > 0) { if(kill(pid, 0) == 0){ sleep(1); time += 1; if (time>20) { printf("signer needs more time to stop...\n"); time = 0; } } else break; } } #ifdef HAVE_READLINE clear_history(); rl_free_undo_list(); #endif return error; } int main(int argc, char* argv[]) { char* argv0; char* cmd = NULL; char const *socketfile = ODS_SE_SOCKFILE; int error, c, options_index = 0; static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"socket", required_argument, 0, 's'}, {"version", no_argument, 0, 'V'}, { 0, 0, 0, 0} }; ods_log_init("ods-signerd", 0, NULL, 0); /* Get the name of the program */ if((argv0 = strrchr(argv[0],'/')) == NULL) argv0 = argv[0]; else ++argv0; if (argc > 5) { fprintf(stderr,"error, too many arguments (%d)\n", argc); exit(1); } /* parse the commandline. The + in the arg string tells getopt * to stop parsing when an unknown command is found not starting * with '-'. This is important for us, else switches inside commands * would be consumed by getopt. */ while ((c=getopt_long(argc, argv, "+hVs:", long_options, &options_index)) != -1) { switch (c) { case 'h': usage(argv0, stdout); exit(1); case 's': socketfile = optarg; printf("sock set to %s\n", socketfile); break; case 'V': version(stdout); exit(0); default: /* unrecognized options * getopt will report an error */ fprintf(stderr, "use --help for usage information\n"); exit(1); } } argc -= optind; argv += optind; if (!socketfile) { fprintf(stderr, "Enforcer socket file not set.\n"); return 101; } if (argc != 0) cmd = ods_strcat_delim(argc, argv, ' '); error = interface_start(cmd, socketfile); free(cmd); return error; } opendnssec-2.1.13/signer/man/0000755000077000001440000000000014446272546013015 500000000000000opendnssec-2.1.13/signer/man/ods-signer.8.in0000644000077000001440000000203014446272525015475 00000000000000.TH "ods-signer" "8" "February 2012" "OpenDNSSEC" "OpenDNSSEC ods-signer" .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\-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-2.1.13/signer/man/ods-signerd.8.in0000644000077000001440000000233214446272525015646 00000000000000.TH "ods-signerd" "8" "February 2012" "OpenDNSSEC" "OpenDNSSEC ods-signerd" .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\-enforcer(8), ods\-hsmspeed(1), ods\-hsmutil(1), ods\-kaspcheck(1), ods\-signer(8), ods\-timing(5), ods\-kasp(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-2.1.13/signer/man/Makefile.in0000644000077000001440000004765614446272532015017 00000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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@ target_triplet = @target@ subdir = signer/man 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_dlopen.m4 \ $(top_srcdir)/m4/acx_enforcer_database.m4 \ $(top_srcdir)/m4/acx_ldns.m4 $(top_srcdir)/m4/acx_libc.m4 \ $(top_srcdir)/m4/acx_libreadline.m4 \ $(top_srcdir)/m4/acx_libxml2.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_ssl.m4 \ $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 \ $(top_srcdir)/m4/ax_lib_sqlite3.m4 \ $(top_srcdir)/m4/ax_prepend_flag.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.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)/m4/pkg.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/common/config.h CONFIG_CLEAN_FILES = ods-signer.8 ods-signerd.8 CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/ods-signer.8.in \ $(srcdir)/ods-signerd.8.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CP = @CP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CUNIT_INCLUDES = @CUNIT_INCLUDES@ CUNIT_LIBS = @CUNIT_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ C_LIBS = @C_LIBS@ 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@ ENFORCER_DB_DATABASE = @ENFORCER_DB_DATABASE@ ENFORCER_DB_HOST = @ENFORCER_DB_HOST@ ENFORCER_DB_INCLUDES = @ENFORCER_DB_INCLUDES@ ENFORCER_DB_LIBS = @ENFORCER_DB_LIBS@ ENFORCER_DB_PASSWORD = @ENFORCER_DB_PASSWORD@ ENFORCER_DB_PORT = @ENFORCER_DB_PORT@ ENFORCER_DB_PORT_TEXT = @ENFORCER_DB_PORT_TEXT@ ENFORCER_DB_USERNAME = @ENFORCER_DB_USERNAME@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_SSL = @HAVE_SSL@ HAVE_SSL_NEW_HMAC = @HAVE_SSL_NEW_HMAC@ INSTALL = @INSTALL@ INSTALLATIONCOND = @INSTALLATIONCOND@ INSTALLATIONGROUP = @INSTALLATIONGROUP@ INSTALLATIONGROUPARG = @INSTALLATIONGROUPARG@ INSTALLATIONUSER = @INSTALLATIONUSER@ INSTALLATIONUSERARG = @INSTALLATIONUSERARG@ 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@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MYSQL_CFLAGS = @MYSQL_CFLAGS@ MYSQL_CONFIG = @MYSQL_CONFIG@ MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ MYSQL_VERSION = @MYSQL_VERSION@ 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_ENFORCER_SOCKETFILE = @OPENDNSSEC_ENFORCER_SOCKETFILE@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ READLINE_LIBS = @READLINE_LIBS@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_VERSION = @SQLITE3_VERSION@ SSL_INCLUDES = @SSL_INCLUDES@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ 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_CXX = @ac_ct_CXX@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ 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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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) @list1='$(man8_MANS)'; \ list2=''; \ test -n "$(man8dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.8[a-z]*$$/p'; \ fi; \ } | 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: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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 $(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 \ cscopelist-am ctags-am 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 tags-am uninstall uninstall-am uninstall-man \ uninstall-man8 .PRECIOUS: Makefile # 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-2.1.13/signer/man/Makefile.am0000644000077000001440000000012614446272525014765 00000000000000MAINTAINERCLEANFILES = $(srcdir)/Makefile.in man8_MANS = ods-signer.8 ods-signerd.8 opendnssec-2.1.13/signer/AUTHORS0000644000077000001440000000021414446272525013224 00000000000000Main developers: Jelte Jansen (jelte@NLnetLabs.nl) http://www.NLnetLabs.nl Matthijs Mekking (matthijs@NLnetLabs.nl) http://www.NLnetLabs.nl opendnssec-2.1.13/signer/Makefile.am0000644000077000001440000000045114446272525014213 00000000000000MAINTAINERCLEANFILES = $(srcdir)/Makefile.in SUBDIRS = src man 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) opendnssec-2.1.13/Doxyfile.in0000644000077000001440000017415014446272525013013 00000000000000# Doxyfile 1.5.8 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = $(PROJECT_NAME) # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = $(OUTPUTDIR) # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, # Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, # Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, # Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = $(SRCDIR) # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = $(SRCDIR) # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.c *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = checks/* # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */.svn/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = $(GENERATE_HTML) # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = $(GENERATE_HTMLHELP) # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = $(GENERATE_CHI) # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to FRAME, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. Other possible values # for this tag are: HIERARCHIES, which will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list; # ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which # disables this behavior completely. For backwards compatibility with previous # releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE # respectively. GENERATE_TREEVIEW = NONE # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = $(GENERATE_LATEX) # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = $(GENERATE_RTF) # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = $(GENERATE_XML) # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = $(HAVE_DOT) # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = NO # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = NO # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = $(DOT_PATH) # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Options related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO opendnssec-2.1.13/install-sh0000755000077000001440000003643514446272532012705 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2018-03-11.20; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) # Note that $RANDOM variable is not portable (e.g. dash); Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p' feature. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: opendnssec-2.1.13/enforcer/0000755000077000001440000000000014446272546012556 500000000000000opendnssec-2.1.13/enforcer/Makefile.in0000644000077000001440000005614614446272532014552 00000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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@ target_triplet = @target@ subdir = enforcer 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_dlopen.m4 \ $(top_srcdir)/m4/acx_enforcer_database.m4 \ $(top_srcdir)/m4/acx_ldns.m4 $(top_srcdir)/m4/acx_libc.m4 \ $(top_srcdir)/m4/acx_libreadline.m4 \ $(top_srcdir)/m4/acx_libxml2.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_ssl.m4 \ $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 \ $(top_srcdir)/m4/ax_lib_sqlite3.m4 \ $(top_srcdir)/m4/ax_prepend_flag.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.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)/m4/pkg.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/common/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS 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@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CP = @CP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CUNIT_INCLUDES = @CUNIT_INCLUDES@ CUNIT_LIBS = @CUNIT_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ C_LIBS = @C_LIBS@ 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@ ENFORCER_DB_DATABASE = @ENFORCER_DB_DATABASE@ ENFORCER_DB_HOST = @ENFORCER_DB_HOST@ ENFORCER_DB_INCLUDES = @ENFORCER_DB_INCLUDES@ ENFORCER_DB_LIBS = @ENFORCER_DB_LIBS@ ENFORCER_DB_PASSWORD = @ENFORCER_DB_PASSWORD@ ENFORCER_DB_PORT = @ENFORCER_DB_PORT@ ENFORCER_DB_PORT_TEXT = @ENFORCER_DB_PORT_TEXT@ ENFORCER_DB_USERNAME = @ENFORCER_DB_USERNAME@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_SSL = @HAVE_SSL@ HAVE_SSL_NEW_HMAC = @HAVE_SSL_NEW_HMAC@ INSTALL = @INSTALL@ INSTALLATIONCOND = @INSTALLATIONCOND@ INSTALLATIONGROUP = @INSTALLATIONGROUP@ INSTALLATIONGROUPARG = @INSTALLATIONGROUPARG@ INSTALLATIONUSER = @INSTALLATIONUSER@ INSTALLATIONUSERARG = @INSTALLATIONUSERARG@ 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@ LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MYSQL_CFLAGS = @MYSQL_CFLAGS@ MYSQL_CONFIG = @MYSQL_CONFIG@ MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ MYSQL_VERSION = @MYSQL_VERSION@ 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_ENFORCER_SOCKETFILE = @OPENDNSSEC_ENFORCER_SOCKETFILE@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ READLINE_LIBS = @READLINE_LIBS@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_VERSION = @SQLITE3_VERSION@ SSL_INCLUDES = @SSL_INCLUDES@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ 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_CXX = @ac_ct_CXX@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in EXTRA_DIST = utils SUBDIRS = src man src/utils 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 enforcer/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign enforcer/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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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 \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ 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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am 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-am uninstall uninstall-am .PRECIOUS: Makefile doxygen: rm -fr $(top_builddir)/enforcer/doxygen-doc env $(DX_ENV) \ PROJECT_NAME="OpenDNSSEC-enforcer" \ SRCDIR=$(top_srcdir)/enforcer \ OUTPUTDIR=$(top_builddir)/enforcer/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-2.1.13/enforcer/src/0000755000077000001440000000000014446272546013345 500000000000000opendnssec-2.1.13/enforcer/src/signconf/0000755000077000001440000000000014446272546015153 500000000000000opendnssec-2.1.13/enforcer/src/signconf/signconf_xml.h0000644000077000001440000000715114446272525017733 00000000000000/* * Copyright (c) 2014 .SE (The Internet Infrastructure Foundation). * Copyright (c) 2014 OpenDNSSEC AB (svb) * 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 SIGNCONF_SIGNCONF_XML_H_ #define SIGNCONF_SIGNCONF_XML_H_ #include "daemon/engine.h" #include "db/db_connection.h" #include "db/zone_db.h" #include "db/policy.h" /** * Indicates a successful signconf export. */ #define SIGNCONF_EXPORT_OK 0 /** * Indicates an error with the arguments provided to signconf_export*(). */ #define SIGNCONF_EXPORT_ERR_ARGS 1 /** * Indicates an error with the signconf XML like parsing, validating or content. */ #define SIGNCONF_EXPORT_ERR_XML 2 /** * Indicates an error with the database like reading, updating or creating. */ #define SIGNCONF_EXPORT_ERR_DATABASE 3 /** * Indicates a memory allocation error or generic internal error. */ #define SIGNCONF_EXPORT_ERR_MEMORY 4 /** * Indicates an error when handing files. */ #define SIGNCONF_EXPORT_ERR_FILE 5 /** * Indicates that the operation was successful but no changes where made. */ #define SIGNCONF_EXPORT_NO_CHANGE 6 /** * Export the signconf XML for all zones. * \param[in] sockfd a socket fd. * \param[in] connection a db_connection_t pointer. * \param[in] force if non-zero it will force the export for all zones even if * there are no updates for the zones. * \return SIGNCONF_EXPORT_ERR_* on error, otherwise SIGNCONF_EXPORT_OK or * SIGNCONF_EXPORT_NO_CHANGE. */ int signconf_export_all(int sockfd, const db_connection_t* connection, int force); /** * Export the signconf XML for zone. * \param[in] zonename Name of zone to write signconf for. * \param[in] dbconn a db_connection_t pointer. * \return SIGNCONF_EXPORT_ERR_* on error, otherwise SIGNCONF_EXPORT_OK or * SIGNCONF_EXPORT_NO_CHANGE. */ extern int signconf_export_zone(char const *zonename, db_connection_t* dbconn); /** * Export the signconf XML for all zones that uses a specified policy. * \param[in] sockfd a socket fd. * \param[in] connection a db_connection_t pointer. * \param[in] policy a policy_t pointer. * \param[in] force if non-zero it will force the export for all zones even if * there are no updates for the zones. * \return SIGNCONF_EXPORT_ERR_* on error, otherwise SIGNCONF_EXPORT_OK or * SIGNCONF_EXPORT_NO_CHANGE. */ extern int signconf_export_policy(int sockfd, const db_connection_t* connection, const policy_t* policy, int force); #endif /* SIGNCONF_SIGNCONF_H_ */ opendnssec-2.1.13/enforcer/src/signconf/signconf_cmd.h0000644000077000001440000000306314446272525017674 00000000000000/* * Copyright (c) 2011 Surfnet * Copyright (c) 2011 .SE (The Internet Infrastructure Foundation). * Copyright (c) 2011 OpenDNSSEC AB (svb) * 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 _SIGNCONF_SIGNCONF_CMD_H_ #define _SIGNCONF_SIGNCONF_CMD_H_ extern struct cmd_func_block signconf_funcblock; #endif /* _SIGNCONF_SIGNCONF_CMD_H_ */ opendnssec-2.1.13/enforcer/src/signconf/signconf_task.h0000644000077000001440000000351714446272525020077 00000000000000/* * Copyright (c) 2011 Surfnet * Copyright (c) 2011 .SE (The Internet Infrastructure Foundation). * Copyright (c) 2011 OpenDNSSEC AB (svb) * 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 _SIGNCONF_SIGNCONF_TASK_H_ #define _SIGNCONF_SIGNCONF_TASK_H_ #include "db/db_connection.h" #include "db/policy.h" extern void signconf_task_flush_zone(engine_type *engine, db_connection_t *dbconn, const char* zonename); extern void signconf_task_flush_policy(engine_type *engine, db_connection_t *dbconn, policy_t const *policy); extern void signconf_task_flush_all(engine_type *engine, db_connection_t *dbconn); #endif opendnssec-2.1.13/enforcer/src/signconf/signconf_cmd.c0000644000077000001440000000431714446272525017672 00000000000000/* * Copyright (c) 2011 Surfnet * Copyright (c) 2011 .SE (The Internet Infrastructure Foundation). * Copyright (c) 2011 OpenDNSSEC AB (svb) * 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 "cmdhandler.h" #include "daemon/enforcercommands.h" #include "daemon/engine.h" #include "signconf/signconf_task.h" #include "file.h" #include "log.h" #include "str.h" #include "clientpipe.h" #include "longgetopt.h" #include "signconf/signconf_cmd.h" static void usage(int sockfd) { client_printf(sockfd, "signconf\n" ); } static void help(int sockfd) { client_printf(sockfd, "Force write of signer configuration files for all zones.\n\n" ); } static int run(cmdhandler_ctx_type* context, int argc, char* argv[]) { db_connection_t* dbconn = getconnectioncontext(context); engine_type* engine = getglobalcontext(context); signconf_task_flush_all(engine, dbconn); return 0; } struct cmd_func_block signconf_funcblock = { "signconf", &usage, &help, NULL, NULL, &run, NULL }; opendnssec-2.1.13/enforcer/src/signconf/signconf_xml.c0000644000077000001440000004236014446272525017727 00000000000000/* * Copyright (c) 2014 .SE (The Internet Infrastructure Foundation). * Copyright (c) 2014 OpenDNSSEC AB (svb) * 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 "log.h" #include "str.h" #include "clientpipe.h" #include "duration.h" #include "db/key_data.h" #include "db/hsm_key.h" #include "utils/kc_helper.h" #include "signconf/signconf_xml.h" #include #include #include #include /** * Export the signconf XML for the given zone that uses the given policy. * \param[in] sockfd a socket fd. * \param[in] policy a policy_t pointer. * \param[in] zone a zone_db_t pointer. * \param[in] force if non-zero it will force the export for all zones even if * there are no updates for the zones. * \return SIGNCONF_EXPORT_ERR_* on error, otherwise SIGNCONF_EXPORT_OK or * SIGNCONF_EXPORT_NO_CHANGE. */ static int signconf_xml_export(int sockfd, const policy_t* policy, zone_db_t* zone, int force); int signconf_export_zone(char const *zonename, db_connection_t* dbconn) { zone_db_t* zone; int ret; policy_t* policy; zone = zone_db_new_get_by_name(dbconn, zonename); if (!zone) { ods_log_error("[signconf_export] Unable to fetch zone %s from" " database", zonename); return SIGNCONF_EXPORT_ERR_DATABASE; } policy = zone_db_get_policy(zone); if (!policy) { ods_log_error("[signconf_export] Unable to fetch policy for zone" " %s from database", zonename); zone_db_free(zone); return SIGNCONF_EXPORT_ERR_DATABASE; } /* We always force. Since now it is scheduled per zone */ ret = signconf_xml_export(-1, policy, zone, 1); policy_free(policy); zone_db_free(zone); return ret; } int signconf_export_all(int sockfd, const db_connection_t* connection, int force) { zone_list_db_t* zone_list; zone_db_t* zone; int ret; policy_t *policy = NULL; int cmp; int change = 0; if (!connection) { return SIGNCONF_EXPORT_ERR_ARGS; } if (!(zone_list = zone_list_db_new(connection)) || zone_list_db_get(zone_list)) { if (zone_list) { zone_list_db_free(zone_list); return SIGNCONF_EXPORT_ERR_DATABASE; } return SIGNCONF_EXPORT_ERR_MEMORY; } for (zone = zone_list_db_get_next(zone_list); zone; zone = zone_list_db_get_next(zone_list)) { if (policy) { /* * If we already have a policy object; If policy_id compare fails * or if they are not the same, free the policy object so we will * later retrieve the correct policy */ if (db_value_cmp(policy_id(policy), zone_db_policy_id(zone), &cmp) || cmp) { policy_free(policy); policy = NULL; } } if (!policy) { if (!(policy = zone_db_get_policy(zone))) { zone_db_free(zone); zone_list_db_free(zone_list); return SIGNCONF_EXPORT_ERR_DATABASE; } } ret = signconf_xml_export(sockfd, policy, zone, force); if (ret == SIGNCONF_EXPORT_OK) { change = 1; } else if (ret != SIGNCONF_EXPORT_NO_CHANGE) { zone_db_free(zone); zone_list_db_free(zone_list); return ret; } zone_db_free(zone); } policy_free(policy); zone_list_db_free(zone_list); if (change) { return SIGNCONF_EXPORT_OK; } return SIGNCONF_EXPORT_NO_CHANGE; } static int __free(char **p) { if (!p || !*p) { return 1; } free(*p); *p = NULL; return 0; } static int signconf_xml_export(int sockfd, const policy_t* policy, zone_db_t* zone, int force) { char path[PATH_MAX]; xmlDocPtr doc; xmlNodePtr root; xmlNodePtr node; xmlNodePtr node2; xmlNodePtr node3; xmlNodePtr node4; xmlNodePtr node5; xmlNodePtr keys; duration_type* duration; char* duration_text = NULL; char text[1024]; key_data_list_t* key_data_list; const key_data_t* key_data; hsm_key_t* hsm_key; int error; if (!policy) { return SIGNCONF_EXPORT_ERR_ARGS; } if (!zone) { return SIGNCONF_EXPORT_ERR_ARGS; } if (!force && !zone_db_signconf_needs_writing(zone)) { return SIGNCONF_EXPORT_NO_CHANGE; } if (snprintf(path, sizeof(path), "%s.new", zone_db_signconf_path(zone)) >= (int)sizeof(path)) { ods_log_error("[signconf_export] Unable to write updated XML for zone %s, path to long!", zone_db_name(zone)); if (sockfd > -1) client_printf_err(sockfd, "Unable to write updated XML for zone %s, path to long!\n", zone_db_name(zone)); return SIGNCONF_EXPORT_ERR_MEMORY; } if (!(duration = duration_create())) { ods_log_error("[signconf_export] Unable to process signconf for zone %s, memory allocation error!", zone_db_name(zone)); if (sockfd > -1) client_printf_err(sockfd, "Unable to process signconf for zone %s, memory allocation error!\n", zone_db_name(zone)); return SIGNCONF_EXPORT_ERR_MEMORY; } if (!(doc = xmlNewDoc((xmlChar*)"1.0")) || !(root = xmlNewNode(NULL, (xmlChar*)"SignerConfiguration")) || !(node = xmlNewChild(root, NULL, (xmlChar*)"Zone", NULL))) { ods_log_error("[signconf_export] Unable to create XML elements for zone %s, memory allocation error!", zone_db_name(zone)); if (sockfd > -1) client_printf_err(sockfd, "Unable to create XML elements for zone %s, memory allocation error!\n", zone_db_name(zone)); if (doc) { xmlFreeDoc(doc); } duration_cleanup(duration); return SIGNCONF_EXPORT_ERR_MEMORY; } xmlDocSetRootElement(doc, root); error = 1; if (!xmlNewProp(node, (xmlChar*)"name", (xmlChar*)zone_db_name(zone)) || !(error = 26) || (policy_passthrough(policy) && !(node2 = xmlNewChild(node, NULL, (xmlChar*)"Passthrough", NULL))) || !(error = 2) || !(node2 = xmlNewChild(node, NULL, (xmlChar*)"Signatures", NULL)) || !(error = 3) || duration_set_time(duration, policy_signatures_resign(policy)) || !(duration_text = duration2string(duration)) || !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"Resign", (xmlChar*)duration_text)) || __free(&duration_text) || !(error = 4) || duration_set_time(duration, policy_signatures_refresh(policy)) || !(duration_text = duration2string(duration)) || !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"Refresh", (xmlChar*)duration_text)) || __free(&duration_text) || !(error = 5) || !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"Validity", NULL)) || !(error = 6) || duration_set_time(duration, policy_signatures_validity_default(policy)) || !(duration_text = duration2string(duration)) || !(node4 = xmlNewChild(node3, NULL, (xmlChar*)"Default", (xmlChar*)duration_text)) || __free(&duration_text) || !(error = 7) || duration_set_time(duration, policy_signatures_validity_denial(policy)) || !(duration_text = duration2string(duration)) || !(node4 = xmlNewChild(node3, NULL, (xmlChar*)"Denial", (xmlChar*)duration_text)) || __free(&duration_text) || !(error = 8) || (policy_signatures_validity_keyset(policy) > 0 ? duration_set_time(duration, policy_signatures_validity_keyset(policy)) || !(duration_text = duration2string(duration)) || !(node4 = xmlNewChild(node3, NULL, (xmlChar*)"Keyset", (xmlChar*)duration_text)) || __free(&duration_text) || !(error = 100) : 0) || duration_set_time(duration, policy_signatures_jitter(policy)) || !(duration_text = duration2string(duration)) || !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"Jitter", (xmlChar*)duration_text)) || __free(&duration_text) || !(error = 9) || duration_set_time(duration, policy_signatures_inception_offset(policy)) || !(duration_text = duration2string(duration)) || !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"InceptionOffset", (xmlChar*)duration_text)) || __free(&duration_text) || !(error = 10) || (policy_signatures_max_zone_ttl(policy) && (duration_set_time(duration, policy_signatures_max_zone_ttl(policy)) || !(duration_text = duration2string(duration)) || !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"MaxZoneTTL", (xmlChar*)duration_text)) || __free(&duration_text))) || !(error = 11) || !(node2 = xmlNewChild(node, NULL, (xmlChar*)"Denial", NULL)) || !(error = 12) || (policy_denial_type(policy) == POLICY_DENIAL_TYPE_NSEC && !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"NSEC", NULL))) || !(error = 13) || (policy_denial_type(policy) == POLICY_DENIAL_TYPE_NSEC3 && (!(node3 = xmlNewChild(node2, NULL, (xmlChar*)"NSEC3", NULL)) || !(error = 14) || (policy_denial_ttl(policy) && (duration_set_time(duration, policy_denial_ttl(policy)) || !(duration_text = duration2string(duration)) || !(node4 = xmlNewChild(node3, NULL, (xmlChar*)"TTL", (xmlChar*)duration_text)) || __free(&duration_text))) || !(error = 15) || (policy_denial_optout(policy) && !(node4 = xmlNewChild(node3, NULL, (xmlChar*)"OptOut", NULL))) || !(error = 16) || !(node4 = xmlNewChild(node3, NULL, (xmlChar*)"Hash", NULL)) || !(error = 17) || snprintf(text, sizeof(text), "%u", policy_denial_algorithm(policy)) >= (int)sizeof(text) || !(node5 = xmlNewChild(node4, NULL, (xmlChar*)"Algorithm", (xmlChar*)text)) || !(error = 18) || snprintf(text, sizeof(text), "%u", policy_denial_iterations(policy)) >= (int)sizeof(text) || !(node5 = xmlNewChild(node4, NULL, (xmlChar*)"Iterations", (xmlChar*)text)) || !(error = 19) || !(node5 = xmlNewChild(node4, NULL, (xmlChar*)"Salt", (xmlChar*)policy_denial_salt(policy))))) || !(error = 20) || !(keys = xmlNewChild(node, NULL, (xmlChar*)"Keys", NULL)) || !(error = 21) || duration_set_time(duration, policy_keys_ttl(policy)) || !(duration_text = duration2string(duration)) || !(node3 = xmlNewChild(keys, NULL, (xmlChar*)"TTL", (xmlChar*)duration_text)) || __free(&duration_text) || !(error = 22) || !(node2 = xmlNewChild(node, NULL, (xmlChar*)"SOA", NULL)) || !(error = 23) || duration_set_time(duration, policy_zone_soa_ttl(policy)) || !(duration_text = duration2string(duration)) || !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"TTL", (xmlChar*)duration_text)) || __free(&duration_text) || !(error = 24) || duration_set_time(duration, policy_zone_soa_minimum(policy)) || !(duration_text = duration2string(duration)) || !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"Minimum", (xmlChar*)duration_text)) || __free(&duration_text) || !(error = 25) || !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"Serial", (xmlChar*)policy_zone_soa_serial_text(policy))) ) { ods_log_error("[signconf_export] Unable to create XML elements for zone %s! [%d]", zone_db_name(zone), error); if (sockfd > -1) client_printf_err(sockfd, "Unable to create XML elements for zone %s!\n", zone_db_name(zone)); __free(&duration_text); duration_cleanup(duration); xmlFreeDoc(doc); return SIGNCONF_EXPORT_ERR_XML; } __free(&duration_text); duration_cleanup(duration); if (!(key_data_list = zone_db_get_keys(zone))) { ods_log_error("[signconf_export] Unable to get keys for zone %s!", zone_db_name(zone)); if (sockfd > -1) client_printf_err(sockfd, "Unable to get keys for zone %s!\n", zone_db_name(zone)); xmlFreeDoc(doc); return SIGNCONF_EXPORT_ERR_DATABASE; } for (key_data = key_data_list_next(key_data_list); key_data; key_data = key_data_list_next(key_data_list)) { if (!(hsm_key = key_data_get_hsm_key(key_data))) { ods_log_error("[signconf_export] Unable to get HSM key from database for zone %s!", zone_db_name(zone)); if (sockfd > -1) client_printf_err(sockfd, "Unable to get HSM key from database for zone %s!\n", zone_db_name(zone)); key_data_list_free(key_data_list); xmlFreeDoc(doc); return SIGNCONF_EXPORT_ERR_DATABASE; } error = 100; if (!(node2 = xmlNewChild(keys, NULL, (xmlChar*)"Key", NULL)) || !(error = 101) || (key_data_role(key_data) == KEY_DATA_ROLE_ZSK && !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"Flags", (xmlChar*)"256"))) || !(error = 102) || (key_data_role(key_data) != KEY_DATA_ROLE_ZSK && !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"Flags", (xmlChar*)"257"))) || !(error = 103) || snprintf(text, sizeof(text), "%u", key_data_algorithm(key_data)) >= (int)sizeof(text) || !(error = 104) || !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"Algorithm", (xmlChar*)text)) || !(error = 105) || !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"Locator",(xmlChar*)hsm_key_locator(hsm_key))) || !(error = 106) || (key_data_active_ksk(key_data) && (key_data_role(key_data) == KEY_DATA_ROLE_KSK || key_data_role(key_data) == KEY_DATA_ROLE_CSK) && !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"KSK", NULL))) || !(error = 107) || (key_data_active_zsk(key_data) && (key_data_role(key_data) == KEY_DATA_ROLE_ZSK || key_data_role(key_data) == KEY_DATA_ROLE_CSK) && !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"ZSK", NULL))) || !(error = 108) || (key_data_publish(key_data) && !(node3 = xmlNewChild(node2, NULL, (xmlChar*)"Publish", NULL))) /* TODO: * What about ? */ ) { ods_log_error("[signconf_export] Unable to create key XML elements for zone %s! [%d]", zone_db_name(zone), error); if (sockfd > -1) client_printf_err(sockfd, "Unable to create key XML elements for zone %s!\n", zone_db_name(zone)); hsm_key_free(hsm_key); key_data_list_free(key_data_list); xmlFreeDoc(doc); return SIGNCONF_EXPORT_ERR_XML; } hsm_key_free(hsm_key); } key_data_list_free(key_data_list); unlink(path); if (xmlSaveFormatFileEnc(path, doc, "UTF-8", 1) == -1) { ods_log_error("[signconf_export] Unable to write signconf for zone %s, LibXML error!", zone_db_name(zone)); if (sockfd > -1) client_printf_err(sockfd, "Unable to write signconf for zone %s, LibXML error!\n", zone_db_name(zone)); xmlFreeDoc(doc); return SIGNCONF_EXPORT_ERR_FILE; } xmlFreeDoc(doc); if (check_rng(path, OPENDNSSEC_SCHEMA_DIR "/signconf.rng", 0)) { ods_log_error("[signconf_export] Unable to validate the exported signconf XML for zone %s!", zone_db_name(zone)); if (sockfd > -1) client_printf_err(sockfd, "Unable to validate the exported signconf XML for zone %s!\n", zone_db_name(zone)); return SIGNCONF_EXPORT_ERR_XML; } if (rename(path, zone_db_signconf_path(zone))) { ods_log_error("[signconf_export] Unable to write signconf for zone %s, rename failed!", zone_db_name(zone)); if (sockfd > -1) client_printf_err(sockfd, "Unable to write signconf for zone %s, rename failed!\n", zone_db_name(zone)); unlink(path); return SIGNCONF_EXPORT_ERR_FILE; } zone_db_set_signconf_needs_writing(zone, 0); zone_db_update(zone); return SIGNCONF_EXPORT_OK; } opendnssec-2.1.13/enforcer/src/signconf/signconf_task.c0000644000077000001440000001036414446272525020070 00000000000000/* * Copyright (c) 2011 Surfnet * Copyright (c) 2011 .SE (The Internet Infrastructure Foundation). * Copyright (c) 2011 OpenDNSSEC AB (svb) * 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 "signconf/signconf_xml.h" #include "duration.h" #include "log.h" #include "file.h" #include "signconf/signconf_task.h" static const char *module_str = "signconf_cmd"; static time_t perform(task_type* task, char const *zonename, void *userdata, void *context) { (void)userdata; int ret; char cmd[SYSTEM_MAXLEN]; db_connection_t* dbconn = (db_connection_t*) context; ods_log_info("[%s] performing signconf for zone %s", module_str, zonename); /* exports all that have "needswriting set */ ret = signconf_export_zone(zonename, dbconn); if (ret == SIGNCONF_EXPORT_NO_CHANGE) { ods_log_info("[%s] signconf done, no change", module_str); return schedule_SUCCESS; } if (ret != SIGNCONF_EXPORT_OK) { ods_log_error("[%s] signconf failed", module_str); /* YBS reschedule backoff? */ return schedule_SUCCESS; } ods_log_info("[%s] signconf done for zone %s, notifying signer", module_str, zonename); /* TODO: do this better, connect directly or use execve() */ if (snprintf(cmd, sizeof(cmd), "%s %s", SIGNER_CLI_UPDATE, zonename) >= (int)sizeof(cmd) || system(cmd)) { ods_log_error("[%s] unable to notify signer of signconf changes for zone %s!", module_str, zonename); } return schedule_SUCCESS; } void signconf_task_flush_zone(engine_type *engine, db_connection_t *dbconn, const char* zonename) { task_type* task = task_create(strdup(zonename), TASK_CLASS_ENFORCER, TASK_TYPE_SIGNCONF, perform, NULL, NULL, time_now()); (void) schedule_task(engine->taskq, task, 1, 0); } void signconf_task_flush_policy(engine_type *engine, db_connection_t *dbconn, policy_t const *policy) { zone_db_t const *zone; zone_list_db_t *zonelist; ods_log_assert(policy); zonelist = zone_list_db_new_get_by_policy_id(dbconn, policy_id(policy)); if (!zonelist) { ods_log_error("[%s] Can't fetch zones for policy %s from database", module_str, policy_name(policy)); return; } while ((zone = zone_list_db_next(zonelist))) { signconf_task_flush_zone(engine, dbconn, zone_db_name(zone)); } zone_list_db_free(zonelist); } void signconf_task_flush_all(engine_type *engine, db_connection_t *dbconn) { zone_list_db_t *zonelist; zone_db_t const *zone; zonelist = zone_list_db_new(dbconn); if (!zonelist) { ods_log_error("[%s] Can't fetch zones from database", module_str); return; } if (zone_list_db_get(zonelist)) { /* fetch all */ ods_log_error("[%s] Can't fetch zones from database", module_str); zone_list_db_free(zonelist); return; } while ((zone = zone_list_db_next(zonelist))) { signconf_task_flush_zone(engine, dbconn, zone_db_name(zone)); } zone_list_db_free(zonelist); } opendnssec-2.1.13/enforcer/src/daemon/0000755000077000001440000000000014446272546014610 500000000000000opendnssec-2.1.13/enforcer/src/daemon/verbosity_cmd.c0000644000077000001440000000613614446272525017550 00000000000000/* * Copyright (c) 2014 NLNet Labs * Copyright (c) 2014 OpenDNSSEC AB (svb) * 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 "file.h" #include "log.h" #include "str.h" #include "cmdhandler.h" #include "daemon/engine.h" #include "clientpipe.h" #include "longgetopt.h" #include "daemon/verbosity_cmd.h" #define MAX_ARGS 2 static const char *module_str = "verbosity_cmd"; static void usage(int sockfd) { client_printf(sockfd, "verbosity \n" ); } static void help(int sockfd) { client_printf(sockfd, "Set verbosity.\n\n" ); } static int run(cmdhandler_ctx_type* context, int argc, char* argv[]) { int sockfd = context->sockfd; long val; char *endptr, *errorstr; ods_log_debug("[%s] verbosity command", module_str); if (argc == 1) { client_printf(sockfd, "Current verbosity is set to %d.\n", ods_log_verbosity()); client_printf(sockfd, "Available modes:\n" " 0 - Critical\n" " 1 - Error\n" " 2 - Warning\n" " 3 - Notice\n" " 4 - Info\n" " 5 - Debug\n" ); return 0; } else if (argc == 2) { errno = 0; val = strtol(argv[1], &endptr, 10); if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) || (errno != 0 && val == 0)) { errorstr = strerror(errno); client_printf(sockfd, "Error parsing verbosity value: %s.\n", errorstr); return -1; } if (endptr == argv[1]) { client_printf(sockfd, "Error parsing verbosity value: No digits were found.\n"); return -1; } if ((int)val < 0) { /* also catches wrapped longs */ client_printf(sockfd, "Error parsing verbosity value: must be >= 0.\n"); return -1; } ods_log_setverbosity(val); client_printf(sockfd, "Verbosity level set to %li.\n", val); return 0; } else { client_printf(sockfd, "Too many arguments.\n"); return -1; } } struct cmd_func_block verbosity_funcblock = { "verbosity", &usage, &help, NULL, NULL, &run, NULL }; opendnssec-2.1.13/enforcer/src/daemon/enforcercommands.h0000644000077000001440000000324514446272525020227 00000000000000/* * Copyright (c) 2016 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_ENFORCERCOMMANDS_H #define DAEMON_ENFORCERCOMMANDS_H #include "config.h" #include "cmdhandler.h" #include "engine.h" #include "db/db_connection.h" extern struct cmd_func_block** enforcercommands; extern engine_type* getglobalcontext(cmdhandler_ctx_type*); extern db_connection_t* getconnectioncontext(cmdhandler_ctx_type*); #endif opendnssec-2.1.13/enforcer/src/daemon/ctrl_cmd.c0000644000077000001440000000704514446272525016466 00000000000000/* * Copyright (c) 2014 NLNet Labs * Copyright (c) 2014 OpenDNSSEC AB (svb) * 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 "file.h" #include "log.h" #include "str.h" #include "cmdhandler.h" #include "daemon/enforcercommands.h" #include "daemon/engine.h" #include "clientpipe.h" #include "longgetopt.h" #include "daemon/ctrl_cmd.h" static void usage(int sockfd) { client_printf(sockfd, "start \n" "running\n" "reload \n" "stop \n" ); } static void help(int sockfd) { client_printf(sockfd, "start Starts the engine and the process. \n" "running Returns acknowledgment that the engine is running.\n" "reload Reload the engine.\n" "stop Stop the engine and terminate the process.\n\n" ); } static int handles(const char *cmd) { if (ods_check_command(cmd, "stop")) return 1; if (ods_check_command(cmd, "reload")) return 1; if (ods_check_command(cmd, "running")) return 1; if (ods_check_command(cmd, "start")) return 1; return 0; } static int run(cmdhandler_ctx_type* context, int argc, char* argv[]) { int sockfd = context->sockfd; engine_type* engine = getglobalcontext(context); if (ods_check_command(argv[0], "start")) { ods_log_debug("[cmdhandler] start command"); client_printf(sockfd, "Engine already running.\n"); /* if you asked us to start, we are already started */ return 1; /* error */ } else if (ods_check_command(argv[0], "running")) { ods_log_debug("[cmdhandler] running command"); client_printf(sockfd, "Engine running.\n"); return 0; } else if (ods_check_command(argv[0], "reload")) { ods_log_debug("[cmdhandler] reload command"); ods_log_assert(engine); engine->need_to_reload = 1; pthread_mutex_lock(&engine->signal_lock); pthread_cond_signal(&engine->signal_cond); pthread_mutex_unlock(&engine->signal_lock); client_printf(sockfd, "Reloading engine.\n"); return 0; } else if (ods_check_command(argv[0], "stop")) { ods_log_debug("[cmdhandler] stop command"); ods_log_assert(engine); engine->need_to_exit = 1; pthread_mutex_lock(&engine->signal_lock); pthread_cond_signal(&engine->signal_cond); pthread_mutex_unlock(&engine->signal_lock); client_printf(sockfd, "%s\n", ODS_SE_STOP_RESPONSE); return 0; } else { return -1; } } struct cmd_func_block ctrl_funcblock = { "ctrl", &usage, &help, &handles, NULL, &run, NULL }; opendnssec-2.1.13/enforcer/src/daemon/time_leap_cmd.h0000644000077000001440000000272114446272525017462 00000000000000/* * Copyright (c) 2014 NLNet Labs * Copyright (c) 2014 OpenDNSSEC AB (svb) * 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 _TIME_LEAP_CMD_H_ #define _TIME_LEAP_CMD_H_ extern struct cmd_func_block time_leap_funcblock; #endif /* _TIME_LEAP_CMD_H_ */ opendnssec-2.1.13/enforcer/src/daemon/queue_cmd.c0000644000077000001440000001144014446272525016640 00000000000000/* * Copyright (c) 2014 NLNet Labs * Copyright (c) 2014 OpenDNSSEC AB (svb) * 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 "file.h" #include "log.h" #include "str.h" #include "duration.h" #include "scheduler/schedule.h" #include "cmdhandler.h" #include "daemon/enforcercommands.h" #include "daemon/engine.h" #include "clientpipe.h" #include "longgetopt.h" #include "daemon/queue_cmd.h" #include "scheduler/task.h" static const char *module_str = "queue_cmd"; static void usage(int sockfd) { client_printf(sockfd, "queue\n" ); } static void help(int sockfd) { client_printf(sockfd, "queue shows all scheduled tasks with their time of earliest executions,\n" "as well as all tasks currently being processed." "\n\n" ); } static int run(cmdhandler_ctx_type* context, int argc, char* argv[]) { int sockfd = context->sockfd; struct tm strtime_struct; char strtime[64]; /* at least 26 according to docs plus a long integer */ char* taskdescription; int count; time_t now; time_t nextFireTime; ldns_rbnode_t* node = LDNS_RBTREE_NULL; task_type* task = NULL; int num_waiting; engine_type* engine = getglobalcontext(context); ods_log_debug("[%s] list tasks command", module_str); ods_log_assert(engine); if (!engine->taskq || !engine->taskq->tasks) { client_printf(sockfd, "There are no tasks scheduled.\n"); return 0; } schedule_info(engine->taskq, &nextFireTime, &num_waiting, &count); if (num_waiting == engine->config->num_worker_threads) { client_printf(sockfd, "All worker threads idle.\n"); } /* how many tasks */ client_printf(sockfd, "There %s %i %s scheduled.\n", (count==1)?"is":"are", (int) count, (count==1)?"task":"tasks"); now = time_now(); strftime(strtime, sizeof(strtime), "%c", localtime_r(&now, &strtime_struct)); client_printf(sockfd, "It is now %s (%ld seconds since epoch)\n", (strtime[0]?strtime:"(null)"), (long)now); if (nextFireTime > now) { strftime(strtime, sizeof(strtime), "%c", localtime_r(&nextFireTime, &strtime_struct)); client_printf(sockfd, "Next task scheduled %s (%ld seconds since epoch)\n", strtime, (long)nextFireTime); } else if (nextFireTime >= 0) { client_printf(sockfd, "Next task scheduled immediately\n"); } /* else: no tasks scheduled at all. */ /* list tasks */ pthread_mutex_lock(&engine->taskq->schedule_lock); node = ldns_rbtree_first(engine->taskq->tasks); while (node && node != LDNS_RBTREE_NULL) { task = (task_type*) node->data; taskdescription = schedule_describetask(task); client_printf(sockfd, "%s", taskdescription); free(taskdescription); node = ldns_rbtree_next(node); } pthread_mutex_unlock(&engine->taskq->schedule_lock); return 0; } struct cmd_func_block queue_funcblock = { "queue", &usage, &help, NULL, NULL, &run, NULL }; static void usage_flush(int sockfd) { client_printf(sockfd, "flush\n" ); } static void help_flush(int sockfd) { client_printf(sockfd, "Execute all scheduled tasks immediately.\n\n"); } static int run_flush(cmdhandler_ctx_type* context, int argc, char* argv[]) { int sockfd = context->sockfd; engine_type* engine = getglobalcontext(context); ods_log_debug("[%s] flush tasks command", module_str); ods_log_assert(engine); ods_log_assert(engine->taskq); schedule_flush(engine->taskq); client_printf(sockfd, "All tasks scheduled immediately.\n"); ods_log_verbose("[cmdhandler] all tasks scheduled immediately"); return 0; } struct cmd_func_block flush_funcblock = { "flush", &usage_flush, &help_flush, NULL, NULL, &run_flush, NULL }; opendnssec-2.1.13/enforcer/src/daemon/queue_cmd.h0000644000077000001440000000275714446272525016660 00000000000000/* * Copyright (c) 2014 NLNet Labs * Copyright (c) 2014 OpenDNSSEC AB (svb) * 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 _QUEUE_CMD_H_ #define _QUEUE_CMD_H_ extern struct cmd_func_block queue_funcblock; extern struct cmd_func_block flush_funcblock; #endif /* _QUEUE_CMD_H_ */ opendnssec-2.1.13/enforcer/src/daemon/engine.c0000644000077000001440000005376714446272525016160 00000000000000/* * 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 #include "daemon/cfg.h" #include "daemon/enforcercommands.h" #include "clientpipe.h" #include "cmdhandler.h" #include "locks.h" #include "daemon/engine.h" #include "scheduler/schedule.h" #include "scheduler/task.h" #include "file.h" #include "log.h" #include "privdrop.h" #include "status.h" #include "util.h" #include "db/db_configuration.h" #include "db/db_connection.h" #include "db/database_version.h" #include "hsmkey/hsm_key_factory.h" #include "libhsm.h" #include "locks.h" #include #include #include #include #include #include #include #include #include #include #include #include #include static const char* engine_str = "engine"; static engine_type* engine = NULL; /** * Create engine. * */ engine_type* engine_alloc(void) { engine = (engine_type*) malloc(sizeof(engine_type)); if (!engine) return NULL; pthread_mutex_init(&engine->signal_lock, NULL); pthread_cond_init(&engine->signal_cond, NULL); engine->dbcfg_list = NULL; engine->taskq = schedule_create(); if (!engine->taskq) { free(engine); return NULL; } return engine; } void engine_dealloc(engine_type* engine) { schedule_cleanup(engine->taskq); pthread_mutex_destroy(&engine->signal_lock); pthread_cond_destroy(&engine->signal_cond); if (engine->dbcfg_list) { db_configuration_list_free(engine->dbcfg_list); } hsm_key_factory_deinit(); free(engine); } static void engine_start_cmdhandler(engine_type* engine) { ods_log_assert(engine); ods_log_debug("[%s] start command handler", engine_str); janitor_thread_create(&engine->cmdhandler->thread_id, workerthreadclass, (janitor_runfn_t)cmdhandler_start, engine->cmdhandler); } /** * 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) { char* name; int i = 0; ods_log_assert(engine); ods_log_assert(engine->config); engine->workers = (worker_type**) malloc( (size_t)engine->config->num_worker_threads * sizeof(worker_type*)); for (i=0; i < (size_t) engine->config->num_worker_threads; i++) { asprintf(&name, "worker[%d]", i+1); engine->workers[i] = worker_create(name, engine->taskq); } } 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]->context = get_database_connection(engine); if (!engine->workers[i]->context) { ods_log_crit("Failed to start worker, could not connect to database"); } else { janitor_thread_create(&engine->workers[i]->thread_id, workerthreadclass, (janitor_runfn_t)worker_start, engine->workers[i]); } } } void engine_stop_workers(engine_type* engine) { int 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 < engine->config->num_worker_threads; i++) { engine->workers[i]->need_to_exit = 1; } engine_wakeup_workers(engine); /* head count */ for (i=0; i < engine->config->num_worker_threads; i++) { ods_log_debug("[%s] join worker %i", engine_str, i+1); janitor_thread_join(engine->workers[i]->thread_id); db_connection_free(engine->workers[i]->context); } } /** * Wake up all workers. * */ void engine_wakeup_workers(engine_type* engine) { ods_log_assert(engine); ods_log_debug("[%s] wake up workers", engine_str); schedule_release_all(engine->taskq); } db_connection_t* get_database_connection(engine_type* engine) { db_connection_t* dbconn; if (!(dbconn = db_connection_new()) || db_connection_set_configuration_list(dbconn, engine->dbcfg_list) || db_connection_setup(dbconn) || db_connection_connect(dbconn)) { db_connection_free(dbconn); ods_log_crit("database connection failed"); return NULL; } return dbconn; } /* * Try to open a connection to the database and close it again. * \param dbcfg_list, database configuration list * \return 0 on success, 1 on failure. */ static int probe_database(engine_type* engine) { db_connection_t *conn; int version; conn = get_database_connection(engine); if (!conn) return 1; version = database_version_get_version(conn); db_connection_free(conn); return !version; } /* * Prepare for database connections and store dbcfg_list in engine * if successfull the counterpart desetup_database() must be called * when quitting the daemon. * \param engine engine config where configuration list is stored * \return 0 on succes, 1 on failure */ static int setup_database(engine_type* engine) { db_configuration_t* dbcfg; if (!(engine->dbcfg_list = db_configuration_list_new())) { fprintf(stderr, "db_configuraiton_list_new failed\n"); return 1; } if (engine->config->db_type == ENFORCER_DATABASE_TYPE_SQLITE) { if (!(dbcfg = db_configuration_new()) || db_configuration_set_name(dbcfg, "backend") || db_configuration_set_value(dbcfg, "sqlite") || db_configuration_list_add(engine->dbcfg_list, dbcfg)) { db_configuration_free(dbcfg); db_configuration_list_free(engine->dbcfg_list); engine->dbcfg_list = NULL; fprintf(stderr, "setup configuration backend failed\n"); return 1; } if (!(dbcfg = db_configuration_new()) || db_configuration_set_name(dbcfg, "file") || db_configuration_set_value(dbcfg, engine->config->datastore) || db_configuration_list_add(engine->dbcfg_list, dbcfg)) { db_configuration_free(dbcfg); db_configuration_list_free(engine->dbcfg_list); engine->dbcfg_list = NULL; fprintf(stderr, "setup configuration file failed\n"); return 1; } dbcfg = NULL; } else if (engine->config->db_type == ENFORCER_DATABASE_TYPE_MYSQL) { if (!(dbcfg = db_configuration_new()) || db_configuration_set_name(dbcfg, "backend") || db_configuration_set_value(dbcfg, "mysql") || db_configuration_list_add(engine->dbcfg_list, dbcfg)) { db_configuration_free(dbcfg); db_configuration_list_free(engine->dbcfg_list); engine->dbcfg_list = NULL; fprintf(stderr, "setup configuration backend failed\n"); return 1; } if (!(dbcfg = db_configuration_new()) || db_configuration_set_name(dbcfg, "host") || db_configuration_set_value(dbcfg, engine->config->db_host) || db_configuration_list_add(engine->dbcfg_list, dbcfg)) { db_configuration_free(dbcfg); db_configuration_list_free(engine->dbcfg_list); engine->dbcfg_list = NULL; fprintf(stderr, "setup configuration file failed\n"); return 1; } dbcfg = NULL; if (engine->config->db_port) { char str[32]; if (snprintf(&str[0], sizeof(str), "%d", engine->config->db_port) >= (int)sizeof(str)) { db_configuration_list_free(engine->dbcfg_list); engine->dbcfg_list = NULL; fprintf(stderr, "setup configuration file failed\n"); return 1; } if (!(dbcfg = db_configuration_new()) || db_configuration_set_name(dbcfg, "port") || db_configuration_set_value(dbcfg, str) || db_configuration_list_add(engine->dbcfg_list, dbcfg)) { db_configuration_free(dbcfg); db_configuration_list_free(engine->dbcfg_list); engine->dbcfg_list = NULL; fprintf(stderr, "setup configuration file failed\n"); return 1; } dbcfg = NULL; } if (!(dbcfg = db_configuration_new()) || db_configuration_set_name(dbcfg, "user") || db_configuration_set_value(dbcfg, engine->config->db_username) || db_configuration_list_add(engine->dbcfg_list, dbcfg)) { db_configuration_free(dbcfg); db_configuration_list_free(engine->dbcfg_list); engine->dbcfg_list = NULL; fprintf(stderr, "setup configuration file failed\n"); return 1; } dbcfg = NULL; if (!(dbcfg = db_configuration_new()) || db_configuration_set_name(dbcfg, "pass") || db_configuration_set_value(dbcfg, engine->config->db_password) || db_configuration_list_add(engine->dbcfg_list, dbcfg)) { db_configuration_free(dbcfg); db_configuration_list_free(engine->dbcfg_list); engine->dbcfg_list = NULL; fprintf(stderr, "setup configuration file failed\n"); return 1; } dbcfg = NULL; if (!(dbcfg = db_configuration_new()) || db_configuration_set_name(dbcfg, "db") || db_configuration_set_value(dbcfg, engine->config->datastore) || db_configuration_list_add(engine->dbcfg_list, dbcfg)) { db_configuration_free(dbcfg); db_configuration_list_free(engine->dbcfg_list); engine->dbcfg_list = NULL; fprintf(stderr, "setup configuration file failed\n"); return 1; } dbcfg = NULL; } else { return 1; } return 0; } /* * destroy database configuration. Call only after all connections * are closed. * \param engine engine config where configuration list is stored */ static void desetup_database(engine_type* engine) { db_configuration_list_free(engine->dbcfg_list); engine->dbcfg_list = NULL; } static void * signal_handler(sig_atomic_t sig) { switch (sig) { case SIGHUP: if (engine) { engine->need_to_reload = 1; pthread_mutex_lock(&engine->signal_lock); pthread_cond_signal(&engine->signal_cond); pthread_mutex_unlock(&engine->signal_lock); } break; case SIGINT: case SIGTERM: if (engine) { engine->need_to_exit = 1; pthread_mutex_lock(&engine->signal_lock); pthread_cond_signal(&engine->signal_cond); pthread_mutex_unlock(&engine->signal_lock); } break; default: break; } return NULL; } /** * Set up engine and return the setup status. * */ ods_status engine_setup() { int fd, error; int pipefd[2]; char buff = '\0'; ods_log_debug("[%s] enforcer setup", engine_str); engine->pid = getpid(); /* We need to do this again after fork() */ if (!util_pidfile_avail(engine->config->pid_filename)) { ods_log_error("[%s] Pidfile exists and process with PID is running", engine_str); return ODS_STATUS_WRITE_PIDFILE_ERR; } /* setup database configuration */ if (setup_database(engine)) return ODS_STATUS_DB_ERR; /* Probe the database, can we connect to it? */ if (probe_database(engine)) { ods_log_crit("Could not connect to database or database not set up properly."); return ODS_STATUS_DB_ERR; } /* create command handler (before chowning socket file) */ engine->cmdhandler = cmdhandler_create(engine->config->clisock_filename, enforcercommands, engine, (void*(*)(void*)) (void(*)(void*))&get_database_connection, (void(*)(void*))&db_connection_free); if (!engine->cmdhandler) { ods_log_error("[%s] create command handler to %s failed", engine_str, engine->config->clisock_filename); return ODS_STATUS_CMDHANDLER_ERR; } if(pipe(pipefd)) { ods_log_error("[%s] unable to pipe: %s", engine_str, strerror(errno)); return ODS_STATUS_PIPE_ERR; } if (!engine->init_setup_done) { /* 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] chdir to %s failed: %s", engine_str, engine->config->working_dir, strerror(errno)); return ODS_STATUS_CHDIR_ERR; } if (engine_privdrop(engine) != ODS_STATUS_OK) { ods_log_error("[%s] unable to drop privileges", engine_str); return ODS_STATUS_PRIVDROP_ERR; } /* daemonize */ if (engine->daemonize) { switch (fork()) { case -1: /* error */ ods_log_error("[%s] unable to fork daemon: %s", engine_str, strerror(errno)); return ODS_STATUS_FORK_ERR; case 0: /* child */ if ((fd = open("/dev/null", O_RDWR, 0)) != -1) { (void)dup2(fd, STDIN_FILENO); (void)dup2(fd, STDOUT_FILENO); (void)dup2(fd, STDERR_FILENO); if (fd > 2) (void)close(fd); } close(pipefd[0]); break; default: /* parent */ close(pipefd[1]); /* Print messages the child may have send us. */ while (read(pipefd[0], &buff, 1) != -1) { if (buff <= 1) break; printf("%c", buff); } close(pipefd[0]); if (buff != '\1') { ods_log_error("[%s] fail to start enforcerd completely", engine_str); exit(1); } ods_log_debug("[%s] enforcerd started successfully", engine_str); exit(0); } if (setsid() == -1) { ods_log_error("[%s] unable to setsid daemon (%s)", engine_str, strerror(errno)); const char *err = "unable to setsid daemon: "; ods_writen(pipefd[1], err, strlen(err)); ods_writeln(pipefd[1], strerror(errno)); write(pipefd[1], "\0", 1); close(pipefd[1]); return ODS_STATUS_SETSID_ERR; } } } engine->init_setup_done = 1; engine->pid = getpid(); ods_log_info("[%s] running as pid %lu", engine_str, (unsigned long) engine->pid); /* create workers */ engine_create_workers(engine); /* write pidfile */ if (util_write_pidfile(engine->config->pid_filename, engine->pid) == -1) { hsm_close(); ods_log_error("[%s] unable to write pid file", engine_str); if (engine->daemonize) { ods_writeln(pipefd[1], "unable to write pid file"); write(pipefd[1], "\0", 1); close(pipefd[1]); } return ODS_STATUS_WRITE_PIDFILE_ERR; } ods_log_info("[%s] enforcer started", engine_str); error = hsm_open2(engine->config->repositories, hsm_prompt_pin); if (error != HSM_OK) { char* errorstr = hsm_get_error(NULL); if (!errorstr) (void)asprintf(&errorstr, "error opening libhsm (errno %i)", error); if (errorstr) ods_log_error("[%s] %s", engine_str, errorstr); if (engine->daemonize) { if (errorstr) ods_writeln(pipefd[1], errorstr); write(pipefd[1], "\0", 1); close(pipefd[1]); } free(errorstr); return ODS_STATUS_HSM_ERR; } engine->need_to_reload = 0; engine_start_cmdhandler(engine); write(pipefd[1], "\1", 1); close(pipefd[1]); if (!engine->daemonize) close(pipefd[0]); engine->daemonize = 0; /* don't fork again on reload */ return ODS_STATUS_OK; } /** * Clean up engine. * */ void engine_teardown(engine_type* engine) { size_t i = 0; if (!engine) return; if (engine->config) { if (engine->config->pid_filename) { (void)unlink(engine->config->pid_filename); } if (engine->config->clisock_filename) { (void)unlink(engine->config->clisock_filename); } } if (engine->workers && engine->config) { for (i=0; i < (size_t) engine->config->num_worker_threads; i++) { worker_cleanup(engine->workers[i]); } free(engine->workers); engine->workers = NULL; } if (engine->cmdhandler) { cmdhandler_cleanup(engine->cmdhandler); engine->cmdhandler = NULL; } desetup_database(engine); } void engine_init(engine_type* engine, int daemonize) { struct sigaction action; engine->config = NULL; engine->workers = NULL; engine->cmdhandler = NULL; engine->init_setup_done = 0; engine->pid = getpid(); /* We need to do this again after fork() */ engine->uid = -1; engine->gid = -1; engine->need_to_exit = 0; engine->need_to_reload = 0; engine->daemonize = daemonize; /* catch signals */ action.sa_handler = (void (*)(int))signal_handler; sigfillset(&action.sa_mask); action.sa_flags = 0; sigaction(SIGHUP, &action, NULL); sigaction(SIGTERM, &action, NULL); sigaction(SIGINT, &action, NULL); engine->dbcfg_list = NULL; action.sa_handler = SIG_IGN; sigaction(SIGPIPE, &action, NULL); } /** * Run engine, run!. * */ int engine_run(engine_type* engine, start_cb_t start, int single_run) { ods_log_assert(engine); engine_start_workers(engine); /* call the external start callback function */ start(engine); while (!engine->need_to_exit && !engine->need_to_reload) { if (single_run) { engine->need_to_exit = 1; /* FIXME: all tasks need to terminate, then set need_to_exit to 1 */ } /* We must use locking here to avoid race conditions. We want * to sleep indefinitely and want to wake up on signal. This * is to make sure we never mis the signal. */ pthread_mutex_lock(&engine->signal_lock); if (!engine->need_to_exit && !engine->need_to_reload && !single_run) { /* TODO: this silly. We should be handling the commandhandler * connections. No reason to spawn that as a thread. * Also it would be easier to wake up the command hander * as signals will reach it if it is the main thread! */ ods_log_debug("[%s] taking a break", engine_str); pthread_cond_wait(&engine->signal_cond, &engine->signal_lock); } pthread_mutex_unlock(&engine->signal_lock); } ods_log_debug("[%s] enforcer halted", engine_str); engine_stop_workers(engine); cmdhandler_stop(engine->cmdhandler); schedule_purge(engine->taskq); /* Remove old tasks in queue */ hsm_close(); return 0; } opendnssec-2.1.13/enforcer/src/daemon/engine.h0000644000077000001440000000764414446272525016156 00000000000000/* * 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 typedef struct engine_struct engine_type; #include "daemon/cfg.h" #include "cmdhandler.h" #include "scheduler/task.h" #include "scheduler/schedule.h" #include "db/db_configuration.h" #include "db/db_connection.h" struct engine_struct { engineconfig_type* config; pid_t pid; uid_t uid; gid_t gid; int daemonize; int need_to_exit; int need_to_reload; int init_setup_done; worker_type** workers; schedule_type* taskq; cmdhandler_type* cmdhandler; /* Main thread blocks on this condition when there is nothing to do */ pthread_cond_t signal_cond; pthread_mutex_t signal_lock; db_configuration_list_t* dbcfg_list; }; /** * Try to open a connection to the database. * \param engine, the engine containing database configuration * \return connection on success, NULL on failure. */ extern db_connection_t* get_database_connection(engine_type* engine); /** * Setup the engine started by engine_create * \param[in] engine the engine returned from engine_start * \param[in] commands NULL terminated list of command functions for * the engine that the command handler can run. * \param[in] help NULL terminated list of help functions that print help * for the command to a socket. */ extern ods_status engine_setup(void); /** * Clean up engine. * \param[in] engine engine * */ extern void engine_teardown(engine_type* engine); extern void engine_init(engine_type* engine, int daemonize); typedef void (*start_cb_t)(engine_type* engine); /** * Run the engine after setting it up using engine_setup. * When this function returns the runloop has finished and * the engine is ready to stop. * \param[in] engine the engine returned from engine_start * \param[in] single_run run once * \return 0 if terminated normally, 1 on unrecoverable error. * */ extern int engine_run(engine_type* engine, start_cb_t start, int single_run); /** * Stop the engine after engine_runloop returns. * \param[in] engine engine * */ extern void engine_stop(engine_type* engine); /** * Wake up workers. * \param[in] engine engine * */ extern void engine_wakeup_workers(engine_type* engine); /** signal all workers to stop. Blocks until all workers are joined. * \param[in] engine engine */ extern void engine_stop_workers(engine_type* engine); /** start all workers. * \param[in] engine engine */ extern void engine_start_workers(engine_type* engine); extern engine_type* engine_alloc(void); extern void engine_dealloc(engine_type* engine); #endif /* DAEMON_ENGINE_H */ opendnssec-2.1.13/enforcer/src/daemon/enforcercommands.c0000644000077000001440000000604214446272525020220 00000000000000#include "config.h" #include "file.h" #include "str.h" #include "locks.h" #include "log.h" #include "status.h" #include "util.h" #include "daemon/engine.h" #include "cmdhandler.h" #include "enforcercommands.h" #include "db/db_connection.h" /* commands to handle */ #include "policy/policy_resalt_cmd.h" #include "policy/policy_list_cmd.h" #include "daemon/time_leap_cmd.h" #include "daemon/queue_cmd.h" #include "daemon/verbosity_cmd.h" #include "daemon/ctrl_cmd.h" #include "enforcer/update_repositorylist_cmd.h" #include "enforcer/repositorylist_cmd.h" #include "enforcer/update_all_cmd.h" #include "enforcer/update_conf_cmd.h" #include "enforcer/enforce_cmd.h" #include "policy/policy_import_cmd.h" #include "policy/policy_export_cmd.h" #include "policy/policy_purge_cmd.h" #include "keystate/zone_list_cmd.h" #include "keystate/zone_del_cmd.h" #include "keystate/zone_add_cmd.h" #include "keystate/zone_set_policy_cmd.h" #include "keystate/keystate_ds_submit_cmd.h" #include "keystate/keystate_ds_seen_cmd.h" #include "keystate/keystate_ds_retract_cmd.h" #include "keystate/keystate_ds_gone_cmd.h" #include "keystate/keystate_export_cmd.h" #include "keystate/keystate_import_cmd.h" #include "keystate/keystate_list_cmd.h" #include "keystate/key_purge_cmd.h" #include "keystate/rollover_list_cmd.h" #include "keystate/keystate_rollover_cmd.h" #include "keystate/zonelist_import_cmd.h" #include "keystate/zonelist_export_cmd.h" #include "signconf/signconf_cmd.h" #include "hsmkey/backup_hsmkeys_cmd.h" #include "hsmkey/key_generate_cmd.h" static struct cmd_func_block* enforcecommands[] = { /* Thoughts has gone into the ordering of this list, it affects * the output of the help command */ &update_conf_funcblock, &update_repositorylist_funcblock, &repositorylist_funcblock, &update_all_funcblock, &policy_list_funcblock, &policy_export_funcblock, &policy_import_funcblock, &policy_purge_funcblock, &resalt_funcblock, &zone_list_funcblock, &zone_add_funcblock, &zone_del_funcblock, &zone_set_policy_funcblock, &zonelist_export_funcblock, &zonelist_import_funcblock, &key_list_funcblock, &key_export_funcblock, &key_import_funcblock, &key_ds_submit_funcblock, &key_ds_seen_funcblock, &key_ds_retract_funcblock, &key_ds_gone_funcblock, &key_generate_funcblock, &key_purge_funcblock, &key_rollover_funcblock, &rollover_list_funcblock, &backup_funcblock, &enforce_funcblock, &signconf_funcblock, &queue_funcblock, &time_leap_funcblock, &flush_funcblock, &ctrl_funcblock, &verbosity_funcblock, NULL }; struct cmd_func_block** enforcercommands = enforcecommands; engine_type* getglobalcontext(cmdhandler_ctx_type* context) { return (engine_type*) context->globalcontext; } db_connection_t* getconnectioncontext(cmdhandler_ctx_type* context) { return (db_connection_t*) context->localcontext; } opendnssec-2.1.13/enforcer/src/daemon/verbosity_cmd.h0000644000077000001440000000272114446272525017551 00000000000000/* * Copyright (c) 2014 NLNet Labs * Copyright (c) 2014 OpenDNSSEC AB (svb) * 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 _VERBOSITY_CMD_H_ #define _VERBOSITY_CMD_H_ extern struct cmd_func_block verbosity_funcblock; #endif /* _VERBOSITY_CMD_H_ */ opendnssec-2.1.13/enforcer/src/daemon/ctrl_cmd.h0000644000077000001440000000267514446272525016477 00000000000000/* * Copyright (c) 2014 NLNet Labs * Copyright (c) 2014 OpenDNSSEC AB (svb) * 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 _CTRL_CMD_H_ #define _CTRL_CMD_H_ extern struct cmd_func_block ctrl_funcblock; #endif /* _CTRL_CMD_H_ */ opendnssec-2.1.13/enforcer/src/daemon/cfg.c0000644000077000001440000002457514446272525015445 00000000000000/* * 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 "file.h" #include "log.h" #include "status.h" #include #include #include static const char* conf_str = "config"; /** * duplicate string but don't ignore NULL ptrs */ static const char * strdup_or_null(const char *s) { return s?strdup(s):s; } /** * Configure engine. * */ engineconfig_type* engine_config(const char* cfgfile, int cmdline_verbosity, engineconfig_type* oldcfg) { engineconfig_type* ecfg; const char* rngfile = ODS_SE_RNGDIR "/conf.rng"; FILE* cfgfd = NULL; if (!cfgfile || cfgfile[0] == 0) { ods_log_error("[%s] failed to read: no filename given", conf_str); return NULL; } ods_log_verbose("[%s] read cfgfile: %s", conf_str, cfgfile); /* check syntax (slows down parsing configuration file) */ if (parse_file_check(cfgfile, rngfile) != ODS_STATUS_OK) { ods_log_error("[%s] failed to read: unable to parse file %s", conf_str, cfgfile); return NULL; } /* open cfgfile */ cfgfd = ods_fopen(cfgfile, NULL, "r"); if (cfgfd) { ecfg = malloc(sizeof(engineconfig_type)); if (!ecfg) { ods_log_error("[%s] failed to read: malloc failed", conf_str); ods_fclose(cfgfd); return NULL; } if (oldcfg) { /* This is a reload */ ecfg->cfg_filename = strdup(oldcfg->cfg_filename); ecfg->clisock_filename = strdup(oldcfg->clisock_filename); ecfg->working_dir = strdup(oldcfg->working_dir); ecfg->username = strdup_or_null(oldcfg->username); ecfg->group = strdup_or_null(oldcfg->group); ecfg->chroot = strdup_or_null(oldcfg->chroot); ecfg->pid_filename = strdup(oldcfg->pid_filename); ecfg->datastore = strdup(oldcfg->datastore); ecfg->db_host = strdup_or_null(oldcfg->db_host); ecfg->db_username = strdup_or_null(oldcfg->db_username); ecfg->db_password = strdup_or_null(oldcfg->db_password); ecfg->db_port = oldcfg->db_port; ecfg->db_type = oldcfg->db_type; } else { ecfg->cfg_filename = strdup(cfgfile); ecfg->clisock_filename = parse_conf_clisock_filename(cfgfile); ecfg->working_dir = parse_conf_working_dir(cfgfile); ecfg->username = parse_conf_username(cfgfile); ecfg->group = parse_conf_group(cfgfile); ecfg->chroot = parse_conf_chroot(cfgfile); ecfg->pid_filename = parse_conf_pid_filename(cfgfile); ecfg->datastore = parse_conf_datastore(cfgfile); ecfg->db_host = parse_conf_db_host(cfgfile); ecfg->db_username = parse_conf_db_username(cfgfile); ecfg->db_password = parse_conf_db_password(cfgfile); ecfg->db_port = parse_conf_db_port(cfgfile); ecfg->db_type = parse_conf_db_type(cfgfile); } /* get values */ ecfg->policy_filename = parse_conf_policy_filename(cfgfile); ecfg->zonelist_filename = parse_conf_zonelist_filename(cfgfile); ecfg->zonefetch_filename = parse_conf_zonefetch_filename(cfgfile); ecfg->log_filename = parse_conf_log_filename(cfgfile); ecfg->delegation_signer_submit_command = parse_conf_delegation_signer_submit_command(cfgfile); ecfg->delegation_signer_retract_command = parse_conf_delegation_signer_retract_command(cfgfile); ecfg->use_syslog = parse_conf_use_syslog(cfgfile); ecfg->num_worker_threads = parse_conf_worker_threads(cfgfile); ecfg->manual_keygen = parse_conf_manual_keygen(cfgfile); ecfg->repositories = parse_conf_repositories(cfgfile); /* If any verbosity has been specified at cmd line we will use that */ ecfg->verbosity = cmdline_verbosity > 0 ? cmdline_verbosity : parse_conf_verbosity(cfgfile); ecfg->automatic_keygen_duration = parse_conf_automatic_keygen_period(cfgfile); ecfg->rollover_notification = parse_conf_rollover_notification(cfgfile); /* done */ ods_fclose(cfgfd); return ecfg; } ods_log_error("[%s] failed to read: unable 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] check failed: config does not exist", conf_str); return ODS_STATUS_CFG_ERR; } if (!config->policy_filename) { ods_log_error("[%s] check failed: no policy filename", conf_str); return ODS_STATUS_CFG_ERR; } if (!config->zonelist_filename) { ods_log_error("[%s] check failed: no zonelist filename", conf_str); return ODS_STATUS_CFG_ERR; } if (!config->clisock_filename) { ods_log_error("[%s] check failed: no socket filename", conf_str); return ODS_STATUS_CFG_ERR; } if (!config->datastore) { ods_log_error("[%s] check failed: no datastore", 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; } ods_log_assert(out); fprintf(out, "\n"); if (config) { ods_log_assert(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->policy_filename); fprintf(out, "\t\t%s\n", config->zonelist_filename); if (config->zonefetch_filename) { fprintf(out, "\t\t%s\n", config->zonefetch_filename); } fprintf(out, "\t\n"); /* Enforcer */ 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"); } fprintf(out, "\t\t%s\n", config->working_dir); fprintf(out, "\t\t%i\n", config->num_worker_threads); if (config->manual_keygen) { fprintf(out, "\t\t\n"); } if (config->delegation_signer_submit_command) { fprintf(out, "\t\t%s\n", config->delegation_signer_submit_command); } if (config->delegation_signer_retract_command) { fprintf(out, "\t\t%s\n", config->delegation_signer_retract_command); } fprintf(out, "\t\n"); fprintf(out, "\n"); /* make configurable: - pid_filename - clisock_filename */ } } /** * Clean up config. * */ void engine_config_cleanup(engineconfig_type* config) { if (!config) { return; } free((void*) config->cfg_filename); free((void*) config->policy_filename); free((void*) config->zonelist_filename); free((void*) config->zonefetch_filename); free((void*) config->log_filename); free((void*) config->pid_filename); free((void*) config->delegation_signer_submit_command); free((void*) config->delegation_signer_retract_command); free((void*) config->clisock_filename); free((void*) config->working_dir); free((void*) config->username); free((void*) config->group); free((void*) config->chroot); free((void*) config->datastore); free((void*) config->db_host); free((void*) config->db_username); free((void*) config->db_password); hsm_repository_free(config->repositories); config->repositories = NULL; free(config); } opendnssec-2.1.13/enforcer/src/daemon/cfg.h0000644000077000001440000000676714446272525015455 00000000000000/* * 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. * */ /** * Enforcer configuration. * */ #ifndef DAEMON_CONFIG_H #define DAEMON_CONFIG_H #include "config.h" #include "status.h" #include #include #include "libhsm.h" typedef enum { ENFORCER_DATABASE_TYPE_NONE, ENFORCER_DATABASE_TYPE_SQLITE, ENFORCER_DATABASE_TYPE_MYSQL } engineconfig_database_type_t; /** * Engine configuration. * */ typedef struct engineconfig_struct engineconfig_type; struct engineconfig_struct { const char* cfg_filename; const char* policy_filename; const char* zonelist_filename; const char* zonefetch_filename; const char* log_filename; const char* pid_filename; const char* delegation_signer_submit_command; const char* delegation_signer_retract_command; const char* clisock_filename; const char* working_dir; const char* username; const char* group; const char* chroot; const char* datastore; /* Datastore/SQLite or Datastore/MySQL/Database */ const char* db_host; /* Datastore/MySQL/Host */ const char* db_username; /* Datastore/MySQL/Username */ const char* db_password; /* Datastore/MySQL/Password */ int use_syslog; int num_worker_threads; int manual_keygen; int verbosity; int db_port; /* Datastore/MySQL/Host/@Port */ time_t automatic_keygen_duration; time_t rollover_notification; hsm_repository_t* repositories; engineconfig_database_type_t db_type; }; /** * Configure engine. * \param[in] allocator memory allocation * \param[in] cfgfile config file * \param[in] cmdline_verbosity log level * \return engineconfig_type* engine configuration * */ engineconfig_type* engine_config(const char* cfgfile, int cmdline_verbosity, engineconfig_type* oldcfg); /** * Check configuration. * \param[in] config engine configuration * \return ods_status status * */ 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-2.1.13/enforcer/src/daemon/time_leap_cmd.c0000644000077000001440000001452114446272525017456 00000000000000/* * Copyright (c) 2014 NLNet Labs * Copyright (c) 2014 OpenDNSSEC AB (svb) * 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 #include "config.h" #include "file.h" #include "duration.h" #include "log.h" #include "str.h" #include "cmdhandler.h" #include "daemon/enforcercommands.h" #include "daemon/engine.h" #include "clientpipe.h" #include "hsmkey/hsm_key_factory.h" #include "longgetopt.h" #include "daemon/time_leap_cmd.h" #define MAX_ARGS 5 static const char *module_str = "time_leap_cmd"; static void usage(int sockfd) { client_printf(sockfd, "time leap\n" " --time