SASL patch
Hi.
With attached patch I can logon to Cyrus IMAP server using sasl/gssapi.
Patch fixes two things:
1. SASL buffer size (LONG_STRING) in auth_sasl.c is too small to
complete gssapi handshake.
2. Fixes segfaults caused by (unnesesary?) memory release in mutt_sasl.c
- FREE (&sasldata->buf).
I'm not sasl expert, but patch works for me (I can successfuly logon to
cyrus imap using Kerberos ticket). Can somebody familiar with SASL
authentication look at it ?
--
mrk
diff -durN mutt-1.4.2.1.orig/imap/auth_sasl.c mutt-1.4.2.1/imap/auth_sasl.c
--- mutt-1.4.2.1.orig/imap/auth_sasl.c 2005-02-17 22:03:53.488279000 +0100
+++ mutt-1.4.2.1/imap/auth_sasl.c 2005-02-17 22:10:31.217174600 +0100
@@ -26,13 +26,15 @@
#include <sasl.h>
#include <saslutil.h>
+#define SASL_BUF_LEN 65536
+
/* imap_auth_sasl: Default authenticator if available. */
imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata, const char* method)
{
sasl_conn_t* saslconn;
sasl_interact_t* interaction = NULL;
int rc, irc;
- char buf[LONG_STRING];
+ char buf[SASL_BUF_LEN];
const char* mech;
const char* pc = NULL;
unsigned int len, olen;
@@ -107,7 +109,7 @@
if (irc == IMAP_CMD_RESPOND)
{
if (sasl_decode64 (idata->cmd.buf+2, strlen (idata->cmd.buf+2), buf,
- LONG_STRING,&len) != SASL_OK)
+ SASL_BUF_LEN,&len) != SASL_OK)
{
dprint (1, (debugfile, "imap_auth_sasl: error base64-decoding server
response.\n"));
goto bail;
diff -durN mutt-1.4.2.1.orig/mutt-1.3.28/PATCHES
mutt-1.4.2.1/mutt-1.3.28/PATCHES
--- mutt-1.4.2.1.orig/mutt-1.3.28/PATCHES 2005-02-17 22:03:53.428348000
+0100
+++ mutt-1.4.2.1/mutt-1.3.28/PATCHES 1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-patch-1.3.28.dw.pgp-hook.3
diff -durN mutt-1.4.2.1.orig/mutt_sasl.c mutt-1.4.2.1/mutt_sasl.c
--- mutt-1.4.2.1.orig/mutt_sasl.c 2005-02-17 22:03:53.517245000 +0100
+++ mutt-1.4.2.1/mutt_sasl.c 2005-02-17 22:09:59.616978560 +0100
@@ -383,7 +383,7 @@
/* release sasl resources */
sasl_dispose (&sasldata->saslconn);
- FREE (&sasldata->buf);
+// FREE (&sasldata->buf);
FREE (&sasldata);
/* call underlying close */
@@ -415,7 +415,7 @@
conn->sockdata = sasldata->sockdata;
- FREE (&sasldata->buf);
+// FREE (&sasldata->buf);
sasldata->bpos = 0;
sasldata->blen = 0;
@@ -486,7 +486,7 @@
}
rc = (sasldata->write) (conn, pbuf, plen);
- FREE (&pbuf);
+// FREE (&pbuf);
if (rc != plen)
goto fail;