diff --git a/src/lib-sieve/sieve-validator.c b/src/lib-sieve/sieve-validator.c index 3319572b5..90051d0bb 100644 --- a/src/lib-sieve/sieve-validator.c +++ b/src/lib-sieve/sieve-validator.c @@ -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