Subject: pkg/35959: mail/cyrus-imapd: imtest(1) compatibility fix for SASL 2.1.22
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <j+nbsd@2007.salmi.ch>
List: pkgsrc-bugs
Date: 03/09/2007 11:35:00
>Number:         35959
>Category:       pkg
>Synopsis:       mail/cyrus-imapd: imtest(1) compatibility fix for SASL 2.1.22
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 09 11:35:00 +0000 2007
>Originator:     Jukka Salmi
>Release:        pkgsrc HEAD and pkgsrc-2006Q4
>Description:
The imtest(1) utility needs a compatibility fix for the current Cyrus
SASL library, otherwise (at least GSSAPI) authentication fails.

>How-To-Repeat:
$ imtest mx1
S: * OK mx1.salmi.ch Cyrus IMAP4 v2.2.13 server ready
C: C01 CAPABILITY
S: * CAPABILITY [...] AUTH=GSSAPI [...]
S: C01 OK Completed
C: A01 AUTHENTICATE GSSAPI [...]
S: + [...]
base64 decoding error
Authentication failed. generic failure

>Fix:
Apply [1]fixd already committed to the Cyrus repository:

https://bugzilla.andrew.cmu.edu/cgi-bin/cvsweb.cgi/src/cyrus/imtest/imtest.c.diff?r1=1.107&r2=1.108

Index: mail/cyrus-imapd/distinfo
===================================================================
RCS file: /pub/NetBSD-CVS/pkgsrc/mail/cyrus-imapd/distinfo,v
retrieving revision 1.26
diff -u -p -r1.26 distinfo
--- mail/cyrus-imapd/distinfo	1 Dec 2006 13:36:59 -0000	1.26
+++ mail/cyrus-imapd/distinfo	9 Mar 2007 11:17:04 -0000
@@ -13,6 +13,7 @@ SHA1 (patch-al) = 6fa8967eb97f7cfdb93de8
 SHA1 (patch-am) = 0804e6fa6694ed820861b740ac1bead29b3eeb4b
 SHA1 (patch-ap) = 95b987e83ddd53065f7ffe503d0f07694f9bcd6b
 SHA1 (patch-aq) = 0d764585dc2af05964b03723c29ff127ebe3c25d
+SHA1 (patch-az) = 5f3b79d6daf74cba733f538476980bc421293903
 SHA1 (patch-ba) = 98bea064fa4d97b0bb1ba2d1fcb4d30611ac706e
 SHA1 (patch-bb) = 8725d9008617acb392b904d76a353b8829fdfb33
 SHA1 (patch-bc) = 3266d52067aef8f4835670cba1be6c190ff94f15
--- /dev/null	2007-03-09 12:17:08.000000000 +0100
+++ mail/cyrus-imapd/patches/patch-az	2007-03-09 12:01:45.000000000 +0100
@@ -0,0 +1,31 @@
+$NetBSD$
+
+===================================================================
+RCS file: /afs/andrew.cmu.edu/system/cvs/src/cyrus/imtest/imtest.c,v
+retrieving revision 1.107
+retrieving revision 1.108
+diff -u -r1.107 -r1.108
+--- imtest/imtest.c	2006/01/20 20:31:23	1.107
++++ imtest/imtest.c	2006/05/25 15:23:07	1.108
+@@ -1,7 +1,7 @@
+ /* imtest.c -- IMAP/POP3/NNTP/LMTP/SMTP/MUPDATE/MANAGESIEVE test client
+  * Ken Murchison (multi-protocol implementation)
+  * Tim Martin (SASL implementation)
+- * $Id: imtest.c,v 1.107 2006/01/20 20:31:23 jeaton Exp $
++ * $Id: imtest.c,v 1.108 2006/05/25 15:23:07 murch Exp $
+  *
+  * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+  *
+@@ -886,6 +886,12 @@
+     }
+     
+     if (*str != '\r') {
++	/* trim CRLF */
++	char *p = str + strlen(str) - 1;
++	if (p >= str && *p == '\n') *p-- = '\0';
++	if (p >= str && *p == '\r') *p-- = '\0';
++
++	/* alloc space for decoded response */
+ 	len = strlen(str) + 1;
+ 	*line = malloc(len);
+ 	if ((*line) == NULL) {