stop parsing config lines after invalid keyword

otherwise we may pointlessly complain about excess tokens.
This commit is contained in:
Oswald Buddenhagen 2022-05-18 19:08:55 +02:00
parent 5d5e07eb63
commit 09f08e4974
3 changed files with 5 additions and 0 deletions

View File

@ -475,6 +475,7 @@ load_config( const char *where )
} else if (!getopt_helper( &cfile, &cops, channel )) { } else if (!getopt_helper( &cfile, &cops, channel )) {
error( "%s:%d: keyword '%s' is not recognized in Channel sections\n", error( "%s:%d: keyword '%s' is not recognized in Channel sections\n",
cfile.file, cfile.line, cfile.cmd ); cfile.file, cfile.line, cfile.cmd );
cfile.rest = NULL;
cfile.err = 1; cfile.err = 1;
} }
} }
@ -522,6 +523,7 @@ load_config( const char *where )
} else { } else {
error( "%s:%d: keyword '%s' is not recognized in Group sections\n", error( "%s:%d: keyword '%s' is not recognized in Group sections\n",
cfile.file, cfile.line, cfile.cmd ); cfile.file, cfile.line, cfile.cmd );
cfile.rest = NULL;
cfile.err = 1; 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", error( "%s:%d: '%s' is not a recognized section-starting or global keyword\n",
cfile.file, cfile.line, cfile.cmd ); cfile.file, cfile.line, cfile.cmd );
cfile.err = 1; cfile.err = 1;
cfile.rest = NULL;
while (getcline( &cfile )) while (getcline( &cfile ))
if (!cfile.cmd) if (!cfile.cmd)
goto reloop; goto reloop;

View File

@ -77,6 +77,7 @@ parse_generic_store( store_conf_t *store, conffile_t *cfg, const char *type )
store->flat_delim = nfstrdup( cfg->val ); store->flat_delim = nfstrdup( cfg->val );
} else { } else {
error( "%s:%d: keyword '%s' is not recognized in %s sections\n", cfg->file, cfg->line, cfg->cmd, type ); 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; cfg->err = 1;
} }
} }

View File

@ -3704,6 +3704,7 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
} else { } else {
error( "%s:%d: keyword '%s' is not recognized in IMAPAccount sections\n", error( "%s:%d: keyword '%s' is not recognized in IMAPAccount sections\n",
cfg->file, cfg->line, cfg->cmd ); cfg->file, cfg->line, cfg->cmd );
cfg->rest = NULL;
cfg->err = 1; cfg->err = 1;
continue; continue;
} }