Index | Thread | Search

From:
Edd Barrett <edd@theunixzoo.co.uk>
Subject:
mail/isync: improve an error message
To:
ports@openbsd.org
Cc:
kn@openbsd.org
Date:
Tue, 9 Jan 2024 14:48:11 +0000

Download raw body.

Thread
Hi,

On a couple of occasions now I've wasted time deciphering this error message
from `mbsync`:

```
IMAP error: selected SASL mechanism(s) not available;
   selected: XOAUTH2
   available: SCRAM-SHA-512 SCRAM-SHA-384 SCRAM-SHA-256 SCRAM-SHA-224 SCRAM-SHA-1 DIGEST-MD5 EXTERNAL OTP CRAM-MD5 NTLM LOGIN PLAIN ANONYMOUS
```

In my case it's because I don't have the cyrus-sasl-xoauth2 package installed,
but that's not very obvious for a user.

This patch improves the error message with a hint that I hope will save others
(and my future self) some time.

If we like this, I can try an upstream it.

OK?


Index: Makefile
===================================================================
RCS file: /cvs/ports/mail/isync/Makefile,v
diff -u -p -r1.57 Makefile
--- Makefile	7 Nov 2023 14:19:36 -0000	1.57
+++ Makefile	9 Jan 2024 14:20:33 -0000
@@ -1,7 +1,7 @@
 COMMENT=	synchronize IMAP4 and maildir mailboxes
 
 DISTNAME=	isync-1.4.4
-REVISION=	2
+REVISION=	3
 
 CATEGORIES=	mail
 SITES=		${SITE_SOURCEFORGE:=isync/}
Index: patches/patch-src_drv_imap_c
===================================================================
RCS file: /cvs/ports/mail/isync/patches/patch-src_drv_imap_c,v
diff -u -p -r1.12 patch-src_drv_imap_c
--- patches/patch-src_drv_imap_c	11 Mar 2022 19:34:38 -0000	1.12
+++ patches/patch-src_drv_imap_c	9 Jan 2024 14:39:36 -0000
@@ -1,4 +1,4 @@
-Use pledge.
+Use pledge and improve an error message.
 
 Index: src/drv_imap.c
 --- src/drv_imap.c.orig
@@ -12,6 +12,15 @@ Index: src/drv_imap.c
  #ifdef HAVE_LIBSSL
  enum { SSL_None, SSL_STARTTLS, SSL_IMAPS };
  #endif
+@@ -2477,7 +2479,7 @@ imap_open_store_authenticate2( imap_store_t *ctx )
+ 			saslavail = "(none)";
+ 		if (!auth_login) {
+ 			error( "IMAP error: selected SASL mechanism(s) not available;\n"
+-			       "   selected:%s\n   available: %s\n", saslmechs, saslavail );
++			       "   selected:'%s'\n   available: %s\nYou may need to install a cyrus-sasl plugin\n", saslmechs, saslavail );
+ 			goto skipnote;
+ 		}
+ 		info( "NOT using available SASL mechanism(s): %s\n", saslavail );
 @@ -3768,6 +3770,8 @@ imap_parse_store( conffile_t *cfg, store_conf_t **stor
  #endif
  				143;

-- 
Best Regards
Edd Barrett

https://www.theunixzoo.co.uk