Skip to content

Commit

Permalink
Merge pull request cyrusimap#4834 from cyrusimap/imap_jmapaccess
Browse files Browse the repository at this point in the history
imapd.c: add support for JMAPACCESS capability and response code
  • Loading branch information
ksmurchison authored Mar 19, 2024
2 parents 5ff58be + b48001d commit fda0d0a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
19 changes: 19 additions & 0 deletions changes/next/imap_jmapaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

Description:

Adds support for IMAP JMAPACCESS response code (draft-ietf-extra-jmapaccess).


Config changes:

Adds jmapaccess_url option.


Upgrade instructions:

None.


GitHub issue:

None.
8 changes: 6 additions & 2 deletions docsrc/imap/rfc-support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,10 @@ The following is an inventory of RFCs supported by Cyrus IMAP.

IMAP4 Extension: Message Preview Generation

:rfc:`9042`

Sieve Email Filtering: Delivery by MAILBOXID

:rfc:`9051`

Internet Message Access Protocol (IMAP) - version 4rev2
Expand All @@ -931,9 +935,9 @@ draft-ietf-extra-imap-inprogress

IMAP4 Response Code for Command Progress Notifications

draft-ietf-extra-sieve-mailboxid
draft-ietf-extra-jmapaccess

Sieve Email Filtering: delivery by mailboxid
The JMAPACCESS Extension for IMAP

draft-ietf-extra-sieve-snooze

Expand Down
11 changes: 10 additions & 1 deletion imap/imapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ static int imapd_starttls_done = 0; /* have we done a successful starttls? */
static int imapd_tls_required = 0; /* is tls required? */
static void *imapd_tls_comp = NULL; /* TLS compression method, if any */
static int imapd_compress_done = 0; /* have we done a successful compress? */
static const char *imapd_jmapaccess_url = NULL;
static const char *plaintextloginalert = NULL;
static int ignorequota = 0;
static int sync_sieve_mailbox_enabled = 0;
Expand Down Expand Up @@ -416,7 +417,7 @@ static struct capa_struct base_capabilities[] = {
{ .statep = &imapd_idle_enabled } },
{ "IMAPSIEVE=", 0, /* not implemented */ { 0 } }, /* RFC 6785 */
{ "INPROGRESS", CAPA_POSTAUTH, { 0 } }, /* draft-ietf-extra-imap-inprogress */
{ "JMAPACCESS", 0, /* not implemented */ { 0 } }, /* draft-ietf-extra-jmapaccess */
{ "JMAPACCESS", 0, /* just a respcode */ { 0 } }, /* draft-ietf-extra-jmapaccess */
{ "LANGUAGE", 0, /* not implemented */ { 0 } }, /* RFC 5255 */
{ "LIST-EXTENDED", CAPA_POSTAUTH, { 0 } }, /* RFC 5258 */
{ "LIST-METADATA", CAPA_POSTAUTH, { 0 } }, /* draft-ietf-extra-imap-list-metadata */
Expand Down Expand Up @@ -1076,6 +1077,8 @@ int service_init(int argc, char **argv, char **envp)
imapd_compress_allowed = 1;
#endif

imapd_jmapaccess_url = config_getstring(IMAPOPT_JMAPACCESS_URL);

/* setup for sending IMAP IDLE/NOTIFY notifications */
if ((imapd_idle_enabled = idle_enabled())) {
idle_sock = idle_init();
Expand Down Expand Up @@ -2918,6 +2921,12 @@ static void authentication_success(const char *tag, int ssf, const char *reply)
/* authstate already created by mysasl_proxy_policy() */
imapd_userisadmin = global_authisa(imapd_authstate, IMAPOPT_ADMINS);

if (imapd_jmapaccess_url) {
prot_printf(imapd_out, "* OK [JMAPACCESS \"%s\"] %s\r\n",
imapd_jmapaccess_url,
"This server is also accessible via JMAP, see RFC8620");
}

prot_printf(imapd_out, "%s OK", tag);
if (!ssf) {
prot_puts(imapd_out, " [CAPABILITY");
Expand Down
5 changes: 5 additions & 0 deletions lib/imapoptions
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,11 @@ Blank lines and lines beginning with ``#'' are ignored.
the same has to be done (cyr_dbtool) for each subscription database
See improved_mboxlist_sort.html.*/

{ "jmapaccess_url", NULL, STRING, "UNRELEASED" }
/* The JMAP Session URL to advertise to sucessfully authenticated IMAP clients,
if the same credentials can be used to authenticate via JMAP
(see draft-ietf-extra-jmapaccess). */

{ "jmap_emailsearch_db_path", NULL, STRING, "3.1.6", "3.6.0" }
/* The absolute path to the JMAP email search cache file. If not
specified, JMAP Email/query and Email/queryChanges will not
Expand Down

0 comments on commit fda0d0a

Please sign in to comment.