Skip to content

Commit 412d3ea

Browse files
authored
in_forward: Support empty_shared_key parameter (#9681)
* in_forward: Support empty_shared_key parameter --------- Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent c50fecd commit 412d3ea

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

plugins/in_forward/fw.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ static struct flb_config_map config_map[] = {
415415
},
416416
{
417417
FLB_CONFIG_MAP_STR, "shared_key", NULL,
418-
0, FLB_FALSE, 0,
418+
0, FLB_TRUE, offsetof(struct flb_in_fw_config, shared_key),
419419
"Shared key for authentication"
420420
},
421421
{
@@ -448,6 +448,11 @@ static struct flb_config_map config_map[] = {
448448
0, FLB_TRUE, offsetof(struct flb_in_fw_config, buffer_max_size),
449449
"The maximum buffer memory size used to receive a Forward message."
450450
},
451+
{
452+
FLB_CONFIG_MAP_BOOL, "empty_shared_key", "false",
453+
0, FLB_TRUE, offsetof(struct flb_in_fw_config, empty_shared_key),
454+
"Set an empty shared key for authentication"
455+
},
451456
{0}
452457
};
453458

plugins/in_forward/fw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct flb_in_fw_config {
6363
flb_sds_t shared_key; /* shared key */
6464
flb_sds_t self_hostname; /* hostname used in certificate */
6565
struct mk_list users; /* username and password pairs */
66+
int empty_shared_key; /* use an empty string as shared key */
6667

6768
int coll_fd;
6869
struct flb_downstream *downstream; /* Client manager */

plugins/in_forward/fw_config.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@ struct flb_in_fw_config *fw_config_init(struct flb_input_instance *i_ins)
8686
}
8787

8888
/* Shared Key */
89-
p = flb_input_get_property("shared_key", i_ins);
90-
if (p) {
91-
config->shared_key = flb_sds_create(p);
92-
}
93-
else {
94-
config->shared_key = NULL;
89+
if (config->empty_shared_key) {
90+
if (config->shared_key) {
91+
flb_sds_destroy(config->shared_key);
92+
}
93+
config->shared_key = flb_sds_create("");
9594
}
9695

9796
/* Self Hostname */

0 commit comments

Comments
 (0)