pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc



Module Name:    pkgsrc
Committed By:   manu
Date:           Thu Apr 16 14:03:29 UTC 2020

Modified Files:
        pkgsrc/doc: CHANGES-2020
Added Files:
        pkgsrc/mail/imapproxy: DESCR MESSAGE Makefile PLIST distinfo
        pkgsrc/mail/imapproxy/files: imapproxy.sh
        pkgsrc/mail/imapproxy/patches: patch-aa patch-ba patch-bb patch-bc
            patch-include_imapproxy.h patch-src_config.c patch-src_imapcommon.c
            patch-src_main.c

Log Message:
Re-add imapproxy, with updated patches to build with OpenSSL 1.1.1


To generate a diff of this commit:
cvs rdiff -u -r1.2318 -r1.2319 pkgsrc/doc/CHANGES-2020
cvs rdiff -u -r0 -r1.4 pkgsrc/mail/imapproxy/DESCR
cvs rdiff -u -r0 -r1.3 pkgsrc/mail/imapproxy/MESSAGE
cvs rdiff -u -r0 -r1.25 pkgsrc/mail/imapproxy/Makefile
cvs rdiff -u -r0 -r1.6 pkgsrc/mail/imapproxy/PLIST
cvs rdiff -u -r0 -r1.13 pkgsrc/mail/imapproxy/distinfo
cvs rdiff -u -r0 -r1.4 pkgsrc/mail/imapproxy/files/imapproxy.sh
cvs rdiff -u -r0 -r1.6 pkgsrc/mail/imapproxy/patches/patch-aa
cvs rdiff -u -r0 -r1.3 pkgsrc/mail/imapproxy/patches/patch-ba \
    pkgsrc/mail/imapproxy/patches/patch-bb \
    pkgsrc/mail/imapproxy/patches/patch-bc \
    pkgsrc/mail/imapproxy/patches/patch-include_imapproxy.h \
    pkgsrc/mail/imapproxy/patches/patch-src_config.c \
    pkgsrc/mail/imapproxy/patches/patch-src_imapcommon.c \
    pkgsrc/mail/imapproxy/patches/patch-src_main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/doc/CHANGES-2020
diff -u pkgsrc/doc/CHANGES-2020:1.2318 pkgsrc/doc/CHANGES-2020:1.2319
--- pkgsrc/doc/CHANGES-2020:1.2318      Thu Apr 16 13:54:09 2020
+++ pkgsrc/doc/CHANGES-2020     Thu Apr 16 14:03:28 2020
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES-2020,v 1.2318 2020/04/16 13:54:09 mef Exp $
+$NetBSD: CHANGES-2020,v 1.2319 2020/04/16 14:03:28 manu Exp $
 
 Changes to the packages collection and infrastructure in 2020:
 
@@ -3189,3 +3189,4 @@ Changes to the packages collection and i
        Updated devel/p5-PPIx-Regexp to 0.071 [mef 2020-04-16]
        Updated devel/p5-Perl-Critic to 1.138 [mef 2020-04-16]
        Updated devel/p5-Alien-Build to 2.21 [mef 2020-04-16]
+       Re-added mail/imapproxy [manu 2020-04-16]

Added files:

Index: pkgsrc/mail/imapproxy/DESCR
diff -u /dev/null pkgsrc/mail/imapproxy/DESCR:1.4
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/DESCR Thu Apr 16 14:03:29 2020
@@ -0,0 +1,6 @@
+ImapProxy is a caching IMAP proxy daemon designed to be used with
+Horde/IMP.  The program forwards all traffic between the client and the
+server, but keeps the connection to the server alive after the client logs
+out.  When the same user attempts to log in again, the proxy will use the
+cached username/password pair to authenticate the client, and tie the new
+client to the old server connection (which was kept alive).

Index: pkgsrc/mail/imapproxy/MESSAGE
diff -u /dev/null pkgsrc/mail/imapproxy/MESSAGE:1.3
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/MESSAGE       Thu Apr 16 14:03:29 2020
@@ -0,0 +1,7 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.3 2020/04/16 14:03:29 manu Exp $
+
+imapproxy configuration file must be located at ${PREFIX}/etc/imapproxy.conf
+A sample file is provided in ${PREFIX}/share/examples/imapproxy
+
+===========================================================================

Index: pkgsrc/mail/imapproxy/Makefile
diff -u /dev/null pkgsrc/mail/imapproxy/Makefile:1.25
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/Makefile      Thu Apr 16 14:03:29 2020
@@ -0,0 +1,51 @@
+# $NetBSD: Makefile,v 1.25 2020/04/16 14:03:29 manu Exp $
+#
+
+DISTNAME=      squirrelmail-imap_proxy-1.2.7
+PKGNAME=       imapproxy-1.2.7
+PKGREVISION=   6
+CATEGORIES=    mail
+MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=squirrelmail/}
+
+MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=      http://www.imapproxy.org/
+COMMENT=       Simple connection caching IMAP proxy daemon
+
+GNU_CONFIGURE= YES
+
+CONFIGURE_ARGS+=       --exec_prefix=${DESTDIR}${PREFIX}
+BUILD_DEFS+=           VARBASE
+CFLAGS+=               -DDEFAULT_CONFIG_FILE=\"${PREFIX}/etc/imapproxy.conf\"
+CFLAGS+=               -DDEFAULT_PID_FILE=\"${VARBASE}/run/imapproxy.pid\"
+RCD_SCRIPTS=           imapproxy
+
+IMAPPROXY_USER?=       imapproxy
+IMAPPROXY_GROUP?=      imapproxy
+IMAPPROXY_CHROOT?=     ${VARBASE}/chroot/imapproxy
+IMAPPROXY_DOC?=                share/doc/imapproxy
+IMAPPROXY_EXAMPLES?=   share/examples/imapproxy
+
+PKG_GROUPS_VARS+=              IMAPPROXY_GROUP
+PKG_USERS_VARS+=               IMAPPROXY_USER
+PKG_GROUPS=                    ${IMAPPROXY_GROUP}
+PKG_USERS=                     ${IMAPPROXY_USER}:${IMAPPROXY_GROUP}
+PKG_GECOS.${IMAPPROXY_USER}=   IMAP Proxy pseudo-user
+PKG_HOME.${IMAPPROXY_USER}=    ${IMAPPROXY_CHROOT}
+
+INSTALLATION_DIRS+=    sbin
+INSTALLATION_DIRS+=    ${IMAPPROXY_DOC}
+INSTALLATION_DIRS+=    ${IMAPPROXY_EXAMPLES}
+
+MAKE_DIRS=             ${VARBASE}/chroot
+OWN_DIRS=              ${VARBASE}/chroot/imapproxy
+
+post-install:
+.for doc in COPYING ChangeLog README README.known_issues README.ssl
+       ${INSTALL_DATA} ${WRKSRC}/${doc} ${DESTDIR}${PREFIX}/${IMAPPROXY_DOC}
+.endfor
+       ${INSTALL_DATA} ${WRKSRC}/scripts/imapproxy.conf \
+                       ${DESTDIR}${PREFIX}/${IMAPPROXY_EXAMPLES}
+
+.include "../../mk/curses.buildlink3.mk"
+.include "../../security/openssl/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"

Index: pkgsrc/mail/imapproxy/PLIST
diff -u /dev/null pkgsrc/mail/imapproxy/PLIST:1.6
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/PLIST Thu Apr 16 14:03:29 2020
@@ -0,0 +1,9 @@
+@comment $NetBSD: PLIST,v 1.6 2020/04/16 14:03:29 manu 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

Index: pkgsrc/mail/imapproxy/distinfo
diff -u /dev/null pkgsrc/mail/imapproxy/distinfo:1.13
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/distinfo      Thu Apr 16 14:03:29 2020
@@ -0,0 +1,14 @@
+$NetBSD: distinfo,v 1.13 2020/04/16 14:03:29 manu Exp $
+
+SHA1 (squirrelmail-imap_proxy-1.2.7.tar.gz) = b2e324383ae8a2cdb3b5bd0340a2e2174941bd65
+RMD160 (squirrelmail-imap_proxy-1.2.7.tar.gz) = 87f3b9ab367e9da2a3f532e6de867004abbe75cf
+SHA512 (squirrelmail-imap_proxy-1.2.7.tar.gz) = 355816e26eb9fa273b2b4e6cf0c2f55b85d0568291095913a4b05dd73a428a173c2a5b327c4ef296ca74ca500250b22fa2ae44d7d44613624641954fc9603507
+Size (squirrelmail-imap_proxy-1.2.7.tar.gz) = 136209 bytes
+SHA1 (patch-aa) = ee753ff90c68549067ef28d9ed8c10ffeb1982e4
+SHA1 (patch-ba) = 8f3d8adbac5a147cc143d7737d56a83401736a9d
+SHA1 (patch-bb) = 348768062f5f9e314223fb7d385f749646ed04be
+SHA1 (patch-bc) = c3daf40715af721a0c4ff1b1071a892c94b59ce5
+SHA1 (patch-include_imapproxy.h) = 9e2326ece220e48c3baa2949b13d21448405e741
+SHA1 (patch-src_config.c) = 84ac9bde7cf64add665adb0f4d658ef856a91ae0
+SHA1 (patch-src_imapcommon.c) = a8d95e87cd6f3857e69abe17dc71a683f196d98d
+SHA1 (patch-src_main.c) = e0795df7e7312cfb285cc65bbabdecd3553c7e65

Index: pkgsrc/mail/imapproxy/files/imapproxy.sh
diff -u /dev/null pkgsrc/mail/imapproxy/files/imapproxy.sh:1.4
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/files/imapproxy.sh    Thu Apr 16 14:03:29 2020
@@ -0,0 +1,18 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: imapproxy.sh,v 1.4 2020/04/16 14:03:29 manu Exp $
+#
+
+# PROVIDE: imapproxy
+# REQUIRE: DAEMON
+# BEFORE:  LOGIN
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="imapproxy"
+rcvar=$name
+command="@PREFIX@/sbin/in.imapproxyd"
+required_files="@PKG_SYSCONFDIR@/imapproxy.conf"
+
+load_rc_config $name
+run_rc_command "$1"

Index: pkgsrc/mail/imapproxy/patches/patch-aa
diff -u /dev/null pkgsrc/mail/imapproxy/patches/patch-aa:1.6
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/patches/patch-aa      Thu Apr 16 14:03:29 2020
@@ -0,0 +1,26 @@
+$NetBSD: patch-aa,v 1.6 2020/04/16 14:03:29 manu Exp $
+
+--- Makefile.in.orig   2010-07-25 09:11:36.000000000 +0000
++++ Makefile.in
+@@ -70,7 +70,7 @@ $(XYD_BIN): $(XYD_OBJ)
+       $(CC) -o $@ $(XYD_OBJ) $(LDFLAGS) $(XYD_LIB)
+ 
+ $(TAT_BIN): $(TAT_OBJ)
+-      $(CC) -o $@ $(TAT_OBJ) $(TAT_LIB)
++      $(CC) -o $@ $(TAT_OBJ) $(LDFLAGS) $(TAT_LIB)
+ 
+ clean:
+       rm -f ./src/core  $(XYD_OBJ) $(TAT_OBJ) $(XYD_BIN) $(TAT_BIN)
+@@ -79,9 +79,9 @@ distclean: clean
+       rm -f config.cache config.log config.h Makefile
+ 
+ install: $(XYD_BIN) $(TAT_BIN)
+-      mkdir -p $(EBIN)
+-      $(INSTALL) -o bin -g bin -m 0755 $(XYD_BIN) $(EBIN)
+-      $(INSTALL) -o bin -g bin -m 0755 $(TAT_BIN) $(EBIN)
++      ${BSD_INSTALL_PROGRAM_DIR} $(EBIN)
++      ${BSD_INSTALL_PROGRAM} $(XYD_BIN) $(EBIN)
++      ${BSD_INSTALL_PROGRAM} $(TAT_BIN) $(EBIN)
+ 
+ install-init:
+       $(INSTALL) -o root -g sys -m 0755 ./scripts/imapproxy.init $(ETC)/init.d/imapproxy

Index: pkgsrc/mail/imapproxy/patches/patch-ba
diff -u /dev/null pkgsrc/mail/imapproxy/patches/patch-ba:1.3
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/patches/patch-ba      Thu Apr 16 14:03:29 2020
@@ -0,0 +1,14 @@
+$NetBSD: patch-ba,v 1.3 2020/04/16 14:03:29 manu Exp $
+--- configure.in.orig  2010-03-21 22:20:57.000000000 +0100
++++ configure.in       2010-03-21 22:21:05.000000000 +0100
+@@ -120,9 +120,9 @@
+ dnl Check for curses
+ save_LIBS="$LIBS"
+ LIB_CURSES=""
+ AC_CHECK_LIB(curses, initscr, LIB_CURSES="-lcurses", [ curses_found=no ])
+-if test "$curses_found" == no; then
++if test "$curses_found" = no; then
+   AC_CHECK_LIB(ncurses, initscr, LIB_CURSES="-lncurses",
+  AC_ERROR([Can't compile without curses!!!]))
+ fi
+ 
Index: pkgsrc/mail/imapproxy/patches/patch-bb
diff -u /dev/null pkgsrc/mail/imapproxy/patches/patch-bb:1.3
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/patches/patch-bb      Thu Apr 16 14:03:29 2020
@@ -0,0 +1,14 @@
+$NetBSD: patch-bb,v 1.3 2020/04/16 14:03:29 manu Exp $
+--- configure.orig     2010-03-21 22:20:49.000000000 +0100
++++ configure  2010-03-21 22:21:13.000000000 +0100
+@@ -3418,9 +3418,9 @@
+ 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
+   echo $ECHO_N "(cached) $ECHO_C" >&6
Index: pkgsrc/mail/imapproxy/patches/patch-bc
diff -u /dev/null pkgsrc/mail/imapproxy/patches/patch-bc:1.3
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/patches/patch-bc      Thu Apr 16 14:03:29 2020
@@ -0,0 +1,20 @@
+$NetBSD: patch-bc,v 1.3 2020/04/16 14:03:29 manu Exp $
+--- include/imapproxy.h.orig   2010-03-22 07:40:36.000000000 +0100
++++ include/imapproxy.h        2010-03-22 08:46:47.000000000 +0100
+@@ -171,14 +171,14 @@
+  */
+ #define PGM                     "in.imapproxyd"
+ #define IMAP_UNTAGGED_OK        "* OK "           /* untagged OK response    */
+ #define IMAP_TAGGED_OK          "1 OK "           /* tagged OK response      */
+-#define BUFSIZE                 4096              /* default buffer size     */
++#define BUFSIZE                 8192              /* default buffer size     */
+ #define MAX_CONN_BACKLOG        5                 /* tcp connection backlog  */
+ #define MAXTAGLEN               256               /* max IMAP tag length     */
+ #define MAXMAILBOXNAME          512               /* max mailbox name length */
+ #define MAXUSERNAMELEN          64                /* max username length     */
+-#define MAXPASSWDLEN            64                /* max passwd length       */
++#define MAXPASSWDLEN            8192              /* max passwd length       */
+ #define POLL_TIMEOUT_MINUTES    30                /* Poll timeout in minutes */
+ #define POLL_TIMEOUT            (POLL_TIMEOUT_MINUTES * 60000)
+ #define SELECT_BUF_SIZE         BUFSIZE           /* max length of a SELECT  */
+                                                 /* string we can cache     */
Index: pkgsrc/mail/imapproxy/patches/patch-include_imapproxy.h
diff -u /dev/null pkgsrc/mail/imapproxy/patches/patch-include_imapproxy.h:1.3
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/patches/patch-include_imapproxy.h     Thu Apr 16 14:03:29 2020
@@ -0,0 +1,17 @@
+$NetBSD: patch-include_imapproxy.h,v 1.3 2020/04/16 14:03:29 manu Exp $
+
+SASL PLAIN Support. Patch submitted upstream
+http://sourceforge.net/tracker/?func=detail&aid=3610674&group_id=311&atid=300311
+
+--- include/imapproxy.h.orig   2013-04-15 11:57:37.000000000 +0200
++++ include/imapproxy.h        2013-04-15 11:58:33.000000000 +0200
+@@ -311,8 +311,9 @@
+     unsigned char support_unselect;           /* unselect support flag */
+     unsigned char support_starttls;           /* starttls support flag */
+     unsigned char login_disabled;             /* login disabled flag */
+     char *chroot_directory;                   /* chroot(2) into this dir */
++    char *auth_sasl_mech;                     /* SASL mechanism */
+ };
+ 
+ 
+ /*
Index: pkgsrc/mail/imapproxy/patches/patch-src_config.c
diff -u /dev/null pkgsrc/mail/imapproxy/patches/patch-src_config.c:1.3
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/patches/patch-src_config.c    Thu Apr 16 14:03:29 2020
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_config.c,v 1.3 2020/04/16 14:03:29 manu Exp $
+
+SASL PLAIN Support. Patch submitted upstream
+http://sourceforge.net/tracker/?func=detail&aid=3610674&group_id=311&atid=300311
+
+--- src/config.c.orig  2010-02-20 18:16:58.000000000 +0100
++++ src/config.c       2013-04-15 12:00:50.000000000 +0200
+@@ -452,8 +452,11 @@
+                 &PC_Struct.force_tls, index );
+ 
+     ADD_TO_TABLE( "enable_admin_commands", SetBooleanValue,
+                 &PC_Struct.enable_admin_commands, index );
++
++    ADD_TO_TABLE( "auth_sasl_mech", SetStringValue,
++                &PC_Struct.auth_sasl_mech, index );
+     
+     ConfigTable[index].Keyword[0] = '\0';
+     
+     FP = fopen( ConfigFile, "r" );
Index: pkgsrc/mail/imapproxy/patches/patch-src_imapcommon.c
diff -u /dev/null pkgsrc/mail/imapproxy/patches/patch-src_imapcommon.c:1.3
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/patches/patch-src_imapcommon.c        Thu Apr 16 14:03:29 2020
@@ -0,0 +1,131 @@
+$NetBSD: patch-src_imapcommon.c,v 1.3 2020/04/16 14:03:29 manu Exp $
+
+Build fixes for OpenSSL 1.1.1
+
+SASL PLAIN Support. Patch submitted upstream
+http://sourceforge.net/tracker/?func=detail&aid=3610674&group_id=311&atid=300311
+
+--- src/imapcommon.c.orig      2010-07-26 09:08:47.000000000 +0200
++++ src/imapcommon.c   2020-04-16 15:49:08.132245848 +0200
+@@ -397,18 +397,19 @@
+     ITD_Struct Server;
+     int rc;
+     unsigned int Expiration;
+ 
+-    EVP_MD_CTX mdctx;
++    EVP_MD_CTX *mdctx = EVP_MD_CTX_new();
+     int md_len;
+ 
+     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);
++    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;
+     HashIndex = Hash( Username, HASH_TABLE_SIZE );
+@@ -689,13 +690,96 @@
+     }
+ #endif /* HAVE_LIBSSL */
+ 
+ 
++     /*
++      * If configured to do so, use SASL PLAIN instead of IMAP LOGIN
++      */
++     if ( PC_Struct.auth_sasl_mech && 
++            !strcmp( PC_Struct.auth_sasl_mech, "plain" ) )
++     {
++      /*
++       * Build SASL AUTH PLAIN string:
++       * username\0username\0password
++       */
++      char *ptr_username;
++      unsigned int username_size;
++      char *ptr_password;
++      unsigned int password_size;
++      unsigned int total_size;
++      unsigned int AuthBufIndex;
++      char AuthBuf[BUFSIZE]; 
++      char EncodedAuthBuf[BUFSIZE]; 
++ 
++      /*
++       * Strip quotes From username
++       */
++      ptr_username = Username;
++      username_size = strlen( Username );
++      if ( *ptr_username == '"' && *(ptr_username + username_size - 1) == '"' )
++      {
++          ++ptr_username;
++          username_size = username_size - 2;
++      }
++ 
++      /*
++       * Same with password
++       */
++      ptr_password = Password;
++      password_size = strlen( Password );
++      if ( *ptr_password == '"' && *(ptr_password + password_size - 1) == '"' )
++      {
++          ++ptr_password;
++          password_size = password_size - 2;
++      }
++ 
++      /*
++       * Make sure output buffer is big enough ( +3 for three \0 )
++       */
++      total_size = username_size + username_size + password_size + 3;
++      if ( total_size > sizeof(AuthBuf) ) {
++          syslog( LOG_INFO,
++                  "LOGIN: '%s' (%s:%s) failed: PLAIN AUTH needs %d/%d bytes",
++                  Username, ClientAddr, portstr, total_size, sizeof(AuthBuf));
++          goto fail;
++      }
++ 
++      /*
++       * Prepare the buffer
++       */
++      AuthBufIndex = 0;
++ 
++      memcpy( AuthBuf + AuthBufIndex, ptr_username, username_size );
++      AuthBufIndex += username_size;
++      AuthBuf[AuthBufIndex++] = '\0';
++ 
++      memcpy( AuthBuf + AuthBufIndex, ptr_username, username_size );
++      AuthBufIndex += username_size;
++      AuthBuf[AuthBufIndex++] = '\0';
++ 
++      memcpy( AuthBuf + AuthBufIndex, ptr_password, password_size );
++      AuthBufIndex += password_size;
++      AuthBuf[AuthBufIndex++] = '\0';
++ 
++      EVP_EncodeBlock( EncodedAuthBuf, AuthBuf, AuthBufIndex );
++ 
++      snprintf( SendBuf, BufLen, "A0001 AUTHENTICATE PLAIN %s\r\n", EncodedAuthBuf );
++ 
++      /* syslog( LOG_INFO, "sending auth plain '%s'", EncodedAuthBuf ); */
++ 
++      if ( IMAP_Write( Server.conn, SendBuf, strlen(SendBuf) ) == -1 )
++      {
++          syslog( LOG_INFO,
++                  "LOGIN: '%s' (%s:%s) failed: IMAP_Write() failed attempting to send AUTHENTICATE command to IMAP server: %s",
++                  Username, ClientAddr, portstr, strerror( errno ) );
++          goto fail;
++      }
++     }
+     /*
+      * Send the login command off to the IMAP server.  Have to treat a literal
+      * password different.
+      */
+-    if ( LiteralPasswd )
++    else if ( LiteralPasswd )
+     {
+       snprintf( SendBuf, BufLen, "A0001 LOGIN %s {%d}\r\n", 
+                 Username, strlen( Password ) );
+       if ( IMAP_Write( Server.conn, SendBuf, strlen(SendBuf) ) == -1 )
Index: pkgsrc/mail/imapproxy/patches/patch-src_main.c
diff -u /dev/null pkgsrc/mail/imapproxy/patches/patch-src_main.c:1.3
--- /dev/null   Thu Apr 16 14:03:29 2020
+++ pkgsrc/mail/imapproxy/patches/patch-src_main.c      Thu Apr 16 14:03:29 2020
@@ -0,0 +1,66 @@
+$NetBSD: patch-src_main.c,v 1.3 2020/04/16 14:03:29 manu Exp $
+
+From upstream:
+Negotiate highest TLS protocol possible, with TLSv1.0 being the minium.
+
+Local patch:
+Fixes to build with OpenSSL 1.1.1
+
+--- src/main.c.orig    2010-07-26 09:21:19.000000000 +0200
++++ src/main.c 2020-04-16 15:44:18.020665162 +0200
+@@ -470,26 +470,36 @@
+ 
+           /* Set up OpenSSL thread protection */
+           ssl_thread_setup(fn);
+           
++
+             /* Need to seed PRNG, too! */
++# ifndef OPENSSL_NO_EGD
+             if ( RAND_egd( ( RAND_file_name( f_randfile, sizeof( f_randfile ) ) == f_randfile ) ? f_randfile : "/.rnd" ) ) 
++#endif
+           {
+                 /* Not an EGD, so read and write it. */
+                 if ( RAND_load_file( f_randfile, -1 ) )
+                     RAND_write_file( f_randfile );
+             }
+       
+           SSL_load_error_strings();
+-          tls_ctx = SSL_CTX_new( TLSv1_client_method() );
++
++          /* 
++           * Despite its name, SSLv23_client_method() negociates highest
++           * version possible, which includes TLSv1.0, TLSv1.1, and TLSv1.2. 
++           * SSLv2 and SSLv3 are disabled using SSL_OP_NO_SSLv2 and 
++           * SSL_OP_NO_SSLv3 below.
++           */ 
++          tls_ctx = SSL_CTX_new( SSLv23_client_method() );
+           if ( tls_ctx == NULL )
+-          {
++          { 
+               syslog(LOG_ERR, "%s: Failed to create new SSL_CTX.  Exiting.", fn);
+               exit( 1 );
+           }
+-
+-          /* Work around all known bugs */
+-          SSL_CTX_set_options( tls_ctx, SSL_OP_ALL );
++       
++          /* Work around all known bugs, disable SSLv2 and SSLv3 */
++          SSL_CTX_set_options( tls_ctx, SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 );
+ 
+           if ( ! SSL_CTX_load_verify_locations( tls_ctx,
+                                                 PC_Struct.tls_ca_file,
+                                                 PC_Struct.tls_ca_path ) ||
+@@ -1380,11 +1390,11 @@
+           ok = 0;
+           verify_error = X509_V_ERR_CERT_CHAIN_TOO_LONG;
+       }
+     }
+-    switch (ctx->error) {
++    switch (X509_STORE_CTX_get_error(ctx)) {
+     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(X509_STORE_CTX_get_current_cert(ctx)), buf, sizeof(buf));
+       syslog(LOG_NOTICE, "issuer= %s", buf);
+       break;
+     case X509_V_ERR_CERT_NOT_YET_VALID:
+     case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:



Home | Main Index | Thread Index | Old Index