diff options
-rw-r--r-- | ChangeLog.adoc | 2 | ||||
-rw-r--r-- | src/plugins/relay/api/relay-api-protocol.c | 14 | ||||
-rw-r--r-- | src/plugins/relay/relay-config.c | 50 | ||||
-rw-r--r-- | src/plugins/relay/relay-config.h | 3 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-protocol.c | 14 |
5 files changed, 27 insertions, 56 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 0336efbf7..677da6da5 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -19,7 +19,7 @@ New features:: * core: use function util_strftimeval in evaluation of expression `date:xxx` * api: add support of specifier `%!` for timestamp in function util_strftimeval * api: add support of base64url in encode/decode functions - * relay: add "api" protocol (HTTP REST API), add option relay.look.display_clients, change option type relay.look.auto_open_buffer to string (issue #2066) + * relay: add "api" protocol (HTTP REST API), add option relay.look.display_clients, change option type relay.look.auto_open_buffer to string, rename option relay.weechat.commands to relay.network.commands (issue #2066) * relay: add support of websocket extension "permessage-deflate" (issue #1549) Bug fixes:: diff --git a/src/plugins/relay/api/relay-api-protocol.c b/src/plugins/relay/api/relay-api-protocol.c index fb1983422..f04264125 100644 --- a/src/plugins/relay/api/relay-api-protocol.c +++ b/src/plugins/relay/api/relay-api-protocol.c @@ -480,7 +480,7 @@ error: RELAY_API_PROTOCOL_CALLBACK(input) { cJSON *json_body, *json_buffer, *json_command; - const char *ptr_buffer_name, *ptr_command, *ptr_weechat_commands; + const char *ptr_buffer_name, *ptr_command, *ptr_commands; struct t_gui_buffer *ptr_buffer; struct t_hashtable *options; @@ -541,15 +541,9 @@ RELAY_API_PROTOCOL_CALLBACK(input) return WEECHAT_RC_OK; } - ptr_weechat_commands = weechat_config_string ( - relay_config_weechat_commands); - if (ptr_weechat_commands && ptr_weechat_commands[0]) - { - weechat_hashtable_set ( - options, - "commands", - weechat_config_string (relay_config_weechat_commands)); - } + ptr_commands = weechat_config_string (relay_config_network_commands); + if (ptr_commands && ptr_commands[0]) + weechat_hashtable_set (options, "commands", ptr_commands); /* * delay the execution of command after we go back in the WeeChat diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c index b0f6beeca..b9c4422ec 100644 --- a/src/plugins/relay/relay-config.c +++ b/src/plugins/relay/relay-config.c @@ -47,7 +47,6 @@ struct t_config_section *relay_config_section_look = NULL; struct t_config_section *relay_config_section_color = NULL; struct t_config_section *relay_config_section_network = NULL; struct t_config_section *relay_config_section_irc = NULL; -struct t_config_section *relay_config_section_weechat = NULL; struct t_config_section *relay_config_section_port = NULL; struct t_config_section *relay_config_section_path = NULL; @@ -74,6 +73,7 @@ struct t_config_option *relay_config_network_allowed_ips = NULL; struct t_config_option *relay_config_network_auth_timeout = NULL; struct t_config_option *relay_config_network_bind_address = NULL; struct t_config_option *relay_config_network_clients_purge_delay = NULL; +struct t_config_option *relay_config_network_commands = NULL; struct t_config_option *relay_config_network_compression = NULL; struct t_config_option *relay_config_network_ipv6 = NULL; struct t_config_option *relay_config_network_max_clients = NULL; @@ -96,10 +96,6 @@ struct t_config_option *relay_config_irc_backlog_since_last_message = NULL; struct t_config_option *relay_config_irc_backlog_tags = NULL; struct t_config_option *relay_config_irc_backlog_time_format = NULL; -/* relay config, weechat section */ - -struct t_config_option *relay_config_weechat_commands = NULL; - /* other */ int relay_config_auto_open_buffer[RELAY_NUM_PROTOCOLS]; @@ -1288,6 +1284,22 @@ relay_config_init () "clients immediately, -1 = never purge)"), NULL, -1, 60 * 24 * 30, "0", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_network_commands = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "commands", "string", + N_("comma-separated list of commands allowed/denied when input " + "data (text or command) is received from a client (weechat " + "and api protocols); " + "\"*\" means any command, a name beginning with \"!\" is " + "a negative value to prevent a command from being executed, " + "wildcard \"*\" is allowed in names; this option should be set " + "if the relay client is not safe (someone could use it to run " + "commands); for example \"*,!exec,!quit\" allows any command " + "except /exec and /quit"), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); relay_config_network_compression = weechat_config_new_option ( relay_config_file, relay_config_section_network, "compression", "integer", @@ -1478,34 +1490,6 @@ relay_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - /* section weechat */ - relay_config_section_weechat = weechat_config_new_section ( - relay_config_file, "weechat", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (relay_config_section_weechat) - { - relay_config_weechat_commands = weechat_config_new_option ( - relay_config_file, relay_config_section_weechat, - "commands", "string", - N_("comma-separated list of commands allowed/denied when input " - "data (text or command) is received from a client; " - "\"*\" means any command, a name beginning with \"!\" is " - "a negative value to prevent a command from being executed, " - "wildcard \"*\" is allowed in names; this option should be set " - "if the relay client is not safe (someone could use it to run " - "commands); for example \"*,!exec,!quit\" allows any command " - "except /exec and /quit"), - NULL, 0, 0, "", NULL, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - } - /* section port */ relay_config_section_port = weechat_config_new_section ( relay_config_file, "port", diff --git a/src/plugins/relay/relay-config.h b/src/plugins/relay/relay-config.h index bc49aca01..de5697341 100644 --- a/src/plugins/relay/relay-config.h +++ b/src/plugins/relay/relay-config.h @@ -45,6 +45,7 @@ extern struct t_config_option *relay_config_network_allowed_ips; extern struct t_config_option *relay_config_network_auth_timeout; extern struct t_config_option *relay_config_network_bind_address; extern struct t_config_option *relay_config_network_clients_purge_delay; +extern struct t_config_option *relay_config_network_commands; extern struct t_config_option *relay_config_network_compression; extern struct t_config_option *relay_config_network_ipv6; extern struct t_config_option *relay_config_network_max_clients; @@ -65,8 +66,6 @@ extern struct t_config_option *relay_config_irc_backlog_since_last_message; extern struct t_config_option *relay_config_irc_backlog_tags; extern struct t_config_option *relay_config_irc_backlog_time_format; -extern struct t_config_option *relay_config_weechat_commands; - extern int relay_config_auto_open_buffer[]; extern int relay_config_display_clients[]; extern regex_t *relay_config_regex_allowed_ips; diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c index acc16b2dc..a7d47e3af 100644 --- a/src/plugins/relay/weechat/relay-weechat-protocol.c +++ b/src/plugins/relay/weechat/relay-weechat-protocol.c @@ -612,7 +612,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(input) { struct t_gui_buffer *ptr_buffer; struct t_hashtable *options; - const char *ptr_weechat_commands; + const char *ptr_commands; char *pos; RELAY_WEECHAT_PROTOCOL_MIN_ARGS(1); @@ -648,15 +648,9 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(input) return WEECHAT_RC_OK; } - ptr_weechat_commands = weechat_config_string ( - relay_config_weechat_commands); - if (ptr_weechat_commands && ptr_weechat_commands[0]) - { - weechat_hashtable_set ( - options, - "commands", - weechat_config_string (relay_config_weechat_commands)); - } + ptr_commands = weechat_config_string (relay_config_network_commands); + if (ptr_commands && ptr_commands[0]) + weechat_hashtable_set (options, "commands", ptr_commands); /* * delay the execution of command after we go back in the WeeChat |