Browse Source

relay: fix binding to an IP address (bug #39119)

master
Mantas Mikulėnas 9 years ago
committed by Sebastien Helleu
parent
commit
1e49718398
  1. 1
      AUTHORS
  2. 3
      ChangeLog
  3. 7
      po/cs.po
  4. 7
      po/de.po
  5. 7
      po/es.po
  6. 9
      po/fr.po
  7. 7
      po/hu.po
  8. 7
      po/it.po
  9. 7
      po/ja.po
  10. 7
      po/pl.po
  11. 7
      po/pt_BR.po
  12. 7
      po/ru.po
  13. 7
      po/weechat.pot
  14. 40
      src/plugins/relay/relay-server.c

1
AUTHORS

@ -39,6 +39,7 @@ Alphabetically:
* Kyle Fuller (kylef)
* Lázaro A.
* Marco Paolone
* Mantas Mikulėnas (grawity)
* Mateusz Poszwa
* Nicolas Cavigneaux
* Nils Görs (nils_2)

3
ChangeLog

@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.2-dev, 2013-05-29
v0.4.2-dev, 2013-05-30
This document lists all changes for each version.
@ -22,6 +22,7 @@ Version 0.4.2 (under dev!)
to empty string
* irc: fix multiple nicks in command /query (separated by commas): open one
buffer per nick
* relay: fix binding to an IP address (bug #39119)
* xfer: fix compilation on OpenBSD (bug #39071)
Version 0.4.1 (2013-05-20)

7
po/cs.po

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-05-29 11:55+0200\n"
"POT-Creation-Date: 2013-05-30 07:59+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -8104,6 +8104,11 @@ msgstr "%s%s: adresa \"%s\" nenalezena"
msgid "%s%s: cannot set socket option \"%s\" to %d: error %d %s"
msgstr "%s%s: nemohu vytvořit soket pro xfer"
#. TRANSLATORS: second "%s" is "IPv4" or "IPv6"
#, fuzzy, c-format
msgid "%s%s: invalid bind address \"%s\" for %s"
msgstr "%s%s: nekorektní znaková sada: \"%s\""
#, fuzzy, c-format
msgid "%s%s: cannot create socket: error %d %s"
msgstr "%s%s: nemohu vytvořit soket pro xfer"

7
po/de.po

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-05-29 11:55+0200\n"
"POT-Creation-Date: 2013-05-30 07:59+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@ -8858,6 +8858,11 @@ msgstr ""
"%s%s: Die Socket-Option \"%s\" kann nicht auf %d geändert werden: Fehler %d "
"%s"
#. TRANSLATORS: second "%s" is "IPv4" or "IPv6"
#, fuzzy, c-format
msgid "%s%s: invalid bind address \"%s\" for %s"
msgstr "%s%s: Ungültiger Zeichensatz: \"%s\""
#, c-format
msgid "%s%s: cannot create socket: error %d %s"
msgstr "%s%s: Socket kann nicht erstellt werden: Fehler %d %s"

7
po/es.po

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-05-29 11:55+0200\n"
"POT-Creation-Date: 2013-05-30 07:59+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -8371,6 +8371,11 @@ msgstr "%s%s: dirección IP \"%s\" no permitida por el repetidor"
msgid "%s%s: cannot set socket option \"%s\" to %d: error %d %s"
msgstr "%s%s: no ha sido posible crear el socket para la transferencia"
#. TRANSLATORS: second "%s" is "IPv4" or "IPv6"
#, fuzzy, c-format
msgid "%s%s: invalid bind address \"%s\" for %s"
msgstr "%s%s: set de caracteres inválido: \"%s\""
#, fuzzy, c-format
msgid "%s%s: cannot create socket: error %d %s"
msgstr "%s%s: no ha sido posible crear el socket para la transferencia"

9
po/fr.po

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-05-29 11:55+0200\n"
"PO-Revision-Date: 2013-05-29 11:57+0200\n"
"POT-Creation-Date: 2013-05-30 07:59+0200\n"
"PO-Revision-Date: 2013-05-29 20:42+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -8617,6 +8617,11 @@ msgstr "%s%s: adresse IP \"%s\" non autorisée pour le relai"
msgid "%s%s: cannot set socket option \"%s\" to %d: error %d %s"
msgstr "%s%s: impossible d'activer l'option socket \"%s\" à %d: erreur %d %s"
#. TRANSLATORS: second "%s" is "IPv4" or "IPv6"
#, c-format
msgid "%s%s: invalid bind address \"%s\" for %s"
msgstr "%s%s: adresse \"%s\" invalide pour le bind %s"
#, c-format
msgid "%s%s: cannot create socket: error %d %s"
msgstr "%s%s: impossible de créer le socket: erreur %d %s"

7
po/hu.po

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-05-29 11:55+0200\n"
"POT-Creation-Date: 2013-05-30 07:59+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -7576,6 +7576,11 @@ msgstr "%s cím \"%s\" nem található\n"
msgid "%s%s: cannot set socket option \"%s\" to %d: error %d %s"
msgstr "%s nem sikerült a csatornát létrehozni\n"
#. TRANSLATORS: second "%s" is "IPv4" or "IPv6"
#, fuzzy, c-format
msgid "%s%s: invalid bind address \"%s\" for %s"
msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n"
#, fuzzy, c-format
msgid "%s%s: cannot create socket: error %d %s"
msgstr "%s nem sikerült a csatornát létrehozni\n"

7
po/it.po

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-05-29 11:55+0200\n"
"POT-Creation-Date: 2013-05-30 07:59+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -8454,6 +8454,11 @@ msgid "%s%s: cannot set socket option \"%s\" to %d: error %d %s"
msgstr ""
"%s%s: impossibile impostare l'opzione del socket \"%s\" ind %d: errore %d %s"
#. TRANSLATORS: second "%s" is "IPv4" or "IPv6"
#, fuzzy, c-format
msgid "%s%s: invalid bind address \"%s\" for %s"
msgstr "%s%s: set di caratter invalido: \"%s\""
#, c-format
msgid "%s%s: cannot create socket: error %d %s"
msgstr "%s%s: impossibile creare il socker: errore %d %s"

7
po/ja.po

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-05-29 11:55+0200\n"
"POT-Creation-Date: 2013-05-30 07:59+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@ -8328,6 +8328,11 @@ msgstr "%s%s: IP アドレス \"%s\" はリレーの許可がありません"
msgid "%s%s: cannot set socket option \"%s\" to %d: error %d %s"
msgstr "%s%s: ソケットオプション \"%s\" を %d に設定できません: エラー %d %s"
#. TRANSLATORS: second "%s" is "IPv4" or "IPv6"
#, fuzzy, c-format
msgid "%s%s: invalid bind address \"%s\" for %s"
msgstr "%s%s: 不正な文字集合: \"%s\""
#, c-format
msgid "%s%s: cannot create socket: error %d %s"
msgstr "%s%s: ソケットの作成に失敗: エラー %d %s"

7
po/pl.po

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-05-29 11:55+0200\n"
"POT-Creation-Date: 2013-05-30 07:59+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -8483,6 +8483,11 @@ msgstr "%s%s: adres IP \"%s\" nie posiada zezwolenia na połączenie"
msgid "%s%s: cannot set socket option \"%s\" to %d: error %d %s"
msgstr "%s%s: nie można ustawić opcji gniazda \"%s\" na %d: błąd %d %s"
#. TRANSLATORS: second "%s" is "IPv4" or "IPv6"
#, fuzzy, c-format
msgid "%s%s: invalid bind address \"%s\" for %s"
msgstr "%s%s: nieprawidłowe kodowanie: \"%s\""
#, c-format
msgid "%s%s: cannot create socket: error %d %s"
msgstr "%s%s: nie można utworzyć gniazda: błąd %d %s"

7
po/pt_BR.po

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-05-29 11:55+0200\n"
"POT-Creation-Date: 2013-05-30 07:59+0200\n"
"PO-Revision-Date: 2013-05-20 16:55+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -7748,6 +7748,11 @@ msgstr "%s%s: endereço IP \"%s\" não permitido para relay"
msgid "%s%s: cannot set socket option \"%s\" to %d: error %d %s"
msgstr "%s%s: não foi possível criar socket para transferência"
#. TRANSLATORS: second "%s" is "IPv4" or "IPv6"
#, fuzzy, c-format
msgid "%s%s: invalid bind address \"%s\" for %s"
msgstr "%s%s: charset inválido: \"%s\""
#, fuzzy, c-format
msgid "%s%s: cannot create socket: error %d %s"
msgstr "%s%s: não foi possível criar socket para transferência"

7
po/ru.po

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-05-29 11:55+0200\n"
"POT-Creation-Date: 2013-05-30 07:59+0200\n"
"PO-Revision-Date: 2013-05-20 16:55+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -7601,6 +7601,11 @@ msgstr "%s адрес \"%s\" не найден\n"
msgid "%s%s: cannot set socket option \"%s\" to %d: error %d %s"
msgstr "%s невозможно создать сокет\n"
#. TRANSLATORS: second "%s" is "IPv4" or "IPv6"
#, fuzzy, c-format
msgid "%s%s: invalid bind address \"%s\" for %s"
msgstr "Не могу записать лог-файл \"%s\"\n"
#, fuzzy, c-format
msgid "%s%s: cannot create socket: error %d %s"
msgstr "%s невозможно создать сокет\n"

7
po/weechat.pot

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-05-29 11:55+0200\n"
"POT-Creation-Date: 2013-05-30 07:59+0200\n"
"PO-Revision-Date: 2013-02-14 18:20+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -6695,6 +6695,11 @@ msgstr ""
msgid "%s%s: cannot set socket option \"%s\" to %d: error %d %s"
msgstr ""
#. TRANSLATORS: second "%s" is "IPv4" or "IPv6"
#, c-format
msgid "%s%s: invalid bind address \"%s\" for %s"
msgstr ""
#, c-format
msgid "%s%s: cannot create socket: error %d %s"
msgstr ""

40
src/plugins/relay/relay-server.c

@ -338,8 +338,11 @@ relay_server_create_socket (struct t_relay_server *server)
int domain, set, max_clients, addr_size;
struct sockaddr_in server_addr;
struct sockaddr_in6 server_addr6;
const char *bind_address;
void *ptr_addr;
bind_address = weechat_config_string (relay_config_network_bind_address);
if (server->ipv6)
{
domain = AF_INET6;
@ -347,6 +350,18 @@ relay_server_create_socket (struct t_relay_server *server)
server_addr6.sin6_family = domain;
server_addr6.sin6_port = htons (server->port);
server_addr6.sin6_addr = in6addr_any;
if (bind_address && bind_address[0])
{
if (!inet_pton (domain, bind_address, &server_addr6.sin6_addr))
{
weechat_printf (NULL,
/* TRANSLATORS: second "%s" is "IPv4" or "IPv6" */
_("%s%s: invalid bind address \"%s\" for %s"),
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
bind_address, "IPv6");
return 0;
}
}
ptr_addr = &server_addr6;
addr_size = sizeof (struct sockaddr_in6);
}
@ -356,25 +371,22 @@ relay_server_create_socket (struct t_relay_server *server)
memset (&server_addr, 0, sizeof (struct sockaddr_in));
server_addr.sin_family = domain;
server_addr.sin_port = htons (server->port);
if (weechat_config_string (relay_config_network_bind_address)
&& weechat_config_string (relay_config_network_bind_address)[0])
{
server_addr.sin_addr.s_addr = inet_addr (weechat_config_string (relay_config_network_bind_address));
}
else
server_addr.sin_addr.s_addr = INADDR_ANY;
if (bind_address && bind_address[0])
{
server_addr.sin_addr.s_addr = INADDR_ANY;
if (!inet_pton (domain, bind_address, &server_addr.sin_addr))
{
weechat_printf (NULL,
/* TRANSLATORS: second "%s" is "IPv4" or "IPv6" */
_("%s%s: invalid bind address \"%s\" for %s"),
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
bind_address, "IPv4");
return 0;
}
}
ptr_addr = &server_addr;
addr_size = sizeof (struct sockaddr_in);
}
if (weechat_config_string (relay_config_network_bind_address)
&& weechat_config_string (relay_config_network_bind_address)[0])
{
inet_pton (domain,
weechat_config_string (relay_config_network_bind_address),
ptr_addr);
}
/* create socket */
server->sock = socket (domain, SOCK_STREAM, 0);

Loading…
Cancel
Save