forked from PsychoticNinja/irssi
Compare commits
3 Commits
master
...
orphaned/a
Author | SHA1 | Date | |
---|---|---|---|
|
3a96dfac03 | ||
|
dbc7896cad | ||
|
d6b0dd2b32 |
27
configure.ac
27
configure.ac
@ -25,15 +25,6 @@ AC_CHECK_HEADERS(sys/socket.h sys/time.h sys/utsname.h regex.h)
|
||||
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
AC_ARG_WITH(socks,
|
||||
[ --with-socks Build with socks support],
|
||||
if test x$withval = xno; then
|
||||
want_socks=no
|
||||
else
|
||||
want_socks=yes
|
||||
fi,
|
||||
want_socks=no)
|
||||
|
||||
AC_ARG_WITH(textui,
|
||||
[ --without-textui Build without text frontend],
|
||||
if test x$withval = xno; then
|
||||
@ -202,24 +193,6 @@ else
|
||||
AC_ERROR([Couldn't find integer type for off_t])
|
||||
fi
|
||||
|
||||
dnl **
|
||||
dnl ** check for socks
|
||||
dnl **
|
||||
|
||||
if test "x$want_socks" = "xyes"; then
|
||||
AC_CHECK_LIB(socks, connect, [
|
||||
AC_DEFINE(HAVE_SOCKS,, Build with socks support)
|
||||
LIBS="$LIBS -lsocks"
|
||||
AC_CHECK_HEADER(socks.h, [
|
||||
AC_DEFINE(HAVE_SOCKS_H)
|
||||
CFLAGS="$CFLAGS -DSOCKS"
|
||||
AC_MSG_RESULT(["socks5 library found, building with it"])
|
||||
], [
|
||||
AC_MSG_RESULT(["socks4 library found, building with it"])
|
||||
CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dgetpeername=Rgetpeername -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
|
||||
])
|
||||
])
|
||||
fi
|
||||
|
||||
dnl **
|
||||
dnl ** OpenSSL checks
|
||||
|
@ -17,7 +17,6 @@
|
||||
-tls_ciphers: TLS cipher suite preference lists.
|
||||
-tls_pinned_cert: Pinned x509 certificate fingerprint.
|
||||
-tls_pinned_pubkey: Pinned public key fingerprint.
|
||||
-noproxy: Ignores the global proxy configuration.
|
||||
-network: The network this connection belongs to.
|
||||
-host: The hostname you would like to connect from.
|
||||
-rawlog: Immediately open rawlog after connecting.
|
||||
|
@ -36,7 +36,6 @@
|
||||
-cmdmax: Specifies the maximum number of commands to perform
|
||||
before starting the internal flood protection.
|
||||
-port: Specifies the port to connect to the server.
|
||||
-noproxy: Ignores the global proxy configuration.
|
||||
-rawlog: Immediately open rawlog after connecting.
|
||||
-noautosendcmd: Doesn't execute autosendcmd.
|
||||
|
||||
@ -64,7 +63,7 @@
|
||||
/SERVER CONNECT chat.freenode.net
|
||||
/SERVER CONNECT +chat.freenode.net
|
||||
/SERVER ADD -network Freenode -noautosendcmd orwell.freenode.net
|
||||
/SERVER ADD -! -auto -host staff.irssi.org -port 6667 -4 -network Freenode -noproxy orwell.freenode.net
|
||||
/SERVER ADD -! -auto -host staff.irssi.org -port 6667 -4 -network Freenode orwell.freenode.net
|
||||
/SERVER MODIFY -network Freenode -noauto orwell.freenode.net
|
||||
/SERVER REMOVE orwell.freenode.net 6667 Freenode
|
||||
/SERVER PURGE
|
||||
|
@ -103,6 +103,8 @@ typedef struct _RAWLOG_REC RAWLOG_REC;
|
||||
|
||||
typedef struct _CHAT_PROTOCOL_REC CHAT_PROTOCOL_REC;
|
||||
typedef struct _CHATNET_REC CHATNET_REC;
|
||||
typedef struct _PROXY_REC PROXY_REC;
|
||||
typedef struct _PROXY_PROTOCOL_REC PROXY_PROTOCOL_REC;
|
||||
typedef struct _SERVER_REC SERVER_REC;
|
||||
typedef struct _WI_ITEM_REC WI_ITEM_REC;
|
||||
typedef struct _CHANNEL_REC CHANNEL_REC;
|
||||
|
@ -34,6 +34,8 @@ libcore_a_SOURCES = \
|
||||
nicklist.c \
|
||||
nickmatch-cache.c \
|
||||
pidwait.c \
|
||||
proxy.c \
|
||||
proxy-protocols.c \
|
||||
queries.c \
|
||||
rawlog.c \
|
||||
recode.c \
|
||||
@ -53,6 +55,7 @@ structure_headers = \
|
||||
channel-rec.h \
|
||||
channel-setup-rec.h \
|
||||
chatnet-rec.h \
|
||||
proxy-rec.h \
|
||||
query-rec.h \
|
||||
server-rec.h \
|
||||
server-setup-rec.h \
|
||||
@ -86,6 +89,8 @@ pkginc_core_HEADERS = \
|
||||
nicklist.h \
|
||||
nickmatch-cache.h \
|
||||
pidwait.h \
|
||||
proxy.h \
|
||||
proxy-protocols.h \
|
||||
queries.h \
|
||||
rawlog.h \
|
||||
recode.h \
|
||||
|
@ -124,6 +124,8 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
|
||||
conn->tls_verify = TRUE;
|
||||
if ((conn->tls_cert != NULL && conn->tls_cert[0] != '\0') || conn->tls_verify)
|
||||
conn->use_tls = TRUE;
|
||||
if ((tmp = g_hash_table_lookup(optlist, "proxy")) != NULL)
|
||||
conn->proxy = g_strdup(tmp);
|
||||
|
||||
if (g_hash_table_lookup(optlist, "!") != NULL)
|
||||
conn->no_autojoin_channels = TRUE;
|
||||
@ -131,10 +133,6 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
|
||||
if (g_hash_table_lookup(optlist, "noautosendcmd") != NULL)
|
||||
conn->no_autosendcmd = TRUE;
|
||||
|
||||
if (g_hash_table_lookup(optlist, "noproxy") != NULL)
|
||||
g_free_and_null(conn->proxy);
|
||||
|
||||
|
||||
*rawlog_file = g_strdup(g_hash_table_lookup(optlist, "rawlog"));
|
||||
|
||||
host = g_hash_table_lookup(optlist, "host");
|
||||
@ -152,8 +150,9 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
|
||||
/* SYNTAX: CONNECT [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>]
|
||||
[-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>]
|
||||
[-ssl_ciphers <list>]
|
||||
[-proxy <proxy>]
|
||||
[-!] [-noautosendcmd]
|
||||
[-noproxy] [-network <network>] [-host <hostname>]
|
||||
[-network <network>] [-host <hostname>]
|
||||
[-rawlog <file>]
|
||||
<address>|<chatnet> [<port> [<password> [<nick>]]] */
|
||||
/* NOTE: -network replaces the old -ircnet flag. */
|
||||
@ -259,8 +258,9 @@ static void sig_default_command_server(const char *data, SERVER_REC *server,
|
||||
/* SYNTAX: SERVER [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>]
|
||||
[-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>]
|
||||
[-ssl_ciphers <list>]
|
||||
[-proxy <proxy>]
|
||||
[-!] [-noautosendcmd]
|
||||
[-noproxy] [-network <network>] [-host <hostname>]
|
||||
[-network <network>] [-host <hostname>]
|
||||
[-rawlog <file>]
|
||||
[+]<address>|<chatnet> [<port> [<password> [<nick>]]] */
|
||||
/* NOTE: -network replaces the old -ircnet flag. */
|
||||
@ -498,7 +498,7 @@ void chat_commands_init(void)
|
||||
signal_add("default command server", (SIGNAL_FUNC) sig_default_command_server);
|
||||
signal_add("server sendmsg", (SIGNAL_FUNC) sig_server_sendmsg);
|
||||
|
||||
command_set_options("connect", "4 6 !! -network ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers +ssl_pinned_cert +ssl_pinned_pubkey tls +tls_cert +tls_pkey +tls_pass tls_verify +tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert +tls_pinned_pubkey +host noproxy -rawlog noautosendcmd");
|
||||
command_set_options("connect", "4 6 !! -network ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers +ssl_pinned_cert +ssl_pinned_pubkey tls +tls_cert +tls_pkey +tls_pass tls_verify +tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert +tls_pinned_pubkey +host +proxy -rawlog noautosendcmd");
|
||||
command_set_options("msg", "channel nick");
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include "chat-protocols.h"
|
||||
#include "servers.h"
|
||||
#include "chatnets.h"
|
||||
#include "proxy.h"
|
||||
#include "proxy-protocols.h"
|
||||
#include "commands.h"
|
||||
#include "expandos.h"
|
||||
#include "write-buffer.h"
|
||||
@ -239,6 +241,8 @@ void core_init(void)
|
||||
chat_protocols_init();
|
||||
chatnets_init();
|
||||
expandos_init();
|
||||
proxy_init();
|
||||
proxy_protocols_init();
|
||||
ignore_init();
|
||||
servers_init();
|
||||
write_buffer_init();
|
||||
@ -290,6 +294,8 @@ void core_deinit(void)
|
||||
ignore_deinit();
|
||||
expandos_deinit();
|
||||
chatnets_deinit();
|
||||
proxy_deinit();
|
||||
proxy_protocols_deinit();
|
||||
chat_protocols_deinit();
|
||||
|
||||
session_deinit();
|
||||
|
134
src/core/proxy-protocols.c
Normal file
134
src/core/proxy-protocols.c
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Alexander Færøy <ahf@irssi.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "proxy-protocols.h"
|
||||
#include "signals.h"
|
||||
|
||||
GSList *proxy_protocols;
|
||||
|
||||
static void proxy_protocol_destroy(PROXY_PROTOCOL_REC *rec)
|
||||
{
|
||||
g_return_if_fail(rec != NULL);
|
||||
|
||||
proxy_protocols = g_slist_remove(proxy_protocols, rec);
|
||||
|
||||
signal_emit("proxy protocol destroyed", 1, rec);
|
||||
|
||||
g_free(rec->name);
|
||||
g_free(rec);
|
||||
}
|
||||
|
||||
/* Register new Proxy Protocol. */
|
||||
PROXY_PROTOCOL_REC *proxy_protocol_register(PROXY_PROTOCOL_REC *rec)
|
||||
{
|
||||
PROXY_PROTOCOL_REC *newrec;
|
||||
int created;
|
||||
|
||||
g_return_val_if_fail(rec != NULL, NULL);
|
||||
|
||||
newrec = proxy_protocol_find(rec->name);
|
||||
created = newrec == NULL;
|
||||
|
||||
if (created) {
|
||||
newrec = g_new0(PROXY_PROTOCOL_REC, 1);
|
||||
proxy_protocols = g_slist_append(proxy_protocols, newrec);
|
||||
} else {
|
||||
g_free(newrec->name);
|
||||
}
|
||||
|
||||
memcpy(newrec, rec, sizeof(PROXY_PROTOCOL_REC));
|
||||
|
||||
newrec->id = module_get_uniq_id_str("PROXY PROTOCOL", rec->name);
|
||||
newrec->name = g_strdup(rec->name);
|
||||
|
||||
if (created)
|
||||
signal_emit("proxy protocol created", 1, newrec);
|
||||
else
|
||||
signal_emit("proxy protocol updated", 1, newrec);
|
||||
|
||||
return newrec;
|
||||
}
|
||||
|
||||
/* Unregister Proxy Protocol. */
|
||||
void proxy_protocol_unregister(const char *name)
|
||||
{
|
||||
PROXY_PROTOCOL_REC *rec;
|
||||
|
||||
g_return_if_fail(name != NULL);
|
||||
|
||||
rec = proxy_protocol_find(name);
|
||||
|
||||
if (rec != NULL)
|
||||
proxy_protocol_destroy(rec);
|
||||
}
|
||||
|
||||
/* Lookup Proxy Protocols. */
|
||||
int proxy_protocol_lookup(const char *name)
|
||||
{
|
||||
PROXY_PROTOCOL_REC *rec;
|
||||
|
||||
g_return_val_if_fail(name != NULL, -1);
|
||||
|
||||
rec = proxy_protocol_find(name);
|
||||
|
||||
return rec == NULL ? -1 : rec->id;
|
||||
}
|
||||
|
||||
PROXY_PROTOCOL_REC *proxy_protocol_find(const char *name)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
g_return_val_if_fail(name != NULL, NULL);
|
||||
|
||||
for (tmp = proxy_protocols; tmp != NULL; tmp = tmp->next) {
|
||||
PROXY_PROTOCOL_REC *rec = tmp->data;
|
||||
|
||||
if (g_ascii_strcasecmp(rec->name, name) == 0)
|
||||
return rec;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PROXY_PROTOCOL_REC *proxy_protocol_find_id(int id)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
g_return_val_if_fail(id > 0, NULL);
|
||||
|
||||
for (tmp = proxy_protocols; tmp != NULL; tmp = tmp->next) {
|
||||
PROXY_PROTOCOL_REC *rec = tmp->data;
|
||||
|
||||
if (rec->id == id)
|
||||
return rec;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void proxy_protocols_init(void)
|
||||
{
|
||||
proxy_protocols = NULL;
|
||||
}
|
||||
|
||||
void proxy_protocols_deinit(void)
|
||||
{
|
||||
while (proxy_protocols != NULL)
|
||||
proxy_protocol_destroy(proxy_protocols->data);
|
||||
}
|
45
src/core/proxy-protocols.h
Normal file
45
src/core/proxy-protocols.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Alexander Færøy <ahf@irssi.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
*/
|
||||
|
||||
#ifndef __PROXY_PROTOCOLS_H
|
||||
#define __PROXY_PROTOCOLS_H
|
||||
|
||||
#include "modules.h"
|
||||
|
||||
struct _PROXY_PROTOCOL_REC {
|
||||
int id;
|
||||
char *name;
|
||||
};
|
||||
|
||||
extern GSList *proxy_protocols;
|
||||
|
||||
/* Register new Proxy Protocol. */
|
||||
PROXY_PROTOCOL_REC *proxy_protocol_register(PROXY_PROTOCOL_REC *rec);
|
||||
|
||||
/* Unregister Proxy Protocol. */
|
||||
void proxy_protocol_unregister(const char *name);
|
||||
|
||||
/* Lookup Proxy Protocols. */
|
||||
int proxy_protocol_lookup(const char *name);
|
||||
PROXY_PROTOCOL_REC *proxy_protocol_find(const char *name);
|
||||
PROXY_PROTOCOL_REC *proxy_protocol_find_id(int id);
|
||||
|
||||
void proxy_protocols_init(void);
|
||||
void proxy_protocols_deinit(void);
|
||||
|
||||
#endif
|
7
src/core/proxy-rec.h
Normal file
7
src/core/proxy-rec.h
Normal file
@ -0,0 +1,7 @@
|
||||
int type; /* module_get_uniq_id("PROXY", 0); */
|
||||
int proxy_type; /* proxy_protocol_lookup(); */
|
||||
|
||||
char *name;
|
||||
|
||||
char *address;
|
||||
int port;
|
151
src/core/proxy.c
Normal file
151
src/core/proxy.c
Normal file
@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Alexander Færøy <ahf@irssi.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "signals.h"
|
||||
#include "lib-config/iconfig.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include "proxy.h"
|
||||
|
||||
GSList *proxies;
|
||||
|
||||
static void proxy_config_save(PROXY_REC *proxy)
|
||||
{
|
||||
CONFIG_NODE *node;
|
||||
|
||||
node = iconfig_node_traverse("proxies", TRUE);
|
||||
node = iconfig_node_section(node, proxy->name, NODE_TYPE_BLOCK);
|
||||
iconfig_node_clear(node);
|
||||
|
||||
iconfig_node_set_str(node, "address", proxy->address);
|
||||
iconfig_node_set_int(node, "port", proxy->port);
|
||||
|
||||
signal_emit("proxy saved", 2, proxy, node);
|
||||
}
|
||||
|
||||
static void proxy_config_remove(PROXY_REC *proxy)
|
||||
{
|
||||
CONFIG_NODE *node;
|
||||
|
||||
node = iconfig_node_traverse("proxies", FALSE);
|
||||
|
||||
if (node != NULL)
|
||||
iconfig_node_set_str(node, proxy->name, NULL);
|
||||
}
|
||||
|
||||
static void read_proxy(CONFIG_NODE *node)
|
||||
{
|
||||
PROXY_REC *rec;
|
||||
|
||||
if (node == NULL || node->key == NULL)
|
||||
return;
|
||||
|
||||
rec = g_new(PROXY_REC, 1);
|
||||
rec->name = g_strdup(node->key);
|
||||
rec->address = g_strdup(config_node_get_str(node, "address", NULL));
|
||||
rec->port = config_node_get_int(node, "port", 0);
|
||||
|
||||
proxies = g_slist_append(proxies, rec);
|
||||
signal_emit("proxy read", 2, rec, node);
|
||||
}
|
||||
|
||||
static void read_proxies(void)
|
||||
{
|
||||
CONFIG_NODE *node;
|
||||
GSList *tmp;
|
||||
|
||||
while (proxies != NULL)
|
||||
proxy_destroy(proxies->data);
|
||||
|
||||
node = iconfig_node_traverse("proxies", FALSE);
|
||||
|
||||
if (node != NULL) {
|
||||
for (tmp = config_node_first(node->value); tmp != NULL; tmp = config_node_next(tmp))
|
||||
read_proxy(tmp->data);
|
||||
}
|
||||
}
|
||||
|
||||
void proxy_create(PROXY_REC *proxy)
|
||||
{
|
||||
g_return_if_fail(proxy != NULL);
|
||||
|
||||
proxy->type = module_get_uniq_id("PROXY", 0);
|
||||
|
||||
if (g_slist_find(proxies, proxy) == NULL)
|
||||
proxies = g_slist_append(proxies, proxy);
|
||||
|
||||
proxy_config_save(proxy);
|
||||
signal_emit("proxy created", 1, proxy);
|
||||
}
|
||||
|
||||
void proxy_remove(PROXY_REC *proxy)
|
||||
{
|
||||
g_return_if_fail(proxy != NULL);
|
||||
|
||||
signal_emit("proxy removed", 1, proxy);
|
||||
|
||||
proxy_config_remove(proxy);
|
||||
proxy_destroy(proxy);
|
||||
}
|
||||
|
||||
void proxy_destroy(PROXY_REC *proxy)
|
||||
{
|
||||
g_return_if_fail(IS_PROXY(proxy));
|
||||
|
||||
proxies = g_slist_remove(proxies, proxy);
|
||||
signal_emit("proxy destroyed", 1, proxy);
|
||||
|
||||
g_free(proxy->name);
|
||||
g_free(proxy->address);
|
||||
g_free(proxy);
|
||||
}
|
||||
|
||||
PROXY_REC *proxy_find(const char *name)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
g_return_val_if_fail(name != NULL, NULL);
|
||||
|
||||
for (tmp = proxies; tmp != NULL; tmp = tmp->next) {
|
||||
PROXY_REC *rec = tmp->data;
|
||||
|
||||
if (g_ascii_strcasecmp(rec->name, name) == 0)
|
||||
return rec;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void proxy_init(void)
|
||||
{
|
||||
proxies = NULL;
|
||||
|
||||
settings_add_str("proxy", "default_proxy", NULL);
|
||||
|
||||
signal_add("setup reread", (SIGNAL_FUNC)read_proxies);
|
||||
signal_add("irssi init read settings", (SIGNAL_FUNC)read_proxies);
|
||||
}
|
||||
|
||||
void proxy_deinit(void)
|
||||
{
|
||||
module_uniq_destroy("PROXY");
|
||||
|
||||
signal_remove("setup reread", (SIGNAL_FUNC)read_proxies);
|
||||
signal_remove("irssi init read settings", (SIGNAL_FUNC)read_proxies);
|
||||
}
|
52
src/core/proxy.h
Normal file
52
src/core/proxy.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Alexander Færøy <ahf@irssi.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
*/
|
||||
|
||||
#ifndef __PROXY_H
|
||||
#define __PROXY_H
|
||||
|
||||
#include "modules.h"
|
||||
|
||||
#define PROXY(proxy) \
|
||||
MODULE_CHECK_CAST(proxy, PROXY_REC, type, "PROXY")
|
||||
|
||||
#define IS_PROXY(proxy) \
|
||||
(PROXY(proxy) ? TRUE : FALSE)
|
||||
|
||||
struct _PROXY_REC {
|
||||
#include "proxy-rec.h"
|
||||
};
|
||||
|
||||
extern GSList *proxies;
|
||||
|
||||
/* Add a proxy to the proxy list. */
|
||||
void proxy_create(PROXY_REC *proxy);
|
||||
|
||||
/* Remove a proxy from the proxy list. */
|
||||
void proxy_remove(PROXY_REC *proxy);
|
||||
|
||||
/* Destroy the proxy structure without removing it from configs. */
|
||||
void proxy_destroy(PROXY_REC *proxy);
|
||||
|
||||
/* Find a proxy by name. */
|
||||
PROXY_REC *proxy_find(const char *name);
|
||||
|
||||
void proxy_init(void);
|
||||
void proxy_deinit(void);
|
||||
|
||||
#endif
|
||||
|
@ -5,11 +5,6 @@ int chat_type; /* chat_protocol_lookup(xx) */
|
||||
|
||||
int refcount;
|
||||
|
||||
/* if we're connecting via proxy, or just NULLs */
|
||||
char *proxy;
|
||||
int proxy_port;
|
||||
char *proxy_string, *proxy_string_after, *proxy_password;
|
||||
|
||||
unsigned short family; /* 0 = don't care, AF_INET or AF_INET6 */
|
||||
char *tag; /* try to keep this tag when connected to server */
|
||||
char *address;
|
||||
@ -32,6 +27,8 @@ char *tls_ciphers;
|
||||
char *tls_pinned_cert;
|
||||
char *tls_pinned_pubkey;
|
||||
|
||||
char *proxy;
|
||||
|
||||
GIOChannel *connect_handle; /* connect using this handle */
|
||||
|
||||
/* when reconnecting, the old server status */
|
||||
|
@ -20,13 +20,14 @@ char *tls_ciphers;
|
||||
char *tls_pinned_cert;
|
||||
char *tls_pinned_pubkey;
|
||||
|
||||
char *proxy;
|
||||
|
||||
char *own_host; /* address to use when connecting this server */
|
||||
IPADDR *own_ip4, *own_ip6; /* resolved own_address if not NULL */
|
||||
|
||||
time_t last_connect; /* to avoid reconnecting too fast.. */
|
||||
|
||||
unsigned int autoconnect:1;
|
||||
unsigned int no_proxy:1;
|
||||
unsigned int last_failed:1; /* if last connection attempt failed */
|
||||
unsigned int banned:1; /* if we're banned from this server */
|
||||
unsigned int dns_error:1; /* DNS said the host doesn't exist */
|
||||
|
@ -157,12 +157,6 @@ server_connect_copy_skeleton(SERVER_CONNECT_REC *src, int connect_info)
|
||||
server_connect_ref(dest);
|
||||
dest->type = module_get_uniq_id("SERVER CONNECT", 0);
|
||||
dest->reconnection = src->reconnection;
|
||||
dest->proxy = g_strdup(src->proxy);
|
||||
dest->proxy_port = src->proxy_port;
|
||||
dest->proxy_string = g_strdup(src->proxy_string);
|
||||
dest->proxy_string_after = g_strdup(src->proxy_string_after);
|
||||
dest->proxy_password = g_strdup(src->proxy_password);
|
||||
|
||||
dest->tag = g_strdup(src->tag);
|
||||
|
||||
if (connect_info) {
|
||||
@ -202,6 +196,8 @@ server_connect_copy_skeleton(SERVER_CONNECT_REC *src, int connect_info)
|
||||
dest->tls_pinned_cert = g_strdup(src->tls_pinned_cert);
|
||||
dest->tls_pinned_pubkey = g_strdup(src->tls_pinned_pubkey);
|
||||
|
||||
dest->proxy = g_strdup(src->proxy);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "chat-protocols.h"
|
||||
#include "chatnets.h"
|
||||
#include "proxy.h"
|
||||
#include "servers.h"
|
||||
#include "servers-setup.h"
|
||||
|
||||
@ -129,15 +130,6 @@ static void server_setup_fill(SERVER_CONNECT_REC *conn,
|
||||
conn->username = g_strdup(settings_get_str("user_name"));
|
||||
conn->realname = g_strdup(settings_get_str("real_name"));
|
||||
|
||||
/* proxy settings */
|
||||
if (settings_get_bool("use_proxy")) {
|
||||
conn->proxy = g_strdup(settings_get_str("proxy_address"));
|
||||
conn->proxy_port = settings_get_int("proxy_port");
|
||||
conn->proxy_string = g_strdup(settings_get_str("proxy_string"));
|
||||
conn->proxy_string_after = g_strdup(settings_get_str("proxy_string_after"));
|
||||
conn->proxy_password = g_strdup(settings_get_str("proxy_password"));
|
||||
}
|
||||
|
||||
/* source IP */
|
||||
if (source_host_ip4 != NULL) {
|
||||
conn->own_ip4 = g_new(IPADDR, 1);
|
||||
@ -159,9 +151,6 @@ static void server_setup_fill_server(SERVER_CONNECT_REC *conn,
|
||||
|
||||
sserver->last_connect = time(NULL);
|
||||
|
||||
if (sserver->no_proxy)
|
||||
g_free_and_null(conn->proxy);
|
||||
|
||||
if (sserver->family != 0 && conn->family == 0)
|
||||
conn->family = sserver->family;
|
||||
if (sserver->port > 0 && conn->port <= 0)
|
||||
@ -185,6 +174,8 @@ static void server_setup_fill_server(SERVER_CONNECT_REC *conn,
|
||||
conn->tls_pinned_cert = g_strdup(sserver->tls_pinned_cert);
|
||||
if (conn->tls_pinned_pubkey == NULL && sserver->tls_pinned_pubkey != NULL && sserver->tls_pinned_pubkey[0] != '\0')
|
||||
conn->tls_pinned_pubkey = g_strdup(sserver->tls_pinned_pubkey);
|
||||
if (conn->proxy == NULL && sserver->proxy != NULL && sserver->proxy[0] != '\0')
|
||||
conn->proxy = g_strdup(sserver->proxy);
|
||||
|
||||
server_setup_fill_reconn(conn, sserver);
|
||||
|
||||
@ -456,8 +447,8 @@ static SERVER_SETUP_REC *server_setup_read(CONFIG_NODE *node)
|
||||
|
||||
rec->port = port;
|
||||
rec->autoconnect = config_node_get_bool(node, "autoconnect", FALSE);
|
||||
rec->no_proxy = config_node_get_bool(node, "no_proxy", FALSE);
|
||||
rec->own_host = g_strdup(config_node_get_str(node, "own_host", NULL));
|
||||
rec->proxy = g_strdup(config_node_get_str(node, "proxy", NULL));
|
||||
|
||||
signal_emit("server setup read", 2, rec, node);
|
||||
|
||||
@ -516,7 +507,7 @@ static void server_setup_save(SERVER_SETUP_REC *rec)
|
||||
iconfig_node_set_str(node, "tls_ciphers", rec->tls_ciphers);
|
||||
iconfig_node_set_str(node, "tls_pinned_cert", rec->tls_pinned_cert);
|
||||
iconfig_node_set_str(node, "tls_pinned_pubkey", rec->tls_pinned_pubkey);
|
||||
|
||||
iconfig_node_set_str(node, "proxy", rec->proxy);
|
||||
iconfig_node_set_str(node, "own_host", rec->own_host);
|
||||
|
||||
iconfig_node_set_str(node, "family",
|
||||
@ -525,8 +516,6 @@ static void server_setup_save(SERVER_SETUP_REC *rec)
|
||||
|
||||
if (rec->autoconnect)
|
||||
iconfig_node_set_bool(node, "autoconnect", TRUE);
|
||||
if (rec->no_proxy)
|
||||
iconfig_node_set_bool(node, "no_proxy", TRUE);
|
||||
|
||||
signal_emit("server setup saved", 2, rec, node);
|
||||
}
|
||||
@ -568,6 +557,7 @@ static void server_setup_destroy(SERVER_SETUP_REC *rec)
|
||||
g_free_not_null(rec->tls_ciphers);
|
||||
g_free_not_null(rec->tls_pinned_cert);
|
||||
g_free_not_null(rec->tls_pinned_pubkey);
|
||||
g_free_not_null(rec->proxy);
|
||||
g_free(rec->address);
|
||||
g_free(rec);
|
||||
}
|
||||
@ -640,13 +630,6 @@ void servers_setup_init(void)
|
||||
settings_add_str("server", "user_name", NULL);
|
||||
settings_add_str("server", "real_name", NULL);
|
||||
|
||||
settings_add_bool("proxy", "use_proxy", FALSE);
|
||||
settings_add_str("proxy", "proxy_address", "");
|
||||
settings_add_int("proxy", "proxy_port", 6667);
|
||||
settings_add_str("proxy", "proxy_string", "CONNECT %s %d");
|
||||
settings_add_str("proxy", "proxy_string_after", "");
|
||||
settings_add_str("proxy", "proxy_password", "");
|
||||
|
||||
setupservers = NULL;
|
||||
source_host_ip4 = source_host_ip6 = NULL;
|
||||
old_source_host = NULL;
|
||||
|
@ -217,8 +217,7 @@ static void server_real_connect(SERVER_REC *server, IPADDR *ip,
|
||||
|
||||
if (ip != NULL) {
|
||||
own_ip = IPADDR_IS_V6(ip) ? server->connrec->own_ip6 : server->connrec->own_ip4;
|
||||
port = server->connrec->proxy != NULL ?
|
||||
server->connrec->proxy_port : server->connrec->port;
|
||||
port = server->connrec->port;
|
||||
handle = server->connrec->use_tls ?
|
||||
net_connect_ip_ssl(ip, port, own_ip, server) : net_connect_ip(ip, port, own_ip);
|
||||
} else {
|
||||
@ -414,8 +413,7 @@ int server_start_connect(SERVER_REC *server)
|
||||
server->connect_pipe[0] = g_io_channel_new(fd[0]);
|
||||
server->connect_pipe[1] = g_io_channel_new(fd[1]);
|
||||
|
||||
connect_address = server->connrec->proxy != NULL ?
|
||||
server->connrec->proxy : server->connrec->address;
|
||||
connect_address = server->connrec->address;
|
||||
server->connect_pid =
|
||||
net_gethostbyname_nonblock(connect_address,
|
||||
server->connect_pipe[1],
|
||||
@ -610,11 +608,6 @@ void server_connect_unref(SERVER_CONNECT_REC *conn)
|
||||
if (conn->connect_handle != NULL)
|
||||
net_disconnect(conn->connect_handle);
|
||||
|
||||
g_free_not_null(conn->proxy);
|
||||
g_free_not_null(conn->proxy_string);
|
||||
g_free_not_null(conn->proxy_string_after);
|
||||
g_free_not_null(conn->proxy_password);
|
||||
|
||||
g_free_not_null(conn->tag);
|
||||
g_free_not_null(conn->address);
|
||||
g_free_not_null(conn->chatnet);
|
||||
|
@ -168,6 +168,8 @@ static void session_save_server(SERVER_REC *server, CONFIG_REC *config,
|
||||
config_node_set_str(config, node, "tls_pinned_cert", server->connrec->tls_pinned_cert);
|
||||
config_node_set_str(config, node, "tls_pinned_pubkey", server->connrec->tls_pinned_pubkey);
|
||||
|
||||
config_node_set_str(config, node, "proxy", server->connrec->proxy);
|
||||
|
||||
handle = g_io_channel_unix_get_fd(net_sendbuffer_handle(server->handle));
|
||||
config_node_set_int(config, node, "handle", handle);
|
||||
|
||||
|
@ -22,6 +22,7 @@ libfe_common_core_a_SOURCES = \
|
||||
fe-messages.c \
|
||||
fe-modules.c \
|
||||
fe-queries.c \
|
||||
fe-proxy.c \
|
||||
fe-server.c \
|
||||
fe-settings.c \
|
||||
fe-tls.c \
|
||||
|
@ -82,6 +82,9 @@ void fe_messages_deinit(void);
|
||||
void fe_modules_init(void);
|
||||
void fe_modules_deinit(void);
|
||||
|
||||
void fe_proxy_init(void);
|
||||
void fe_proxy_deinit(void);
|
||||
|
||||
void fe_server_init(void);
|
||||
void fe_server_deinit(void);
|
||||
|
||||
@ -176,6 +179,7 @@ void fe_common_core_init(void)
|
||||
fe_ignore_init();
|
||||
fe_log_init();
|
||||
fe_modules_init();
|
||||
fe_proxy_init();
|
||||
fe_server_init();
|
||||
fe_settings_init();
|
||||
fe_tls_init();
|
||||
@ -218,6 +222,7 @@ void fe_common_core_deinit(void)
|
||||
fe_ignore_deinit();
|
||||
fe_log_deinit();
|
||||
fe_modules_deinit();
|
||||
fe_proxy_deinit();
|
||||
fe_server_deinit();
|
||||
fe_settings_deinit();
|
||||
fe_tls_deinit();
|
||||
|
124
src/fe-common/core/fe-proxy.c
Normal file
124
src/fe-common/core/fe-proxy.c
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Alexander Færøy <ahf@irssi.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "signals.h"
|
||||
#include "commands.h"
|
||||
#include "network.h"
|
||||
#include "levels.h"
|
||||
#include "settings.h"
|
||||
#include "proxy.h"
|
||||
|
||||
#include "module-formats.h"
|
||||
#include "printtext.h"
|
||||
|
||||
/* SYNTAX: PROXY ADD <name> <type> <address> <port> */
|
||||
static void cmd_proxy_add(const char *data)
|
||||
{
|
||||
char *name, *type, *address, *port;
|
||||
GHashTable *optlist;
|
||||
PROXY_REC *rec;
|
||||
void *free_arg;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 4 | PARAM_FLAG_OPTIONS,
|
||||
"proxy add", &optlist, &name, &type, &address, &port))
|
||||
return;
|
||||
|
||||
if (*name == '\0' || *type == '\0' || *address == '\0' || *port == '\0')
|
||||
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
rec = proxy_find(name);
|
||||
|
||||
if (rec == NULL) {
|
||||
rec = g_new0(PROXY_REC, 1);
|
||||
rec->name = g_strdup(name);
|
||||
} else {
|
||||
g_free_and_null(rec->address);
|
||||
}
|
||||
|
||||
rec->address = g_strdup(address);
|
||||
rec->port = atoi(port);
|
||||
|
||||
proxy_create(rec);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_PROXY_ADDED, name);
|
||||
|
||||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
||||
/* SYNTAX: PROXY REMOVE <name> */
|
||||
static void cmd_proxy_remove(const char *data)
|
||||
{
|
||||
PROXY_REC *rec;
|
||||
|
||||
if (*data == '\0')
|
||||
cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
rec = proxy_find(data);
|
||||
|
||||
if (rec == NULL)
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_PROXY_NOT_FOUND, data);
|
||||
else {
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_PROXY_REMOVED, data);
|
||||
proxy_remove(rec);
|
||||
}
|
||||
}
|
||||
|
||||
/* SYNTAX: PROXY LIST */
|
||||
static void cmd_proxy_list(void)
|
||||
{
|
||||
GString *str;
|
||||
GSList *tmp;
|
||||
|
||||
str = g_string_new(NULL);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_PROXY_HEADER);
|
||||
|
||||
for (tmp = proxies; tmp != NULL; tmp = tmp->next) {
|
||||
PROXY_REC *rec = tmp->data;
|
||||
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_PROXY_LINE, rec->name, rec->address, rec->port, str->str);
|
||||
}
|
||||
|
||||
g_string_free(str, TRUE);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_PROXY_FOOTER);
|
||||
}
|
||||
|
||||
static void cmd_proxy(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
|
||||
{
|
||||
if (*data == '\0')
|
||||
cmd_proxy_list();
|
||||
else
|
||||
command_runsub("proxy", data, server, item);
|
||||
}
|
||||
|
||||
void fe_proxy_init(void)
|
||||
{
|
||||
command_bind("proxy", NULL, (SIGNAL_FUNC)cmd_proxy);
|
||||
command_bind("proxy list", NULL, (SIGNAL_FUNC)cmd_proxy_list);
|
||||
command_bind("proxy add", NULL, (SIGNAL_FUNC)cmd_proxy_add);
|
||||
command_bind("proxy remove", NULL, (SIGNAL_FUNC)cmd_proxy_remove);
|
||||
|
||||
command_set_options("proxy add", "");
|
||||
}
|
||||
|
||||
void fe_proxy_deinit(void)
|
||||
{
|
||||
command_unbind("proxy", (SIGNAL_FUNC)cmd_proxy);
|
||||
command_unbind("proxy list", (SIGNAL_FUNC)cmd_proxy_list);
|
||||
command_unbind("proxy add", (SIGNAL_FUNC)cmd_proxy_add);
|
||||
command_unbind("proxy remove", (SIGNAL_FUNC)cmd_proxy_remove);
|
||||
}
|
@ -215,10 +215,12 @@ static void cmd_server_add_modify(const char *data, gboolean add)
|
||||
if ((rec->tls_cert != NULL && rec->tls_cert[0] != '\0') || rec->tls_verify == TRUE)
|
||||
rec->use_tls = TRUE;
|
||||
|
||||
value = g_hash_table_lookup(optlist, "proxy");
|
||||
if (value != NULL && *value != '\0')
|
||||
rec->proxy = g_strdup(value);
|
||||
|
||||
if (g_hash_table_lookup(optlist, "auto")) rec->autoconnect = TRUE;
|
||||
if (g_hash_table_lookup(optlist, "noauto")) rec->autoconnect = FALSE;
|
||||
if (g_hash_table_lookup(optlist, "proxy")) rec->no_proxy = FALSE;
|
||||
if (g_hash_table_lookup(optlist, "noproxy")) rec->no_proxy = TRUE;
|
||||
|
||||
if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password);
|
||||
value = g_hash_table_lookup(optlist, "host");
|
||||
@ -434,8 +436,8 @@ void fe_server_init(void)
|
||||
command_bind_first("server", NULL, (SIGNAL_FUNC) server_command);
|
||||
command_bind_first("disconnect", NULL, (SIGNAL_FUNC) server_command);
|
||||
|
||||
command_set_options("server add", "4 6 !! ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers +ssl_fingerprint tls +tls_cert +tls_pkey +tls_pass tls_verify +tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert +tls_pinned_pubkey auto noauto proxy noproxy -host -port noautosendcmd");
|
||||
command_set_options("server modify", "4 6 !! ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers +ssl_fingerprint tls +tls_cert +tls_pkey +tls_pass tls_verify +tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert +tls_pinned_pubkey auto noauto proxy noproxy -host -port noautosendcmd");
|
||||
command_set_options("server add", "4 6 !! ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers +ssl_fingerprint tls +tls_cert +tls_pkey +tls_pass tls_verify +tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert +tls_pinned_pubkey +proxy auto noauto -host -port noautosendcmd");
|
||||
command_set_options("server modify", "4 6 !! ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers +ssl_fingerprint tls +tls_cert +tls_pkey +tls_pass tls_verify +tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert +tls_pinned_pubkey +proxy auto noauto -host -port noautosendcmd");
|
||||
|
||||
signal_add("server looking", (SIGNAL_FUNC) sig_server_looking);
|
||||
signal_add("server connecting", (SIGNAL_FUNC) sig_server_connecting);
|
||||
|
@ -304,5 +304,15 @@ FORMAT_REC fecommon_core_formats[] = {
|
||||
{ "tls_cert_fingerprint", "Certificate Fingerprint: {hilight $0} ({hilight $1})", 2, { 0, 0 } },
|
||||
{ "tls_protocol_version", "Protocol: {hilight $0} ({hilight $1} bit, {hilight $2})", 3, { 0, 1, 0 } },
|
||||
|
||||
/* ---- */
|
||||
{ NULL, "Proxy", 0 },
|
||||
|
||||
{ "proxy_added", "Proxy $0 added", 1, { 0 } },
|
||||
{ "proxy_not_found", "Proxy $0 not found", 1, { 0 } },
|
||||
{ "proxy_removed", "Proxy $0 removed", 1, { 0 } },
|
||||
{ "proxy_header", "%#Proxy Server Port Settings", 0 },
|
||||
{ "proxy_line", "%#%|$[!10]0 $[20]1 $[5]2 $3", 4, { 0, 0, 1, 0 } },
|
||||
{ "proxy_footer", "", 0 },
|
||||
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
@ -266,7 +266,16 @@ enum {
|
||||
TXT_TLS_CERT_ISSUER,
|
||||
TXT_TLS_PUBKEY_FINGERPRINT,
|
||||
TXT_TLS_CERT_FINGERPRINT,
|
||||
TXT_TLS_PROTOCOL_VERSION
|
||||
TXT_TLS_PROTOCOL_VERSION,
|
||||
|
||||
TXT_FILL_16,
|
||||
|
||||
TXT_PROXY_ADDED,
|
||||
TXT_PROXY_NOT_FOUND,
|
||||
TXT_PROXY_REMOVED,
|
||||
TXT_PROXY_HEADER,
|
||||
TXT_PROXY_LINE,
|
||||
TXT_PROXY_FOOTER
|
||||
};
|
||||
|
||||
extern FORMAT_REC fecommon_core_formats[];
|
||||
|
@ -54,6 +54,7 @@ const char *get_visible_target(IRC_SERVER_REC *server, const char *target)
|
||||
/* SYNTAX: SERVER ADD|MODIFY [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>]
|
||||
[-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>]
|
||||
[-ssl_ciphers <list>]
|
||||
[-proxy <proxy>]
|
||||
[-auto | -noauto] [-network <network>] [-host <hostname>]
|
||||
[-cmdspeed <ms>] [-cmdmax <count>] [-port <port>]
|
||||
<address> [<port> [<password>]] */
|
||||
@ -106,8 +107,6 @@ static void cmd_server_list(const char *data)
|
||||
g_string_append(str, "(pass), ");
|
||||
if (rec->autoconnect)
|
||||
g_string_append(str, "autoconnect, ");
|
||||
if (rec->no_proxy)
|
||||
g_string_append(str, "noproxy, ");
|
||||
if (rec->use_tls) {
|
||||
g_string_append(str, "tls, ");
|
||||
if (rec->tls_cert) {
|
||||
@ -129,7 +128,6 @@ static void cmd_server_list(const char *data)
|
||||
g_string_append_printf(str, "tls_pinned_cert: %s, ", rec->tls_pinned_cert);
|
||||
if (rec->tls_pinned_pubkey)
|
||||
g_string_append_printf(str, "tls_pinned_pubkey: %s, ", rec->tls_pinned_pubkey);
|
||||
|
||||
}
|
||||
if (rec->max_cmds_at_once > 0)
|
||||
g_string_append_printf(str, "cmdmax: %d, ", rec->max_cmds_at_once);
|
||||
@ -139,6 +137,8 @@ static void cmd_server_list(const char *data)
|
||||
g_string_append_printf(str, "querychans: %d, ", rec->max_query_chans);
|
||||
if (rec->own_host != NULL)
|
||||
g_string_append_printf(str, "host: %s, ", rec->own_host);
|
||||
if (rec->proxy)
|
||||
g_string_append_printf(str, "proxy: %s, ", rec->proxy);
|
||||
|
||||
if (str->len > 1) g_string_truncate(str, str->len-2);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_SETUPSERVER_LINE,
|
||||
|
@ -219,19 +219,6 @@ static void server_init(IRC_SERVER_REC *server)
|
||||
|
||||
conn = server->connrec;
|
||||
|
||||
if (conn->proxy != NULL && conn->proxy_password != NULL &&
|
||||
*conn->proxy_password != '\0') {
|
||||
cmd = g_strdup_printf("PASS %s", conn->proxy_password);
|
||||
irc_send_cmd_now(server, cmd);
|
||||
g_free(cmd);
|
||||
}
|
||||
|
||||
if (conn->proxy != NULL && conn->proxy_string != NULL) {
|
||||
cmd = g_strdup_printf(conn->proxy_string, conn->address, conn->port);
|
||||
irc_send_cmd_now(server, cmd);
|
||||
g_free(cmd);
|
||||
}
|
||||
|
||||
if (conn->sasl_mechanism != SASL_MECHANISM_NONE)
|
||||
cap_toggle(server, "sasl", TRUE);
|
||||
|
||||
@ -271,12 +258,6 @@ static void server_init(IRC_SERVER_REC *server)
|
||||
g_free(cmd);
|
||||
g_free(username);
|
||||
|
||||
if (conn->proxy != NULL && conn->proxy_string_after != NULL) {
|
||||
cmd = g_strdup_printf(conn->proxy_string_after, conn->address, conn->port);
|
||||
irc_send_cmd_now(server, cmd);
|
||||
g_free(cmd);
|
||||
}
|
||||
|
||||
server->isupport = g_hash_table_new((GHashFunc) g_istr_hash,
|
||||
(GCompareFunc) g_istr_equal);
|
||||
|
||||
|
@ -165,7 +165,6 @@ static void perl_client_fill_hash(HV *hv, CLIENT_REC *client)
|
||||
{
|
||||
(void) hv_store(hv, "nick", 4, new_pv(client->nick), 0);
|
||||
(void) hv_store(hv, "addr", 4, new_pv(client->addr), 0);
|
||||
(void) hv_store(hv, "proxy_address", 13, new_pv(client->proxy_address), 0);
|
||||
(void) hv_store(hv, "server", 6, iobject_bless(client->server), 0);
|
||||
(void) hv_store(hv, "pass_sent", 9, newSViv(client->pass_sent), 0);
|
||||
(void) hv_store(hv, "user_sent", 9, newSViv(client->user_sent), 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user