Impose the use of SASL2, so that we can drop a lot of useless old dead code.
[apps/madmutt.git] / imap / auth_gss.c
index 8fe099c..6e82a26 100644 (file)
@@ -9,15 +9,9 @@
 
 /* GSS login/authentication code */
 
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "mutt.h"
-#include "imap_private.h"
-#include "auth.h"
+#include <lib-lib/lib-lib.h>
 
-#include <lib-lib/macros.h>
+#ifdef USE_GSS
 
 #include <netinet/in.h>
 
 #define GSS_AUTH_P_INTEGRITY 2
 #define GSS_AUTH_P_PRIVACY   4
 
+#include "mutt.h"
+#include "imap_private.h"
+#include "auth.h"
+
 /* imap_auth_gss: AUTH=GSSAPI support. */
 imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute__ ((unused)))
 {
@@ -42,7 +40,6 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute
   gss_buffer_t sec_token;
   gss_name_t target_name;
   gss_ctx_id_t context;
-  gss_OID mech_name;
   gss_qop_t quality;
   int cflags;
   OM_uint32 maj_stat, min_stat;
@@ -176,7 +173,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute
   memcpy (buf1, &buf_size, 4);
   buf1[0] = GSS_AUTH_P_NONE;
   /* server decides if principal can log in as user */
-  strncpy (buf1 + 4, idata->conn->account.user, sizeof (buf1) - 4);
+  m_strcpy(buf1 + 4, sizeof(buf1) - 4, idata->conn->account.user);
   request_buf.value = buf1;
   request_buf.length = 4 + m_strlen(idata->conn->account.user) + 1;
   maj_stat = gss_wrap (&min_stat, context, 0, GSS_C_QOP_DEFAULT, &request_buf,
@@ -223,3 +220,5 @@ bail:
   mutt_sleep (2);
   return IMAP_AUTH_FAILURE;
 }
+
+#endif /* USE_GSS */