/* SASL login/authentication code */
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <lib-lib/mem.h>
-#include <lib-lib/ascii.h>
+#include <lib-lib/lib-lib.h>
#include "mutt.h"
#include "mutt_sasl.h"
#include "imap_private.h"
#include "auth.h"
-#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
-
#include <sasl/sasl.h>
#include <sasl/saslutil.h>
unsigned char client_start;
if (mutt_sasl_client_new (idata->conn, &saslconn) < 0) {
- debug_print (1, ("Error allocating SASL connection.\n"));
return IMAP_AUTH_FAILURE;
}
if (mutt_bit_isset (idata->capabilities, AUTH_ANON) &&
(!idata->conn->account.user[0] ||
- !ascii_strncmp (idata->conn->account.user, "anonymous", 9)))
+ !m_strncmp(idata->conn->account.user, "anonymous", 9)))
rc = sasl_client_start (saslconn, "AUTH=ANONYMOUS", NULL, &pc, &olen,
&mech);
}
client_start = (olen > 0);
if (rc != SASL_OK && rc != SASL_CONTINUE) {
- if (method)
- debug_print (2, ("%s unavailable\n", method));
- else
- debug_print (1, ("Failure starting authentication exchange. No shared mechanisms?\n"));
/* SASL doesn't support LOGIN, so fall back */
-
return IMAP_AUTH_UNAVAIL;
}
while (irc == IMAP_CMD_CONTINUE);
if (method && irc == IMAP_CMD_NO) {
- debug_print (2, ("%s failed\n", method));
sasl_dispose (&saslconn);
return IMAP_AUTH_UNAVAIL;
}
goto bail;
if (irc == IMAP_CMD_RESPOND) {
- if (sasl_decode64
- (idata->cmd.buf + 2, m_strlen(idata->cmd.buf + 2), buf,
- LONG_STRING - 1,
- &len) != SASL_OK) {
- debug_print (1, ("error base64-decoding server response.\n"));
+ if (sasl_decode64(idata->cmd.buf + 2, m_strlen(idata->cmd.buf + 2), buf,
+ LONG_STRING - 1, &len) != SASL_OK) {
goto bail;
}
}
/* send out response, or line break if none needed */
if (olen) {
if (sasl_encode64 (pc, olen, buf, sizeof (buf), &olen) != SASL_OK) {
- debug_print (1, ("error base64-encoding client response.\n"));
goto bail;
}
}
/* If SASL has errored out, send an abort string to the server */
if (rc < 0) {
mutt_socket_write (idata->conn, "*\r\n");
- debug_print (1, ("sasl_client_step error %d\n", rc));
}
olen = 0;