Skip to content

Commit

Permalink
lib-sieve: validator: Prevent duplicate registration of persistent co…
Browse files Browse the repository at this point in the history
…mmand tags.
  • Loading branch information
stephanbosch committed Feb 29, 2016
1 parent 6178058 commit 5181c14
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/lib-sieve/sieve-validator.c
Expand Up @@ -429,14 +429,23 @@ void sieve_validator_register_persistent_tag

struct sieve_tag_registration *reg;

if ( !array_is_created(&cmd_reg->persistent_tags) )
p_array_init(&cmd_reg->persistent_tags, valdtr->pool, 4);
else {
struct sieve_tag_registration *const *reg_idx;

/* Avoid dupplicate registration */
array_foreach (&cmd_reg->persistent_tags, reg_idx) {
if ((*reg_idx)->tag_def == tag_def)
return;
}
}

reg = p_new(valdtr->pool, struct sieve_tag_registration, 1);
reg->ext = ext;
reg->tag_def = tag_def;
reg->id_code = -1;

if ( !array_is_created(&cmd_reg->persistent_tags) )
p_array_init(&cmd_reg->persistent_tags, valdtr->pool, 4);

array_append(&cmd_reg->persistent_tags, &reg, 1);
}
}
Expand Down

0 comments on commit 5181c14

Please sign in to comment.