diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib-dns/Makefile.am | 36 | ||||
-rw-r--r-- | src/lib-dns/Makefile.in | 874 | ||||
-rw-r--r-- | src/lib-dns/dns-lookup.c | 438 | ||||
-rw-r--r-- | src/lib-dns/dns-lookup.h | 90 | ||||
-rw-r--r-- | src/lib-dns/dns-util.c | 85 | ||||
-rw-r--r-- | src/lib-dns/dns-util.h | 36 | ||||
-rw-r--r-- | src/lib-dns/test-dns-util.c | 124 |
7 files changed, 1683 insertions, 0 deletions
diff --git a/src/lib-dns/Makefile.am b/src/lib-dns/Makefile.am new file mode 100644 index 0000000..509f7b0 --- /dev/null +++ b/src/lib-dns/Makefile.am @@ -0,0 +1,36 @@ +noinst_LTLIBRARIES = libdns.la + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/lib + +libdns_la_SOURCES = \ + dns-lookup.c \ + dns-util.c + +headers = \ + dns-lookup.h \ + dns-util.h + +test_programs = \ + test-dns-util + +noinst_PROGRAMS = $(test_programs) + +test_libs = \ + libdns.la \ + ../lib-test/libtest.la \ + ../lib/liblib.la + +test_dns_util_SOURCE = test-dns-util.c +test_dns_util_LDADD = $(test_libs) +test_dns_util_CFLAGS = $(AM_CPPFLAGS) \ + -I$(top_srcdir)/src/lib-test + +check-local: + for bin in $(test_programs); do \ + if ! $(RUN_TEST) ./$$bin; then exit 1; fi; \ + done + + +pkginc_libdir=$(pkgincludedir) +pkginc_lib_HEADERS = $(headers) diff --git a/src/lib-dns/Makefile.in b/src/lib-dns/Makefile.in new file mode 100644 index 0000000..fe45740 --- /dev/null +++ b/src/lib-dns/Makefile.in @@ -0,0 +1,874 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 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@ +noinst_PROGRAMS = $(am__EXEEXT_1) +subdir = src/lib-dns +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_checktype2.m4 \ + $(top_srcdir)/m4/ac_typeof.m4 $(top_srcdir)/m4/arc4random.m4 \ + $(top_srcdir)/m4/blockdev.m4 $(top_srcdir)/m4/c99_vsnprintf.m4 \ + $(top_srcdir)/m4/clock_gettime.m4 $(top_srcdir)/m4/crypt.m4 \ + $(top_srcdir)/m4/crypt_xpg6.m4 $(top_srcdir)/m4/dbqlk.m4 \ + $(top_srcdir)/m4/dirent_dtype.m4 $(top_srcdir)/m4/dovecot.m4 \ + $(top_srcdir)/m4/fd_passing.m4 $(top_srcdir)/m4/fdatasync.m4 \ + $(top_srcdir)/m4/flexible_array_member.m4 \ + $(top_srcdir)/m4/glibc.m4 $(top_srcdir)/m4/gmtime_max.m4 \ + $(top_srcdir)/m4/gmtime_tm_gmtoff.m4 \ + $(top_srcdir)/m4/ioloop.m4 $(top_srcdir)/m4/iovec.m4 \ + $(top_srcdir)/m4/ipv6.m4 $(top_srcdir)/m4/libcap.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/libwrap.m4 \ + $(top_srcdir)/m4/linux_mremap.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/mmap_write.m4 \ + $(top_srcdir)/m4/mntctl.m4 $(top_srcdir)/m4/modules.m4 \ + $(top_srcdir)/m4/notify.m4 $(top_srcdir)/m4/nsl.m4 \ + $(top_srcdir)/m4/off_t_max.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/pr_set_dumpable.m4 \ + $(top_srcdir)/m4/q_quotactl.m4 $(top_srcdir)/m4/quota.m4 \ + $(top_srcdir)/m4/random.m4 $(top_srcdir)/m4/rlimit.m4 \ + $(top_srcdir)/m4/sendfile.m4 $(top_srcdir)/m4/size_t_signed.m4 \ + $(top_srcdir)/m4/sockpeercred.m4 $(top_srcdir)/m4/sql.m4 \ + $(top_srcdir)/m4/ssl.m4 $(top_srcdir)/m4/st_tim.m4 \ + $(top_srcdir)/m4/static_array.m4 $(top_srcdir)/m4/test_with.m4 \ + $(top_srcdir)/m4/time_t.m4 $(top_srcdir)/m4/typeof.m4 \ + $(top_srcdir)/m4/typeof_dev_t.m4 \ + $(top_srcdir)/m4/uoff_t_max.m4 $(top_srcdir)/m4/vararg.m4 \ + $(top_srcdir)/m4/want_apparmor.m4 \ + $(top_srcdir)/m4/want_bsdauth.m4 \ + $(top_srcdir)/m4/want_bzlib.m4 \ + $(top_srcdir)/m4/want_cassandra.m4 \ + $(top_srcdir)/m4/want_cdb.m4 \ + $(top_srcdir)/m4/want_checkpassword.m4 \ + $(top_srcdir)/m4/want_clucene.m4 $(top_srcdir)/m4/want_db.m4 \ + $(top_srcdir)/m4/want_gssapi.m4 $(top_srcdir)/m4/want_icu.m4 \ + $(top_srcdir)/m4/want_ldap.m4 $(top_srcdir)/m4/want_lua.m4 \ + $(top_srcdir)/m4/want_lz4.m4 $(top_srcdir)/m4/want_lzma.m4 \ + $(top_srcdir)/m4/want_mysql.m4 $(top_srcdir)/m4/want_pam.m4 \ + $(top_srcdir)/m4/want_passwd.m4 $(top_srcdir)/m4/want_pgsql.m4 \ + $(top_srcdir)/m4/want_prefetch.m4 \ + $(top_srcdir)/m4/want_shadow.m4 \ + $(top_srcdir)/m4/want_sodium.m4 $(top_srcdir)/m4/want_solr.m4 \ + $(top_srcdir)/m4/want_sqlite.m4 \ + $(top_srcdir)/m4/want_stemmer.m4 \ + $(top_srcdir)/m4/want_systemd.m4 \ + $(top_srcdir)/m4/want_textcat.m4 \ + $(top_srcdir)/m4/want_unwind.m4 $(top_srcdir)/m4/want_zlib.m4 \ + $(top_srcdir)/m4/want_zstd.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(pkginc_lib_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = test-dns-util$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +LTLIBRARIES = $(noinst_LTLIBRARIES) +libdns_la_LIBADD = +am_libdns_la_OBJECTS = dns-lookup.lo dns-util.lo +libdns_la_OBJECTS = $(am_libdns_la_OBJECTS) +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 = +test_dns_util_SOURCES = test-dns-util.c +test_dns_util_OBJECTS = test_dns_util-test-dns-util.$(OBJEXT) +test_dns_util_DEPENDENCIES = $(test_libs) +test_dns_util_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_dns_util_CFLAGS) \ + $(CFLAGS) $(AM_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) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/dns-lookup.Plo \ + ./$(DEPDIR)/dns-util.Plo \ + ./$(DEPDIR)/test_dns_util-test-dns-util.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 = $(libdns_la_SOURCES) test-dns-util.c +DIST_SOURCES = $(libdns_la_SOURCES) test-dns-util.c +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; }; \ + } +am__installdirs = "$(DESTDIR)$(pkginc_libdir)" +HEADERS = $(pkginc_lib_HEADERS) +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@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPARMOR_LIBS = @APPARMOR_LIBS@ +AR = @AR@ +AUTH_CFLAGS = @AUTH_CFLAGS@ +AUTH_LIBS = @AUTH_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BINARY_CFLAGS = @BINARY_CFLAGS@ +BINARY_LDFLAGS = @BINARY_LDFLAGS@ +BISON = @BISON@ +CASSANDRA_CFLAGS = @CASSANDRA_CFLAGS@ +CASSANDRA_LIBS = @CASSANDRA_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CDB_LIBS = @CDB_LIBS@ +CFLAGS = @CFLAGS@ +CLUCENE_CFLAGS = @CLUCENE_CFLAGS@ +CLUCENE_LIBS = @CLUCENE_LIBS@ +COMPRESS_LIBS = @COMPRESS_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CRYPT_LIBS = @CRYPT_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DICT_LIBS = @DICT_LIBS@ +DLLIB = @DLLIB@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FLEX = @FLEX@ +FUZZER_CPPFLAGS = @FUZZER_CPPFLAGS@ +FUZZER_LDFLAGS = @FUZZER_LDFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KRB5CONFIG = @KRB5CONFIG@ +KRB5_CFLAGS = @KRB5_CFLAGS@ +KRB5_LIBS = @KRB5_LIBS@ +LD = @LD@ +LDAP_LIBS = @LDAP_LIBS@ +LDFLAGS = @LDFLAGS@ +LD_NO_WHOLE_ARCHIVE = @LD_NO_WHOLE_ARCHIVE@ +LD_WHOLE_ARCHIVE = @LD_WHOLE_ARCHIVE@ +LIBCAP = @LIBCAP@ +LIBDOVECOT = @LIBDOVECOT@ +LIBDOVECOT_COMPRESS = @LIBDOVECOT_COMPRESS@ +LIBDOVECOT_DEPS = @LIBDOVECOT_DEPS@ +LIBDOVECOT_DSYNC = @LIBDOVECOT_DSYNC@ +LIBDOVECOT_LA_LIBS = @LIBDOVECOT_LA_LIBS@ +LIBDOVECOT_LDA = @LIBDOVECOT_LDA@ +LIBDOVECOT_LDAP = @LIBDOVECOT_LDAP@ +LIBDOVECOT_LIBFTS = @LIBDOVECOT_LIBFTS@ +LIBDOVECOT_LIBFTS_DEPS = @LIBDOVECOT_LIBFTS_DEPS@ +LIBDOVECOT_LOGIN = @LIBDOVECOT_LOGIN@ +LIBDOVECOT_LUA = @LIBDOVECOT_LUA@ +LIBDOVECOT_LUA_DEPS = @LIBDOVECOT_LUA_DEPS@ +LIBDOVECOT_SQL = @LIBDOVECOT_SQL@ +LIBDOVECOT_STORAGE = @LIBDOVECOT_STORAGE@ +LIBDOVECOT_STORAGE_DEPS = @LIBDOVECOT_STORAGE_DEPS@ +LIBEXTTEXTCAT_CFLAGS = @LIBEXTTEXTCAT_CFLAGS@ +LIBEXTTEXTCAT_LIBS = @LIBEXTTEXTCAT_LIBS@ +LIBICONV = @LIBICONV@ +LIBICU_CFLAGS = @LIBICU_CFLAGS@ +LIBICU_LIBS = @LIBICU_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSODIUM_CFLAGS = @LIBSODIUM_CFLAGS@ +LIBSODIUM_LIBS = @LIBSODIUM_LIBS@ +LIBTIRPC_CFLAGS = @LIBTIRPC_CFLAGS@ +LIBTIRPC_LIBS = @LIBTIRPC_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ +LINKED_STORAGE_LDADD = @LINKED_STORAGE_LDADD@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MODULE_LIBS = @MODULE_LIBS@ +MODULE_SUFFIX = @MODULE_SUFFIX@ +MYSQL_CFLAGS = @MYSQL_CFLAGS@ +MYSQL_CONFIG = @MYSQL_CONFIG@ +MYSQL_LIBS = @MYSQL_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NOPLUGIN_LDFLAGS = @NOPLUGIN_LDFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PANDOC = @PANDOC@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PGSQL_CFLAGS = @PGSQL_CFLAGS@ +PGSQL_LIBS = @PGSQL_LIBS@ +PG_CONFIG = @PG_CONFIG@ +PIE_CFLAGS = @PIE_CFLAGS@ +PIE_LDFLAGS = @PIE_LDFLAGS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +QUOTA_LIBS = @QUOTA_LIBS@ +RANLIB = @RANLIB@ +RELRO_LDFLAGS = @RELRO_LDFLAGS@ +RPCGEN = @RPCGEN@ +RUN_TEST = @RUN_TEST@ +SED = @SED@ +SETTING_FILES = @SETTING_FILES@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SQLITE_CFLAGS = @SQLITE_CFLAGS@ +SQLITE_LIBS = @SQLITE_LIBS@ +SQL_CFLAGS = @SQL_CFLAGS@ +SQL_LIBS = @SQL_LIBS@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +ZSTD_CFLAGS = @ZSTD_CFLAGS@ +ZSTD_LIBS = @ZSTD_LIBS@ +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@ +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@ +dict_drivers = @dict_drivers@ +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@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rundir = @rundir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sql_drivers = @sql_drivers@ +srcdir = @srcdir@ +ssldir = @ssldir@ +statedir = @statedir@ +sysconfdir = @sysconfdir@ +systemdservicetype = @systemdservicetype@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = libdns.la +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/lib + +libdns_la_SOURCES = \ + dns-lookup.c \ + dns-util.c + +headers = \ + dns-lookup.h \ + dns-util.h + +test_programs = \ + test-dns-util + +test_libs = \ + libdns.la \ + ../lib-test/libtest.la \ + ../lib/liblib.la + +test_dns_util_SOURCE = test-dns-util.c +test_dns_util_LDADD = $(test_libs) +test_dns_util_CFLAGS = $(AM_CPPFLAGS) \ + -I$(top_srcdir)/src/lib-test + +pkginc_libdir = $(pkgincludedir) +pkginc_lib_HEADERS = $(headers) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/lib-dns/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/lib-dns/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +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 + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libdns.la: $(libdns_la_OBJECTS) $(libdns_la_DEPENDENCIES) $(EXTRA_libdns_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libdns_la_OBJECTS) $(libdns_la_LIBADD) $(LIBS) + +test-dns-util$(EXEEXT): $(test_dns_util_OBJECTS) $(test_dns_util_DEPENDENCIES) $(EXTRA_test_dns_util_DEPENDENCIES) + @rm -f test-dns-util$(EXEEXT) + $(AM_V_CCLD)$(test_dns_util_LINK) $(test_dns_util_OBJECTS) $(test_dns_util_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dns-lookup.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dns-util.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_dns_util-test-dns-util.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)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 $@ $< + +test_dns_util-test-dns-util.o: test-dns-util.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_dns_util_CFLAGS) $(CFLAGS) -MT test_dns_util-test-dns-util.o -MD -MP -MF $(DEPDIR)/test_dns_util-test-dns-util.Tpo -c -o test_dns_util-test-dns-util.o `test -f 'test-dns-util.c' || echo '$(srcdir)/'`test-dns-util.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_dns_util-test-dns-util.Tpo $(DEPDIR)/test_dns_util-test-dns-util.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-dns-util.c' object='test_dns_util-test-dns-util.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_dns_util_CFLAGS) $(CFLAGS) -c -o test_dns_util-test-dns-util.o `test -f 'test-dns-util.c' || echo '$(srcdir)/'`test-dns-util.c + +test_dns_util-test-dns-util.obj: test-dns-util.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_dns_util_CFLAGS) $(CFLAGS) -MT test_dns_util-test-dns-util.obj -MD -MP -MF $(DEPDIR)/test_dns_util-test-dns-util.Tpo -c -o test_dns_util-test-dns-util.obj `if test -f 'test-dns-util.c'; then $(CYGPATH_W) 'test-dns-util.c'; else $(CYGPATH_W) '$(srcdir)/test-dns-util.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_dns_util-test-dns-util.Tpo $(DEPDIR)/test_dns_util-test-dns-util.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-dns-util.c' object='test_dns_util-test-dns-util.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_dns_util_CFLAGS) $(CFLAGS) -c -o test_dns_util-test-dns-util.obj `if test -f 'test-dns-util.c'; then $(CYGPATH_W) 'test-dns-util.c'; else $(CYGPATH_W) '$(srcdir)/test-dns-util.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pkginc_libHEADERS: $(pkginc_lib_HEADERS) + @$(NORMAL_INSTALL) + @list='$(pkginc_lib_HEADERS)'; test -n "$(pkginc_libdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkginc_libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkginc_libdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkginc_libdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkginc_libdir)" || exit $$?; \ + done + +uninstall-pkginc_libHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(pkginc_lib_HEADERS)'; test -n "$(pkginc_libdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkginc_libdir)'; $(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 + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(pkginc_libdir)"; 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." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/dns-lookup.Plo + -rm -f ./$(DEPDIR)/dns-util.Plo + -rm -f ./$(DEPDIR)/test_dns_util-test-dns-util.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-pkginc_libHEADERS + +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)/dns-lookup.Plo + -rm -f ./$(DEPDIR)/dns-util.Plo + -rm -f ./$(DEPDIR)/test_dns_util-test-dns-util.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-pkginc_libHEADERS + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am \ + check-local clean clean-generic clean-libtool \ + clean-noinstLTLIBRARIES 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-pkginc_libHEADERS 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-pkginc_libHEADERS + +.PRECIOUS: Makefile + + +check-local: + for bin in $(test_programs); do \ + if ! $(RUN_TEST) ./$$bin; then exit 1; fi; \ + done + +# 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: diff --git a/src/lib-dns/dns-lookup.c b/src/lib-dns/dns-lookup.c new file mode 100644 index 0000000..c37445e --- /dev/null +++ b/src/lib-dns/dns-lookup.c @@ -0,0 +1,438 @@ +/* Copyright (c) 2010-2018 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "ioloop.h" +#include "str.h" +#include "array.h" +#include "ostream.h" +#include "connection.h" +#include "lib-event.h" +#include "llist.h" +#include "istream.h" +#include "write-full.h" +#include "time-util.h" +#include "dns-lookup.h" + +#include <stdio.h> +#include <unistd.h> + +#define MAX_INBUF_SIZE 512 + +static struct event_category event_category_dns = { + .name = "dns" +}; + +struct dns_lookup { + struct dns_lookup *prev, *next; + struct dns_client *client; + pool_t pool; + bool ptr_lookup; + + struct timeout *to; + + struct timeval start_time; + unsigned int warn_msecs; + + struct dns_lookup_result result; + struct event *event; + + dns_lookup_callback_t *callback; + void *context; +}; + +struct dns_client { + struct connection conn; + struct connection_list *clist; + struct dns_lookup *head, *tail; + struct timeout *to_idle; + struct ioloop *ioloop; + char *path; + + unsigned int timeout_msecs; + unsigned int idle_timeout_msecs; + + bool connected:1; + bool deinit_client_at_free:1; +}; + +#undef dns_lookup +#undef dns_lookup_ptr +#undef dns_client_lookup +#undef dns_client_lookup_ptr + +static void dns_lookup_free(struct dns_lookup **_lookup); + +static void dns_lookup_save_msecs(struct dns_lookup *lookup); + +static void dns_lookup_callback(struct dns_lookup *lookup) +{ + struct event_passthrough *e = + event_create_passthrough(lookup->event)-> + set_name("dns_request_finished"); + + dns_lookup_save_msecs(lookup); + + if (lookup->result.ret != 0) { + e->add_int("error_code", lookup->result.ret); + e->add_str("error", lookup->result.error); + e_debug(e->event(), "Lookup failed after %u msecs: %s", + lookup->result.msecs, lookup->result.error); + } else { + e_debug(e->event(), "Lookup successful after %u msecs", + lookup->result.msecs); + } + lookup->callback(&lookup->result, lookup->context); +} + +static void dns_client_disconnect(struct dns_client *client, const char *error) +{ + struct dns_lookup *lookup, *next; + struct dns_lookup_result result; + + if (!client->connected) + return; + timeout_remove(&client->to_idle); + + connection_disconnect(&client->conn); + client->connected = FALSE; + + i_zero(&result); + result.ret = EAI_FAIL; + result.error = error; + e_debug(client->conn.event, "Disconnect: %s", error); + + lookup = client->head; + client->head = NULL; + while (lookup != NULL) { + next = lookup->next; + dns_lookup_callback(lookup); + dns_lookup_free(&lookup); + lookup = next; + } +} + +static void dns_client_destroy(struct connection *conn) +{ + struct dns_client *client = container_of(conn, struct dns_client, conn); + client->connected = FALSE; + connection_deinit(conn); +} + +static int dns_lookup_input_args(struct dns_lookup *lookup, const char *const *args) +{ + struct dns_lookup_result *result = &lookup->result; + + if (str_to_int(args[0], &result->ret) < 0) + return -1; + if (result->ret != 0) { + result->error = args[1]; + return 1; + } + + if (lookup->ptr_lookup) { + result->name = p_strdup(lookup->pool, args[1]); + return 1; + } + + ARRAY(struct ip_addr) ips; + p_array_init(&ips, lookup->pool, 2); + for(unsigned int i = 1; args[i] != NULL; i++) { + struct ip_addr *ip = array_append_space(&ips); + if (net_addr2ip(args[i], ip) < 0) + return -1; + } + result->ips = array_get(&ips, &result->ips_count); + + return 1; +} + +static void dns_lookup_save_msecs(struct dns_lookup *lookup) +{ + struct timeval now; + int diff; + + i_gettimeofday(&now); + + diff = timeval_diff_msecs(&now, &lookup->start_time); + if (diff > 0) + lookup->result.msecs = diff; +} + +static int dns_client_input_args(struct connection *conn, const char *const *args) +{ + struct dns_client *client = container_of(conn, struct dns_client, conn); + struct dns_lookup *lookup = client->head; + bool retry = FALSE; + int ret = 0; + + if (lookup == NULL) { + dns_client_disconnect(client, t_strdup_printf( + "Unexpected input from %s", conn->name)); + return -1; + } + + if ((ret = dns_lookup_input_args(lookup, args)) == 0) { + return 1; /* keep on reading */ + } else if (ret < 0) { + dns_client_disconnect(client, t_strdup_printf( + "Invalid input from %s", conn->name)); + return -1; + } else if (ret > 0) { + dns_lookup_callback(lookup); + retry = !lookup->client->deinit_client_at_free; + dns_lookup_free(&lookup); + } + + return retry ? 1 : -1; +} + +static void dns_lookup_timeout(struct dns_lookup *lookup) +{ + lookup->result.error = "Lookup timed out"; + + dns_lookup_callback(lookup); + dns_lookup_free(&lookup); +} + +int dns_lookup(const char *host, const struct dns_lookup_settings *set, + dns_lookup_callback_t *callback, void *context, + struct dns_lookup **lookup_r) +{ + struct dns_client *client; + + client = dns_client_init(set); + event_add_category(client->conn.event, &event_category_dns); + client->deinit_client_at_free = TRUE; + return dns_client_lookup(client, host, callback, context, lookup_r); +} + +int dns_lookup_ptr(const struct ip_addr *ip, + const struct dns_lookup_settings *set, + dns_lookup_callback_t *callback, void *context, + struct dns_lookup **lookup_r) +{ + struct dns_client *client; + + client = dns_client_init(set); + event_add_category(client->conn.event, &event_category_dns); + client->deinit_client_at_free = TRUE; + return dns_client_lookup_ptr(client, ip, callback, context, lookup_r); +} + +static void dns_client_idle_timeout(struct dns_client *client) +{ + i_assert(client->head == NULL); + + /* send QUIT */ + o_stream_nsend_str(client->conn.output, "QUIT\n"); + dns_client_disconnect(client, "Idle timeout"); +} + +static void dns_lookup_free(struct dns_lookup **_lookup) +{ + struct dns_lookup *lookup = *_lookup; + struct dns_client *client = lookup->client; + + *_lookup = NULL; + + DLLIST2_REMOVE(&client->head, &client->tail, lookup); + timeout_remove(&lookup->to); + if (client->deinit_client_at_free) + dns_client_deinit(&client); + else if (client->head == NULL && client->connected) { + client->to_idle = timeout_add_to(client->ioloop, + client->idle_timeout_msecs, + dns_client_idle_timeout, client); + } + event_unref(&lookup->event); + pool_unref(&lookup->pool); +} + +void dns_lookup_abort(struct dns_lookup **lookup) +{ + dns_lookup_free(lookup); +} + +static void dns_lookup_switch_ioloop_real(struct dns_lookup *lookup) +{ + if (lookup->to != NULL) + lookup->to = io_loop_move_timeout(&lookup->to); +} + +void dns_lookup_switch_ioloop(struct dns_lookup *lookup) +{ + /* dns client ioloop switch switches all lookups too */ + if (lookup->client->deinit_client_at_free) + dns_client_switch_ioloop(lookup->client); + else + dns_lookup_switch_ioloop_real(lookup); +} + +static void dns_client_connected(struct connection *conn, bool success) +{ + struct dns_client *client = container_of(conn, struct dns_client, conn); + if (!success) + return; + client->connected = TRUE; +} + +static const struct connection_vfuncs dns_client_vfuncs = { + .destroy = dns_client_destroy, + .input_args = dns_client_input_args, + .client_connected = dns_client_connected, +}; + +static const struct connection_settings dns_client_set = { + .service_name_in = "dns", + .service_name_out = "dns-client", + .major_version = 1, + .minor_version = 0, + .input_max_size = SIZE_MAX, + .output_max_size = SIZE_MAX, + .client = TRUE, +}; + +struct dns_client *dns_client_init(const struct dns_lookup_settings *set) +{ + struct dns_client *client; + + client = i_new(struct dns_client, 1); + client->timeout_msecs = set->timeout_msecs; + client->idle_timeout_msecs = set->idle_timeout_msecs; + client->clist = connection_list_init(&dns_client_set, &dns_client_vfuncs); + client->ioloop = set->ioloop == NULL ? current_ioloop : set->ioloop; + client->path = i_strdup(set->dns_client_socket_path); + client->conn.event_parent=set->event_parent; + connection_init_client_unix(client->clist, &client->conn, client->path); + return client; +} + +void dns_client_deinit(struct dns_client **_client) +{ + struct dns_client *client = *_client; + struct connection_list *clist = client->clist; + *_client = NULL; + + i_assert(client->head == NULL); + + dns_client_disconnect(client, "deinit"); + connection_list_deinit(&clist); + i_free(client->path); + i_free(client); +} + +int dns_client_connect(struct dns_client *client, const char **error_r) +{ + if (client->connected) + return 0; + if (client->ioloop != NULL) + connection_switch_ioloop_to(&client->conn, client->ioloop); + int ret = connection_client_connect(&client->conn); + if (ret < 0) + *error_r = t_strdup_printf("Failed to connect to %s: %m", + client->path); + return ret; +} + +static int +dns_client_send_request(struct dns_client *client, const char *cmd, + const char **error_r) +{ + int ret; + + if (!client->connected) { + if (dns_client_connect(client, error_r) < 0) + return -1; + } + + if ((ret = o_stream_send(client->conn.output, cmd, strlen(cmd))) < 0) { + *error_r = t_strdup_printf("write(%s) failed: %s", + client->conn.name, + o_stream_get_error(client->conn.output)); + dns_client_disconnect(client, "Cannot send data"); + } + + return ret; +} + +static int +dns_client_lookup_common(struct dns_client *client, + const char *cmd, const char *param, bool ptr_lookup, + dns_lookup_callback_t *callback, void *context, + struct dns_lookup **lookup_r) +{ + struct dns_lookup *lookup; + int ret; + + i_assert(param != NULL && *param != '\0'); + cmd = t_strdup_printf("%s\t%s\n", cmd, param); + + pool_t pool = pool_alloconly_create("dns lookup", 512); + lookup = p_new(pool, struct dns_lookup, 1); + lookup->pool = pool; + + i_gettimeofday(&lookup->start_time); + + lookup->client = client; + lookup->callback = callback; + lookup->context = context; + lookup->ptr_lookup = ptr_lookup; + lookup->result.ret = EAI_FAIL; + lookup->event = event_create(client->conn.event); + event_set_append_log_prefix(lookup->event, t_strconcat("dns(", param, "): ", NULL)); + struct event_passthrough *e = + event_create_passthrough(lookup->event)-> + set_name("dns_request_started"); + e_debug(e->event(), "Lookup started"); + + if ((ret = dns_client_send_request(client, cmd, &lookup->result.error)) <= 0) { + if (ret == 0) { + /* retry once */ + ret = dns_client_send_request(client, cmd, + &lookup->result.error); + } + if (ret <= 0) { + dns_lookup_callback(lookup); + dns_lookup_free(&lookup); + return -1; + } + } + + if (client->timeout_msecs != 0) { + lookup->to = timeout_add_to(client->ioloop, + client->timeout_msecs, + dns_lookup_timeout, lookup); + } + timeout_remove(&client->to_idle); + DLLIST2_APPEND(&client->head, &client->tail, lookup); + *lookup_r = lookup; + return 0; +} + +int dns_client_lookup(struct dns_client *client, const char *host, + dns_lookup_callback_t *callback, void *context, + struct dns_lookup **lookup_r) +{ + return dns_client_lookup_common(client, "IP", host, FALSE, + callback, context, lookup_r); +} + +int dns_client_lookup_ptr(struct dns_client *client, const struct ip_addr *ip, + dns_lookup_callback_t *callback, void *context, + struct dns_lookup **lookup_r) +{ + return dns_client_lookup_common(client, "NAME", net_ip2addr(ip), TRUE, + callback, context, lookup_r); +} + +void dns_client_switch_ioloop(struct dns_client *client) +{ + struct dns_lookup *lookup; + + connection_switch_ioloop(&client->conn); + client->to_idle = io_loop_move_timeout(&client->to_idle); + client->ioloop = current_ioloop; + + for (lookup = client->head; lookup != NULL; lookup = lookup->next) + dns_lookup_switch_ioloop_real(lookup); +} diff --git a/src/lib-dns/dns-lookup.h b/src/lib-dns/dns-lookup.h new file mode 100644 index 0000000..38d65f6 --- /dev/null +++ b/src/lib-dns/dns-lookup.h @@ -0,0 +1,90 @@ +#ifndef DNS_LOOKUP_H +#define DNS_LOOKUP_H + +#define DNS_CLIENT_SOCKET_NAME "dns-client" + +struct dns_lookup; + +struct dns_lookup_settings { + const char *dns_client_socket_path; + unsigned int timeout_msecs; + /* the idle_timeout_msecs works only with the dns_client_* API. + 0 = disconnect immediately */ + unsigned int idle_timeout_msecs; + + /* ioloop to run the lookup on (defaults to current_ioloop) */ + struct ioloop *ioloop; + struct event *event_parent; +}; + +struct dns_lookup_result { + /* all is ok if ret=0, otherwise it contains net_gethosterror() + compatible error code. error string is always set if ret != 0. */ + int ret; + const char *error; + + /* how many milliseconds the lookup took. */ + unsigned int msecs; + + /* for IP lookup: */ + unsigned int ips_count; + const struct ip_addr *ips; + /* for PTR lookup: */ + const char *name; +}; + +typedef void dns_lookup_callback_t(const struct dns_lookup_result *result, + void *context); + +/* Do asynchronous DNS lookup via dns-client UNIX socket. Returns 0 if lookup + started, -1 if there was an error communicating with the UNIX socket. + When failing with -1, the callback is called before returning from the + function. */ +int dns_lookup(const char *host, const struct dns_lookup_settings *set, + dns_lookup_callback_t *callback, void *context, + struct dns_lookup **lookup_r) ATTR_NULL(4); +#define dns_lookup(host, set, callback, context, lookup_r) \ + dns_lookup(host - \ + CALLBACK_TYPECHECK(callback, void (*)( \ + const struct dns_lookup_result *, typeof(context))), \ + set, (dns_lookup_callback_t *)callback, context, lookup_r) +int dns_lookup_ptr(const struct ip_addr *ip, + const struct dns_lookup_settings *set, + dns_lookup_callback_t *callback, void *context, + struct dns_lookup **lookup_r) ATTR_NULL(4); +#define dns_lookup_ptr(host, set, callback, context, lookup_r) \ + dns_lookup_ptr(host - \ + CALLBACK_TYPECHECK(callback, void (*)( \ + const struct dns_lookup_result *, typeof(context))), \ + set, (dns_lookup_callback_t *)callback, context, lookup_r) +/* Abort the DNS lookup without calling the callback. */ +void dns_lookup_abort(struct dns_lookup **lookup); + +void dns_lookup_switch_ioloop(struct dns_lookup *lookup); + +/* Alternative API for clients that need to do multiple DNS lookups. */ +struct dns_client *dns_client_init(const struct dns_lookup_settings *set); +void dns_client_deinit(struct dns_client **client); + +/* Connect immediately to the dns-lookup socket. */ +int dns_client_connect(struct dns_client *client, const char **error_r); +int dns_client_lookup(struct dns_client *client, const char *host, + dns_lookup_callback_t *callback, void *context, + struct dns_lookup **lookup_r) ATTR_NULL(4); +#define dns_client_lookup(client, host, callback, context, lookup_r) \ + dns_client_lookup(client, host - \ + CALLBACK_TYPECHECK(callback, void (*)( \ + const struct dns_lookup_result *, typeof(context))), \ + (dns_lookup_callback_t *)callback, context, lookup_r) +int dns_client_lookup_ptr(struct dns_client *client, const struct ip_addr *ip, + dns_lookup_callback_t *callback, void *context, + struct dns_lookup **lookup_r) ATTR_NULL(4); +#define dns_client_lookup_ptr(client, host, callback, context, lookup_r) \ + dns_client_lookup_ptr(client, host - \ + CALLBACK_TYPECHECK(callback, void (*)( \ + const struct dns_lookup_result *, typeof(context))), \ + (dns_lookup_callback_t *)callback, context, lookup_r) + +void dns_client_switch_ioloop(struct dns_client *client); + +#endif diff --git a/src/lib-dns/dns-util.c b/src/lib-dns/dns-util.c new file mode 100644 index 0000000..a8469ce --- /dev/null +++ b/src/lib-dns/dns-util.c @@ -0,0 +1,85 @@ +/* Copyright (c) 2010-2018 Dovecot authors, see the included COPYING file */ +#include "lib.h" +#include "dns-util.h" + +/** + return first position from b->a of c or a if not found + */ +static inline +const char *strchr_ba(const char *a, const char *b, char c) +{ + for(;b>a && *b != c; b--); + return b; +} + +int dns_ncompare(const char *a, const char *b, size_t n) +{ + if (a == NULL && b == NULL) return 0; + if (a == NULL && b != NULL) return 1; + if (a != NULL && b == NULL) return -1; + + for(size_t i = 0; i < n && + *a != '\0' && + *b != '\0' && + dns_tolower(*a) == dns_tolower(*b); + i++, a++, b++); + + return dns_tolower(*a) - dns_tolower(*b); +} + +int dns_compare(const char *a, const char *b) +{ + return dns_ncompare(a, b, SIZE_MAX); +} + +int dns_compare_labels(const char *a, const char *b) +{ + if (a == NULL && b == NULL) return 0; + if (a == NULL && b != NULL) return 1; + if (a != NULL && b == NULL) return -1; + + const char *ptr_a = a + strlen(a); + const char *ptr_b = b + strlen(b); + const char *label_a = ptr_a, *label_b = ptr_b; + int comp = 0; + + while(comp == 0 && ptr_a > a && ptr_b > b) { + /* look for start of label, including dot */ + label_a = strchr_ba(a, ptr_a, '.'); + label_b = strchr_ba(b, ptr_b, '.'); + if (ptr_a - label_a != ptr_b - label_b) + /* compare labels up to minimum length + but include \0 to make sure that we + don't consider alpha and alphabet + equal */ + return dns_ncompare(label_a, label_b, + I_MIN(ptr_a - label_a, + ptr_b - label_b)+1); + comp = dns_ncompare(label_a, label_b, ptr_a -label_a); + ptr_a = label_a - 1; + ptr_b = label_b - 1; + } + + return dns_tolower(*label_a) - dns_tolower(*label_b); +} + +int dns_match_wildcard(const char *name, const char *mask) +{ + i_assert(name != NULL && mask != NULL); + + for(;*name != '\0' && *mask != '\0'; name++, mask++) { + switch(*mask) { + case '*': + name = strchr(name, '.'); + if (name == NULL || mask[1] != '.') return -1; + mask++; + break; + case '?': + break; + default: + if (dns_tolower(*name) != dns_tolower(*mask)) return -1; + } + } + if (*mask == '*') mask++; + return dns_tolower(*name) == dns_tolower(*mask) ? 0 : -1; +} diff --git a/src/lib-dns/dns-util.h b/src/lib-dns/dns-util.h new file mode 100644 index 0000000..cff52ff --- /dev/null +++ b/src/lib-dns/dns-util.h @@ -0,0 +1,36 @@ +#ifndef DNS_UTIL_H +#define DNS_UTIL_H 1 + +static inline char +dns_tolower(char c) +{ + if (c >= 'A' && c <= 'Z') + c+='a'-'A'; + return c; +} + +/** + * Will compare names in accordance with RFC4343 + */ +int dns_compare(const char *a, const char *b) ATTR_PURE; +int dns_ncompare(const char *a, const char *b, size_t n) ATTR_PURE; + +/** + * Same as above but done by labels from right to left + * + * www.example.org and www.example.net would be compared as + * org = net (return first difference) + * example = example + * www = www + */ +int dns_compare_labels(const char *a, const char *b) ATTR_PURE; + +/** + * Will match names in RFC4592 style + * + * this means *.foo.bar will match name.foo.bar + * but *DOES NOT* match something.name.foo.bar + */ +int dns_match_wildcard(const char *name, const char *mask) ATTR_PURE; + +#endif diff --git a/src/lib-dns/test-dns-util.c b/src/lib-dns/test-dns-util.c new file mode 100644 index 0000000..15d5047 --- /dev/null +++ b/src/lib-dns/test-dns-util.c @@ -0,0 +1,124 @@ +/* Copyright (c) 2016-2018 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "test-lib.h" +#include "dns-util.h" +#include "array.h" + +static void test_dns_compare(void) +{ + static const struct { + const char *a; + const char *b; + int res; + } tests[] = + { + { NULL, NULL, 0 }, + { NULL, "", 1 }, + { "", NULL, -1 }, + { "", "", 0 }, + { "a", "a", 0 }, + { "a", "b", -1 }, + { "b", "a", 1 }, + { "A", "A", 0 }, + { "A", "B", -1 }, + { "B", "A", 1 }, + { "A", "a", 0 }, + { "a", "B", -1 }, + { "B", "a", 1 }, + { "test.invalid", "TeSt.InVaLid", 0 }, + { "alphabet.com", "alpha.com", 52 }, + { "com.alphabet", "com.alpha", 98 }, + { "com.com", "com.comcom", -99 }, + }; + + test_begin("test_dns_compare"); + + for(size_t i = 0; i < N_ELEMENTS(tests); i++) { + test_assert_idx(dns_compare(tests[i].a, tests[i].b) == tests[i].res, i); + test_assert_idx(dns_compare_labels(tests[i].a, tests[i].b) == tests[i].res, i); + } + + test_end(); +} + +static void test_dns_match(void) +{ + static const struct { + const char *name; + const char *mask; + int res; + } tests[] = + { + { "", "", 0 }, + { "", "*", 0 }, + { "*", "", -1 }, + { "TeSt.InVaLid", "test.invalid", 0 }, + { "contoso.com", "test.invalid", -1 }, + { "test.invalid", "test.unvalid", -1 }, + { "name.test.invalid", "*.test.invalid", 0 }, + { "real.name.test.invalid", "*.test.invalid", -1 }, + { "real.name.test.invalid", "*.*.test.invalid", 0 }, + { "name.test.invalid", "*name*.test.invalid", -1 }, + { "name.invalid", "name.*", -1 }, + }; + + test_begin("test_dns_match"); + + for(size_t i = 0; i < N_ELEMENTS(tests); i++) { + test_assert_idx(dns_match_wildcard(tests[i].name, tests[i].mask) == tests[i].res, i); + } + + test_end(); +} + +static int +arr_dns_compare(const char *const *a, const char *const *b) +{ + return dns_compare_labels(*a,*b); +} + +static void test_dns_sort(void) +{ + const char *input[] = { + "test.invalid", + "test.com", + "test.contoso.com", + "test.alphabet.com", + "test.xxx", + }; + + const char *output[] = { + "test.alphabet.com", + "test.contoso.com", + "test.com", + "test.invalid", + "test.xxx", + }; + + test_begin("test_dns_sort"); + + ARRAY_TYPE(const_string) arr; + t_array_init(&arr, 8); + + array_append(&arr, input, N_ELEMENTS(input)); + + array_sort(&arr, arr_dns_compare); + + for(size_t i = 0; i < N_ELEMENTS(output); i++) { + const char *str = array_idx_elem(&arr, i); + test_assert_idx(dns_compare(str, output[i]) == 0, i); + } + + test_end(); +} + +int main(void) { + void (*const test_functions[])(void) = { + test_dns_compare, + test_dns_match, + test_dns_sort, + NULL + }; + return test_run(test_functions); +} |