1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-04 06:15:24 +00:00

mail/fetchmail: Fix build without SSLv3

- Fix build with OpenSSL 1.1 and LibreSSL
  - Stop using pkg-install/pkg-deinstall scripts
  - Use pkg-plist keywords
  - Use GSSAPI ports framework
  - Change X11, POP2 options to use options framework

PR:             210130
Submitted by:	freebsd-ports@charlieroot.de
Reviewed by:	Corey Halpin <chalpin@cs.wisc.edu> (maintainer)
Approved by:	Corey Halpin <chalpin@cs.wisc.edu> (maintainer)
This commit is contained in:
Bernard Spil 2016-06-21 06:14:41 +00:00
parent 7cc668a926
commit 0917233fb0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=417187
6 changed files with 82 additions and 76 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= fetchmail
PORTVERSION= 6.3.26
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= mail ipv6
MASTER_SITES= SF/${PORTNAME}/branch_6.3/ \
http://mandree.home.pages.de/${PORTNAME}/
@ -16,7 +16,6 @@ LICENSE_COMB= dual
RUN_DEPENDS= ${LOCALBASE}/share/certs/ca-root-nss.crt:security/ca_root_nss
# Note USERS can only contain a single word as parts below rely on that.
USERS= ${PORTNAME}
GROUPS= ${USERS}
@ -24,8 +23,7 @@ USES= cpe gmake shebangfix tar:xz
SHEBANG_FILES= fetchmailconf.py
USE_RC_SUBR= fetchmail
SUB_FILES= pkg-message pkg-install pkg-deinstall
SUB_LIST+= USERS=${USERS} GROUPS=${GROUPS} PORTNAME=${PORTNAME}
SUB_FILES= pkg-message
GNU_CONFIGURE= yes
USE_OPENSSL= yes
@ -36,60 +34,42 @@ CONFIGURE_ENV= ac_cv_have_decl_SSLv2_client_method=no
LDFLAGS+= -L${LOCALBASE}/lib
OPTIONS_DEFINE= X11 NLS NTLM GSSAPI POP2 DOCS
OPTIONS_DEFAULT= GSSAPI
OPTIONS_DEFINE= X11 NLS NTLM POP2 DOCS
OPTIONS_SINGLE= GSSAPI
OPTIONS_SINGLE_GSSAPI= GSSAPI_BASE GSSAPI_HEIMDAL GSSAPI_MIT GSSAPI_NONE
OPTIONS_DEFAULT= GSSAPI_BASE
OPTIONS_SUB= yes
GSSAPI_BASE_USES= gssapi
GSSAPI_BASE_CONFIGURE_ON= --with-gssapi=${GSSAPIBASEDIR} ${GSSAPI_CONFIGURE_ARGS}
GSSAPI_HEIMDAL_USES= gssapi:heimdal
GSSAPI_HEIMDAL_CONFIGURE_ON= --with-gssapi=${GSSAPIBASEDIR} ${GSSAPI_CONFIGURE_ARGS}
GSSAPI_MIT_USES= gssapi:mit
GSSAPI_MIT_CONFIGURE_ON= --with-gssapi=${GSSAPIBASEDIR} ${GSSAPI_CONFIGURE_ARGS}
GSSAPI_NONE_CONFIGURE_ON= --without-gssapi
X11_DESC= Python/Tkinter dependencies for ``fetchmailconf''
POP2_DESC= POP2 Protocol support[obsolete]
NLS_USES= gettext
NLS_CONFIGURE_ENABLE= nls
NLS_CONFIGURE_ON= --enable-nls
NLS_CONFIGURE_OFF= --disable-nls
NTLM_CONFIGURE_ENABLE= NTLM
NTLM_PORTDOCS= README.NTLM
# POP2 is obsolete
POP2_CONFIGURE_ENABLE= POP2
X11_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}tkinter>=0:x11-toolkits/py-tkinter
X11_USES= python
X11_CONFIGURE_OFF= PYTHON=:
X11_SUB_FILES_OFF= fetchmailconf
PORTDOCS= FAQ FEATURES NEWS NOTES README README.SSL \
design-notes.html fetchmail-FAQ.html fetchmail-features.html \
esrs-design-notes.html
.include <bsd.port.options.mk>
# Pop2 is obsolete
.if ${PORT_OPTIONS:MPOP2}
CONFIGURE_ARGS+= --enable-POP2
.endif
.if ${PORT_OPTIONS:MX11}
USES+= python
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}tkinter>=0:x11-toolkits/py-tkinter
PLIST_SUB+= NOX11="@comment "
.else
CONFIGURE_ARGS+= PYTHON=:
SUB_FILES+= fetchmailconf
PLIST_SUB+= NOX11=""
.endif
.if ${PORT_OPTIONS:MGSSAPI}
.if !defined(KRB5_HOME)
.if exists(${LOCALBASE}/lib/libkrb5.a)
KRB5_HOME= ${LOCALBASE}
.elif exists(/usr/lib/libkrb5.a)
KRB5_HOME= /usr
.endif
.endif
.if defined(KRB5_HOME) && !exists(${KRB5_HOME}/lib/libkrb5.a)
BROKEN= KRB5_HOME is set but doesn\'t provide lib/libkrb5.a
.endif
.if defined(KRB5_HOME) && exists(${KRB5_HOME}/lib/libkrb5.a)
CONFIGURE_ARGS+= --with-gssapi=${KRB5_HOME}
.endif
.endif
.if ${PORT_OPTIONS:MNTLM}
CONFIGURE_ARGS+= --enable-NTLM
PORTDOCS+= README.NTLM
.endif
#.include <bsd.port.options.mk>
post-patch:
.if !exists(/usr/lib/libcom_err.so)
@ -99,7 +79,8 @@ post-patch:
post-build:
@${MAKE_CMD} -C ${WRKSRC} check
post-install:
post-stage:
${INSTALL} -d ${STAGEDIR}/var/run/fetchmail
${INSTALL_DATA} ${FILESDIR}/fetchmailrc.sample \
${STAGEDIR}${PREFIX}/etc/fetchmailrc.sample

View File

@ -0,0 +1,26 @@
--- fetchmail.c.orig 2013-04-23 20:00:45 UTC
+++ fetchmail.c
@@ -50,6 +50,10 @@
#include <arpa/nameser.h>
#include <resolv.h>
+#ifdef SSL_ENABLE
+#include <openssl/ssl.h>
+#endif
+
#ifndef ENETUNREACH
#define ENETUNREACH 128 /* Interactive doesn't know this */
#endif /* ENETUNREACH */
@@ -263,6 +267,12 @@ int main(int argc, char **argv)
#ifdef SSL_ENABLE
"+SSL"
#endif
+#ifdef OPENSSL_NO_SSL2
+ "-SSLv2"
+#endif
+#ifdef OPENSSL_NO_SSL3_METHOD
+ "-SSLv3"
+#endif
#ifdef OPIE_ENABLE
"+OPIE"
#endif /* OPIE_ENABLE */

View File

@ -0,0 +1,24 @@
--- socket.c.orig 2013-04-23 20:00:45 UTC
+++ socket.c
@@ -907,14 +907,19 @@ int SSLOpen(int sock, char *mycert, char
_ssl_context[sock] = NULL;
if(myproto) {
if(!strcasecmp("ssl2",myproto)) {
-#if HAVE_DECL_SSLV2_CLIENT_METHOD + 0 > 0
+#ifndef OPENSSL_NO_SSL2
_ctx[sock] = SSL_CTX_new(SSLv2_client_method());
#else
- report(stderr, GT_("Your operating system does not support SSLv2.\n"));
+ report(stderr, GT_("Your OpenSSL version does not support SSLv2.\n"));
return -1;
#endif
} else if(!strcasecmp("ssl3",myproto)) {
+#ifndef OPENSSL_NO_SSL3_METHOD
_ctx[sock] = SSL_CTX_new(SSLv3_client_method());
+#else
+ report(stderr, GT_("Your OpenSSL version does not support SSLv3.\n"));
+ return -1;
+#endif
} else if(!strcasecmp("tls1",myproto)) {
_ctx[sock] = SSL_CTX_new(TLSv1_client_method());
} else if (!strcasecmp("ssl23",myproto)) {

View File

@ -1,13 +0,0 @@
#!/bin/sh
if [ x$2 != xPOST-DEINSTALL ]; then
exit
fi
if [ -f /var/run/%%PORTNAME%%/fetchmail.pid ] ; then
/bin/rm -f /var/run/%%PORTNAME%%/fetchmail.pid
fi
/bin/rmdir /var/run/%%PORTNAME%%
exit

View File

@ -1,13 +0,0 @@
#!/bin/sh
if [ x$2 != xPOST-INSTALL ]; then
exit
fi
/bin/mkdir -m 0755 -p /var/run/%%PORTNAME%%
/usr/sbin/chown "%%USERS%%:%%GROUPS%%" /var/run/%%PORTNAME%%
/usr/sbin/chown "%%USERS%%:%%GROUPS%%" %%PREFIX%%/etc/fetchmailrc*
/bin/chmod 0600 %%PREFIX%%/etc/fetchmailrc
/bin/chmod 0644 %%PREFIX%%/etc/fetchmailrc.sample
exit

View File

@ -2,7 +2,7 @@ bin/fetchmail
bin/fetchmailconf
man/man1/fetchmail.1.gz
man/man1/fetchmailconf.1.gz
%%NOX11%%libexec/fetchmailconf.py
%%X11%%libexec/fetchmailconf.py
%%NLS%%share/locale/ca/LC_MESSAGES/fetchmail.mo
%%NLS%%share/locale/cs/LC_MESSAGES/fetchmail.mo
%%NLS%%share/locale/da/LC_MESSAGES/fetchmail.mo
@ -30,4 +30,5 @@ man/man1/fetchmailconf.1.gz
%%X11%%%%PYTHON_SITELIBDIR%%/fetchmailconf.py
%%X11%%%%PYTHON_SITELIBDIR%%/fetchmailconf.pyc
%%X11%%%%PYTHON_SITELIBDIR%%/fetchmailconf.pyo
@sample etc/fetchmailrc.sample
@sample(fetchmail,fetchmail,600) etc/fetchmailrc.sample
@dir(fetchmail,fetchmail,755) /var/run/fetchmail