summaryrefslogtreecommitdiff
path: root/mail-filter/libdkim
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /mail-filter/libdkim
reinit the tree, so we can have metadata
Diffstat (limited to 'mail-filter/libdkim')
-rw-r--r--mail-filter/libdkim/Manifest15
-rw-r--r--mail-filter/libdkim/files/debianize/Makefile.in93
-rw-r--r--mail-filter/libdkim/files/debianize/aclocal.m4171
-rw-r--r--mail-filter/libdkim/files/debianize/configure.ac39
-rw-r--r--mail-filter/libdkim/files/debianize/libdkim.pc.in12
-rw-r--r--mail-filter/libdkim/files/debianize/libdkim.ver4
-rw-r--r--mail-filter/libdkim/files/libdkim-1.0.21-gcc6.patch25
-rw-r--r--mail-filter/libdkim/files/libdkim-extra-options.patch87
-rw-r--r--mail-filter/libdkim/files/patches/fix_warnings.patch293
-rw-r--r--mail-filter/libdkim/files/patches/series2
-rw-r--r--mail-filter/libdkim/files/patches/strtok_r.patch119
-rw-r--r--mail-filter/libdkim/libdkim-1.0.21-r3.ebuild54
-rw-r--r--mail-filter/libdkim/metadata.xml8
13 files changed, 922 insertions, 0 deletions
diff --git a/mail-filter/libdkim/Manifest b/mail-filter/libdkim/Manifest
new file mode 100644
index 000000000000..23565ac08085
--- /dev/null
+++ b/mail-filter/libdkim/Manifest
@@ -0,0 +1,15 @@
+AUX debianize/Makefile.in 2428 SHA256 01452e3aaa461d5d3dfc908c9b7068f312406a662db2c6e1a8a50b41b39f6c47 SHA512 05db88fa13c37e3523c7ec9fd4687d57b250d789318afe886d9b5d37813d12ec1cccbff9d519faee213061e25a41dcb0cd2cf0490755d1712e5bc58a023e69c7 WHIRLPOOL 827b83dd031875e2c4a1d4786db47664469491a00707c2abdf7699b982d09ad5126299f582e6427c9a6bcdb349560df9f3ee1a9fa86881ba286957517ed31bbd
+AUX debianize/aclocal.m4 5813 SHA256 e27480508f65f624233c17e47e0086abf15f08d8c7e08370080dde5fa71a33b2 SHA512 f0e4b4d56768c1c05f0e814c36597f7011274914cad28938a8b174e89dbe4263374849ad88a246b64789f312740fc660853d086f54397fa5ccd3be95dfa9b99d WHIRLPOOL 52e17322dc2d37aae9f6eab8b37c0f5ca7d13d95425db3a85396e076b7edb6b0573df5f0eacddfa18e826a906cb06e78b6f7fb6ca46929e87382d07951578cfe
+AUX debianize/configure.ac 958 SHA256 474143bb47d15bb05097a30bea42809a01ad79594003219a3a42e0c137674313 SHA512 c78b670a4bf7b6d56253f2ba78f26fdfbce2da70f2c1c872ca98062528729f25e1e0363f7520713640fe040c42d7900350ca16c15b0d40c04a45f40709f13354 WHIRLPOOL 39a2ea237e9ed9d9a5d2318d90a49389a92214adf7c0287fa592446eae1341f7636bb720deb3354ae4c436db9a76c40d8a606fa3f3d8064553cc9ca1946b1c5d
+AUX debianize/libdkim.pc.in 293 SHA256 afa34ed46a4d3dcdc1347aa13c9481fb8a5fbdccca502006ddbc2b9ac0b5b863 SHA512 4bc756efd21b2e6c3673af626e93c542a861b9e380dbf91a7f61cecd72e87d4346552350382d10acaffb19b7adfeaaa422ebd3387754441115c882a807ee4250 WHIRLPOOL c45f99047897d5a6d06230999aa0a07fdfdf70327f34a74f24727cd540aa21a345e4f7feefdec7e5cb8389b0ac9877968bf1aa62e0785fbbb444bb4a55ab0933
+AUX debianize/libdkim.ver 34 SHA256 e4c48efbc73175b3d47e23fcd5d7e99e7ce9d8dd7a4e86ad7475bc8cc4671203 SHA512 98c6b245561e1cc7c9b21e1dfff7f44c784de2b20cee036761ff517d5521fea6fa00b734c3710504fc50bb9b143bb0343b73f730da670c22047bff9b8407adc6 WHIRLPOOL edd1cf1717e4c3ba30bcdd79daf63d6ce2e573548981e06f1bfdbff5dee4991af225e0541128f69e6b4f75b564df93bfdb9b9bff551177840eed6c108e3fe174
+AUX libdkim-1.0.21-gcc6.patch 4944 SHA256 c9ce20cf94cbb692cc2bfe40434e00a57c96821b396e583e01225b3af5e8cc57 SHA512 e67f75d5a88458a8a5b06837986d1c50001d77f6530ccc95b9034d70df3d4f187132d5d2f4f48535a60dd62b60b123f543e443ac3ab328a460a2a785ea9dc27b WHIRLPOOL 2bff95523f46b1c43de47a1961e46d9c37879570613c15bf994fc92d2e4b30438cd3772aa535606c969bc5f1a5d3340bf4be66df6abd2d0148f48246c76ae2cf
+AUX libdkim-extra-options.patch 2614 SHA256 4cc9eed6273fab56b29aede8235ead9a9441e9b2d0309a08e412d79ff9bfdc9f SHA512 da5521eca184074cf853f4438b6c0c58219ff32901c3c77de9f9ef8a894444e74854895909e55b0002f6ae561d7b065575d56193954ebf3892e0584b2386b10a WHIRLPOOL ac3dec155c47fc2472cf146587da1db60c94eacd5b06a9c2464e559b70b529a0e6ba529d9e6bc16b777f82b11055245a019895ef5f1b4dcc386a1830e177b53f
+AUX patches/fix_warnings.patch 10043 SHA256 2bc30344ff91135a15ae0fa4cc41c9743aaa8071e36ec578ef5a1cbffac933cd SHA512 4714f34c4420d025c99895278630fa5fb72c5525181cd4e5c201d547e4d09b179542725b6b4f5f6fad79e8d7c8935976867f2fe46f7db8893151a299fca4b0c2 WHIRLPOOL 1e89985eff880b3dfe9d5f6236e3882eb6de461b39ebcc5db2eb05c803261d44150c63424c2cd8a781c559f79b973f2d730b1826580ac8c2e80d651b139771cd
+AUX patches/series 34 SHA256 1ed3204f857bf8471824c23ce0d05da5d2779df9da4292c896efebef8ad63427 SHA512 d2ba14924b9d56a2fb92ced7cc3186f061b0c9f4a7f3c6976e5051ac459998413667d7d5d7352eb05561f0f711fa104d78c7bbb47c193a383a9a5ce4ba6f44d0 WHIRLPOOL 76181e8bdf046b82c4252e90c1848e2087d921674391988d75857a5b0956e1d66698802e13ee6cc21e788f151295217ea236c31fb8d57e8ed839eeb68c4f46bc
+AUX patches/strtok_r.patch 3412 SHA256 4992bb70dd2ef24ecb7f77502e5233980342dd2a59556cc213481d640c4b9e82 SHA512 ecd9ccb430654e94a285dcccc5e47a139f8b07633f77c8e056e5d21d132eec886fdf3bc01fab82b762c0d581908755be69de8e4881c3d7da2b7d546429025e00 WHIRLPOOL 7f0bdf710bc31c6c2df1625e80f54ab88a4e3073a443346d6714d19eb0e0445b8f24ebfd913fa2d98292b5f4c52d95ee54494267e5202fc075cd5b052abb2831
+DIST libdkim-1.0.21.zip 55049 SHA256 dc685c8c47384c5d0379a1bcc0c96c8b7877a01e0c3bfedd6a54ae4ebdfa0323 SHA512 3996c64398151dc9c07d357e8f3ac9b94e3c8d06ce5d83ebbe546416f361349d869b0b73216f28d0b732319731f31e61afd9eab0f540471760b944a90130a094 WHIRLPOOL bb95cb2e0cb02192996116a7bcc27221f275f6f8a88ecdbce6c6f70d6f15a4a23fee445706cbbf5d3ac6211d8d999c723aff5f1a673247f12929b285e23602f8
+EBUILD libdkim-1.0.21-r3.ebuild 1159 SHA256 a3cb16b98b2783a0b7f506cc5bb9fa12ae3cbeb03a385158f7418a7a27c18be4 SHA512 439632cb76e30aa54834ae9a36d8e909100281d4d6f43700ff0ab61f61d7385f519a1ec45fd0d7c39cf47efc59eb6125ab70d212725d2d8cce92841f3b6663d4 WHIRLPOOL 876130b7f667b19a4a7fb49606a3ef341ebd066466029fe53348d2787cc63972e0f70bb3d6f154730281c2bace0093531a22442e622f01129a87e90faa509496
+MISC ChangeLog 3112 SHA256 e639b8c756e94966692cac30217d7d38393f00a0480450362add92c5df9429ca SHA512 52e6aee045c1bb768c5414c3b5edd9f47176ac652734c14a12325724b177866111f266ca617f0fc85c10b6dfb2e72982989c83fc02d429a2319705a7181b7c9f WHIRLPOOL d5c35f9a8b8ada8dd27b26c4cc8b03f9ecd1d600c5c3be5914f90b247b3ee58a4863aee3a1827a6d11dc7393af4b598501c10d52cec149f90c1b583577fa4313
+MISC ChangeLog-2015 1830 SHA256 1b338ea31636afba570acfe2623a9cd67b440e2c972d1a560a06880ae3726ffc SHA512 5b3e33e7aa563fd650d34b1e583985e99982f7bb669a708e853f4cf16ffdc6fd5c0c35ac0712927408c6e406e422d5068528c679d76a8fbeb8d7bb50dcb1221f WHIRLPOOL 8ec2ad81115e248c0d7b5213dfa3fe128a921ee061f0c0f40b5aed682badc82a8f4ede5caec259f3aa2eceb1a98c7011b5ba7aab4a34e0f3609c562c29db3a32
+MISC metadata.xml 249 SHA256 e3ce0b9c6699b697b631c6b3171180e541301d0fda3b2d4657412a8bb51bc575 SHA512 a2be284cf2f4e9a6c84979c88c89dc591d63b1c9093f63a72e96c7a725660467e69f780a7e6e586ec8e2665a8ae1b687cdec7cf79c16fbbd693dc5156c3f413b WHIRLPOOL 5536b233a39cf840c3ec3ad4773264965d6834b100ec31935458ed0ba4793a205c9e937ecb575e684e04893c547e16c664381ee26555b7842647426247b82b3c
diff --git a/mail-filter/libdkim/files/debianize/Makefile.in b/mail-filter/libdkim/files/debianize/Makefile.in
new file mode 100644
index 000000000000..862f9b8478c7
--- /dev/null
+++ b/mail-filter/libdkim/files/debianize/Makefile.in
@@ -0,0 +1,93 @@
+# libdkim makefile for UNIX
+#
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+libdir = @libdir@
+includedir = @includedir@
+
+OBJEXT = @OBJEXT@
+LIBS = @LIBS@ @libcrypto_LIBS@
+
+CC = @CC@
+CXX = @CXX@
+
+CFLAGS = @CFLAGS@
+CXXFLAGS = @CXXFLAGS@
+CPPFLAGS = @CPPFLAGS@
+
+INCL =
+LDFLAGS = @LDFLAGS@
+
+libdkim_SOURCES = dkim.cpp dns.cpp dkimbase.cpp dkimsign.cpp dkimverify.cpp
+HEADERS = dkim.h dns.h dkimbase.h dkimsign.h dkimverify.h
+
+libdkim_OBJS = $(libdkim_SOURCES:.cpp=.$(OBJEXT))
+libdkim_PURE_OBJS = $(libdkim_SOURCES:.cpp=.p$(OBJEXT))
+
+libdkimtest_SOURCES = libdkimtest.cpp
+libdkimtest_OBJS = libdkimtest.$(OBJEXT)
+
+SHLIBFORLINK = libdkim.so
+SHLIBSONAME = $(SHLIBFORLINK).$(SHLIBMAJOR)
+SHLIBTARGET = $(SHLIBFORLINK)
+SHLIBLINK = $(CXX) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -Wl,-version-script=libdkim.ver
+SHLIBMAJOR = 1d
+SHLIBMINOR = 1
+SHLIBFILE = $(SHLIBSONAME).$(SHLIBMINOR)
+SHLIBCFLAGS = -fPIC
+
+ARFLAGS = crs
+
+TARGETS = libdkim.a $(SHLIBTARGET) libdkimtest
+
+all: $(TARGETS)
+
+libdkim.a: $(libdkim_OBJS)
+ -rm -f $@
+ $(AR) $(ARFLAGS) $@ $(libdkim_OBJS)
+
+$(SHLIBFORLINK): $(libdkim_PURE_OBJS)
+ $(SHLIBLINK) -o $@ $(libdkim_PURE_OBJS) $(LIBS)
+ -mkdir .lib 2>/dev/null
+ [ -z "$(SHLIBSONAME)" ] || (cd .lib \
+ && ln -sf ../$(SHLIBFORLINK) $(SHLIBSONAME))
+
+libdkimtest: $(libdkimtest_OBJS) $(SHLIBFORLINK)
+ $(CXX) ${LDFLAGS} -L. -o $@ libdkimtest.o -ldkim $(LIBS)
+
+libdkimtest.o: $(libdkimtest_SOURCES) $(HDRS)
+ $(CXX) $(CXXFLAGS) -o $@ -c $<
+
+%.$(OBJEXT): %.cpp $(HDRS)
+ $(CXX) $(CXXFLAGS) -o $@ -c $<
+
+%.p$(OBJEXT): %.cpp $(HDRS)
+ $(CXX) $(SHLIBCFLAGS) $(CXXFLAGS) -o $@ -c $<
+
+clean:
+ -rm -f *.$(OBJEXT) *.p$(OBJEXT) $(TARGETS)
+ -rm -rf .lib
+
+distclean: clean
+ -rm -f config.status config.log Makefile libdkim.pc
+
+install: all
+ install -m 755 -d $(DESTDIR)$(libdir)
+ install -m 755 -d $(DESTDIR)$(libdir)/pkgconfig
+ install -m 755 -d $(DESTDIR)$(includedir)
+ install -m 644 libdkim.a $(DESTDIR)$(libdir)
+ install -m 755 $(SHLIBFORLINK) $(DESTDIR)$(libdir)/$(SHLIBFILE)
+ [ -z "$(SHLIBSONAME)" ] \
+ || (cd $(DESTDIR)$(libdir) \
+ && ln -sf $(SHLIBFILE) $(SHLIBSONAME) \
+ && ln -sf $(SHLIBFILE) $(SHLIBFORLINK) )
+ install -m 644 $(srcdir)/dkim.h $(DESTDIR)$(includedir)
+ install -m 644 libdkim.pc $(DESTDIR)$(libdir)/pkgconfig
+ install -m 755 -d $(DESTDIR)$(bindir)
+ install -m 755 libdkimtest $(DESTDIR)$(bindir)
+
+.PHONY: all install clean distclean
diff --git a/mail-filter/libdkim/files/debianize/aclocal.m4 b/mail-filter/libdkim/files/debianize/aclocal.m4
new file mode 100644
index 000000000000..92a0b0dd9430
--- /dev/null
+++ b/mail-filter/libdkim/files/debianize/aclocal.m4
@@ -0,0 +1,171 @@
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
+# 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.
+
+# 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.
+
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# 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.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+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
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure 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_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$PKG_CONFIG"; then
+ if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ else
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+ [pkg_failed=yes])
+ fi
+else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+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
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# 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 $1])
+
+_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
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ ifelse([$4], , [AC_MSG_ERROR(dnl
+[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
+])],
+ [AC_MSG_RESULT([no])
+ $4])
+elif test $pkg_failed = untried; then
+ ifelse([$4], , [AC_MSG_FAILURE(dnl
+[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 <http://www.freedesktop.org/software/pkgconfig>.])],
+ [$4])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MODULES
+
diff --git a/mail-filter/libdkim/files/debianize/configure.ac b/mail-filter/libdkim/files/debianize/configure.ac
new file mode 100644
index 000000000000..045fd33fcb6c
--- /dev/null
+++ b/mail-filter/libdkim/files/debianize/configure.ac
@@ -0,0 +1,39 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.61)
+AC_INIT(libdkim, 1.0.21)
+LT_INIT
+AC_CONFIG_SRCDIR([dkim.cpp])
+##AC_CONFIG_HEADER([config.h])
+
+# Checks for programs.
+AC_PROG_CXX
+PKG_PROG_PKG_CONFIG
+
+# Checks for libraries.
+#AC_CHECK_LIB([crypto], [PEM_read_PrivateKey])
+PKG_CHECK_MODULES([libcrypto], [libcrypto])
+AC_SEARCH_LIBS([res_query], [resolv c],,
+ [AC_SEARCH_LIBS(__res_query,resolv bind)])
+
+# Checks for header files.
+AC_HEADER_RESOLV
+AC_HEADER_STDC
+AC_CHECK_HEADERS([netdb.h netinet/in.h inttypes.h stdlib.h string.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_C_CONST
+AC_C_INLINE
+AC_HEADER_TIME
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+
+# Checks for library functions.
+AC_FUNC_MEMCMP
+AC_FUNC_SELECT_ARGTYPES
+AC_CHECK_FUNCS([select socket strchr])
+
+AC_CONFIG_FILES([Makefile libdkim.pc])
+AC_OUTPUT
diff --git a/mail-filter/libdkim/files/debianize/libdkim.pc.in b/mail-filter/libdkim/files/debianize/libdkim.pc.in
new file mode 100644
index 000000000000..d8d914ac439a
--- /dev/null
+++ b/mail-filter/libdkim/files/debianize/libdkim.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: @PACKAGE_NAME@
+Description: DomainKeys Identified Mail library from Alt-N Inc.
+Version: @PACKAGE_VERSION@
+Requires.private: libcrypto
+Libs: -L${libdir} -ldkim
+Libs.private: @LIBS@
+Cflags: -I${includedir}
diff --git a/mail-filter/libdkim/files/debianize/libdkim.ver b/mail-filter/libdkim/files/debianize/libdkim.ver
new file mode 100644
index 000000000000..d2049046aff4
--- /dev/null
+++ b/mail-filter/libdkim/files/debianize/libdkim.ver
@@ -0,0 +1,4 @@
+{
+ global: DKIM*;
+ local: *;
+};
diff --git a/mail-filter/libdkim/files/libdkim-1.0.21-gcc6.patch b/mail-filter/libdkim/files/libdkim-1.0.21-gcc6.patch
new file mode 100644
index 000000000000..087e731d02cd
--- /dev/null
+++ b/mail-filter/libdkim/files/libdkim-1.0.21-gcc6.patch
@@ -0,0 +1,25 @@
+--- a/src/dkimverify.cpp
++++ b/src/dkimverify.cpp
+@@ -211,14 +211,14 @@
+ unsigned DecodeBase64(char *ptr)
+ {
+ static const unsigned char base64_table[256] = {
+- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,
+- -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,
+- -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1,
+- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
++ (unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,
++ (unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,62,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,63,52,53,54,55,56,57,58,59,60,61,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,
++ (unsigned char) -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,
++ (unsigned char) -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,
++ (unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,
++ (unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,
++ (unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,
++ (unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1,(unsigned char) -1};
+
+ unsigned char *s = (unsigned char *)ptr;
+ unsigned char *d = (unsigned char *)ptr;
diff --git a/mail-filter/libdkim/files/libdkim-extra-options.patch b/mail-filter/libdkim/files/libdkim-extra-options.patch
new file mode 100644
index 000000000000..5c8a240fdbec
--- /dev/null
+++ b/mail-filter/libdkim/files/libdkim-extra-options.patch
@@ -0,0 +1,87 @@
+diff -Naur libdkim.orig/src/libdkimtest.cpp libdkim/src/libdkimtest.cpp
+--- libdkim.orig/src/libdkimtest.cpp 2009-03-13 16:17:45.000000000 -0500
++++ libdkim/src/libdkimtest.cpp 2009-03-13 16:26:02.000000000 -0500
+@@ -55,8 +55,23 @@
+ return 0;
+ }
+
++void usage()
++{
+
+-
++ printf( "usage: libdkimtest [-b<allman|ietf|both>] [-c<r|s|t|u>] [-d<domain>] [-l] [-h] [-i<you@yourdomain.com>] [-q] [-s] [-t] [-v] [-x<expire time>] [-z<hash>] <msgfile> <privkeyfile> <outfile>\n");
++ printf( "-b<standard> allman , ietf or both\n");
++ printf( "-c<canonicalization> r for relaxed [DEFAULT], s - simple, t relaxed/simple, u - simple/relaxed\n");
++ printf( "-d<domain> the domain tag, if not provided it will be determined from the sender/from header\n");
++ printf( "-l include body length tag\n");
++ printf( "-h this help\n");
++ printf( "-i<identity> the identity, if not provided it will not be included\n");
++ printf( "-s sign the message\n");
++ printf( "-t include a timestamp tag\n");
++ printf( "-v verify the message\n");
++ printf( "-x<expire_time> the expire time in seconds since epoch ( DEFAULT = current time + 604800)\n\t if set to - then it will not be included");
++ printf( "-z<hash> 1 for sha1, 2 for sha256, 3 for both\n");
++ printf( "-y<selector> the selector tag DEFAULT=MDaemon\n");
++}
+ int main(int argc, char* argv[])
+ {
+ int n;
+@@ -77,7 +92,7 @@
+ time(&t);
+
+ opts.nCanon = DKIM_SIGN_RELAXED;
+- opts.nIncludeBodyLengthTag = 1;
++ opts.nIncludeBodyLengthTag = 0;
+ opts.nIncludeQueryMethod = 0;
+ opts.nIncludeTimeStamp = 0;
+ opts.expireTime = t + 604800; // expires in 1 week
+@@ -92,6 +107,11 @@
+ int nArgParseState = 0;
+ bool bSign = true;
+
++ if(argc<2){
++ usage();
++ exit(1);
++ }
++
+ for( n = 1; n < argc; n++ )
+ {
+ if( argv[n][0] == '-' && strlen(argv[n]) > 1 )
+@@ -121,14 +141,16 @@
+ }
+ break;
+
+-
++ case 'd':
++ strncpy(opts.szDomain,(const char*)(argv[n]+2),sizeof(opts.szDomain)-1);
++ break;
+ case 'l': // body length tag
+ opts.nIncludeBodyLengthTag = 1;
+ break;
+
+
+ case 'h':
+- printf( "usage: \n" );
++ usage();
+ return 0;
+
+ case 'i': // identity
+@@ -138,7 +160,7 @@
+ }
+ else
+ {
+- strcpy( opts.szIdentity, argv[n] + 2 );
++ strncpy( opts.szIdentity, argv[n] + 2,sizeof(opts.szIdentity)-1 );
+ }
+ break;
+
+@@ -169,6 +191,9 @@
+ }
+ break;
+
++ case 'y':
++ strncpy( opts.szSelector, argv[n]+2, sizeof(opts.szSelector)-1);
++ break;
+
+ case 'z': // sign w/ sha1, sha256 or both
+ opts.nHash = atoi( &argv[n][2] );
diff --git a/mail-filter/libdkim/files/patches/fix_warnings.patch b/mail-filter/libdkim/files/patches/fix_warnings.patch
new file mode 100644
index 000000000000..56ed6ffc8a1d
--- /dev/null
+++ b/mail-filter/libdkim/files/patches/fix_warnings.patch
@@ -0,0 +1,293 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 02_fix_warnings.dpatch by Russell Coker <russell@coker.com.au>
+##
+## DP: Get rid of warnings through the use of const and more correct types
+
+@DPATCH@
+
+diff -ru libdkim-1.0.19.orig/src/dkim.cpp libdkim-1.0.19/src/dkim.cpp
+--- libdkim-1.0.19.orig/src/dkim.cpp 2008-05-12 20:07:32.000000000 +1000
++++ libdkim-1.0.19/src/dkim.cpp 2009-04-15 19:38:08.000000000 +1000
+@@ -172,7 +172,7 @@
+ }
+
+
+-int DKIM_CALL DKIMVerifyProcess( DKIMContext* pVerifyContext, char* szBuffer, int nBufLength )
++int DKIM_CALL DKIMVerifyProcess( DKIMContext* pVerifyContext, const char* const szBuffer, int nBufLength )
+ {
+ CDKIMVerify* pVerify = (CDKIMVerify*)ValidateContext( pVerifyContext, false );
+
+@@ -226,13 +226,13 @@
+ }
+
+
+-char* DKIM_CALL DKIMVersion()
++const char* DKIM_CALL DKIMVersion()
+ {
+ return VERSION_STRING;
+ }
+
+
+-static char* DKIMErrorStrings[-1-DKIM_MAX_ERROR] = {
++static const char* DKIMErrorStrings[-1-DKIM_MAX_ERROR] = {
+ "DKIM_FAIL",
+ "DKIM_BAD_SYNTAX",
+ "DKIM_SIGNATURE_BAD",
+@@ -254,7 +254,7 @@
+ };
+
+
+-char* DKIM_CALL DKIMGetErrorString( int ErrorCode )
++const char* DKIM_CALL DKIMGetErrorString( int ErrorCode )
+ {
+ if (ErrorCode >= 0 || ErrorCode <= DKIM_MAX_ERROR)
+ return "Unknown";
+diff -ru libdkim-1.0.19.orig/src/dkim.h libdkim-1.0.19/src/dkim.h
+--- libdkim-1.0.19.orig/src/dkim.h 2009-04-15 19:37:48.000000000 +1000
++++ libdkim-1.0.19/src/dkim.h 2009-04-15 19:38:08.000000000 +1000
+@@ -155,14 +155,14 @@
+ void DKIM_CALL DKIMSignFree( DKIMContext* pSignContext );
+
+ int DKIM_CALL DKIMVerifyInit( DKIMContext* pVerifyContext, DKIMVerifyOptions* pOptions );
+-int DKIM_CALL DKIMVerifyProcess( DKIMContext* pVerifyContext, char* szBuffer, int nBufLength );
++int DKIM_CALL DKIMVerifyProcess( DKIMContext* pVerifyContext, const char* szBuffer, int nBufLength );
+ int DKIM_CALL DKIMVerifyResults( DKIMContext* pVerifyContext );
+ int DKIM_CALL DKIMVerifyGetDetails( DKIMContext* pVerifyContext, int* nSigCount, DKIMVerifyDetails** pDetails, char* szPractices );
+ void DKIM_CALL DKIMVerifyFree( DKIMContext* pVerifyContext );
+
+-char *DKIM_CALL DKIMVersion();
++const char *DKIM_CALL DKIMVersion();
+
+-char *DKIM_CALL DKIMGetErrorString( int ErrorCode );
++const char *DKIM_CALL DKIMGetErrorString( int ErrorCode );
+
+ #ifdef __cplusplus
+ }
+diff -ru libdkim-1.0.19.orig/src/dkimbase.cpp libdkim-1.0.19/src/dkimbase.cpp
+--- libdkim-1.0.19.orig/src/dkimbase.cpp 2008-05-12 20:07:36.000000000 +1000
++++ libdkim-1.0.19/src/dkimbase.cpp 2009-04-15 19:49:32.000000000 +1000
+@@ -118,10 +118,10 @@
+ // Process - split buffers into lines without any CRs or LFs at the end.
+ //
+ ////////////////////////////////////////////////////////////////////////////////
+-int CDKIMBase::Process( char* szBuffer, int nBufLength, bool bEOF )
++int CDKIMBase::Process( const char* szBuffer, int nBufLength, bool bEOF )
+ {
+- char* p = szBuffer;
+- char* e = szBuffer + nBufLength;
++ const char* p = szBuffer;
++ const char* e = szBuffer + nBufLength;
+
+ while( p < e )
+ {
+@@ -208,7 +208,8 @@
+ {
+ m_InHeaders = false;
+ ProcessHeaders();
+- ProcessBody("", 0, true);
++ /* type conversion should be safe as length is zero */
++ ProcessBody((char *)"", 0, true);
+ }
+
+ return DKIM_SUCCESS;
+@@ -338,9 +339,9 @@
+
+ CompressSWSP(sTemp);
+
+- unsigned cpos = sTemp.find(':');
++ string::size_type cpos = sTemp.find(':');
+
+- if (cpos == -1)
++ if (cpos == string::npos)
+ {
+ // no colon?!
+ }
+diff -ru libdkim-1.0.19.orig/src/dkimbase.h libdkim-1.0.19/src/dkimbase.h
+--- libdkim-1.0.19.orig/src/dkimbase.h 2008-05-12 20:07:24.000000000 +1000
++++ libdkim-1.0.19/src/dkimbase.h 2009-04-15 19:49:32.000000000 +1000
+@@ -41,7 +41,7 @@
+
+ int Init(void);
+
+- int Process( char* szBuffer, int nBufLength, bool bEOF );
++ int Process( const char* szBuffer, int nBufLength, bool bEOF );
+ int ProcessFinal(void);
+
+ int Alloc( char*& szBuffer, int nRequiredSize );
+diff -ru libdkim-1.0.19.orig/src/dkimsign.cpp libdkim-1.0.19/src/dkimsign.cpp
+--- libdkim-1.0.19.orig/src/dkimsign.cpp 2008-05-12 20:07:46.000000000 +1000
++++ libdkim-1.0.19/src/dkimsign.cpp 2009-04-15 19:49:32.000000000 +1000
+@@ -144,7 +144,7 @@
+
+ fwrite( szBuffer, 1, nBufLength, fpdebug );
+
+- /** END DEBUG CODE **/
++ ** END DEBUG CODE **/
+
+ if( bAllmanOnly )
+ {
+@@ -555,7 +555,7 @@
+ // if bFold, fold at cbrk char
+ //
+ ////////////////////////////////////////////////////////////////////////////////
+-void CDKIMSign::AddTagToSig( char* Tag, const string &sValue, char cbrk, bool bFold )
++void CDKIMSign::AddTagToSig( const char* const Tag, const string &sValue, char cbrk, bool bFold )
+ {
+ int nTagLen = strlen(Tag);
+
+@@ -583,10 +583,10 @@
+ // AddTagToSig - add tag and numeric value to signature folding if necessary
+ //
+ ////////////////////////////////////////////////////////////////////////////////
+-void CDKIMSign::AddTagToSig( char* Tag, unsigned long nValue )
++void CDKIMSign::AddTagToSig( const char* const Tag, unsigned long nValue )
+ {
+ char szValue[64];
+- sprintf( szValue, "%u", nValue );
++ sprintf( szValue, "%lu", nValue );
+ AddTagToSig( Tag, szValue, 0, false );
+ }
+
+@@ -686,7 +686,7 @@
+ // GetSig - compute hash and return signature header in szSignature
+ //
+ ////////////////////////////////////////////////////////////////////////////////
+-int CDKIMSign::GetSig( char* szPrivKey, char* szSignature, int nSigLength )
++int CDKIMSign::GetSig( char* szPrivKey, char* szSignature, unsigned nSigLength )
+ {
+ if( szPrivKey == NULL )
+ {
+@@ -794,7 +794,6 @@
+ int size;
+ int len;
+ char* buf;
+- int pos = 0;
+
+ // construct the DKIM-Signature: header and add to hash
+ InitSig();
+@@ -879,7 +878,7 @@
+ }
+ BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+ BIO_push(b64, bio);
+- if (BIO_write(b64, Hash, nHashLen) < nHashLen)
++ if (BIO_write(b64, Hash, nHashLen) < (int)nHashLen)
+ {
+ BIO_free_all(b64);
+ return DKIM_OUT_OF_MEMORY;
+@@ -993,7 +992,7 @@
+ }
+ BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+ BIO_push(b64, bio);
+- if (BIO_write(b64, sig, siglen) < siglen)
++ if (BIO_write(b64, sig, siglen) < (int)siglen)
+ {
+ OPENSSL_free(sig);
+ BIO_free_all(b64);
+diff -ru libdkim-1.0.19.orig/src/dkimsign.h libdkim-1.0.19/src/dkimsign.h
+--- libdkim-1.0.19.orig/src/dkimsign.h 2008-05-12 20:07:58.000000000 +1000
++++ libdkim-1.0.19/src/dkimsign.h 2009-04-15 19:49:32.000000000 +1000
+@@ -32,7 +32,7 @@
+
+ int Init( DKIMSignOptions* pOptions );
+
+- int GetSig( char* szPrivKey, char* szSignature, int nSigLength );
++ int GetSig( char* szPrivKey, char* szSignature, unsigned nSigLength );
+ int GetSig2( char* szPrivKey, char** pszSignature );
+
+ virtual int ProcessHeaders(void);
+@@ -50,8 +50,8 @@
+ bool ParseFromAddress( void );
+
+ void InitSig(void);
+- void AddTagToSig( char* Tag, const string &sValue, char cbrk, bool bFold );
+- void AddTagToSig( char* Tag, unsigned long nValue );
++ void AddTagToSig( const char* const Tag, const string &sValue, char cbrk, bool bFold );
++ void AddTagToSig( const char* const Tag, unsigned long nValue );
+ void AddInterTagSpace( int nSizeOfNextTag );
+ void AddFoldedValueToSig( const string &sValue, char cbrk );
+
+diff -ru libdkim-1.0.19.orig/src/dkimverify.cpp libdkim-1.0.19/src/dkimverify.cpp
+--- libdkim-1.0.19.orig/src/dkimverify.cpp 2009-04-15 19:37:48.000000000 +1000
++++ libdkim-1.0.19/src/dkimverify.cpp 2009-04-15 19:49:32.000000000 +1000
+@@ -440,7 +440,7 @@
+ {
+ ProcessFinal();
+
+- int SuccessCount=0;
++ unsigned int SuccessCount=0;
+ int TestingFailures=0;
+ int RealFailures=0;
+
+@@ -646,7 +646,7 @@
+ /** END DEBUG CODE **/
+ #endif
+
+- if (IsBody && BodyLength != -1)
++ if (IsBody && BodyLength != (unsigned)-1)
+ {
+ VerifiedBodyCount += nBufLength;
+ if (VerifiedBodyCount > BodyLength)
+@@ -1019,7 +1019,7 @@
+ // body count
+ if (values[8] == NULL || !m_HonorBodyLengthTag)
+ {
+- sig.BodyLength = -1;
++ sig.BodyLength = (unsigned)-1;
+ }
+ else
+ {
+@@ -1057,17 +1057,17 @@
+ // expiration time
+ if (values[11] == NULL)
+ {
+- sig.ExpireTime = -1;
++ sig.ExpireTime = (unsigned)-1;
+ }
+ else
+ {
+ if (!ParseUnsigned(values[11], &sig.ExpireTime))
+ return DKIM_BAD_SYNTAX;
+
+- if (sig.ExpireTime != -1)
++ if (sig.ExpireTime != (unsigned)-1)
+ {
+ // the value of x= MUST be greater than the value of t= if both are present
+- if (SignedTime != -1 && sig.ExpireTime <= SignedTime)
++ if (SignedTime != (unsigned)-1 && sig.ExpireTime <= SignedTime)
+ return DKIM_BAD_SYNTAX;
+
+ // todo: if possible, use the received date/time instead of the current time
+@@ -1169,7 +1169,7 @@
+ }
+
+
+-SelectorInfo::SelectorInfo(const string &sSelector, const string &sDomain) : Selector(sSelector), Domain(sDomain)
++SelectorInfo::SelectorInfo(const string &sSelector, const string &sDomain) : Domain(sDomain), Selector(sSelector)
+ {
+ AllowSHA1 = true;
+ AllowSHA256 = true;
+@@ -1207,7 +1207,7 @@
+ return DKIM_SELECTOR_INVALID; // todo: maybe create a new error code for unsupported selector version
+
+ // make sure v= is the first tag in the response // todo: maybe don't enforce this, it seems unnecessary
+- for (int j=1; j<sizeof(values)/sizeof(values[0]); j++)
++ for (unsigned j=1; j<sizeof(values)/sizeof(values[0]); j++)
+ {
+ if (values[j] != NULL && values[j] < values[0])
+ {
+diff -ru libdkim-1.0.19.orig/src/libdkimtest.cpp libdkim-1.0.19/src/libdkimtest.cpp
+--- libdkim-1.0.19.orig/src/libdkimtest.cpp 2008-05-12 20:08:54.000000000 +1000
++++ libdkim-1.0.19/src/libdkimtest.cpp 2009-04-15 19:38:08.000000000 +1000
+@@ -60,9 +60,9 @@
+ int main(int argc, char* argv[])
+ {
+ int n;
+- char* PrivKeyFile = "test.pem";
+- char* MsgFile = "test.msg";
+- char* OutFile = "signed.msg";
++ const char* PrivKeyFile = "test.pem";
++ const char* MsgFile = "test.msg";
++ const char* OutFile = "signed.msg";
+ int nPrivKeyLen;
+ char PrivKey[2048];
+ char Buffer[1024];
diff --git a/mail-filter/libdkim/files/patches/series b/mail-filter/libdkim/files/patches/series
new file mode 100644
index 000000000000..57acbdb1e7de
--- /dev/null
+++ b/mail-filter/libdkim/files/patches/series
@@ -0,0 +1,2 @@
+strtok_r.patch
+fix_warnings.patch
diff --git a/mail-filter/libdkim/files/patches/strtok_r.patch b/mail-filter/libdkim/files/patches/strtok_r.patch
new file mode 100644
index 000000000000..b3b4999aaf5f
--- /dev/null
+++ b/mail-filter/libdkim/files/patches/strtok_r.patch
@@ -0,0 +1,119 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01_strtok_r.dpatch by Russell Coker <russell@coker.com.au>
+##
+## DP: Use strtok_r() instead of strtok().
+
+@DPATCH@
+
+diff -ru libdkim-1.0.19/src/dkimverify.cpp libdkim-1.0.19-new/src/dkimverify.cpp
+--- libdkim-1.0.19/src/dkimverify.cpp 2008-05-12 20:08:06.000000000 +1000
++++ libdkim-1.0.19-new/src/dkimverify.cpp 2009-06-11 18:28:10.000000000 +1000
+@@ -855,6 +855,9 @@
+ ////////////////////////////////////////////////////////////////////////////////
+ int CDKIMVerify::ParseDKIMSignature( const string& sHeader, SignatureInfo &sig )
+ {
++ // for strtok_r()
++ char *saveptr;
++
+ // save header for later
+ sig.Header = sHeader;
+
+@@ -1032,7 +1035,7 @@
+ {
+ // make sure "dns" is in the list
+ bool HasDNS = false;
+- char *s = strtok(values[9], ":");
++ char *s = strtok_r(values[9], ":", &saveptr);
+ while (s != NULL)
+ {
+ if (strncmp(s, "dns", 3) == 0 && (s[3] == '\0' || s[3] == '/'))
+@@ -1040,7 +1043,7 @@
+ HasDNS = true;
+ break;
+ }
+- s = strtok(NULL, ": \t");
++ s = strtok_r(NULL, ": \t", &saveptr);
+ }
+ if (!HasDNS)
+ return DKIM_BAD_SYNTAX; // todo: maybe create a new error code for unknown query method
+@@ -1080,7 +1083,7 @@
+ // parse the signed headers list
+ bool HasFrom = false, HasSubject = false;
+ RemoveSWSP(values[4]); // header names shouldn't have spaces in them so this should be ok...
+- char *s = strtok(values[4], ":");
++ char *s = strtok_r(values[4], ":", &saveptr);
+ while (s != NULL)
+ {
+ if (_stricmp(s, "From") == 0)
+@@ -1090,7 +1093,7 @@
+
+ sig.SignedHeaders.push_back(s);
+
+- s = strtok(NULL, ":");
++ s = strtok_r(NULL, ":", &saveptr);
+ }
+
+ if (!HasFrom)
+@@ -1194,6 +1197,9 @@
+ ////////////////////////////////////////////////////////////////////////////////
+ int SelectorInfo::Parse( char* Buffer )
+ {
++ // for strtok_r()
++ char *saveptr;
++
+ static const char *tags[] = {"v","g","h","k","p","s","t","n",NULL};
+ char *values[sizeof(tags)/sizeof(tags[0])] = {NULL};
+
+@@ -1235,14 +1241,14 @@
+ else
+ {
+ // MUST include "sha1" or "sha256"
+- char *s = strtok(values[2], ":");
++ char *s = strtok_r(values[2], ":", &saveptr);
+ while (s != NULL)
+ {
+ if (strcmp(s, "sha1") == 0)
+ AllowSHA1 = true;
+ else if (strcmp(s, "sha256") == 0)
+ AllowSHA256 = true;
+- s = strtok(NULL, ":");
++ s = strtok_r(NULL, ":", &saveptr);
+ }
+ if ( !(AllowSHA1 || AllowSHA256) )
+ return DKIM_SELECTOR_INVALID; // todo: maybe create a new error code for unsupported hash algorithm
+@@ -1261,7 +1267,7 @@
+ {
+ // make sure "*" or "email" is in the list
+ bool ServiceTypeMatch = false;
+- char *s = strtok(values[5], ":");
++ char *s = strtok_r(values[5], ":", &saveptr);
+ while (s != NULL)
+ {
+ if (strcmp(s, "*") == 0 || strcmp(s, "email") == 0)
+@@ -1269,7 +1275,7 @@
+ ServiceTypeMatch = true;
+ break;
+ }
+- s = strtok(NULL, ":");
++ s = strtok_r(NULL, ":", &saveptr);
+ }
+ if (!ServiceTypeMatch)
+ return DKIM_SELECTOR_INVALID;
+@@ -1278,7 +1284,7 @@
+ // flags
+ if (values[6] != NULL)
+ {
+- char *s = strtok(values[6], ":");
++ char *s = strtok_r(values[6], ":", &saveptr);
+ while (s != NULL)
+ {
+ if (strcmp(s, "y") == 0)
+@@ -1289,7 +1295,7 @@
+ {
+ SameDomain = true;
+ }
+- s = strtok(NULL, ":");
++ s = strtok_r(NULL, ":", &saveptr);
+ }
+ }
+
diff --git a/mail-filter/libdkim/libdkim-1.0.21-r3.ebuild b/mail-filter/libdkim/libdkim-1.0.21-r3.ebuild
new file mode 100644
index 000000000000..86a1e2d444f9
--- /dev/null
+++ b/mail-filter/libdkim/libdkim-1.0.21-r3.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+inherit autotools-utils eutils toolchain-funcs
+
+DESCRIPTION="DomainKeys Identified Mail library from Alt-N Inc"
+HOMEPAGE="http://libdkim.sourceforge.net"
+SRC_URI="mirror://sourceforge/${PN}/${P}.zip"
+
+LICENSE="Apache-2.0 yahoo-patent-license-1.2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="libressl static-libs"
+
+DEPEND="
+ !libressl? ( dev-libs/openssl:0 )
+ libressl? ( dev-libs/libressl )
+ app-arch/unzip"
+RDEPEND="
+ !mail-filter/libdkim-exim
+ dev-libs/openssl"
+
+S="${WORKDIR}/${PN}/src"
+
+src_prepare() {
+ ecvs_clean
+ cp "${FILESDIR}"/debianize/* "${S}" || die
+ epatch "${FILESDIR}"/patches/*.patch
+ epatch "${FILESDIR}"/libdkim-extra-options.patch
+ epatch "${FILESDIR}"/${P}-gcc6.patch
+
+ # Bug 476772
+ if ! use static-libs; then
+ sed -i \
+ -e '/^TARGETS/s/libdkim.a//' \
+ -e '/install -m 644 libdkim.a/d' \
+ Makefile.in || die 'sed on Makefile.in failed'
+ fi
+
+ # Bug 476770
+ tc-export AR
+
+ autotools-utils_src_prepare
+}
+
+src_install() {
+ autotools-utils_src_install
+ dodoc ../README
+}
diff --git a/mail-filter/libdkim/metadata.xml b/mail-filter/libdkim/metadata.xml
new file mode 100644
index 000000000000..f5f607de0d04
--- /dev/null
+++ b/mail-filter/libdkim/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <!-- maintainer-needed -->
+ <upstream>
+ <remote-id type="sourceforge">libdkim</remote-id>
+ </upstream>
+</pkgmetadata>