Skip to content

Commit 2acc449

Browse files
committed
in_forward: Handle '' and "" or absent value for yaml value as an empty shared_key
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent d573777 commit 2acc449

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

plugins/in_forward/fw_config.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,21 @@ struct flb_in_fw_config *fw_config_init(struct flb_input_instance *i_ins)
8888
/* Shared Key */
8989
p = flb_input_get_property("shared_key", i_ins);
9090
if (p) {
91-
config->shared_key = flb_sds_create(p);
91+
if (strcmp(p, "\'\'") == 0 || strcmp(p, "\"\"") == 0) {
92+
config->shared_key = flb_sds_create("");
93+
}
94+
else {
95+
config->shared_key = flb_sds_create(p);
96+
}
9297
}
9398
else {
94-
config->shared_key = NULL;
99+
config->shared_key = flb_sds_create("");
100+
}
101+
if (config->shared_key == NULL) {
102+
flb_plg_error(i_ins, "could not initialize shared_key");
103+
fw_config_destroy(config);
104+
105+
return NULL;
95106
}
96107

97108
/* Self Hostname */

0 commit comments

Comments
 (0)