X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=imap%2Fauth_sasl.c;h=4d9df2640ef74aede786012ae8348828d812e953;hb=d5d56308b49c3f157a17125415312f0c13e1e25b;hp=fa1714fa26542442315bd7dba1aabc48e19d3da5;hpb=f5b0e714a215eddd4d9f8084b434b713f0a580b4;p=apps%2Fmadmutt.git diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index fa1714f..4d9df26 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -13,23 +13,19 @@ # include "config.h" #endif +#include +#include + #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 #include "lib/debug.h" -#ifdef USE_SASL2 #include #include -#else -#include -#include -#endif /* imap_auth_sasl: Default authenticator if available. */ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method) @@ -40,11 +36,7 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method) char buf[HUGE_STRING]; const char *mech; -#ifdef USE_SASL2 const char *pc = NULL; -#else - char *pc = NULL; -#endif unsigned int len, olen; unsigned char client_start; @@ -70,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))) -#ifdef USE_SASL2 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 { -#ifdef USE_SASL2 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); } @@ -128,13 +109,9 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method) goto bail; if (irc == IMAP_CMD_RESPOND) { -#ifdef USE_SASL2 if (sasl_decode64 - (idata->cmd.buf + 2, str_len (idata->cmd.buf + 2), buf, + (idata->cmd.buf + 2, m_strlen(idata->cmd.buf + 2), buf, LONG_STRING - 1, -#else - if (sasl_decode64 (idata->cmd.buf + 2, str_len (idata->cmd.buf + 2), buf, -#endif &len) != SASL_OK) { debug_print (1, ("error base64-decoding server response.\n")); goto bail; @@ -161,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; } - - /* sasl_client_st(art|ep) allocate pc with malloc, expect me to - * free it */ -#ifndef USE_SASL2 - mem_free (&pc); -#endif } 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); }