mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
relay/api: fix connection to remote without password (closes #2158)
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
- php: fix return value of function hdata_longlong
|
||||
- tcl: fix return value of function hdata_longlong ([#2119](https://github.com/weechat/weechat/issues/2119))
|
||||
- relay/api: allow clients without authentication when no relay password is defined and option relay.network.allow_empty_password is on ([#2158](https://github.com/weechat/weechat/issues/2158))
|
||||
- relay/api: fix connection to remote without password ([#2158](https://github.com/weechat/weechat/issues/2158))
|
||||
- relay/api: fix timezone of dates sent to clients ([#2151](https://github.com/weechat/weechat/issues/2151))
|
||||
- relay/api: fix "body_type" returned when lines or nicks of a buffer are requested
|
||||
- relay/api: fix read of one buffer line
|
||||
|
||||
@@ -655,6 +655,7 @@ relay_remote_network_connect_ws_auth (struct t_relay_remote *remote)
|
||||
password = NULL;
|
||||
totp_secret = NULL;
|
||||
str_auth[0] = '\0';
|
||||
str_auth_base64[0] = '\0';
|
||||
str_totp[0] = '\0';
|
||||
str_extensions[0] = '\0';
|
||||
|
||||
@@ -717,7 +718,7 @@ relay_remote_network_connect_ws_auth (struct t_relay_remote *remote)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!str_auth[0])
|
||||
if (password[0] && !str_auth[0])
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%sremote[%s]: failed to build authentication"),
|
||||
@@ -732,7 +733,8 @@ relay_remote_network_connect_ws_auth (struct t_relay_remote *remote)
|
||||
free (remote->websocket_key);
|
||||
remote->websocket_key = strdup (ws_key_base64);
|
||||
|
||||
weechat_string_base_encode ("64", str_auth, strlen (str_auth), str_auth_base64);
|
||||
if (str_auth[0])
|
||||
weechat_string_base_encode ("64", str_auth, strlen (str_auth), str_auth_base64);
|
||||
|
||||
if (totp_secret && totp_secret[0])
|
||||
{
|
||||
@@ -759,7 +761,7 @@ relay_remote_network_connect_ws_auth (struct t_relay_remote *remote)
|
||||
snprintf (
|
||||
str_http, sizeof (str_http),
|
||||
"GET /api HTTP/1.1\r\n"
|
||||
"Authorization: Basic %s\r\n"
|
||||
"%s%s%s"
|
||||
"%s"
|
||||
"Sec-WebSocket-Version: 13\r\n"
|
||||
"Sec-WebSocket-Key: %s\r\n"
|
||||
@@ -768,7 +770,9 @@ relay_remote_network_connect_ws_auth (struct t_relay_remote *remote)
|
||||
"%s"
|
||||
"Host: %s:%d\r\n"
|
||||
"\r\n",
|
||||
str_auth_base64,
|
||||
(str_auth_base64[0]) ? "Authorization: Basic " : "",
|
||||
(str_auth_base64[0]) ? str_auth_base64 : "",
|
||||
(str_auth_base64[0]) ? "\r\n" : "",
|
||||
str_totp,
|
||||
ws_key_base64,
|
||||
str_extensions,
|
||||
|
||||
Reference in New Issue
Block a user