From 09f08e4974aab8b8913de0125e81978ad9bf84c4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 18 May 2022 19:08:55 +0200 Subject: [PATCH] stop parsing config lines after invalid keyword otherwise we may pointlessly complain about excess tokens. --- src/config.c | 3 +++ src/driver.c | 1 + src/drv_imap.c | 1 + 3 files changed, 5 insertions(+) diff --git a/src/config.c b/src/config.c index f932920..036ad41 100644 --- a/src/config.c +++ b/src/config.c @@ -475,6 +475,7 @@ load_config( const char *where ) } else if (!getopt_helper( &cfile, &cops, channel )) { error( "%s:%d: keyword '%s' is not recognized in Channel sections\n", cfile.file, cfile.line, cfile.cmd ); + cfile.rest = NULL; cfile.err = 1; } } @@ -522,6 +523,7 @@ load_config( const char *where ) } else { error( "%s:%d: keyword '%s' is not recognized in Group sections\n", cfile.file, cfile.line, cfile.cmd ); + cfile.rest = NULL; cfile.err = 1; } } @@ -550,6 +552,7 @@ load_config( const char *where ) error( "%s:%d: '%s' is not a recognized section-starting or global keyword\n", cfile.file, cfile.line, cfile.cmd ); cfile.err = 1; + cfile.rest = NULL; while (getcline( &cfile )) if (!cfile.cmd) goto reloop; diff --git a/src/driver.c b/src/driver.c index 05bbb9b..ef63719 100644 --- a/src/driver.c +++ b/src/driver.c @@ -77,6 +77,7 @@ parse_generic_store( store_conf_t *store, conffile_t *cfg, const char *type ) store->flat_delim = nfstrdup( cfg->val ); } else { error( "%s:%d: keyword '%s' is not recognized in %s sections\n", cfg->file, cfg->line, cfg->cmd, type ); + cfg->rest = NULL; cfg->err = 1; } } diff --git a/src/drv_imap.c b/src/drv_imap.c index 34cc951..31beb59 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -3704,6 +3704,7 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep ) } else { error( "%s:%d: keyword '%s' is not recognized in IMAPAccount sections\n", cfg->file, cfg->line, cfg->cmd ); + cfg->rest = NULL; cfg->err = 1; continue; }