aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile12
-rwxr-xr-xconfigure22
-rw-r--r--debian/copyright2
-rw-r--r--doc/CREDITS2
-rw-r--r--ipc.c2
-rw-r--r--irc.c85
-rw-r--r--irc.h2
-rw-r--r--irc_commands.c44
-rw-r--r--lib/Makefile6
-rw-r--r--lib/canohost.c140
-rw-r--r--lib/canohost.h43
-rw-r--r--lib/misc.c47
-rw-r--r--lib/misc.h4
-rw-r--r--protocols/Makefile6
-rw-r--r--protocols/jabber/Makefile4
-rw-r--r--protocols/msn/Makefile4
-rw-r--r--protocols/oscar/Makefile4
-rw-r--r--protocols/purple/Makefile4
-rw-r--r--protocols/twitter/Makefile4
-rw-r--r--tests/Makefile4
-rw-r--r--tests/check.c2
21 files changed, 331 insertions, 112 deletions
diff --git a/Makefile b/Makefile
index d4d15e48..be554e02 100644
--- a/Makefile
+++ b/Makefile
@@ -176,28 +176,28 @@ tar:
tar czf $$x.tar.gz --exclude=debian --exclude=.git* --exclude=.depend $$x
$(subdirs):
- @$(MAKE) -C $@ $(MAKECMDGOALS)
+ $(MAKE) -C $@ $(MAKECMDGOALS)
$(OTR_PI): %.so: $(_SRCDIR_)%.c
@echo '*' Building plugin $@
- @$(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS)
+ $(VERBOSE) $(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS)
$(SKYPE_PI): $(_SRCDIR_)protocols/skype/skype.c
@echo '*' Building plugin skype
- @$(CC) $(CFLAGS) $(LDFLAGS) $(SKYPEFLAGS) $< -o $@
+ $(VERBOSE) $(CC) $(CFLAGS) $(LDFLAGS) $(SKYPEFLAGS) $< -o $@
$(objects): %.o: $(_SRCDIR_)%.c
@echo '*' Compiling $<
- @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
+ $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
$(objects): Makefile Makefile.settings config.h
$(OUTFILE): $(objects) $(subdirs)
@echo '*' Linking $(OUTFILE)
- @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LDFLAGS) $(EFLAGS)
+ $(VERBOSE) $(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LDFLAGS) $(EFLAGS)
ifneq ($(firstword $(STRIP)), \#)
@echo '*' Stripping $(OUTFILE)
- @-$(STRIP) $(OUTFILE)
+ $(VERBOSE) -$(STRIP) $(OUTFILE)
endif
ctags:
diff --git a/configure b/configure
index 7d1537b6..ee50e4ab 100755
--- a/configure
+++ b/configure
@@ -38,6 +38,7 @@ oscar="default-on"
twitter=1
purple=0
+verbose=0
doc=1
debug=0
strip=0
@@ -126,6 +127,8 @@ Option Description Default
--pidfile=... $pidfile
--config=... $config
+--verbose=0/1 Disable/enable verbose build $verbose
+
--msn=0/1 Disable/enable MSN part $msn
--jabber=0/1 Disable/enable Jabber part $jabber
--oscar=0/1 Disable/enable Oscar part (ICQ, AIM) $oscar
@@ -284,6 +287,25 @@ if [ "$asan" = "1" ]; then
debug=1
fi
+if [ "$verbose" = "0" ]; then
+ echo 'VERBOSE=@' >> Makefile.settings
+else
+ echo 'VERBOSE=' >> Makefile.settings
+fi
+
+cat <<EOF >>Makefile.settings
+
+# Enable/disable output verbosity
+ifdef V
+ifeq (\$(V),1)
+ VERBOSE=
+else
+ VERBOSE=@
+endif
+endif
+
+EOF
+
if [ "$debug" = "1" ]; then
echo 'DEBUG=1' >> Makefile.settings
CFLAGS="$CFLAGS -g3 -DDEBUG -O0"
diff --git a/debian/copyright b/debian/copyright
index c5ca4e16..09f27568 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -16,6 +16,8 @@ Bits of third party code, also (L)GPLed:
Other license (but GPL-compatible):
* lib/json.[ch] is from <https://github.com/udp/json-parser> and licensed
under the modified BSD license.
+* lib/canohost.[ch] is from OpenSSH and licenced under the BSD-3-clause
+ licence.
BitlBee License:
diff --git a/doc/CREDITS b/doc/CREDITS
index d53f6de0..b77a851a 100644
--- a/doc/CREDITS
+++ b/doc/CREDITS
@@ -21,7 +21,7 @@ The authors thank the following people:
bug reports.
- Bryan Williams, for the help in getting BitlBee to run on Cygwin.
- Peter van Dijk for discovering a security leak in BitlBee.
-- Christian Häggeström, for the fix for the Jabber barf on high ASCII
+- Christian Häggeström, for the fix for the Jabber barf on high ASCII
characters in away messages.
- James Ray, for some testing, development and patching.
- Yuri Pimenov, for writing the charset/iconv code, requested by a
diff --git a/ipc.c b/ipc.c
index 304a8ef2..e4e48a89 100644
--- a/ipc.c
+++ b/ipc.c
@@ -897,7 +897,7 @@ int ipc_master_listen_socket()
un_addr.sun_family = AF_UNIX;
strcpy(un_addr.sun_path, IPCSOCKET);
- serversock = socket(AF_UNIX, SOCK_STREAM, PF_UNIX);
+ serversock = socket(AF_UNIX, SOCK_STREAM, 0);
if (serversock == -1) {
log_message(LOGLVL_WARNING, "Unable to create UNIX socket: %s", strerror(errno));
diff --git a/irc.c b/irc.c
index 7ba9ef8b..a1aae4ef 100644
--- a/irc.c
+++ b/irc.c
@@ -24,6 +24,7 @@
*/
#include "bitlbee.h"
+#include "canohost.h"
#include "ipc.h"
#include "dcc.h"
#include "lib/ssl_client.h"
@@ -41,9 +42,6 @@ static char *set_eval_certfp(set_t *set, char *value);
irc_t *irc_new(int fd)
{
irc_t *irc;
- struct sockaddr_storage sock;
- socklen_t socklen = sizeof(sock);
- char *host = NULL, *myhost = NULL;
irc_user_t *iu;
GSList *l;
set_t *s;
@@ -67,33 +65,6 @@ irc_t *irc_new(int fd)
irc->save_source_id = -1;
- if (global.conf->hostname) {
- myhost = g_strdup(global.conf->hostname);
- } else if (getsockname(irc->fd, (struct sockaddr*) &sock, &socklen) == 0) {
- char buf[NI_MAXHOST + 1];
-
- if (getnameinfo((struct sockaddr *) &sock, socklen, buf,
- NI_MAXHOST, NULL, 0, 0) == 0) {
- myhost = g_strdup(ipv6_unwrap(buf));
- }
- }
-
- if (getpeername(irc->fd, (struct sockaddr*) &sock, &socklen) == 0) {
- char buf[NI_MAXHOST + 1];
-
- if (getnameinfo((struct sockaddr *) &sock, socklen, buf,
- NI_MAXHOST, NULL, 0, 0) == 0) {
- host = g_strdup(ipv6_unwrap(buf));
- }
- }
-
- if (host == NULL) {
- host = g_strdup("localhost.localdomain");
- }
- if (myhost == NULL) {
- myhost = g_strdup("localhost.localdomain");
- }
-
if (global.conf->ping_interval > 0 && global.conf->ping_timeout > 0) {
irc->ping_source_id = b_timeout_add(global.conf->ping_interval * 1000, irc_userping, irc);
}
@@ -150,17 +121,16 @@ irc_t *irc_new(int fd)
#endif
irc->root = iu = irc_user_new(irc, ROOT_NICK);
- iu->host = g_strdup(myhost);
iu->fullname = g_strdup(ROOT_FN);
iu->f = &irc_user_root_funcs;
iu = irc_user_new(irc, NS_NICK);
- iu->host = g_strdup(myhost);
iu->fullname = g_strdup(ROOT_FN);
iu->f = &irc_user_root_funcs;
irc->user = g_new0(irc_user_t, 1);
- irc->user->host = g_strdup(host);
+
+ irc_set_hosts(irc, NULL, 0);
conf_loaddefaults(irc);
@@ -176,9 +146,6 @@ irc_t *irc_new(int fd)
"See doc/README for more information.");
}
- g_free(myhost);
- g_free(host);
-
/* libpurple doesn't like fork()s after initializing itself, so this
is the right moment to initialize it. */
#ifdef WITH_PURPLE
@@ -200,6 +167,52 @@ irc_t *irc_new(int fd)
return irc;
}
+void irc_set_hosts(irc_t *irc, const struct sockaddr *remote_addr, const socklen_t remote_addrlen)
+{
+ struct sockaddr_storage sock;
+ socklen_t socklen = sizeof(sock);
+ char *host = NULL, *myhost = NULL;
+ struct irc_user *iu;
+
+ if (global.conf->hostname) {
+ myhost = g_strdup(global.conf->hostname);
+ } else if (getsockname(irc->fd, (struct sockaddr*) &sock, &socklen) == 0) {
+ myhost = reverse_lookup((struct sockaddr*) &sock, socklen);
+ }
+
+ if (remote_addrlen > 0) {
+ host = reverse_lookup(remote_addr, remote_addrlen);
+ } else if (getpeername(irc->fd, (struct sockaddr*) &sock, &socklen) == 0) {
+ host = reverse_lookup((struct sockaddr*) &sock, socklen);
+ }
+
+ if (myhost == NULL) {
+ myhost = g_strdup("localhost.localdomain");
+ }
+ if (host == NULL) {
+ host = g_strdup("localhost.localdomain");
+ }
+
+ if (irc->root->host != irc->root->nick) {
+ g_free(irc->root->host);
+ }
+ irc->root->host = g_strdup(myhost);
+ if ((iu = irc_user_by_name(irc, NS_NICK))) {
+ if (iu->host != iu->nick) {
+ g_free(iu->host);
+ }
+ iu->host = g_strdup(myhost);
+ }
+
+ if (irc->user->host != irc->user->nick) {
+ g_free(irc->user->host);
+ }
+ irc->user->host = g_strdup(host);
+
+ g_free(myhost);
+ g_free(host);
+}
+
/* immed=1 makes this function pretty much equal to irc_free(), except that
this one will "log". In case the connection is already broken and we
shouldn't try to write to it. */
diff --git a/irc.h b/irc.h
index 37e044e6..860140f4 100644
--- a/irc.h
+++ b/irc.h
@@ -33,6 +33,7 @@
#ifdef WITH_GNUTLS
# include <gnutls/gnutls.h>
#endif
+#include <sys/socket.h>
#define IRC_MAX_LINE 512
#define IRC_MAX_ARGS 16
@@ -290,6 +291,7 @@ extern GSList *irc_plugins; /* struct irc_plugin */
extern GSList *irc_connection_list;
irc_t *irc_new(int fd);
+void irc_set_hosts(irc_t *irc, const struct sockaddr *remote_addr, const socklen_t remote_addrlen);
void irc_abort(irc_t *irc, int immed, char *format, ...) G_GNUC_PRINTF(3, 4);
void irc_free(irc_t *irc);
void irc_setpass(irc_t *irc, const char *pass);
diff --git a/irc_commands.c b/irc_commands.c
index 01b1d821..f45f94e2 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -25,6 +25,7 @@
#define BITLBEE_CORE
#include "bitlbee.h"
+#include "canohost.h"
#include "help.h"
#include "ipc.h"
#include "base64.h"
@@ -58,6 +59,48 @@ static void irc_cmd_pass(irc_t *irc, char **cmd)
}
}
+/* http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
+
+ This isn't actually IRC, it's used by for example stunnel4 to indicate
+ the origin of the secured counterpart of the connection. It'll go wrong
+ with arguments starting with : like for example "::1" but I guess I'm
+ okay with that. */
+static void irc_cmd_proxy(irc_t *irc, char **cmd)
+{
+ struct addrinfo hints, *ai;
+ struct sockaddr_storage sock;
+ socklen_t socklen = sizeof(sock);
+
+ if (getpeername(irc->fd, (struct sockaddr*) &sock, &socklen) != 0) {
+ return;
+ }
+
+ ipv64_normalise_mapped(&sock, &socklen);
+
+ /* Only accept PROXY "command" on localhost sockets. */
+ if (!((sock.ss_family == AF_INET &&
+ ntohl(((struct sockaddr_in*)&sock)->sin_addr.s_addr) == INADDR_LOOPBACK) ||
+ (sock.ss_family == AF_INET6 &&
+ IN6_IS_ADDR_LOOPBACK(&((struct sockaddr_in6*)&sock)->sin6_addr)))) {
+ return;
+ }
+
+ /* And only once. Do this with a pretty dumb regex-match for
+ now, maybe better to use some sort of flag.. */
+ if (!g_regex_match_simple("^(ip6-)?localhost(.(localdomain.?)?)?$", irc->user->host, 0, 0)) {
+ return;
+ }
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_flags = AI_NUMERICHOST;
+ if (getaddrinfo(cmd[2], NULL, &hints, &ai) != 0) {
+ return;
+ }
+
+ irc_set_hosts(irc, ai->ai_addr, ai->ai_addrlen);
+ freeaddrinfo(ai);
+}
+
static gboolean irc_sasl_plain_parse(char *input, char **user, char **pass)
{
int i, part, len;
@@ -816,6 +859,7 @@ static void irc_cmd_rehash(irc_t *irc, char **cmd)
static const command_t irc_commands[] = {
{ "cap", 1, irc_cmd_cap, 0 },
{ "pass", 1, irc_cmd_pass, 0 },
+ { "proxy", 5, irc_cmd_proxy, IRC_CMD_PRE_LOGIN },
{ "user", 4, irc_cmd_user, IRC_CMD_PRE_LOGIN },
{ "nick", 1, irc_cmd_nick, 0 },
{ "quit", 0, irc_cmd_quit, 0 },
diff --git a/lib/Makefile b/lib/Makefile
index 40c03215..fc46aedc 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -12,7 +12,7 @@ _SRCDIR_ := $(_SRCDIR_)lib/
endif
# [SH] Program variables
-objects = arc.o base64.o $(EVENT_HANDLER) ftutil.o http_client.o ini.o json.o json_util.o md5.o misc.o oauth.o oauth2.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o ns_parse.o
+objects = arc.o base64.o canohost.o $(EVENT_HANDLER) ftutil.o http_client.o ini.o json.o json_util.o md5.o misc.o oauth.o oauth2.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o ns_parse.o
LFLAGS += -r
@@ -35,12 +35,12 @@ distclean: clean $(subdirs)
lib.o: $(objects) $(subdirs)
@echo '*' Linking lib.o
- @$(LD) $(LFLAGS) $(objects) -o lib.o
+ $(VERBOSE) $(LD) $(LFLAGS) $(objects) -o lib.o
$(objects): ../Makefile.settings Makefile
$(objects): %.o: $(_SRCDIR_)%.c
@echo '*' Compiling $<
- @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
+ $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
-include .depend/*.d
diff --git a/lib/canohost.c b/lib/canohost.c
new file mode 100644
index 00000000..61d695b9
--- /dev/null
+++ b/lib/canohost.c
@@ -0,0 +1,140 @@
+ /********************************************************************\
+ * BitlBee -- An IRC to other IM-networks gateway *
+ * *
+ * Copyright 2002-2017 Wilmer van der Gaast and others *
+ \********************************************************************/
+
+/*
+ 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 with
+ the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
+ if not, write to the Free Software Foundation, Inc., 51 Franklin St.,
+ Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+/* These two functions, with some modifications, taken from OpenSSH:
+ *
+ * $OpenBSD: canohost.c,v 1.73 2016/03/07 19:02:43 djm Exp
+ *
+ * Author: Tatu Ylonen <ylo@cs.hut.fi>
+ * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
+ * All rights reserved
+ * Functions for returning the canonical host name of the remote site.
+ *
+ * As far as I am concerned, the code I have written for this software
+ * can be used freely for any purpose. Any derived versions of this
+ * software must be clearly marked as such, and if the derived work is
+ * incompatible with the protocol description in the RFC file, it must be
+ * called by a name other than "ssh" or "Secure Shell".
+ */
+
+#include "canohost.h"
+
+char *reverse_lookup(const struct sockaddr *from_, const socklen_t fromlen_)
+{
+ struct sockaddr_storage from;
+ socklen_t fromlen;
+ struct addrinfo hints, *ai, *aitop;
+ char name[NI_MAXHOST], ntop2[NI_MAXHOST];
+ char ntop[INET6_ADDRSTRLEN];
+
+ fromlen = sizeof(from);
+ memset(&from, 0, sizeof(from));
+ memcpy(&from, from_, fromlen_);
+ ipv64_normalise_mapped(&from, &fromlen);
+ if (from.ss_family == AF_INET6) {
+ fromlen = sizeof(struct sockaddr_in6);
+ }
+
+ if (getnameinfo((struct sockaddr *)&from, fromlen, ntop, sizeof(ntop),
+ NULL, 0, NI_NUMERICHOST) != 0) {
+ return NULL;
+ }
+
+ /* Map the IP address to a host name. */
+ if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name),
+ NULL, 0, NI_NAMEREQD) != 0) {
+ /* Host name not found. Use ip address. */
+ return g_strdup(ntop);
+ }
+
+ /*
+ * if reverse lookup result looks like a numeric hostname,
+ * someone is trying to trick us by PTR record like following:
+ * 1.1.1.10.in-addr.arpa. IN PTR 2.3.4.5
+ */
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_socktype = SOCK_DGRAM; /*dummy*/
+ hints.ai_flags = AI_NUMERICHOST;
+ if (getaddrinfo(name, NULL, &hints, &ai) == 0) {
+ freeaddrinfo(ai);
+ return g_strdup(ntop);
+ }
+
+ /* Names are stored in lowercase. */
+ char *tolower = g_utf8_strdown(name, -1);
+ g_snprintf(name, sizeof(name), "%s", tolower);
+ g_free(tolower);
+
+ /*
+ * Map it back to an IP address and check that the given
+ * address actually is an address of this host. This is
+ * necessary because anyone with access to a name server can
+ * define arbitrary names for an IP address. Mapping from
+ * name to IP address can be trusted better (but can still be
+ * fooled if the intruder has access to the name server of
+ * the domain).
+ */
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = from.ss_family;
+ hints.ai_socktype = SOCK_STREAM;
+ if (getaddrinfo(name, NULL, &hints, &aitop) != 0) {
+ return g_strdup(ntop);
+ }
+ /* Look for the address from the list of addresses. */
+ for (ai = aitop; ai; ai = ai->ai_next) {
+ if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop2,
+ sizeof(ntop2), NULL, 0, NI_NUMERICHOST) == 0 &&
+ (strcmp(ntop, ntop2) == 0))
+ break;
+ }
+ freeaddrinfo(aitop);
+ /* If we reached the end of the list, the address was not there. */
+ if (ai == NULL) {
+ /* Address not found for the host name. */
+ return g_strdup(ntop);
+ }
+ return g_strdup(name);
+}
+
+void
+ipv64_normalise_mapped(struct sockaddr_storage *addr, socklen_t *len)
+{
+ struct sockaddr_in6 *a6 = (struct sockaddr_in6 *)addr;
+ struct sockaddr_in *a4 = (struct sockaddr_in *)addr;
+ struct in_addr inaddr;
+ u_int16_t port;
+
+ if (addr->ss_family != AF_INET6 ||
+ !IN6_IS_ADDR_V4MAPPED(&a6->sin6_addr))
+ return;
+
+ memcpy(&inaddr, ((char *)&a6->sin6_addr) + 12, sizeof(inaddr));
+ port = a6->sin6_port;
+
+ memset(a4, 0, sizeof(*a4));
+
+ a4->sin_family = AF_INET;
+ *len = sizeof(*a4);
+ memcpy(&a4->sin_addr, &inaddr, sizeof(inaddr));
+ a4->sin_port = port;
+}
diff --git a/lib/canohost.h b/lib/canohost.h
new file mode 100644
index 00000000..25fa30f2
--- /dev/null
+++ b/lib/canohost.h
@@ -0,0 +1,43 @@
+ /********************************************************************\
+ * BitlBee -- An IRC to other IM-networks gateway *
+ * *
+ * Copyright 2002-2017 Wilmer van der Gaast and others *
+ \********************************************************************/
+
+/*
+ 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 with
+ the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
+ if not, write to the Free Software Foundation, Inc., 51 Franklin St.,
+ Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+/* These two functions, with some modifications, taken from OpenSSH:
+ *
+ * $OpenBSD: canohost.c,v 1.73 2016/03/07 19:02:43 djm Exp
+ *
+ * Author: Tatu Ylonen <ylo@cs.hut.fi>
+ * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
+ * All rights reserved
+ * Functions for returning the canonical host name of the remote site.
+ *
+ * As far as I am concerned, the code I have written for this software
+ * can be used freely for any purpose. Any derived versions of this
+ * software must be clearly marked as such, and if the derived work is
+ * incompatible with the protocol description in the RFC file, it must be
+ * called by a name other than "ssh" or "Secure Shell".
+ */
+
+#include <bitlbee.h>
+
+G_MODULE_EXPORT char *reverse_lookup(const struct sockaddr *from_, const socklen_t fromlen_);
+G_MODULE_EXPORT void ipv64_normalise_mapped(struct sockaddr_storage *addr, socklen_t *len);
diff --git a/lib/misc.c b/lib/misc.c
index c611d99f..2723be1e 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -1,4 +1,4 @@
-/********************************************************************\
+ /********************************************************************\
* BitlBee -- An IRC to other IM-networks gateway *
* *
* Copyright 2002-2012 Wilmer van der Gaast and others *
@@ -334,51 +334,6 @@ char *strip_newlines(char *source)
return source;
}
-/* Wrap an IPv4 address into IPv6 space. Not thread-safe... */
-char *ipv6_wrap(char *src)
-{
- static char dst[64];
- int i;
-
- for (i = 0; src[i]; i++) {
- if ((src[i] < '0' || src[i] > '9') && src[i] != '.') {
- break;
- }
- }
-
- /* Hmm, it's not even an IP... */
- if (src[i]) {
- return src;
- }
-
- g_snprintf(dst, sizeof(dst), "::ffff:%s", src);
-
- return dst;
-}
-
-/* Unwrap an IPv4 address into IPv6 space. Thread-safe, because it's very simple. :-) */
-char *ipv6_unwrap(char *src)
-{
- int i;
-
- if (g_strncasecmp(src, "::ffff:", 7) != 0) {
- return src;
- }
-
- for (i = 7; src[i]; i++) {
- if ((src[i] < '0' || src[i] > '9') && src[i] != '.') {
- break;
- }
- }
-
- /* Hmm, it's not even an IP... */
- if (src[i]) {
- return src;
- }
-
- return (src + 7);
-}
-
/* Convert from one charset to another.
from_cs, to_cs: Source and destination charsets
diff --git a/lib/misc.h b/lib/misc.h
index 581e7a76..68ed21ce 100644
--- a/lib/misc.h
+++ b/lib/misc.h
@@ -28,6 +28,7 @@
#include <gmodule.h>
#include <time.h>
+#include <sys/socket.h>
struct ns_srv_reply {
int prio;
@@ -129,9 +130,6 @@ G_MODULE_EXPORT char *escape_html(const char *html);
G_MODULE_EXPORT void http_decode(char *s);
G_MODULE_EXPORT void http_encode(char *s);
-G_MODULE_EXPORT char *ipv6_wrap(char *src);
-G_MODULE_EXPORT char *ipv6_unwrap(char *src);
-
G_MODULE_EXPORT signed int do_iconv(char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf);
G_MODULE_EXPORT void random_bytes(unsigned char *buf, int count);
diff --git a/protocols/Makefile b/protocols/Makefile
index b4565ab6..10b8c95e 100644
--- a/protocols/Makefile
+++ b/protocols/Makefile
@@ -42,18 +42,18 @@ distclean: clean $(subdirs)
rm -rf .depend
$(subdirs):
- @$(MAKE) -C $@ $(MAKECMDGOALS)
+ $(MAKE) -C $@ $(MAKECMDGOALS)
### MAIN PROGRAM
protocols.o: $(objects) $(subdirs)
@echo '*' Linking protocols.o
- @$(LD) $(LFLAGS) $(objects) $(subdirobjs) -o protocols.o
+ $(VERBOSE) $(LD) $(LFLAGS) $(objects) $(subdirobjs) -o protocols.o
$(objects): ../Makefile.settings Makefile
$(objects): %.o: $(_SRCDIR_)%.c
@echo '*' Compiling $<
- @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
+ $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
-include .depend/*.d
diff --git a/protocols/jabber/Makefile b/protocols/jabber/Makefile
index 49a9b3f4..458f646b 100644
--- a/protocols/jabber/Makefile
+++ b/protocols/jabber/Makefile
@@ -37,10 +37,10 @@ $(objects): ../../Makefile.settings Makefile
$(objects): %.o: $(_SRCDIR_)%.c
@echo '*' Compiling $<
- @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
+ $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
jabber_mod.o: $(objects)
@echo '*' Linking jabber_mod.o
- @$(LD) $(LFLAGS) $(objects) -o jabber_mod.o
+ $(VERBOSE) $(LD) $(LFLAGS) $(objects) -o jabber_mod.o
-include .depend/*.d
diff --git a/protocols/msn/Makefile b/protocols/msn/Makefile
index 7d020942..089297f6 100644
--- a/protocols/msn/Makefile
+++ b/protocols/msn/Makefile
@@ -37,10 +37,10 @@ $(objects): ../../Makefile.settings Makefile
$(objects): %.o: $(_SRCDIR_)%.c
@echo '*' Compiling $<
- @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
+ $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
msn_mod.o: $(objects)
@echo '*' Linking msn_mod.o
- @$(LD) $(LFLAGS) $(objects) -o msn_mod.o
+ $(VERBOSE) $(LD) $(LFLAGS) $(objects) -o msn_mod.o
-include .depend/*.d
diff --git a/protocols/oscar/Makefile b/protocols/oscar/Makefile
index 8088bdb6..506e758c 100644
--- a/protocols/oscar/Makefile
+++ b/protocols/oscar/Makefile
@@ -38,10 +38,10 @@ $(objects): ../../Makefile.settings Makefile
$(objects): %.o: $(_SRCDIR_)%.c
@echo '*' Compiling $<
- @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
+ $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
oscar_mod.o: $(objects)
@echo '*' Linking oscar_mod.o
- @$(LD) $(LFLAGS) $(objects) -o oscar_mod.o
+ $(VERBOSE) $(LD) $(LFLAGS) $(objects) -o oscar_mod.o
-include .depend/*.d
diff --git a/protocols/purple/Makefile b/protocols/purple/Makefile
index 562b4db1..41cc7b6a 100644
--- a/protocols/purple/Makefile
+++ b/protocols/purple/Makefile
@@ -38,10 +38,10 @@ $(objects): ../../Makefile.settings Makefile
$(objects): %.o: $(_SRCDIR_)%.c
@echo '*' Compiling $<
- @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
+ $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
purple_mod.o: $(objects)
@echo '*' Linking purple_mod.o
- @$(LD) $(LFLAGS) $(objects) -o purple_mod.o
+ $(VERBOSE) $(LD) $(LFLAGS) $(objects) -o purple_mod.o
-include .depend/*.d
diff --git a/protocols/twitter/Makefile b/protocols/twitter/Makefile
index ce87090f..40ae9de4 100644
--- a/protocols/twitter/Makefile
+++ b/protocols/twitter/Makefile
@@ -37,10 +37,10 @@ $(objects): ../../Makefile.settings Makefile
$(objects): %.o: $(_SRCDIR_)%.c
@echo '*' Compiling $<
- @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
+ $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
twitter_mod.o: $(objects)
@echo '*' Linking twitter_mod.o
- @$(LD) $(LFLAGS) $(objects) -o twitter_mod.o
+ $(VERBOSE) $(LD) $(LFLAGS) $(objects) -o twitter_mod.o
-include .depend/*.d
diff --git a/tests/Makefile b/tests/Makefile
index 09763e0c..76122a2f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -20,8 +20,8 @@ test_objs = check.o check_util.o check_nick.o check_md5.o check_arc.o check_irc.
check: $(test_objs) $(addprefix ../, $(main_objs)) ../protocols/protocols.o ../lib/lib.o
@echo '*' Linking $@
- @$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(EFLAGS)
+ $(VERBOSE) $(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(EFLAGS)
%.o: $(_SRCDIR_)%.c
@echo '*' Compiling $<
- @$(CC) -c $(CFLAGS) $< -o $@
+ $(VERBOSE) $(CC) -c $(CFLAGS) $< -o $@
diff --git a/tests/check.c b/tests/check.c
index 25e27b49..2fb51cc6 100644
--- a/tests/check.c
+++ b/tests/check.c
@@ -13,7 +13,7 @@ gboolean g_io_channel_pair(GIOChannel **ch1, GIOChannel **ch2)
{
int sock[2];
- if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNIX, sock) < 0) {
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sock) < 0) {
perror("socketpair");
return FALSE;
}