summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortm <tm@pkgsrc.org>2020-04-17 11:28:02 +0000
committertm <tm@pkgsrc.org>2020-04-17 11:28:02 +0000
commitdc4c4140e82d95f105391293272a657db3a07821 (patch)
tree9d907d154915cc91d975862947ab6cc3ebb44d38
parent1008295493490d52d273bfcf04450c27ea131776 (diff)
downloadpkgsrc-dc4c4140e82d95f105391293272a657db3a07821.tar.gz
up-imapproxy: re-add version 1.2.8 with OpenSSL 1.1 patches
Include patchset from the community and Debian package maintainers to support OpenSSL version 1.1. This is the more feature rich version of imapproxy. Last official changelog entries: 2016-09-12 Paul Lesniewski <paul@squirrelmail.org> * Added support for systemd startup * Added support for accepting pre-auth ID commands (RFC 2971) * Added support for DNS RR to cycle through multiple IMAP server backends (thanks to Wolfgang Breyha) * Added ability to restrict DNS lookups to IPv4 or IPv6 only (thanks to Wolfgang Breyha) * Make EGD support conditional, provide compatibility with LibreSSL, other small fixes provided by the BSD team * Fixed anomalous crashes recycling used connections (thanks to Emmanuel Dreyfus) * Retain compatibility with older OpenSSL versions (thanks to Wolfgang Breyha) * Make use of the no_new_privs flag (Linux only) when becoming non-root (thanks to Shawn Landden) 2014-01-20 Paul Lesniewski <paul@squirrelmail.org> * Added support for up to TLS v1.2 (thanks to Emmanuel Dreyfus) * Added support for ECDHE ciphers (thanks to Emmanuel Dreyfus) * Added ability to manually specify TLS ciphers (thanks to Emmanuel Dreyfus) * Added server certificate validation (thanks to Emmanuel Dreyfus) 2012-01-01 Paul Lesniewski <paul@squirrelmail.org> * Fixed problem where default TLS CA data would never be loaded (thanks to Orion Poplawski) * Fixed bug in SSL context initialization
-rw-r--r--mail/Makefile3
-rw-r--r--mail/up-imappproxy/DESCR4
-rw-r--r--mail/up-imappproxy/Makefile43
-rw-r--r--mail/up-imappproxy/PLIST9
-rw-r--r--mail/up-imappproxy/distinfo20
-rw-r--r--mail/up-imappproxy/files/smf/manifest.xml29
-rw-r--r--mail/up-imappproxy/patches/patch-check-dup-return-value37
-rw-r--r--mail/up-imappproxy/patches/patch-configure15
-rw-r--r--mail/up-imappproxy/patches/patch-default-location-conf32
-rw-r--r--mail/up-imappproxy/patches/patch-fix-egd-ifdef18
-rw-r--r--mail/up-imappproxy/patches/patch-fix-missing-definitions17
-rw-r--r--mail/up-imappproxy/patches/patch-fix-size_t-formatters-hash.c18
-rw-r--r--mail/up-imappproxy/patches/patch-fix-size_t-formatters-imapcommon.c18
-rw-r--r--mail/up-imappproxy/patches/patch-fix-socklen_t-types-main.c18
-rw-r--r--mail/up-imappproxy/patches/patch-fix-socklen_t-types-request.c27
-rw-r--r--mail/up-imappproxy/patches/patch-fix-ssl-types27
-rw-r--r--mail/up-imappproxy/patches/patch-openssl-1.1-imapcommon.c21
-rw-r--r--mail/up-imappproxy/patches/patch-openssl-1.1-main.c38
-rw-r--r--mail/up-imappproxy/patches/patch-remove-install-chown41
-rw-r--r--mail/up-imappproxy/patches/patch-remove-unused-variables18
20 files changed, 452 insertions, 1 deletions
diff --git a/mail/Makefile b/mail/Makefile
index 5a548bd2242..20baf981f00 100644
--- a/mail/Makefile
+++ b/mail/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.547 2020/03/31 20:37:47 roy Exp $
+# $NetBSD: Makefile,v 1.548 2020/04/17 11:28:02 tm Exp $
#
COMMENT= Electronic mail utilities
@@ -392,6 +392,7 @@ SUBDIR+= tnef
SUBDIR+= tnef2txt
SUBDIR+= trojita
SUBDIR+= turba
+SUBDIR+= up-imapproxy
SUBDIR+= vm
SUBDIR+= wl
SUBDIR+= wl-snapshot
diff --git a/mail/up-imappproxy/DESCR b/mail/up-imappproxy/DESCR
new file mode 100644
index 00000000000..a411d9ca02b
--- /dev/null
+++ b/mail/up-imappproxy/DESCR
@@ -0,0 +1,4 @@
+Proxies IMAP transactions between an IMAP client and an IMAP server. The
+general idea is that the client should never know that it's not talking to
+the real IMAP server. The only thing that makes this a slightly unique Imap
+Proxy server is that it caches server connections.
diff --git a/mail/up-imappproxy/Makefile b/mail/up-imappproxy/Makefile
new file mode 100644
index 00000000000..86ef2405451
--- /dev/null
+++ b/mail/up-imappproxy/Makefile
@@ -0,0 +1,43 @@
+# $NetBSD: Makefile,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+VERSION= 1.2.8
+PKGNAME= up-imapproxy-${VERSION}
+DISTNAME= up-imapproxy_${VERSION}~svn20171105.orig
+CATEGORIES= mail
+MASTER_SITES= ${MASTER_SITE_DEBIAN:=pool/main/u/up-imapproxy/}
+EXTRACT_SUFX= .tar.bz2
+CONFLICTS+= imapproxy-[0-9]*
+
+MAINTAINER= tm@NetBSD.org
+HOMEPAGE= http://www.imapproxy.org/
+COMMENT= Connection caching IMAP proxy server
+LICENSE= gnu-gpl-v2
+
+GNU_CONFIGURE= YES
+
+WRKSRC= ${WRKDIR}/squirrelmail.imap_proxy
+
+RCD_SCRIPTS= imapproxy
+RCD_SCRIPT_SRC.imapproxy= ${WRKSRC}/scripts/imapproxy-bsd.init
+
+INSTALLATION_DIRS+= sbin share/doc/imapproxy share/examples/imapproxy
+CONF_FILES= ${PREFIX}/share/examples/imapproxy/imapproxy.conf \
+ ${PKG_SYSCONFDIR}/imapproxy.conf
+
+SUBST_CLASSES+= paths
+SUBST_STAGE.paths= pre-configure
+SUBST_FILES.paths= include/imapproxy.h
+SUBST_VARS.paths= PKG_SYSCONFDIR VARBASE
+SUBST_MESSAGE.paths= Fixing hard coded paths.
+
+post-install:
+.for doc in COPYING ChangeLog README README.known_issues README.ssl
+ ${INSTALL_DATA} ${WRKSRC}/${doc} ${DESTDIR}${PREFIX}/share/doc/imapproxy
+.endfor
+ ${INSTALL_DATA} ${WRKSRC}/scripts/imapproxy.conf \
+ ${DESTDIR}${PREFIX}/share/examples/imapproxy
+
+.include "../../security/openssl/buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/curses.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/mail/up-imappproxy/PLIST b/mail/up-imappproxy/PLIST
new file mode 100644
index 00000000000..cb0cebda6f8
--- /dev/null
+++ b/mail/up-imappproxy/PLIST
@@ -0,0 +1,9 @@
+@comment $NetBSD: PLIST,v 1.1 2020/04/17 11:28:02 tm Exp $
+sbin/in.imapproxyd
+sbin/pimpstat
+share/doc/imapproxy/COPYING
+share/doc/imapproxy/ChangeLog
+share/doc/imapproxy/README
+share/doc/imapproxy/README.known_issues
+share/doc/imapproxy/README.ssl
+share/examples/imapproxy/imapproxy.conf
diff --git a/mail/up-imappproxy/distinfo b/mail/up-imappproxy/distinfo
new file mode 100644
index 00000000000..818edffdf8e
--- /dev/null
+++ b/mail/up-imappproxy/distinfo
@@ -0,0 +1,20 @@
+$NetBSD: distinfo,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+SHA1 (up-imapproxy_1.2.8~svn20171105.orig.tar.bz2) = 85e76717b0d2f790e366b7516cc567fc551c9cc6
+RMD160 (up-imapproxy_1.2.8~svn20171105.orig.tar.bz2) = dac57dcea68c333f6b05942c99fb8d0bfd0b7808
+SHA512 (up-imapproxy_1.2.8~svn20171105.orig.tar.bz2) = 72b79266d3f277052657ecab47a431c9efd764e9fa9523177288cedeede47dd1a5a654a8c9a851a45b3175f43e18ad2290d87778b45889976f7ce0d17625962f
+Size (up-imapproxy_1.2.8~svn20171105.orig.tar.bz2) = 118836 bytes
+SHA1 (patch-check-dup-return-value) = ee1aee413dd3d0a1a01cb9c360c71f4cecfe5c7a
+SHA1 (patch-configure) = 514e1b7c7470aef719364470987166418f6f40ba
+SHA1 (patch-default-location-conf) = 5d43f7d142b3a25d940a58c8bed5def799119845
+SHA1 (patch-fix-egd-ifdef) = cd17fb681a9c7bcfe8f005235eeed36160e97721
+SHA1 (patch-fix-missing-definitions) = 026448da651b76b91bda4ccef453a1ab646d8524
+SHA1 (patch-fix-size_t-formatters-hash.c) = a5c2c26c9c4c1241099d78e6ef0adc9241c2e8e6
+SHA1 (patch-fix-size_t-formatters-imapcommon.c) = 23ea515f680105864dd5c8381acdcfd84c141be7
+SHA1 (patch-fix-socklen_t-types-main.c) = d9ec2c92ecfee08c54c6e28a6a15dfc6730eeffd
+SHA1 (patch-fix-socklen_t-types-request.c) = 99cd03e88f7885bebc766be9d2d14958ffd45be6
+SHA1 (patch-fix-ssl-types) = 2f32060a7ab8922dd038e07f20da6d4240c2bdb0
+SHA1 (patch-openssl-1.1-imapcommon.c) = 69fca63f349fc4c2c11169936136e4611d496901
+SHA1 (patch-openssl-1.1-main.c) = fe2d2eab38a872dd55f0f1cf965e50bd9e501022
+SHA1 (patch-remove-install-chown) = e3811e13fa3fe89dc7d58162a3dcde9a57527be2
+SHA1 (patch-remove-unused-variables) = 37e0a94667d390e11bb408a69e3758e40675c63c
diff --git a/mail/up-imappproxy/files/smf/manifest.xml b/mail/up-imappproxy/files/smf/manifest.xml
new file mode 100644
index 00000000000..3a44f0759c2
--- /dev/null
+++ b/mail/up-imappproxy/files/smf/manifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<service_bundle type="manifest" name="export">
+ <service name="@SMF_PREFIX@/@SMF_NAME@" type="service" version="0">
+ <create_default_instance enabled="false" />
+ <single_instance />
+ <dependency name="net-physical" grouping="require_all" restart_on="none" type="service">
+ <service_fmri value="svc:/network/physical"/>
+ </dependency>
+ <dependency name="filesystem" grouping="require_all" restart_on="none" type="service">
+ <service_fmri value="svc:/system/filesystem/local"/>
+ </dependency>
+ <exec_method name="start" type="method" exec="@PREFIX@/sbin/in.imapproxyd -f %{config_file}" timeout_seconds="10"/>
+ <exec_method name="stop" type="method" exec=":kill" timeout_seconds="10"/>
+ <exec_method name="refresh" type="method" exec=":kill -HUP" timeout_seconds="60"/>
+ <property_group name="startd" type="framework">
+ <propval name="duration" type="astring" value="contract"/>
+ <propval name="ignore_error" type="astring" value="core,signal"/>
+ </property_group>
+ <property_group name="application" type="application">
+ <propval name="config_file" type="astring" value="@PKG_SYSCONFDIR@/imapproxy.conf"/>
+ </property_group>
+ <template>
+ <common_name>
+ <loctext xml:lang="C">imapproxy - Simple connection caching IMAP proxy daemon</loctext>
+ </common_name>
+ </template>
+ </service>
+</service_bundle>
diff --git a/mail/up-imappproxy/patches/patch-check-dup-return-value b/mail/up-imappproxy/patches/patch-check-dup-return-value
new file mode 100644
index 00000000000..9c1f07f57ed
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-check-dup-return-value
@@ -0,0 +1,37 @@
+$NetBSD: patch-check-dup-return-value,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Check dup() return value. Switched to dup2(), which combines the
+close() call.
+
+Richard Laager <rlaager@wiktel.com>
+https://sourceforge.net/p/squirrelmail/mailman/message/35526927/
+
+--- src/main.c.orig
++++ src/main.c
+@@ -998,6 +998,7 @@
+ FILE* fp=NULL;
+ pid_t pid; /* used just for a fork call */
+ int i;
++ int j;
+
+ /* detach from our parent if necessary */
+ // NOTE: When started under systemd, the parent PID is already 1, so
+@@ -1059,9 +1060,15 @@
+ strerror(errno));
+ exit( 1 );
+ }
+- close(2); dup(i);
+- close(1); dup(i);
+- close(0); dup(i);
++ for(j=0; j <= 2; j++)
++ {
++ if (dup2(i, j) < 0)
++ {
++ syslog(LOG_ERR, "%s: dup2() failed: %s", fn,
++ strerror(errno));
++ exit( 1 );
++ }
++ }
+ close(i);
+ }
+ else
diff --git a/mail/up-imappproxy/patches/patch-configure b/mail/up-imappproxy/patches/patch-configure
new file mode 100644
index 00000000000..1933735ce00
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-configure
@@ -0,0 +1,15 @@
+$NetBSD: patch-configure,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Fix test command in configure
+
+--- configure.orig 2010-07-25 08:19:30.000000000 +0000
++++ configure
+@@ -3419,7 +3419,7 @@ else
+ curses_found=no
+ fi
+
+-if test "$curses_found" == no; then
++if test "$curses_found" = no; then
+ echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5
+ echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6
+ if test "${ac_cv_lib_ncurses_initscr+set}" = set; then
diff --git a/mail/up-imappproxy/patches/patch-default-location-conf b/mail/up-imappproxy/patches/patch-default-location-conf
new file mode 100644
index 00000000000..5e6275fe11f
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-default-location-conf
@@ -0,0 +1,32 @@
+$NetBSD: patch-default-location-conf,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Fix config and pid file path. And add missing definitions.
+
+--- include/imapproxy.h.orig Fri Jan 27 20:53:57 2017
++++ include/imapproxy.h Thu Apr 16 21:25:31 2020
+@@ -179,10 +179,10 @@
+ #define SELECT_STATUS_BUF_SIZE 256 /* size of select status */
+
+ #ifndef DEFAULT_CONFIG_FILE
+-#define DEFAULT_CONFIG_FILE "/etc/imapproxy.conf"
++#define DEFAULT_CONFIG_FILE "@PKG_SYSCONFDIR@/etc/imapproxy.conf"
+ #endif
+ #ifndef DEFAULT_PID_FILE
+-#define DEFAULT_PID_FILE "/var/run/imapproxy.pid"
++#define DEFAULT_PID_FILE "@VARBASE@/run/imapproxy.pid"
+ #endif
+
+ #define LITERAL_PASSWORD 1
+@@ -373,8 +373,12 @@
+ extern void ICC_Logout( ICC_Struct * );
+ extern void ICC_Recycle( unsigned int );
+ extern void ICC_Recycle_Loop( void );
++extern void ICC_Invalidate( ICC_Struct * );
+ extern void LockMutex( pthread_mutex_t * );
+ extern void UnLockMutex( pthread_mutex_t * );
++#ifdef HAVE_LIBSSL
++extern int Attempt_STARTTLS( ITD_Struct * );
++#endif
+ extern void SetDefaultConfigValues(ProxyConfig_Struct *);
+ extern void SetConfigOptions( char * );
+ extern void SetLogOptions( void );
diff --git a/mail/up-imappproxy/patches/patch-fix-egd-ifdef b/mail/up-imappproxy/patches/patch-fix-egd-ifdef
new file mode 100644
index 00000000000..406f1b1eb68
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-fix-egd-ifdef
@@ -0,0 +1,18 @@
+$NetBSD: patch-fix-egd-ifdef,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Fix compilation without EGD
+
+Richard Laager <rlaager@wiktel.com>
+https://sourceforge.net/p/squirrelmail/mailman/message/35526927/
+
+--- src/main.c.orig
++++ src/main.c
+@@ -460,7 +460,7 @@
+ /* Set up OpenSSL thread protection */
+ ssl_thread_setup(fn);
+
+-#ifndef HAVE_RAND_EGD
++#ifdef HAVE_RAND_EGD
+ if ( RAND_egd( ( RAND_file_name( f_randfile, sizeof( f_randfile ) ) == f_randfile ) ? f_randfile : "/.rnd" ) )
+ #endif
+ {
diff --git a/mail/up-imappproxy/patches/patch-fix-missing-definitions b/mail/up-imappproxy/patches/patch-fix-missing-definitions
new file mode 100644
index 00000000000..c95164c5242
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-fix-missing-definitions
@@ -0,0 +1,17 @@
+$NetBSD: patch-fix-missing-definitions,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Fix missing definitions
+
+Richard Laager <rlaager@wiktel.com>
+https://sourceforge.net/p/squirrelmail/mailman/message/35526927/
+
+--- src/becomenonroot.c.orig
++++ src/becomenonroot.c
+@@ -48,6 +48,7 @@
+
+ #include <sys/types.h>
+ #include <strings.h>
++#include <string.h>
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <stdio.h>
diff --git a/mail/up-imappproxy/patches/patch-fix-size_t-formatters-hash.c b/mail/up-imappproxy/patches/patch-fix-size_t-formatters-hash.c
new file mode 100644
index 00000000000..40cf6cf1721
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-fix-size_t-formatters-hash.c
@@ -0,0 +1,18 @@
+$NetBSD: patch-fix-size_t-formatters-hash.c,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Fix size_t formatters
+
+Richard Laager <rlaager@wiktel.com>
+https://sourceforge.net/p/squirrelmail/mailman/message/35526927/
+
+--- src/hash.c.orig
++++ src/hash.c
+@@ -69,7 +69,7 @@
+
+ if ( Size > sizeof Hash_Buffer )
+ {
+- syslog(LOG_ERR, "Hash(): Maximum of %d for '%s' exceeds architectural limit of %d", Size, Input_Key, sizeof Hash_Buffer );
++ syslog(LOG_ERR, "Hash(): Maximum of %d for '%s' exceeds architectural limit of %zd", Size, Input_Key, sizeof Hash_Buffer );
+ exit(1);
+ }
+
diff --git a/mail/up-imappproxy/patches/patch-fix-size_t-formatters-imapcommon.c b/mail/up-imappproxy/patches/patch-fix-size_t-formatters-imapcommon.c
new file mode 100644
index 00000000000..fb06c7524de
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-fix-size_t-formatters-imapcommon.c
@@ -0,0 +1,18 @@
+$NetBSD: patch-fix-size_t-formatters-imapcommon.c,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Fix size_t formatters
+
+Richard Laager <rlaager@wiktel.com>
+https://sourceforge.net/p/squirrelmail/mailman/message/35526927/
+
+--- src/imapcommon.c.orig
++++ src/imapcommon.c
+@@ -1004,7 +1004,7 @@
+ */
+ else if ( LiteralPasswd )
+ {
+- snprintf( SendBuf, BufLen, "A0001 LOGIN %s {%d}\r\n",
++ snprintf( SendBuf, BufLen, "A0001 LOGIN %s {%zd}\r\n",
+ Username, strlen( Password ) );
+ if ( IMAP_Write( Server.conn, SendBuf, strlen(SendBuf) ) == -1 )
+ {
diff --git a/mail/up-imappproxy/patches/patch-fix-socklen_t-types-main.c b/mail/up-imappproxy/patches/patch-fix-socklen_t-types-main.c
new file mode 100644
index 00000000000..a138b1e117a
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-fix-socklen_t-types-main.c
@@ -0,0 +1,18 @@
+$NetBSD: patch-fix-socklen_t-types-main.c,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Fix socklen_t types
+
+Richard Laager <rlaager@wiktel.com>
+https://sourceforge.net/p/squirrelmail/mailman/message/35526927/
+
+--- src/main.c.orig
++++ src/main.c
+@@ -285,7 +285,7 @@
+ char f_randfile[ PATH_MAX ];
+ int listensd; /* socket descriptor we'll bind to */
+ long clientsd; /* incoming socket descriptor */
+- int sockaddrlen;
++ socklen_t sockaddrlen;
+ struct sockaddr_storage srvaddr;
+ struct sockaddr_storage cliaddr;
+ pthread_t ThreadId; /* thread id of each incoming conn */
diff --git a/mail/up-imappproxy/patches/patch-fix-socklen_t-types-request.c b/mail/up-imappproxy/patches/patch-fix-socklen_t-types-request.c
new file mode 100644
index 00000000000..e1a357eb44e
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-fix-socklen_t-types-request.c
@@ -0,0 +1,27 @@
+$NetBSD: patch-fix-socklen_t-types-request.c,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Fix socklen_t types
+
+Richard Laager <rlaager@wiktel.com>
+https://sourceforge.net/p/squirrelmail/mailman/message/35526927/
+
+--- src/request.c.orig
++++ src/request.c
+@@ -702,7 +702,7 @@
+ char fullServerResponse[BUFSIZE] = "\0\0\0";
+ int BytesRead;
+ struct sockaddr_storage cli_addr;
+- int sockaddrlen;
++ socklen_t sockaddrlen;
+ char hostaddr[INET6_ADDRSTRLEN], portstr[NI_MAXSERV];
+
+ unsigned int BufLen = BUFSIZE - 1;
+@@ -979,7 +979,7 @@
+ ICD_Struct *conn;
+ char fullServerResponse[BUFSIZE] = "\0\0\0";
+ struct sockaddr_storage cli_addr;
+- int sockaddrlen;
++ socklen_t sockaddrlen;
+ char hostaddr[INET6_ADDRSTRLEN], portstr[NI_MAXSERV];
+
+ memset( &Server, 0, sizeof Server );
diff --git a/mail/up-imappproxy/patches/patch-fix-ssl-types b/mail/up-imappproxy/patches/patch-fix-ssl-types
new file mode 100644
index 00000000000..59a18c36969
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-fix-ssl-types
@@ -0,0 +1,27 @@
+$NetBSD: patch-fix-ssl-types,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Fix SSL types
+
+Richard Laager <rlaager@wiktel.com>
+https://sourceforge.net/p/squirrelmail/mailman/message/35526927/
+
+--- src/imapcommon.c.orig
++++ src/imapcommon.c
+@@ -543,7 +543,7 @@
+ char AuthBufIndex;
+
+ unsigned int BufLen = BUFSIZE - 1;
+- char md5pw[MD5_DIGEST_LENGTH];
++ unsigned char md5pw[MD5_DIGEST_LENGTH];
+ char *tokenptr;
+ char *endptr;
+ char *last;
+@@ -555,7 +555,7 @@
+ struct addrinfo *useai;
+
+ EVP_MD_CTX mdctx;
+- int md_len;
++ unsigned int md_len;
+
+ Expiration = PC_Struct.cache_expiration_time;
+ memset( &Server, 0, sizeof Server );
diff --git a/mail/up-imappproxy/patches/patch-openssl-1.1-imapcommon.c b/mail/up-imappproxy/patches/patch-openssl-1.1-imapcommon.c
new file mode 100644
index 00000000000..1b02230a91f
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-openssl-1.1-imapcommon.c
@@ -0,0 +1,21 @@
+$NetBSD: patch-openssl-1.1-imapcommon.c,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Fix compilation with OpenSSL 1.1
+
+Richard Laager <rlaager@wiktel.com>
+https://sourceforge.net/p/squirrelmail/mailman/message/35526927/
+
+--- src/main.c.orig
++++ src/main.c
+@@ -1582,9 +1582,9 @@
+ verify_error = X509_V_ERR_CERT_CHAIN_TOO_LONG;
+ }
+ }
+- switch (ctx->error) {
++ switch (err) {
+ case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
+- X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), buf, sizeof(buf));
++ X509_NAME_oneline(X509_get_issuer_name(err_cert), buf, sizeof(buf));
+ syslog(LOG_NOTICE, "issuer= %s", buf);
+ break;
+ case X509_V_ERR_CERT_NOT_YET_VALID:
diff --git a/mail/up-imappproxy/patches/patch-openssl-1.1-main.c b/mail/up-imappproxy/patches/patch-openssl-1.1-main.c
new file mode 100644
index 00000000000..9242edcd06a
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-openssl-1.1-main.c
@@ -0,0 +1,38 @@
+$NetBSD: patch-openssl-1.1-main.c,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Fix compilation with OpenSSL 1.1
+
+Richard Laager <rlaager@wiktel.com>
+https://sourceforge.net/p/squirrelmail/mailman/message/35526927/
+
+--- src/imapcommon.c.orig
++++ src/imapcommon.c
+@@ -554,16 +554,24 @@
+ unsigned int Expiration;
+ struct addrinfo *useai;
+
+- EVP_MD_CTX mdctx;
++ EVP_MD_CTX *mdctx;
+ unsigned int md_len;
+
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
++ EVP_MD_CTX mdctx_;
++#define EVP_MD_CTX_new(x) &mdctx_
++#define EVP_MD_CTX_free(x)
++#endif
++
+ Expiration = PC_Struct.cache_expiration_time;
+ memset( &Server, 0, sizeof Server );
+
+ /* need to md5 the passwd regardless, so do that now */
+- EVP_DigestInit(&mdctx, EVP_md5());
+- EVP_DigestUpdate(&mdctx, Password, strlen(Password));
+- EVP_DigestFinal(&mdctx, md5pw, &md_len);
++ mdctx = EVP_MD_CTX_new();
++ EVP_DigestInit(mdctx, EVP_md5());
++ EVP_DigestUpdate(mdctx, Password, strlen(Password));
++ EVP_DigestFinal(mdctx, md5pw, &md_len);
++ EVP_MD_CTX_free(mdctx);
+
+ /* see if we have a reusable connection available */
+ ICC_Active = NULL;
diff --git a/mail/up-imappproxy/patches/patch-remove-install-chown b/mail/up-imappproxy/patches/patch-remove-install-chown
new file mode 100644
index 00000000000..db13bf36a62
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-remove-install-chown
@@ -0,0 +1,41 @@
+$NetBSD: patch-remove-install-chown,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Remove install chown
+This eliminates the chown/chgrp from the install commands, which allows the
+package to be built without root privileges.
+
+Author: Richard Laager <rlaager@wiktel.com>
+
+--- Makefile.in.orig
++++ Makefile.in
+@@ -80,23 +80,23 @@
+
+ install: $(XYD_BIN) $(TAT_BIN)
+ mkdir -p $(DESTDIR)$(EBIN)
+- $(INSTALL) -o bin -g bin -m 0755 $(XYD_BIN) $(DESTDIR)$(EBIN)
+- $(INSTALL) -o bin -g bin -m 0755 $(TAT_BIN) $(DESTDIR)$(EBIN)
++ $(INSTALL) -m 0755 $(XYD_BIN) $(DESTDIR)$(EBIN)
++ $(INSTALL) -m 0755 $(TAT_BIN) $(DESTDIR)$(EBIN)
+
+ install-init-linux:
+- $(INSTALL) -o root -g sys -m 0755 ./scripts/imapproxy-linux.init $(DESTDIR)$(ETC)/init.d/imapproxy
++ $(INSTALL) -m 0755 ./scripts/imapproxy-linux.init $(DESTDIR)$(ETC)/init.d/imapproxy
+ ln -s ../init.d/imapproxy $(DESTDIR)/etc/rc2.d/S99imapproxy
+ ln -s ../init.d/imapproxy $(DESTDIR)/etc/rc0.d/K10imapproxy
+
+ install-init-systemd:
+- $(INSTALL) -o root -g root -m 0644 ./scripts/imap_proxy.service $(DESTDIR)/lib/systemd/system
++ $(INSTALL) -m 0644 ./scripts/imap_proxy.service $(DESTDIR)/lib/systemd/system
+
+ install-conf:
+- $(INSTALL) -o root -g bin -m 0644 ./scripts/imapproxy.conf $(DESTDIR)$(ETC)
++ $(INSTALL) -m 0644 ./scripts/imapproxy.conf $(DESTDIR)$(ETC)
+
+ rpm-install: install
+- $(INSTALL) -o root -g sys -m 0644 ./scripts/imapproxy.conf $(DESTDIR)/etc
+- $(INSTALL) -o root -g sys -m 0755 ./scripts/imapproxy-linux.init $(DESTDIR)/etc/init.d/imapproxy
++ $(INSTALL) -m 0644 ./scripts/imapproxy.conf $(DESTDIR)/etc
++ $(INSTALL) -m 0755 ./scripts/imapproxy-linux.init $(DESTDIR)/etc/init.d/imapproxy
+
+ pkg:
+ pkgmk -o -r .
diff --git a/mail/up-imappproxy/patches/patch-remove-unused-variables b/mail/up-imappproxy/patches/patch-remove-unused-variables
new file mode 100644
index 00000000000..e6f2f0a2c10
--- /dev/null
+++ b/mail/up-imappproxy/patches/patch-remove-unused-variables
@@ -0,0 +1,18 @@
+$NetBSD: patch-remove-unused-variables,v 1.1 2020/04/17 11:28:02 tm Exp $
+
+Remove unused variables
+
+--- src/main.c.orig Thu Apr 16 22:21:03 2020
++++ src/main.c Thu Apr 16 22:30:27 2020
+@@ -186,11 +186,6 @@
+ **
+ */
+
+-
+-static char *sourceRevision = "$Revision: 1.1 $";
+-static char *sourceVersion = "$Id: patch-remove-unused-variables,v 1.1 2020/04/17 11:28:02 tm Exp $";
+-static char *sourceAuthor = "$Author: tm $";
+-
+ #define _REENTRANT
+
+ #include <config.h>