]> granicus.if.org Git - neomutt/commitdiff
An updated version of the previous patch. From Brendan.
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 13 Jun 2001 08:28:12 +0000 (08:28 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 13 Jun 2001 08:28:12 +0000 (08:28 +0000)
imap/auth_sasl.c
mutt_sasl.c
mutt_sasl.h
pop_auth.c

index 818d37db8cab9c210773a73f8bee281f06218dce..5c54f5dc7128299efdfb4f74df9488f55967f837 100644 (file)
@@ -38,9 +38,6 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata, const char* method)
   unsigned int len, olen;
   unsigned char client_start;
 
-  if (mutt_sasl_start () != SASL_OK)
-    return IMAP_AUTH_FAILURE;
-
   if (mutt_sasl_client_new (idata->conn, &saslconn) < 0)
   {
     dprint (1, (debugfile,
index 91e190fff6918a5e46856a446768cb3ccb91f248..f4ff9b688a5adad3ae13e5a3a73a106296f4d3db 100644 (file)
@@ -34,6 +34,8 @@
 
 static sasl_callback_t mutt_sasl_callbacks[5];
 
+static int mutt_sasl_start (void);
+
 /* callbacks */
 static int mutt_sasl_cb_log (void* context, int priority, const char* message);
 static int mutt_sasl_cb_authname (void* context, int id, const char** result,
@@ -57,30 +59,31 @@ int mutt_sasl_start (void)
   sasl_callback_t* callback, callbacks[2];
   int rc;
 
-  if (!sasl_init) {
-    /* set up default logging callback */
-    callback = callbacks;
+  if (sasl_init)
+    return SASL_OK;
 
-    callback->id = SASL_CB_LOG;
-    callback->proc = mutt_sasl_cb_log;
-    callback->context = NULL;
-    callback++;
+  /* set up default logging callback */
+  callback = callbacks;
 
-    callback->id = SASL_CB_LIST_END;
-    callback->proc = NULL;
-    callback->context = NULL;
+  callback->id = SASL_CB_LOG;
+  callback->proc = mutt_sasl_cb_log;
+  callback->context = NULL;
+  callback++;
 
-    rc = sasl_client_init (callbacks);
+  callback->id = SASL_CB_LIST_END;
+  callback->proc = NULL;
+  callback->context = NULL;
 
-    if (rc != SASL_OK)
-    {
-      dprint (1, (debugfile, "mutt_sasl_start: libsasl initialisation failed.\n"));
-      return SASL_FAIL;
-    }
+  rc = sasl_client_init (callbacks);
 
-    sasl_init = 1;
+  if (rc != SASL_OK)
+  {
+    dprint (1, (debugfile, "mutt_sasl_start: libsasl initialisation failed.\n"));
+    return SASL_FAIL;
   }
 
+  sasl_init = 1;
+
   return SASL_OK;
 }
 
@@ -94,6 +97,9 @@ int mutt_sasl_client_new (CONNECTION* conn, sasl_conn_t** saslconn)
   const char* service;
   int rc;
 
+  if (mutt_sasl_start () != SASL_OK)
+    return -1;
+
   switch (conn->account.type)
   {
     case M_ACCT_TYPE_IMAP:
index 1e236c0c5a5b237f8d250a5a45f2c58513f29180..2e7e473910f1060ff22aee8893db7064bc95d206 100644 (file)
@@ -25,7 +25,6 @@
 
 #include "mutt_socket.h"
 
-int mutt_sasl_start (void);
 int mutt_sasl_client_new (CONNECTION*, sasl_conn_t**);
 sasl_callback_t* mutt_sasl_get_callbacks (ACCOUNT*);
 int mutt_sasl_interact (sasl_interact_t*);
index 0553075362c90a242f1ef48a5017b80adc9eb618..fa62400530e21efb0e939387d4233cb62850e472 100644 (file)
@@ -45,12 +45,6 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA *pop_data)
   unsigned int len, olen;
   unsigned char client_start;
 
-  if (!pop_data->auth_list)
-    return POP_A_UNAVAIL;
-
-  if (mutt_sasl_start () != SASL_OK)
-    return POP_A_FAILURE;
-
   if (mutt_sasl_client_new (pop_data->conn, &saslconn) < 0)
   {
     dprint (1, (debugfile, "pop_auth_sasl: Error allocating SASL connection.\n"));