Skip to content

Commit

Permalink
in_forward: Handle '' and "" or absent value for yaml value as an emp…
Browse files Browse the repository at this point in the history
…ty shared_key

Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Dec 3, 2024
1 parent d573777 commit 2acc449
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions plugins/in_forward/fw_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,21 @@ struct flb_in_fw_config *fw_config_init(struct flb_input_instance *i_ins)
/* Shared Key */
p = flb_input_get_property("shared_key", i_ins);
if (p) {
config->shared_key = flb_sds_create(p);
if (strcmp(p, "\'\'") == 0 || strcmp(p, "\"\"") == 0) {
config->shared_key = flb_sds_create("");
}
else {
config->shared_key = flb_sds_create(p);
}
}
else {
config->shared_key = NULL;
config->shared_key = flb_sds_create("");
}
if (config->shared_key == NULL) {
flb_plg_error(i_ins, "could not initialize shared_key");
fw_config_destroy(config);

return NULL;
}

/* Self Hostname */
Expand Down

0 comments on commit 2acc449

Please sign in to comment.