Skip to content

Commit

Permalink
lib-sieve: Fix assert panic occurring when used command has external …
Browse files Browse the repository at this point in the history
…tag, but is not registered.

This occurred for example when the "fileinto" command is used with only the
"copy" extension in the require line.

Panic message was:

Panic: file hash.c: line 263 (hash_table_insert_node): assertion failed: (opcode == HASH_TABLE_OP_UPDATE)
  • Loading branch information
stephanbosch committed Mar 5, 2018
1 parent 26afe30 commit e45df36
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib-sieve/sieve-validator.c
Expand Up @@ -352,8 +352,16 @@ void sieve_validator_register_command
static void sieve_validator_register_unknown_command
(struct sieve_validator *valdtr, const char *command)
{
(void)_sieve_validator_register_command
(valdtr, NULL, &unknown_command, command);
struct sieve_command_registration *cmd_reg =
sieve_validator_find_command_registration(valdtr, command);

if (cmd_reg == NULL) {
(void)_sieve_validator_register_command
(valdtr, NULL, &unknown_command, command);
} else {
i_assert(cmd_reg->cmd_def == NULL);
cmd_reg->cmd_def = &unknown_command;
}
}

/*const struct sieve_command *sieve_validator_find_command
Expand Down

0 comments on commit e45df36

Please sign in to comment.