core: add support of secured data in proxy options username/password (evaluate content)

This commit is contained in:
Sebastien Helleu 2013-09-19 15:07:55 +02:00
parent 087e9cc008
commit 2110c6d92e
14 changed files with 119 additions and 117 deletions

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-rc1\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-09-19 13:56+0200\n"
"PO-Revision-Date: 2013-09-02 21:20+0200\n"
"POT-Creation-Date: 2013-09-19 14:26+0200\n"
"PO-Revision-Date: 2013-09-19 14:45+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: cs\n"
@ -3521,11 +3521,11 @@ msgstr "adresa proxy serveru (IP nebo jméno hosta)"
msgid "port for connecting to proxy server"
msgstr "port pro připojení na proxy server"
msgid "username for proxy server"
msgstr "uživatelské jméno pro proxy server"
msgid "username for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "password for proxy server"
msgstr "heslo pro proxy server"
msgid "password for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "Please enter your passphrase to decrypt the data secured by WeeChat:"
msgstr ""
@ -9824,6 +9824,3 @@ msgstr ""
msgid "Constants"
msgstr ""
#~ msgid "password for server"
#~ msgstr "heslo pro server"

View File

@ -22,8 +22,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-09-19 13:56+0200\n"
"PO-Revision-Date: 2013-09-16 22:50+0200\n"
"POT-Creation-Date: 2013-09-19 14:26+0200\n"
"PO-Revision-Date: 2013-09-19 14:43+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
"Language: de_DE\n"
@ -4021,11 +4021,11 @@ msgstr "Adresse des Proxy-Servers (IP oder Hostname)"
msgid "port for connecting to proxy server"
msgstr "Port, auf dem der Proxy-Server läuft"
msgid "username for proxy server"
msgstr "Benutzername für die Proxy-Verbindung"
msgid "username for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "password for proxy server"
msgstr "Passwort für die Proxy-Verbindung"
msgid "password for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "Please enter your passphrase to decrypt the data secured by WeeChat:"
msgstr ""
@ -10839,6 +10839,3 @@ msgstr "Type"
msgid "Constants"
msgstr "Konstanten"
#~ msgid "password for server"
#~ msgstr "Passwort für den Server"

View File

@ -22,8 +22,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-rc1\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-09-19 13:56+0200\n"
"PO-Revision-Date: 2013-09-02 21:20+0200\n"
"POT-Creation-Date: 2013-09-19 14:26+0200\n"
"PO-Revision-Date: 2013-09-19 14:46+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: es\n"
@ -3721,11 +3721,11 @@ msgstr "dirección del servidor proxy (IP o nombre de máquina)"
msgid "port for connecting to proxy server"
msgstr "puerto para conectarse al servidor proxy"
msgid "username for proxy server"
msgstr "nombre de usuario para el servidor proxy"
msgid "username for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "password for proxy server"
msgstr "contraseña para el servidor proxy"
msgid "password for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "Please enter your passphrase to decrypt the data secured by WeeChat:"
msgstr ""
@ -10081,6 +10081,3 @@ msgstr "Tipo"
msgid "Constants"
msgstr "Constantes"
#~ msgid "password for server"
#~ msgstr "contraseña del servidor"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-rc1\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-09-19 13:56+0200\n"
"PO-Revision-Date: 2013-09-19 13:57+0200\n"
"POT-Creation-Date: 2013-09-19 14:26+0200\n"
"PO-Revision-Date: 2013-09-19 14:44+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -3912,11 +3912,15 @@ msgstr "adresse du serveur proxy (IP ou nom de machine)"
msgid "port for connecting to proxy server"
msgstr "port pour se connecter au serveur proxy"
msgid "username for proxy server"
msgstr "nom d'utilisateur pour le serveur proxy"
msgid "username for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
"nom d'utilisateur pour le serveur proxy (note: le contenu est évalué, voir /"
"help eval)"
msgid "password for proxy server"
msgstr "mot de passe pour le serveur proxy"
msgid "password for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
"mot de passe pour le serveur proxy (note: le contenu est évalué, voir /help "
"eval)"
msgid "Please enter your passphrase to decrypt the data secured by WeeChat:"
msgstr ""
@ -10572,6 +10576,3 @@ msgstr "Type"
msgid "Constants"
msgstr "Constantes"
#~ msgid "password for server"
#~ msgstr "mot de passe pour le serveur"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-rc1\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-09-19 13:56+0200\n"
"PO-Revision-Date: 2013-09-02 21:20+0200\n"
"POT-Creation-Date: 2013-09-19 14:26+0200\n"
"PO-Revision-Date: 2013-09-19 14:35+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: hu\n"
@ -3147,11 +3147,11 @@ msgstr "proxy szerver címe (IP-cím vagy gépnév)"
msgid "port for connecting to proxy server"
msgstr "proxy szerverhez való csatlakozáskor használt port"
msgid "username for proxy server"
msgstr "felhasználónév a proxy szerverhez"
msgid "username for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "password for proxy server"
msgstr "jelszó a proxy szerverhez"
msgid "password for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "Please enter your passphrase to decrypt the data secured by WeeChat:"
msgstr ""
@ -9255,7 +9255,3 @@ msgstr ""
msgid "Constants"
msgstr ""
#, fuzzy
#~ msgid "password for server"
#~ msgstr "jelszó az IRC szerveren"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-rc1\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-09-19 13:56+0200\n"
"PO-Revision-Date: 2013-09-02 21:20+0200\n"
"POT-Creation-Date: 2013-09-19 14:26+0200\n"
"PO-Revision-Date: 2013-09-19 14:46+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: it\n"
@ -3786,11 +3786,11 @@ msgstr "indirizzo del server proxy (IP o nome host)"
msgid "port for connecting to proxy server"
msgstr "porta per la connessione al server proxy"
msgid "username for proxy server"
msgstr "nome utente per il server proxy"
msgid "username for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "password for proxy server"
msgstr "password per il server proxy"
msgid "password for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "Please enter your passphrase to decrypt the data secured by WeeChat:"
msgstr ""
@ -10180,6 +10180,3 @@ msgstr "Tipo"
msgid "Constants"
msgstr "Costanti"
#~ msgid "password for server"
#~ msgstr "password per il server"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-rc1\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-09-19 13:56+0200\n"
"PO-Revision-Date: 2013-09-02 21:20+0200\n"
"POT-Creation-Date: 2013-09-19 14:26+0200\n"
"PO-Revision-Date: 2013-09-19 14:44+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
"Language: ja\n"
@ -3759,11 +3759,11 @@ msgstr "プロキシサーバアドレス (IP アドレスかホスト名)"
msgid "port for connecting to proxy server"
msgstr "プロキシサーバの接続ポート"
msgid "username for proxy server"
msgstr "プロキシサーバのユーザ名"
msgid "username for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "password for proxy server"
msgstr "プロキシサーバのパスワード"
msgid "password for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "Please enter your passphrase to decrypt the data secured by WeeChat:"
msgstr ""
@ -10193,6 +10193,3 @@ msgstr "タイプ"
msgid "Constants"
msgstr "定数"
#~ msgid "password for server"
#~ msgstr "サーバのパスワード"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-rc1\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-09-19 13:56+0200\n"
"PO-Revision-Date: 2013-09-02 21:21+0200\n"
"POT-Creation-Date: 2013-09-19 14:26+0200\n"
"PO-Revision-Date: 2013-09-19 14:46+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: pl\n"
@ -3847,11 +3847,11 @@ msgstr "adres serwera proxy (adres IP lub nazwa hosta)"
msgid "port for connecting to proxy server"
msgstr "port do połączeń z serwerem proxy"
msgid "username for proxy server"
msgstr "nazwa użytkownika dla serwera proxy"
msgid "username for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "password for proxy server"
msgstr "hasło do serwera proxy"
msgid "password for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "Please enter your passphrase to decrypt the data secured by WeeChat:"
msgstr ""
@ -10376,6 +10376,3 @@ msgstr "Typ"
msgid "Constants"
msgstr "Stałe"
#~ msgid "password for server"
#~ msgstr "hasło dla serwera"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-rc1\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-09-19 13:56+0200\n"
"PO-Revision-Date: 2013-09-16 11:21+0200\n"
"POT-Creation-Date: 2013-09-19 14:26+0200\n"
"PO-Revision-Date: 2013-09-19 14:46+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: pt_BR\n"
@ -3609,10 +3609,10 @@ msgstr ""
msgid "port for connecting to proxy server"
msgstr ""
msgid "username for proxy server"
msgid "username for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "password for proxy server"
msgid "password for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "Please enter your passphrase to decrypt the data secured by WeeChat:"
@ -9455,6 +9455,3 @@ msgstr ""
msgid "Constants"
msgstr ""
#~ msgid "password for server"
#~ msgstr "senha para o servidor"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-rc1\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-09-19 13:56+0200\n"
"PO-Revision-Date: 2013-09-02 21:21+0200\n"
"POT-Creation-Date: 2013-09-19 14:26+0200\n"
"PO-Revision-Date: 2013-09-19 14:35+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: ru\n"
@ -3175,11 +3175,11 @@ msgstr "адрес proxy-сервера (IP или хост)"
msgid "port for connecting to proxy server"
msgstr "порт, используемый при подключении к proxy-серверу"
msgid "username for proxy server"
msgstr "имя пользователя, используемое при подключения к proxy-серверу"
msgid "username for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "password for proxy server"
msgstr "пароль к proxy серверу"
msgid "password for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "Please enter your passphrase to decrypt the data secured by WeeChat:"
msgstr ""
@ -9275,7 +9275,3 @@ msgstr ""
msgid "Constants"
msgstr ""
#, fuzzy
#~ msgid "password for server"
#~ msgstr "пароль, используемый при подключении к IRC серверу"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-rc1\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-09-19 13:56+0200\n"
"PO-Revision-Date: 2013-09-02 21:21+0200\n"
"POT-Creation-Date: 2013-09-19 14:26+0200\n"
"PO-Revision-Date: 2013-09-19 14:35+0200\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: tr\n"
@ -2798,11 +2798,11 @@ msgstr ""
msgid "port for connecting to proxy server"
msgstr ""
msgid "username for proxy server"
msgstr "vekil sunucu için kullanıcı adı"
msgid "username for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "password for proxy server"
msgstr "vekil sunucu için parola"
msgid "password for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "Please enter your passphrase to decrypt the data secured by WeeChat:"
msgstr ""
@ -8277,6 +8277,3 @@ msgstr "Tür"
msgid "Constants"
msgstr ""
#~ msgid "password for server"
#~ msgstr "sunucu için parola"

View File

@ -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-09-19 13:56+0200\n"
"POT-Creation-Date: 2013-09-19 14:26+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"
@ -2802,10 +2802,10 @@ msgstr ""
msgid "port for connecting to proxy server"
msgstr ""
msgid "username for proxy server"
msgid "username for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "password for proxy server"
msgid "password for proxy server (note: content is evaluated, see /help eval)"
msgstr ""
msgid "Please enter your passphrase to decrypt the data secured by WeeChat:"

View File

@ -48,6 +48,7 @@
#include "weechat.h"
#include "wee-network.h"
#include "wee-eval.h"
#include "wee-hook.h"
#include "wee-config.h"
#include "wee-proxy.h"
@ -238,17 +239,27 @@ int
network_pass_httpproxy (struct t_proxy *proxy, int sock, const char *address,
int port)
{
char buffer[256], authbuf[128], authbuf_base64[512];
char buffer[256], authbuf[128], authbuf_base64[512], *username, *password;
int length;
if (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])
&& CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])[0])
{
/* authentication */
snprintf (authbuf, sizeof (authbuf), "%s:%s",
CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]),
(CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD])) ?
CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]) : "");
username = eval_expression (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]),
NULL, NULL, NULL);
if (!username)
return 0;
password = eval_expression (CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]),
NULL, NULL, NULL);
if (!password)
{
free (username);
return 0;
}
snprintf (authbuf, sizeof (authbuf), "%s:%s", username, password);
free (username);
free (password);
string_encode_base64 (authbuf, strlen (authbuf), authbuf_base64);
length = snprintf (buffer, sizeof (buffer),
"CONNECT %s:%d HTTP/1.0\r\nProxy-Authorization: "
@ -340,16 +351,22 @@ network_pass_socks4proxy (struct t_proxy *proxy, int sock, const char *address,
{
struct t_network_socks4 socks4;
unsigned char buffer[24];
char ip_addr[NI_MAXHOST];
char ip_addr[NI_MAXHOST], *username;
int length;
username = eval_expression (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]),
NULL, NULL, NULL);
if (!username)
return 0;
socks4.version = 4;
socks4.method = 1;
socks4.port = htons (port);
network_resolve (address, ip_addr, NULL);
socks4.address = inet_addr (ip_addr);
strncpy (socks4.user, CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]),
sizeof (socks4.user) - 1);
strncpy (socks4.user, username, sizeof (socks4.user) - 1);
free (username);
length = 8 + strlen (socks4.user) + 1;
if (network_send_with_retry (sock, (char *) &socks4, length, 0) != length)
@ -388,6 +405,7 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
unsigned char buffer[288];
int username_len, password_len, addr_len, addr_buffer_len;
unsigned char *addr_buffer;
char *username, *password;
socks5.version = 5;
socks5.nmethods = 1;
@ -419,16 +437,29 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
return 0;
/* authentication as in RFC 1929 */
username_len = strlen (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]));
password_len = strlen (CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]));
username = eval_expression (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]),
NULL, NULL, NULL);
if (!username)
return 0;
password = eval_expression (CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]),
NULL, NULL, NULL);
if (!password)
{
free (username);
return 0;
}
username_len = strlen (username);
password_len = strlen (password);
/* make username/password buffer */
buffer[0] = 1;
buffer[1] = (unsigned char) username_len;
memcpy(buffer + 2, CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]), username_len);
memcpy (buffer + 2, username, username_len);
buffer[2 + username_len] = (unsigned char) password_len;
memcpy (buffer + 3 + username_len,
CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]), password_len);
memcpy (buffer + 3 + username_len, password, password_len);
free (username);
free (password);
if (network_send_with_retry (sock, buffer, 3 + username_len + password_len, 0) < 3 + username_len + password_len)
return 0;

View File

@ -337,7 +337,8 @@ proxy_create_option (const char *proxy_name, int index_option,
ptr_option = config_file_new_option (
weechat_config_file, weechat_config_section_proxy,
option_name, "string",
N_("username for proxy server"),
N_("username for proxy server "
"(note: content is evaluated, see /help eval)"),
NULL, 0, 0, value, NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
break;
@ -345,7 +346,8 @@ proxy_create_option (const char *proxy_name, int index_option,
ptr_option = config_file_new_option (
weechat_config_file, weechat_config_section_proxy,
option_name, "string",
N_("password for proxy server"),
N_("password for proxy server "
"(note: content is evaluated, see /help eval)"),
NULL, 0, 0, value, NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
break;