diff options
author | manu <manu@pkgsrc.org> | 2013-04-15 15:41:55 +0000 |
---|---|---|
committer | manu <manu@pkgsrc.org> | 2013-04-15 15:41:55 +0000 |
commit | a324f123a305124e09edb5cf661e6031cbeb9e35 (patch) | |
tree | 7b9e0e29c2f9b58ddda8c972cc44168d7d9982e8 | |
parent | 4227de7cdbdfb1cc4563f18a3924319b97878c44 (diff) | |
download | pkgsrc-a324f123a305124e09edb5cf661e6031cbeb9e35.tar.gz |
Add SASL PLAIN Support. Patch submitted upstream
http://sourceforge.net/tracker/?func=detail&aid=3610674&group_id=311&atid=300311
-rw-r--r-- | mail/imapproxy/Makefile | 3 | ||||
-rw-r--r-- | mail/imapproxy/distinfo | 5 | ||||
-rw-r--r-- | mail/imapproxy/patches/patch-include_imapproxy.h | 17 | ||||
-rw-r--r-- | mail/imapproxy/patches/patch-src_config.c | 19 | ||||
-rw-r--r-- | mail/imapproxy/patches/patch-src_imapcommon.c | 105 |
5 files changed, 147 insertions, 2 deletions
diff --git a/mail/imapproxy/Makefile b/mail/imapproxy/Makefile index 467c4e740ea..5eb9579335f 100644 --- a/mail/imapproxy/Makefile +++ b/mail/imapproxy/Makefile @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.12 2012/10/08 12:19:14 asau Exp $ +# $NetBSD: Makefile,v 1.13 2013/04/15 15:41:55 manu Exp $ # DISTNAME= up-imapproxy-1.2.7 PKGNAME= imapproxy-1.2.7 +PKGREVISION= 2 CATEGORIES= mail MASTER_SITES= http://www.imapproxy.org/downloads/ diff --git a/mail/imapproxy/distinfo b/mail/imapproxy/distinfo index d512583da49..0dc8816784e 100644 --- a/mail/imapproxy/distinfo +++ b/mail/imapproxy/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.6 2010/04/07 15:24:16 joerg Exp $ +$NetBSD: distinfo,v 1.7 2013/04/15 15:41:55 manu Exp $ SHA1 (up-imapproxy-1.2.7.tar.gz) = 1e09730c19cbde3590093b5b4c4599ab69bfced7 RMD160 (up-imapproxy-1.2.7.tar.gz) = 32eddc89fb35c49334eedc3135ede0fc1241e831 @@ -7,3 +7,6 @@ SHA1 (patch-aa) = 7818f16b5e9339672eef4fb0ec89303a11a2e72a 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) = 250b9d6edb9e0b475f673af8ca9bef235ddab796 diff --git a/mail/imapproxy/patches/patch-include_imapproxy.h b/mail/imapproxy/patches/patch-include_imapproxy.h new file mode 100644 index 00000000000..c3ed25f5d2a --- /dev/null +++ b/mail/imapproxy/patches/patch-include_imapproxy.h @@ -0,0 +1,17 @@ +$NetBSD: patch-include_imapproxy.h,v 1.1 2013/04/15 15:41:55 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 */ + }; + + + /* diff --git a/mail/imapproxy/patches/patch-src_config.c b/mail/imapproxy/patches/patch-src_config.c new file mode 100644 index 00000000000..c165728f41d --- /dev/null +++ b/mail/imapproxy/patches/patch-src_config.c @@ -0,0 +1,19 @@ +$NetBSD: patch-src_config.c,v 1.1 2013/04/15 15:41:55 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" ); diff --git a/mail/imapproxy/patches/patch-src_imapcommon.c b/mail/imapproxy/patches/patch-src_imapcommon.c new file mode 100644 index 00000000000..b5d16c4f248 --- /dev/null +++ b/mail/imapproxy/patches/patch-src_imapcommon.c @@ -0,0 +1,105 @@ +$NetBSD: patch-src_imapcommon.c,v 1.1 2013/04/15 15:41:55 manu Exp $ + +SASL PLAIN Support. Patch submitted upstream +http://sourceforge.net/tracker/?func=detail&aid=3610674&group_id=311&atid=300311 + +--- src/imapcommon.c.orig 2010-02-20 18:16:58.000000000 +0100 ++++ src/imapcommon.c 2013-04-15 12:12:45.000000000 +0200 +@@ -689,13 +689,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 ) |