Skip to content

Commit

Permalink
in_forward: Support empty_shared_key parameter (#9681)
Browse files Browse the repository at this point in the history
* in_forward: Support empty_shared_key parameter

---------

Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 authored Dec 6, 2024
1 parent c50fecd commit 412d3ea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
7 changes: 6 additions & 1 deletion plugins/in_forward/fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ static struct flb_config_map config_map[] = {
},
{
FLB_CONFIG_MAP_STR, "shared_key", NULL,
0, FLB_FALSE, 0,
0, FLB_TRUE, offsetof(struct flb_in_fw_config, shared_key),
"Shared key for authentication"
},
{
Expand Down Expand Up @@ -448,6 +448,11 @@ static struct flb_config_map config_map[] = {
0, FLB_TRUE, offsetof(struct flb_in_fw_config, buffer_max_size),
"The maximum buffer memory size used to receive a Forward message."
},
{
FLB_CONFIG_MAP_BOOL, "empty_shared_key", "false",
0, FLB_TRUE, offsetof(struct flb_in_fw_config, empty_shared_key),
"Set an empty shared key for authentication"
},
{0}
};

Expand Down
1 change: 1 addition & 0 deletions plugins/in_forward/fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct flb_in_fw_config {
flb_sds_t shared_key; /* shared key */
flb_sds_t self_hostname; /* hostname used in certificate */
struct mk_list users; /* username and password pairs */
int empty_shared_key; /* use an empty string as shared key */

int coll_fd;
struct flb_downstream *downstream; /* Client manager */
Expand Down
11 changes: 5 additions & 6 deletions plugins/in_forward/fw_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,11 @@ 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);
}
else {
config->shared_key = NULL;
if (config->empty_shared_key) {
if (config->shared_key) {
flb_sds_destroy(config->shared_key);
}
config->shared_key = flb_sds_create("");
}

/* Self Hostname */
Expand Down

0 comments on commit 412d3ea

Please sign in to comment.