projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From: Alain Bench <messtic@oreka.com>
[apps/madmutt.git]
/
imap
/
auth_sasl.c
diff --git
a/imap/auth_sasl.c
b/imap/auth_sasl.c
index
67452b9
..
fa1714f
100644
(file)
--- a/
imap/auth_sasl.c
+++ b/
imap/auth_sasl.c
@@
-14,12
+14,14
@@
#endif
#include "mutt.h"
#endif
#include "mutt.h"
+#include "ascii.h"
#include "mutt_sasl.h"
#include "imap_private.h"
#include "auth.h"
#include "lib/mem.h"
#include "lib/intl.h"
#include "mutt_sasl.h"
#include "imap_private.h"
#include "auth.h"
#include "lib/mem.h"
#include "lib/intl.h"
+#include "lib/debug.h"
#ifdef USE_SASL2
#include <sasl/sasl.h>
#ifdef USE_SASL2
#include <sasl/sasl.h>
@@
-47,8
+49,7
@@
imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
unsigned char client_start;
if (mutt_sasl_client_new (idata->conn, &saslconn) < 0) {
unsigned char client_start;
if (mutt_sasl_client_new (idata->conn, &saslconn) < 0) {
- dprint (1, (debugfile,
- "imap_auth_sasl: Error allocating SASL connection.\n"));
+ debug_print (1, ("Error allocating SASL connection.\n"));
return IMAP_AUTH_FAILURE;
}
return IMAP_AUTH_FAILURE;
}
@@
-97,11
+98,9
@@
imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
if (rc != SASL_OK && rc != SASL_CONTINUE) {
if (method)
if (rc != SASL_OK && rc != SASL_CONTINUE) {
if (method)
- d
print (2, (debugfile, "imap_auth_sasl:
%s unavailable\n", method));
+ d
ebug_print (2, ("
%s unavailable\n", method));
else
else
- dprint (1,
- (debugfile,
- "imap_auth_sasl: Failure starting authentication exchange. No shared mechanisms?\n"));
+ debug_print (1, ("Failure starting authentication exchange. No shared mechanisms?\n"));
/* SASL doesn't support LOGIN, so fall back */
return IMAP_AUTH_UNAVAIL;
/* SASL doesn't support LOGIN, so fall back */
return IMAP_AUTH_UNAVAIL;
@@
-120,7
+119,7
@@
imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
while (irc == IMAP_CMD_CONTINUE);
if (method && irc == IMAP_CMD_NO) {
while (irc == IMAP_CMD_CONTINUE);
if (method && irc == IMAP_CMD_NO) {
- d
print (2, (debugfile, "imap_auth_sasl:
%s failed\n", method));
+ d
ebug_print (2, ("
%s failed\n", method));
sasl_dispose (&saslconn);
return IMAP_AUTH_UNAVAIL;
}
sasl_dispose (&saslconn);
return IMAP_AUTH_UNAVAIL;
}
@@
-131,20
+130,21
@@
imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
if (irc == IMAP_CMD_RESPOND) {
#ifdef USE_SASL2
if (sasl_decode64
if (irc == IMAP_CMD_RESPOND) {
#ifdef USE_SASL2
if (sasl_decode64
- (idata->cmd.buf + 2,
mutt_str
len (idata->cmd.buf + 2), buf,
+ (idata->cmd.buf + 2,
str_
len (idata->cmd.buf + 2), buf,
LONG_STRING - 1,
#else
LONG_STRING - 1,
#else
- if (sasl_decode64 (idata->cmd.buf + 2,
mutt_str
len (idata->cmd.buf + 2), buf,
+ if (sasl_decode64 (idata->cmd.buf + 2,
str_
len (idata->cmd.buf + 2), buf,
#endif
&len) != SASL_OK) {
#endif
&len) != SASL_OK) {
- dprint (1,
- (debugfile,
- "imap_auth_sasl: error base64-decoding server response.\n"));
+ debug_print (1, ("error base64-decoding server response.\n"));
goto bail;
}
}
goto bail;
}
}
- if (!client_start) {
+ /* client-start is only available with the SASL-IR extension, but
+ * SASL 2.1 seems to want to use it regardless, at least for DIGEST
+ * fast reauth. Override if the server sent an initial continuation */
+ if (!client_start || buf[0]) {
do {
rc = sasl_client_step (saslconn, buf, len, &interaction, &pc, &olen);
if (rc == SASL_INTERACT)
do {
rc = sasl_client_step (saslconn, buf, len, &interaction, &pc, &olen);
if (rc == SASL_INTERACT)
@@
-158,16
+158,14
@@
imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
/* send out response, or line break if none needed */
if (olen) {
if (sasl_encode64 (pc, olen, buf, sizeof (buf), &olen) != SASL_OK) {
/* send out response, or line break if none needed */
if (olen) {
if (sasl_encode64 (pc, olen, buf, sizeof (buf), &olen) != SASL_OK) {
- dprint (1,
- (debugfile,
- "imap_auth_sasl: error base64-encoding client response.\n"));
+ debug_print (1, ("error base64-encoding client response.\n"));
goto bail;
}
/* sasl_client_st(art|ep) allocate pc with malloc, expect me to
* free it */
#ifndef USE_SASL2
goto bail;
}
/* sasl_client_st(art|ep) allocate pc with malloc, expect me to
* free it */
#ifndef USE_SASL2
-
FREE
(&pc);
+
mem_free
(&pc);
#endif
}
#endif
}
@@
-179,8
+177,7
@@
imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
/* If SASL has errored out, send an abort string to the server */
if (rc < 0) {
mutt_socket_write (idata->conn, "*\r\n");
/* If SASL has errored out, send an abort string to the server */
if (rc < 0) {
mutt_socket_write (idata->conn, "*\r\n");
- dprint (1,
- (debugfile, "imap_auth_sasl: sasl_client_step error %d\n", rc));
+ debug_print (1, ("sasl_client_step error %d\n", rc));
}
olen = 0;
}
olen = 0;