The sendmail Mail Filter API (Milter) is designed to allow third-party programs access to mail messages as they are being processed in order to filter meta-information and content. This library is a prerequisite for the OpenDKIM package. The proposed Makefile also contains sections for building Sendmail. These sections are commented out because more work is necessary to properly complete porting of Sendmail to LEDE/OpenWrt. The notes in Makefile provide details on what is required to complete the port. It has been verified that Sendmail executables compile and run properly on the target system when the commented sections in Makefile are uncommented. Signed-off-by: Val Kulkov <val.kulkov@gmail.com>lilik-openwrt-22.03
@ -0,0 +1,133 @@ | |||||
# | |||||
# Copyright (C) 2017 Val Kulkov <val.kulkov@gmail.com> | |||||
# | |||||
# This is free software, licensed under the GNU General Public License v3. | |||||
# | |||||
include $(TOPDIR)/rules.mk | |||||
PKG_NAME:=sendmail | |||||
PKG_VERSION:=8.15.2 | |||||
PKG_RELEASE:=1 | |||||
PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tar.gz | |||||
PKG_SOURCE_URL:=http://artfiles.org/sendmail.org/pub/sendmail/ \ | |||||
ftp://ftp.cs.berkeley.edu/ucb/sendmail/ \ | |||||
http://www.netgull.com/sendmail/ | |||||
PKG_HASH:=24f94b5fd76705f15897a78932a5f2439a32b1a2fdc35769bb1a5f5d9b4db439 | |||||
PKG_MAINTAINER:=Val Kulkov <val.kulkov@gmail.com> | |||||
PKG_LICENSE:=Sendmail | |||||
PKG_LICENSE_FILES:=LICENSE | |||||
PKG_INSTALL:=1 | |||||
include $(INCLUDE_DIR)/package.mk | |||||
TARGET_OS:=OpenWrt | |||||
SITECONFIG:=site.$(TARGET_OS).m4 | |||||
# | |||||
# Uncomment the following sections that are currently commented out | |||||
# to enable building and packaging Sendmail executables and default | |||||
# configuration files into the "sendmail" package. | |||||
# | |||||
# Note that in this edition of the "sendmail" package: | |||||
# 1. No init script is provided to start the Sendmail daemon. | |||||
# 2. The initial configuration files in /etc/mail are likely inadequate | |||||
# for running the Sendmail daemon on your LEDE/OpenWrt device. | |||||
# 3. You may have to "opkg install m4" to build Sendmail configuration files | |||||
# from customized mc files on your LEDE/OpenWrt device using m4, or | |||||
# alternatively you may use a Linux computer to build configuration | |||||
# files from customized mc files. | |||||
# 4. Compiling and building the "sendmail" package will likely fail at | |||||
# the packaging stage if you have already selected and built the "ssmtp" | |||||
# package. "ssmtp" installs /usr/sbin/sendmail in the form of a symlink | |||||
# to /usr/sbin/ssmtp. Where /usr/sbin/sendmail is already present, | |||||
# copying the sendmail executable into /usr/sbin/sendmail results in | |||||
# an error: | |||||
# cp: not writing through dangling symlink | |||||
# ... | |||||
# lede/source/include/toplevel.mk:206: recipe for target 'package/feeds/packages/libmilter/compile' failed | |||||
# | |||||
# ANYONE WHO IS READING THIS MAKEFILE AND WHO HAS THE KNOWLEDGE AND DESIRE | |||||
# TO COMPLETE PORTING OF SENDMAIL TO LEDE/OPENWRT PLATFORM IS ENCOURAGED | |||||
# TO DO SO AND TAKE OVER THE MAINTAINERSHIP OF THIS PACKAGE FROM VAL KULKOV. | |||||
# | |||||
#define Package/sendmail | |||||
# SECTION:=mail | |||||
# CATEGORY:=Mail | |||||
# DEPENDS:=+libopenssl | |||||
# TITLE:=A general purpose internetwork mail routing facility | |||||
# URL:=http://sendmail.org/ | |||||
#endef | |||||
# | |||||
#define Package/sendmail/description | |||||
# Sendmail is a general purpose internetwork email routing facility that | |||||
# supports many kinds of mail-transfer and delivery methods, including | |||||
# the Simple Mail Transfer Protocol (SMTP) used for email transport over | |||||
# the Internet. | |||||
#endef | |||||
# | |||||
#define Package/sendmail/conffiles | |||||
#/etc/mail/helpfile | |||||
#/etc/mail/sendmail.cf | |||||
#/etc/mail/submit.cf | |||||
#/etc/mail/statistics | |||||
#endef | |||||
define Package/libmilter-sendmail | |||||
SECTION:=libs | |||||
CATEGORY:=Libraries | |||||
DEPENDS:=+libpthread | |||||
TITLE:=The sendmail Mail Filter API (Milter) library | |||||
URL:=http://sendmail.org/ | |||||
endef | |||||
define Package/libmilter-sendmail/description | |||||
The sendmail Mail Filter API (Milter) is designed to allow third-party | |||||
programs access to mail messages as they are being processed in order to | |||||
filter meta-information and content. | |||||
endef | |||||
TARGET_CFLAGS += $(FPIC) | |||||
define Build/Prepare | |||||
$(Build/Prepare/Default) | |||||
$(CP) files/lm_getver.c $(PKG_BUILD_DIR)/libmilter/ | |||||
$(CP) files/$(SITECONFIG) $(PKG_BUILD_DIR)/devtools/Site/ | |||||
$(CP) files/$(TARGET_OS) $(PKG_BUILD_DIR)/devtools/OS/ | |||||
$(CP) files/sharedlibrary.m4 $(PKG_BUILD_DIR)/devtools/M4/UNIX/ | |||||
$(CP) $(PKG_BUILD_DIR)/cf/cf/generic-linux.mc $(PKG_BUILD_DIR)/cf/cf/sendmail.mc | |||||
$(SED) 's@TARGET_CC@$(TARGET_CC)@g' $(PKG_BUILD_DIR)/devtools/Site/$(SITECONFIG) | |||||
$(SED) 's@TARGET_CFLAGS@$(TARGET_CFLAGS)@g' $(PKG_BUILD_DIR)/devtools/Site/$(SITECONFIG) | |||||
endef | |||||
define Build/Compile | |||||
$(call Build/Compile/Default,) | |||||
$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/libmilter $(MAKE_FLAGS) all | |||||
$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR)/libmilter $(MAKE_FLAGS) DESTDIR="$(PKG_INSTALL_DIR)" install | |||||
$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR)/cf/cf $(MAKE_FLAGS) DESTDIR="$(PKG_INSTALL_DIR)" install-cf | |||||
endef | |||||
define Build/InstallDev | |||||
$(INSTALL_DIR) $(1)/usr/include/libmilter $(1)/usr/lib | |||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/libmilter/* $(1)/usr/include/libmilter/ | |||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmilter.so* $(1)/usr/lib/ | |||||
endef | |||||
define Package/libmilter-sendmail/install | |||||
$(INSTALL_DIR) $(1)/usr/lib | |||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmilter.so* $(1)/usr/lib/ | |||||
endef | |||||
#define Package/sendmail/install | |||||
# $(INSTALL_DIR) $(1)/etc/mail $(1)/usr/bin $(1)/usr/sbin | |||||
# $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/mail/* $(1)/etc/mail/ | |||||
# $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ | |||||
# $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ | |||||
#endef | |||||
$(eval $(call BuildPackage,libmilter-sendmail)) | |||||
#$(eval $(call BuildPackage,sendmail)) | |||||
@ -0,0 +1,60 @@ | |||||
dnl DO NOT EDIT THIS FILE. | |||||
dnl Place personal settings in devtools/Site/site.config.m4 | |||||
define(`confDEPEND_TYPE', `CC-M') | |||||
define(`confCCOPTS_SO', `-fPIC') | |||||
define(`confSM_OS_HEADER', `sm_os_linux') | |||||
define(`confLIBS', `-ldl') | |||||
define(`confEBINDIR', `/usr/sbin') | |||||
define(`confMKDIR', `mkdir') | |||||
APPENDDEF(`confLIBSEARCH', `crypt nsl') | |||||
define(`confMTCCOPTS', `-D_REENTRANT') | |||||
define(`confMTLDOPTS', `-lpthread') | |||||
define(`confLDOPTS_SO', `-shared') | |||||
define(`confSONAME',`-soname') | |||||
define(`currentuser', esyscmd(`id -nu')) | |||||
define(`currentgroup', esyscmd(`id -ng')) | |||||
define(`confDONT_INSTALL_CATMAN',) | |||||
define(`confNO_MAN_BUILD',) | |||||
define(`confINCOWN', currentuser) | |||||
define(`confINCGRP', currentgroup) | |||||
define(`confINCMODE', `644') | |||||
define(`confLIBOWN', currentuser) | |||||
define(`confLIBGRP', currentgroup) | |||||
define(`confLIBMODE', `644') | |||||
define(`confMBINOWN', currentuser) | |||||
define(`confMBINGRP', currentgroup) | |||||
define(`confMBINMODE', `750') | |||||
define(`confSBINOWN', currentuser) | |||||
define(`confSBINGRP', currentgroup) | |||||
define(`confSBINMODE', `755') | |||||
define(`confUBINOWN', currentuser) | |||||
define(`confUBINGRP', currentgroup) | |||||
define(`confUBINMODE', `755') | |||||
define(`confGBINOWN', currentuser) | |||||
define(`confGBINGRP', currentgroup) | |||||
define(`confGBINMODE', `755') | |||||
define(`confMSPQOWN', currentuser) | |||||
ifelse(confBLDVARIANT, `DEBUG', | |||||
dnl Debug build | |||||
` | |||||
define(`confOPTIMIZE',`-g -Wall') | |||||
', | |||||
dnl Optimized build | |||||
confBLDVARIANT, `OPTIMIZED', | |||||
` | |||||
define(`confOPTIMIZE',`-O2') | |||||
', | |||||
dnl Purify build | |||||
confBLDVARIANT, `PURIFY', | |||||
` | |||||
define(`confOPTIMIZE',`-g') | |||||
', | |||||
dnl default | |||||
` | |||||
define(`confOPTIMIZE',`-O2') | |||||
') |
@ -0,0 +1,9 @@ | |||||
#include <stdio.h> | |||||
#include "libmilter/mfapi.h" | |||||
int main() { | |||||
printf("%d.%d.%d", | |||||
SM_LM_VRS_MAJOR(SMFI_VERSION), | |||||
SM_LM_VRS_MINOR(SMFI_VERSION), | |||||
SM_LM_VRS_PLVL(SMFI_VERSION) | |||||
); | |||||
} |
@ -0,0 +1,25 @@ | |||||
divert(0)dnl | |||||
include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/links.m4')dnl | |||||
bldLIST_PUSH_ITEM(`bldC_PRODUCTS', bldCURRENT_PRODUCT)dnl | |||||
bldPUSH_TARGET(bldCURRENT_PRODUCT.so.confSOVER)dnl | |||||
bldPUSH_INSTALL_TARGET(`install-'bldCURRENT_PRODUCT)dnl | |||||
bldPUSH_CLEAN_TARGET(bldCURRENT_PRODUCT`-clean')dnl | |||||
include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/defines.m4') | |||||
divert(bldTARGETS_SECTION) | |||||
bldCURRENT_PRODUCT.so.confSOVER: ${BEFORE} ${bldCURRENT_PRODUCT`OBJS'} | |||||
${LD} ${LDOPTS_SO} -o bldCURRENT_PRODUCT.so.confSOVER confSONAME bldCURRENT_PRODUCT.so.confSOVER ${bldCURRENT_PRODUCT`OBJS'} | |||||
ifdef(`bldLINK_SOURCES', `bldMAKE_SOURCE_LINKS(bldLINK_SOURCES)') | |||||
install-`'bldCURRENT_PRODUCT: bldCURRENT_PRODUCT.so.confSOVER | |||||
ifdef(`bldINSTALLABLE', ` ifdef(`confMKDIR', `if [ ! -d ${DESTDIR}${LIBDIR} ]; then confMKDIR -p ${DESTDIR}${LIBDIR}; else :; fi ') | |||||
${LN} ${LNOPTS} bldCURRENT_PRODUCT.so.confSOVER ${DESTDIR}${LIBDIR}/bldCURRENT_PRODUCT.so | |||||
${INSTALL} -c -m 644 bldCURRENT_PRODUCT.so.confSOVER ${DESTDIR}${LIBDIR}') | |||||
bldCURRENT_PRODUCT-clean: | |||||
rm -f ${OBJS} bldCURRENT_PRODUCT.so* ${MANPAGES} | |||||
divert(0) | |||||
COPTS+= confCCOPTS_SO |
@ -0,0 +1,5 @@ | |||||
define(`confCC', `TARGET_CC') | |||||
define(`confCCOPTS', `TARGET_CFLAGS') | |||||
APPENDDEF(`confENVDEF',`-DSTARTTLS') | |||||
APPENDDEF(`confLIBS', `-lssl -lcrypto') | |||||
@ -0,0 +1,17 @@ | |||||
Index: sendmail-8.15.2/cf/cf/Makefile | |||||
=================================================================== | |||||
--- sendmail-8.15.2.orig/cf/cf/Makefile | |||||
+++ sendmail-8.15.2/cf/cf/Makefile | |||||
@@ -80,10 +80,10 @@ install: | |||||
install-cf: install-sendmail-cf install-submit-cf | |||||
install-sendmail-cf: $(CF).cf | |||||
- $(INSTALL) -c -o $(CFOWN) -g $(CFGRP) -m $(CFMODE) $(CF).cf ${DESTDIR}$(MAILDIR)/sendmail.cf | |||||
+ $(INSTALL) -c -m $(CFMODE) $(CF).cf ${DESTDIR}$(MAILDIR)/sendmail.cf | |||||
install-submit-cf: $(SUBMIT).cf | |||||
- $(INSTALL) -c -o $(CFOWN) -g $(CFGRP) -m $(CFMODE) $(SUBMIT).cf ${DESTDIR}$(MAILDIR)/submit.cf | |||||
+ $(INSTALL) -c -m $(CFMODE) $(SUBMIT).cf ${DESTDIR}$(MAILDIR)/submit.cf | |||||
depend: | |||||
@ -0,0 +1,16 @@ | |||||
Index: sendmail-8.15.2/libmilter/Makefile.m4 | |||||
=================================================================== | |||||
--- sendmail-8.15.2.orig/libmilter/Makefile.m4 | |||||
+++ sendmail-8.15.2/libmilter/Makefile.m4 | |||||
@@ -9,7 +9,10 @@ define(`confMT', `true') | |||||
SMSRCDIR=ifdef(`confSMSRCDIR', `confSMSRCDIR', `${SRCDIR}/sendmail') | |||||
PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ') | |||||
-bldPRODUCT_START(`library', `libmilter') | |||||
+# obtain libmilter version | |||||
+define(`confSOVER', `esyscmd(`gcc -I../include -o lm_getver lm_getver.c && ./lm_getver')') | |||||
+ | |||||
+bldPRODUCT_START(`sharedlibrary', `libmilter') | |||||
define(`bldINSTALLABLE', `true') | |||||
define(`LIBMILTER_EXTRAS', `errstring.c strl.c') | |||||
APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL -Dsm_snprintf=snprintf') |
@ -0,0 +1,49 @@ | |||||
--- a/include/sm/conf.h | |||||
+++ b/include/sm/conf.h | |||||
@@ -57,7 +57,7 @@ | |||||
# endif /* ! HASNICE */ | |||||
# ifndef HASRRESVPORT | |||||
-# define HASRRESVPORT 1 /* has rrsevport(3) call */ | |||||
+# define HASRRESVPORT 0 /* has rrsevport(3) call */ | |||||
# endif /* ! HASRRESVPORT */ | |||||
/********************************************************************** | |||||
@@ -1470,7 +1470,9 @@ extern void *malloc(); | |||||
# define SM_CONF_GETOPT 0 /* need a replacement for getopt(3) */ | |||||
# define HASUNAME 1 /* use System V uname(2) system call */ | |||||
# define HASUNSETENV 1 /* has unsetenv(3) call */ | |||||
-# define ERRLIST_PREDEFINED /* don't declare sys_errlist */ | |||||
+# ifdef __GLIBC__ | |||||
+# define ERRLIST_PREDEFINED /* don't declare sys_errlist */ | |||||
+# endif /* __GLIBC__ */ | |||||
# define GIDSET_T gid_t /* from <linux/types.h> */ | |||||
# ifndef HASGETUSERSHELL | |||||
# define HASGETUSERSHELL 0 /* getusershell(3) broken in Slackware 2.0 */ | |||||
@@ -1508,6 +1510,7 @@ extern void *malloc(); | |||||
# if defined(__GLIBC__) && defined(__GLIBC_MINOR__) | |||||
# define HASSTRERROR 1 /* has strerror(3) */ | |||||
# endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */ | |||||
+# define HASSTRERROR 1 /* Patch for LEDE/OpenWRT: has strerror(3) */ | |||||
# ifndef TZ_TYPE | |||||
# define TZ_TYPE TZ_NONE /* no standard for Linux */ | |||||
# endif /* ! TZ_TYPE */ | |||||
--- a/devtools/bin/Build | |||||
+++ b/devtools/bin/Build | |||||
@@ -320,6 +320,16 @@ then | |||||
rel=`/usr/apollo/bin/bldt | grep Domain | awk '{ print $4 }' | sed -e 's/,//g'` | |||||
fi | |||||
+# | |||||
+# LEDE/OpenWrt build system | |||||
+# | |||||
+if [ -n "$STAGING_DIR" -a -n "$OPENWRT_BUILD" ] | |||||
+then | |||||
+ os="OpenWrt" | |||||
+ rel="any" | |||||
+ arch="any" | |||||
+fi | |||||
+ | |||||
if [ ! "$arch" -a ! "$os" -a ! "$rel" ] | |||||
then | |||||
arch=`uname -m | sed -e 's/ //g' -e 's/\//-/g'` |
@ -0,0 +1,109 @@ | |||||
Index: sendmail-8.15.2/sendmail/envelope.c | |||||
=================================================================== | |||||
--- sendmail-8.15.2.orig/sendmail/envelope.c | |||||
+++ sendmail-8.15.2/sendmail/envelope.c | |||||
@@ -323,7 +323,7 @@ dropenvelope(e, fulldrop, split) | |||||
/* don't free, allocated from e_rpool */ | |||||
e->e_message = sm_rpool_strdup_x(e->e_rpool, buf); | |||||
- message(buf); | |||||
+ message("%s", buf); | |||||
e->e_flags |= EF_CLRQUEUE; | |||||
} | |||||
if (msg_timeout == MSG_NOT_BY) | |||||
@@ -420,7 +420,7 @@ dropenvelope(e, fulldrop, split) | |||||
/* don't free, allocated from e_rpool */ | |||||
e->e_message = sm_rpool_strdup_x(e->e_rpool, | |||||
buf); | |||||
- message(buf); | |||||
+ message("%s", buf); | |||||
e->e_flags |= EF_WARNING; | |||||
} | |||||
if (msg_timeout == MSG_WARN_BY) | |||||
Index: sendmail-8.15.2/sendmail/parseaddr.c | |||||
=================================================================== | |||||
--- sendmail-8.15.2.orig/sendmail/parseaddr.c | |||||
+++ sendmail-8.15.2/sendmail/parseaddr.c | |||||
@@ -218,7 +218,7 @@ parseaddr(addr, a, flags, delim, delimpt | |||||
msg = "Deferring message until queue run"; | |||||
if (tTd(20, 1)) | |||||
sm_dprintf("parseaddr: queueing message\n"); | |||||
- message(msg); | |||||
+ message("%s", msg); | |||||
if (e->e_message == NULL && e->e_sendmode != SM_DEFER) | |||||
e->e_message = sm_rpool_strdup_x(e->e_rpool, msg); | |||||
a->q_state = QS_QUEUEUP; | |||||
Index: sendmail-8.15.2/sendmail/srvrsmtp.c | |||||
=================================================================== | |||||
--- sendmail-8.15.2.orig/sendmail/srvrsmtp.c | |||||
+++ sendmail-8.15.2/sendmail/srvrsmtp.c | |||||
@@ -578,13 +578,13 @@ static bool smtp_data __P((SMTP_T *, ENV | |||||
bool tsave = QuickAbort; \ | |||||
\ | |||||
QuickAbort = false; \ | |||||
- usrerr(response); \ | |||||
+ usrerr("%s", response); \ | |||||
QuickAbort = tsave; \ | |||||
e->e_sendqueue = NULL; \ | |||||
goto doquit; \ | |||||
} \ | |||||
else \ | |||||
- usrerr(response); \ | |||||
+ usrerr("%s", response); \ | |||||
break; \ | |||||
\ | |||||
case SMFIR_REJECT: \ | |||||
@@ -615,7 +615,7 @@ static bool smtp_data __P((SMTP_T *, ENV | |||||
str, addr, MSG_TEMPFAIL); \ | |||||
LogUsrErrs = false; \ | |||||
} \ | |||||
- usrerr(MSG_TEMPFAIL); \ | |||||
+ usrerr("%s", MSG_TEMPFAIL); \ | |||||
break; \ | |||||
default: \ | |||||
milter_cmd_fail = false; \ | |||||
@@ -931,7 +931,7 @@ smtp(nullserver, d_flags, e) | |||||
} | |||||
else if (strncmp(nullserver, "421 ", 4) == 0) | |||||
{ | |||||
- message(nullserver); | |||||
+ message("%s", nullserver); | |||||
goto doquit; | |||||
} | |||||
@@ -1849,7 +1849,7 @@ smtp(nullserver, d_flags, e) | |||||
if (nullserver != NULL) | |||||
{ | |||||
if (ISSMTPREPLY(nullserver)) | |||||
- usrerr(nullserver); | |||||
+ usrerr("%s", nullserver); | |||||
else | |||||
usrerr("550 5.0.0 %s", | |||||
nullserver); | |||||
@@ -2452,7 +2452,7 @@ smtp(nullserver, d_flags, e) | |||||
tempfail = true; | |||||
smtp.sm_milterize = false; | |||||
if (response != NULL) | |||||
- usrerr(response); | |||||
+ usrerr("%s", response); | |||||
else | |||||
message("421 4.7.0 %s closing connection", | |||||
MyHostName); | |||||
@@ -3659,7 +3659,7 @@ smtp_data(smtp, e) | |||||
(void) extenhsc(response + 4, ' ', e->e_enhsc); | |||||
#endif /* _FFR_MILTER_ENHSC */ | |||||
- usrerr(response); | |||||
+ usrerr("%s", response); | |||||
if (strncmp(response, "421 ", 4) == 0 | |||||
|| strncmp(response, "421-", 4) == 0) | |||||
{ | |||||
@@ -3779,7 +3779,7 @@ smtp_data(smtp, e) | |||||
if (ISSMTPCODE(response)) | |||||
(void) extenhsc(response + 4, ' ', e->e_enhsc); | |||||
#endif /* _FFR_MILTER_ENHSC */ | |||||
- usrerr(response); | |||||
+ usrerr("%s", response); | |||||
if (strncmp(response, "421 ", 4) == 0 | |||||
|| strncmp(response, "421-", 4) == 0) | |||||
rv = false; |
@ -0,0 +1,48 @@ | |||||
This patch increases the stack size for pthreads from 80 KB, the default | |||||
stack size for musl libc, to 2 MB. The default stack size for glibc is 8 MB. | |||||
OpenDKIM, an application that depends on libmilter, segfaults if the stack | |||||
size for pthreads is left unchanged at the musl default value of 80 KB. | |||||
Apparently, OpenDKIM allocates blocks of 64 KB multiple times, which causes | |||||
libmilter and therefore OpenDKIM to crash: | |||||
https://git.alpinelinux.org/cgit/aports/commit/?id=95724d1bd53ae87f72e6388cb7323dbd8f84be9d | |||||
This patch follows the patch suggested by an Alpine Linux user in bug report | |||||
above. Also, a bug report has been filed upstream: | |||||
https://sourceforge.net/p/opendkim/bugs/258/ | |||||
Index: sendmail-8.15.2/libmilter/libmilter.h | |||||
=================================================================== | |||||
--- sendmail-8.15.2.orig/libmilter/libmilter.h | |||||
+++ sendmail-8.15.2/libmilter/libmilter.h | |||||
@@ -127,10 +127,10 @@ struct smfi_str | |||||
# define MI_SOCK_READ(s, b, l) read(s, b, l) | |||||
# define MI_SOCK_READ_FAIL(x) ((x) < 0) | |||||
# define MI_SOCK_WRITE(s, b, l) write(s, b, l) | |||||
- | |||||
-# define thread_create(ptid,wr,arg) pthread_create(ptid, NULL, wr, arg) | |||||
# define sthread_get_id() pthread_self() | |||||
+extern int thread_create(pthread_t *ptid, void *(*wr) (void *), void *arg); | |||||
+ | |||||
typedef pthread_mutex_t smutex_t; | |||||
# define smutex_init(mp) (pthread_mutex_init(mp, NULL) == 0) | |||||
# define smutex_destroy(mp) (pthread_mutex_destroy(mp) == 0) | |||||
Index: sendmail-8.15.2/libmilter/main.c | |||||
=================================================================== | |||||
--- sendmail-8.15.2.orig/libmilter/main.c | |||||
+++ sendmail-8.15.2/libmilter/main.c | |||||
@@ -16,6 +16,12 @@ SM_RCSID("@(#)$Id: main.c,v 8.85 2013-11 | |||||
#include <fcntl.h> | |||||
#include <sys/stat.h> | |||||
+int thread_create(pthread_t *ptid, void *(*wr) (void *), void *arg) { | |||||
+ pthread_attr_t attr; | |||||
+ pthread_attr_init(&attr); | |||||
+ pthread_attr_setstacksize(&attr,2*1024*1024); | |||||
+ return pthread_create(ptid, &attr, wr, arg); | |||||
+} | |||||
static smfiDesc_ptr smfi = NULL; | |||||
@ -0,0 +1,42 @@ | |||||
--- a/sendmail/Makefile.m4 | |||||
+++ b/sendmail/Makefile.m4 | |||||
@@ -71,6 +71,7 @@ install-set-user-id: bldCURRENT_PRODUCT | |||||
${INSTALL} -c -o ${S`'BINOWN} -g ${S`'BINGRP} -m ${S`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR} | |||||
for i in ${sendmailTARGET_LINKS}; do \ | |||||
rm -f $$i; \ | |||||
+ mkdir -p $$(dirname $$i); \ | |||||
${LN} ${LNOPTS} ${M`'BINDIR}/sendmail $$i; \ | |||||
done | |||||
@@ -79,6 +80,7 @@ install-sm-mta: bldCURRENT_PRODUCT | |||||
${INSTALL} -c -o ${M`'BINOWN} -g ${M`'BINGRP} -m ${M`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}/sm-mta | |||||
for i in confMTA_LINKS; do \ | |||||
rm -f $$i; \ | |||||
+ mkdir -p $$(dirname $$i); \ | |||||
${LN} ${LNOPTS} ${M`'BINDIR}/sm-mta $$i; \ | |||||
done | |||||
--- a/devtools/M4/UNIX/links.m4 | |||||
+++ b/devtools/M4/UNIX/links.m4 | |||||
@@ -23,6 +23,7 @@ define(`bldMAKE_SOURCE_LINKS', | |||||
define(`bldMAKE_TARGET_LINKS', | |||||
` for i in $2; do \ | |||||
rm -f $$i; \ | |||||
+ mkdir -p $$(dirname $$i); \ | |||||
ln -s $1 $$i; \ | |||||
done' | |||||
)dnl | |||||
--- a/cf/cf/Makefile | |||||
+++ b/cf/cf/Makefile | |||||
@@ -80,9 +80,11 @@ install: | |||||
install-cf: install-sendmail-cf install-submit-cf | |||||
install-sendmail-cf: $(CF).cf | |||||
+ mkdir -p ${DESTDIR}$(MAILDIR) | |||||
$(INSTALL) -c -m $(CFMODE) $(CF).cf ${DESTDIR}$(MAILDIR)/sendmail.cf | |||||
install-submit-cf: $(SUBMIT).cf | |||||
+ mkdir -p ${DESTDIR}$(MAILDIR) | |||||
$(INSTALL) -c -m $(CFMODE) $(SUBMIT).cf ${DESTDIR}$(MAILDIR)/submit.cf | |||||
depend: |