Nico Golde:
[apps/madmutt.git] / mutt_sasl.c
index 6a20137..33e2b3a 100644 (file)
 
 /* common SASL helper routines */
 
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include "mutt.h"
 #include "account.h"
 #include "mutt_sasl.h"
 #include "mutt_socket.h"
 
 #ifdef USE_SASL2
+#include <errno.h>
 #include <netdb.h>
 #include <sasl/sasl.h>
 #else
@@ -189,7 +194,7 @@ int mutt_sasl_client_new (CONNECTION* conn, sasl_conn_t** saslconn)
       service = "imap";
       break;
     case M_ACCT_TYPE_POP:
-      service = "pop-3";
+      service = "pop";
       break;
     default:
       dprint (1, (debugfile, "mutt_sasl_client_new: account type unset\n"));
@@ -293,7 +298,7 @@ dprint(1,(debugfile, "local ip: %s, remote ip:%s\n", iplocalport, ipremoteport))
    * If someone does it'd probably be trivial to write mutt_nss_get_ssf().
    * I have a feeling more SSL code could be shared between those two files,
    * but I haven't looked into it yet, since I still don't know the APIs. */
-#if defined(USE_SSL) && !defined(USE_NSS)
+#if (defined(USE_SSL) || defined(USE_GNUTLS) && !defined(USE_NSS))
   if (conn->account.flags & M_ACCT_SSL)
   {
 #ifdef USE_SASL2 /* I'm not sure this actually has an effect, at least with SASLv2 */
@@ -310,8 +315,8 @@ dprint(1,(debugfile, "local ip: %s, remote ip:%s\n", iplocalport, ipremoteport))
       return -1;
     }
 #ifdef USE_SASL2
-    dprint (2, (debugfile, "External authentication name: %s\n","NULL"));
-    if (sasl_setprop (*saslconn, SASL_AUTH_EXTERNAL, NULL) != SASL_OK)
+    dprint (2, (debugfile, "External authentication name: %s\n", conn->account.user));
+    if (sasl_setprop (*saslconn, SASL_AUTH_EXTERNAL, conn->account.user) != SASL_OK)
      {
       dprint (1, (debugfile, "mutt_sasl_client_new: Error setting external properties\n"));
       return -1;