projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change generated files to madmutt
[apps/madmutt.git]
/
imap
/
auth_sasl.c
diff --git
a/imap/auth_sasl.c
b/imap/auth_sasl.c
index
21af375
..
4d9df26
100644
(file)
--- a/
imap/auth_sasl.c
+++ b/
imap/auth_sasl.c
@@
-13,22
+13,19
@@
# include "config.h"
#endif
# include "config.h"
#endif
+#include <lib-lib/mem.h>
+#include <lib-lib/ascii.h>
+
#include "mutt.h"
#include "mutt_sasl.h"
#include "imap_private.h"
#include "auth.h"
#include "mutt.h"
#include "mutt_sasl.h"
#include "imap_private.h"
#include "auth.h"
-#include "lib/mem.h"
-#include "lib/intl.h"
+#include <lib-lib/macros.h>
#include "lib/debug.h"
#include "lib/debug.h"
-#ifdef USE_SASL2
#include <sasl/sasl.h>
#include <sasl/saslutil.h>
#include <sasl/sasl.h>
#include <sasl/saslutil.h>
-#else
-#include <sasl.h>
-#include <saslutil.h>
-#endif
/* imap_auth_sasl: Default authenticator if available. */
imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
/* imap_auth_sasl: Default authenticator if available. */
imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
@@
-39,11
+36,7
@@
imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
char buf[HUGE_STRING];
const char *mech;
char buf[HUGE_STRING];
const char *mech;
-#ifdef USE_SASL2
const char *pc = NULL;
const char *pc = NULL;
-#else
- char *pc = NULL;
-#endif
unsigned int len, olen;
unsigned char client_start;
unsigned int len, olen;
unsigned char client_start;
@@
-69,25
+62,14
@@
imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
if (mutt_bit_isset (idata->capabilities, AUTH_ANON) &&
(!idata->conn->account.user[0] ||
!ascii_strncmp (idata->conn->account.user, "anonymous", 9)))
if (mutt_bit_isset (idata->capabilities, AUTH_ANON) &&
(!idata->conn->account.user[0] ||
!ascii_strncmp (idata->conn->account.user, "anonymous", 9)))
-#ifdef USE_SASL2
rc = sasl_client_start (saslconn, "AUTH=ANONYMOUS", NULL, &pc, &olen,
&mech);
rc = sasl_client_start (saslconn, "AUTH=ANONYMOUS", NULL, &pc, &olen,
&mech);
-#else
- rc =
- sasl_client_start (saslconn, "AUTH=ANONYMOUS", NULL, NULL, &pc, &olen,
- &mech);
-#endif
}
if (rc != SASL_OK && rc != SASL_CONTINUE)
do {
}
if (rc != SASL_OK && rc != SASL_CONTINUE)
do {
-#ifdef USE_SASL2
rc = sasl_client_start (saslconn, method, &interaction,
&pc, &olen, &mech);
rc = sasl_client_start (saslconn, method, &interaction,
&pc, &olen, &mech);
-#else
- rc = sasl_client_start (saslconn, method, NULL, &interaction,
- &pc, &olen, &mech);
-#endif
if (rc == SASL_INTERACT)
mutt_sasl_interact (interaction);
}
if (rc == SASL_INTERACT)
mutt_sasl_interact (interaction);
}
@@
-127,20
+109,19
@@
imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
goto bail;
if (irc == IMAP_CMD_RESPOND) {
goto bail;
if (irc == IMAP_CMD_RESPOND) {
-#ifdef USE_SASL2
if (sasl_decode64
if (sasl_decode64
- (idata->cmd.buf + 2, m
utt_strlen
(idata->cmd.buf + 2), buf,
+ (idata->cmd.buf + 2, m
_strlen
(idata->cmd.buf + 2), buf,
LONG_STRING - 1,
LONG_STRING - 1,
-#else
- if (sasl_decode64 (idata->cmd.buf + 2, mutt_strlen (idata->cmd.buf + 2), buf,
-#endif
&len) != SASL_OK) {
debug_print (1, ("error base64-decoding server response.\n"));
goto bail;
}
}
&len) != SASL_OK) {
debug_print (1, ("error base64-decoding server response.\n"));
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)
@@
-157,16
+138,10
@@
imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
debug_print (1, ("error base64-encoding client response.\n"));
goto bail;
}
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
- FREE (&pc);
-#endif
}
if (irc == IMAP_CMD_RESPOND) {
}
if (irc == IMAP_CMD_RESPOND) {
-
strfcpy (buf + olen, "\r\n", sizeof (buf) - olen
);
+
m_strcpy(buf + olen, sizeof(buf) - olen, "\r\n"
);
mutt_socket_write (idata->conn, buf);
}
mutt_socket_write (idata->conn, buf);
}