[commit] 1.2: accept NAMESPACE responses without hierarchy delimiter
commit ef0e7fdd3e921d612220a830436bb9862bca61ac Author: Oswald BuddenhagenDate: Sun Dec 4 11:23:47 2016 +0100 accept NAMESPACE responses without hierarchy delimiter RFC2342 states that the delimiter may be NIL, which some servers apparently actually make use of. REFMAIL: CAM0xXk_FQ83CPrd37iQCMKtc1B2P8=u-r5jx0n2we5y+348...@mail.gmail.com src/drv_imap.c | 18 -- 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/drv_imap.c b/src/drv_imap.c index f15bc5b..83b0358 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -638,6 +638,12 @@ next_arg( char **ps ) } static int +is_opt_atom( list_t *list ) +{ + return list && list->val && list->val != LIST; +} + +static int is_atom( list_t *list ) { return list && list->val && list->val != NIL && list->val != LIST; @@ -850,7 +856,7 @@ parse_namespace_check( list_t *list ) goto bad; if (!is_atom( list->child )) goto bad; - if (!is_atom( list->child->next )) + if (!is_opt_atom( list->child->next )) goto bad; /* Namespace response extensions may follow here; we don't care. */ } @@ -2147,17 +2153,17 @@ static void imap_open_store_namespace2( imap_store_t *ctx ) { imap_store_conf_t *cfg = (imap_store_conf_t *)ctx->gen.conf; - list_t *nsp, *nsp_1st, *nsp_1st_ns, *nsp_1st_dl; + list_t *nsp, *nsp_1st; /* XXX for now assume 1st personal namespace */ if (is_list( (nsp = ctx->ns_personal) ) && - is_list( (nsp_1st = nsp->child) ) && - is_atom( (nsp_1st_ns = nsp_1st->child) ) && - is_atom( (nsp_1st_dl = nsp_1st_ns->next) )) + is_list( (nsp_1st = nsp->child) )) { + list_t *nsp_1st_ns = nsp_1st->child; + list_t *nsp_1st_dl = nsp_1st_ns->next; if (!ctx->prefix && cfg->use_namespace) ctx->prefix = nsp_1st_ns->val; - if (!ctx->delimiter) + if (!ctx->delimiter && is_atom( nsp_1st_dl )) ctx->delimiter = nfstrdup( nsp_1st_dl->val ); } imap_open_store_finalize( ctx ); -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ isync-devel mailing list isync-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/isync-devel
[commit] 1.2: validate NAMESPACE response earlier
commit 03e25db3b8e5e938f1bb1009d747514b1315cae7 Author: Oswald BuddenhagenDate: Sun Dec 4 11:14:34 2016 +0100 validate NAMESPACE response earlier ... and don't silently fail later on. src/drv_imap.c | 37 ++--- 1 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/drv_imap.c b/src/drv_imap.c index 686faef..f15bc5b 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -837,33 +837,50 @@ static int parse_namespace_rsp_p2( imap_store_t *, list_t *, char * ); static int parse_namespace_rsp_p3( imap_store_t *, list_t *, char * ); static int -parse_namespace_rsp_fail( void ) +parse_namespace_check( list_t *list ) { + if (!list) + goto bad; + if (list->val == NIL) + return 0; + if (list->val != LIST) + goto bad; + for (list = list->child; list; list = list->next) { + if (list->val != LIST) + goto bad; + if (!is_atom( list->child )) + goto bad; + if (!is_atom( list->child->next )) + goto bad; + /* Namespace response extensions may follow here; we don't care. */ + } + return 0; + bad: error( "IMAP error: malformed NAMESPACE response\n" ); - return LIST_BAD; + return -1; } static int parse_namespace_rsp( imap_store_t *ctx, list_t *list, char *s ) { - if (!(ctx->ns_personal = list)) - return parse_namespace_rsp_fail(); + if (parse_namespace_check( (ctx->ns_personal = list) )) + return LIST_BAD; return parse_list( ctx, s, parse_namespace_rsp_p2 ); } static int parse_namespace_rsp_p2( imap_store_t *ctx, list_t *list, char *s ) { - if (!(ctx->ns_other = list)) - return parse_namespace_rsp_fail(); + if (parse_namespace_check( (ctx->ns_other = list) )) + return LIST_BAD; return parse_list( ctx, s, parse_namespace_rsp_p3 ); } static int parse_namespace_rsp_p3( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED ) { - if (!(ctx->ns_shared = list)) - return parse_namespace_rsp_fail(); + if (parse_namespace_check( (ctx->ns_shared = list) )) + return LIST_BAD; return LIST_OK; } @@ -2142,10 +2159,8 @@ imap_open_store_namespace2( imap_store_t *ctx ) ctx->prefix = nsp_1st_ns->val; if (!ctx->delimiter) ctx->delimiter = nfstrdup( nsp_1st_dl->val ); - imap_open_store_finalize( ctx ); - } else { - imap_open_store_bail( ctx, FAIL_FINAL ); } + imap_open_store_finalize( ctx ); } static void -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ isync-devel mailing list isync-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/isync-devel
Re: Sasl: No worthy mechs found
On Sun, Dec 04, 2016 at 04:21:54AM +0100, Peter P. wrote: > Oswald Buddenhagen[2016-12-03 18:03]: > > then the next guess would be that libsasl2-modules is not installed. > > At least, on my system, libsasl2-modules is installed. > yeah, while testing my fixes, i found that you'd get at least EXTERNAL even if no modules at all are available, so that guess wasn't all that informed, either. things should work without workarounds in the 1.2 branch now. -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ isync-devel mailing list isync-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/isync-devel