[Patch] Fix broken IMAP Kerberos authentication

Albrecht Dreß <[email protected]>
Newsgroups gmane.comp.gnome.apps.balsa
Message-ID <[email protected]>
Hi all,

unfortunately the IMAP Kerberos (GSSAPI) is completely broken, unless your user name is “test” – for some strange reason, I forgot to fix a test version which (surprise) uses user test on a test vm with Samba4 & Kerberos.  Probably the right moment for me to grab a HUGE brown bag and hide in it… 😭

The trivial patch which emits the signal for reading the user name (no password is required in this case) is attached.

Sorry,
Albrecht.

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list
fix_broken_imap_kerberos_auth.diff (text/x-patch, 1.3 KB)
diff --git a/libbalsa/imap/auth-gssapi.c b/libbalsa/imap/auth-gssapi.c
index 1c382d502..14a2de569 100644
--- a/libbalsa/imap/auth-gssapi.c
+++ b/libbalsa/imap/auth-gssapi.c
@@ -115,6 +115,7 @@ imap_gss_auth_loop(ImapMboxHandle* handle, NetClientGssCtx *gss_ctx, unsigned cm
 ImapResult
 imap_auth_gssapi(ImapMboxHandle* handle)
 {
+	gchar **auth_data;
     NetClientGssCtx *gss_ctx;
     GError *error = NULL;
     ImapResult retval;
@@ -123,8 +124,15 @@ imap_auth_gssapi(ImapMboxHandle* handle)
         return IMAP_AUTH_UNAVAIL;
     }
 
+    g_signal_emit_by_name(handle->sio, "auth", FALSE, &auth_data);
+    if((auth_data == NULL) || (auth_data[0] == NULL)) {
+    	imap_mbox_handle_set_msg(handle, "User name required, authentication cancelled");
+    	g_strfreev(auth_data);
+    	return IMAP_AUTH_CANCELLED;
+    }
+
     /* try to create the context */
-    gss_ctx = net_client_gss_ctx_new("imap", handle->host, "test", &error);
+    gss_ctx = net_client_gss_ctx_new("imap", handle->host, auth_data[0], &error);
     if (gss_ctx == NULL) {
     	retval = IMAP_AUTH_UNAVAIL;
     } else {
@@ -145,6 +153,7 @@ imap_auth_gssapi(ImapMboxHandle* handle)
 		net_client_gss_ctx_free(gss_ctx);
 		retval = (result && (rc == IMR_OK)) ? IMAP_SUCCESS : IMAP_AUTH_UNAVAIL;
     }
+	g_strfreev(auth_data);
 
     if (error != NULL) {
         gchar *err_msg;
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEcCEPemLFTtyGf4zATKlvDmfn2fgFAlvPe+sACgkQTKlvDmfn
2fiQLQgA4TONccWilSgOLWTPTR6HX8k5PUpYT+vRTzDu9tabtukMC3ShJ7EFvKuz
yEfFxApMAl3VT2toPzTus8jRpHm9lISTLAJ+P2tOpBv7BI16k64kpz5gfnWUCJtz
yhv/k6o8H3qQReDmA6xu1K+j5htMi66zRG5iavmwfz+V0kMIu/MYx5m6lp3HBBRB
LFMqfvKctlqv99plKihvJ7SjSlRmYqSG48yYtaexJY+FIDGjxO5BO/q/D0bg/OKx
UxFiyF22wMhgQYI8Rq4XJkJ5lHd2hupzncoANcEfawnvAfDpvs0tHgjfn+ofZ6ew
m9ux5r5nxF/qQh+6n25dVdKJFda8LA==
=58nr
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.