--- timps-0.25.orig/naf/conn.c +++ timps-0.25/naf/conn.c @@ -1110,12 +1110,12 @@ return; } -static struct nafconn *listenestablish(struct nafmodule *mod, unsigned short portnum, struct nafmodule *nowner) +static struct nafconn *listenestablish(struct nafmodule *mod, const char *addr, unsigned short portnum, struct nafmodule *nowner) { nbio_sockfd_t sfd; struct nafconn *retconn = NULL; - if ((sfd = nbio_sfd_newlistener(&gnb, portnum)) == -1) { + if ((sfd = nbio_sfd_newlistener(&gnb, addr, portnum)) == -1) { dprintf(mod, "unable to create listener socket\n"); return NULL; } @@ -1131,25 +1131,38 @@ static int findlistenport_matcher(struct nafmodule *mod, struct nafconn *conn, const void *data) { - unsigned short port; + struct sockaddr_in *insin; + struct sockaddr_in *testsin; if (!(conn->type & NAF_CONN_TYPE_LISTENER)) return 0; - port = ntohs(((struct sockaddr_in *)&conn->localendpoint)->sin_port); + insin = (struct sockaddr_in *)data; + testsin = (struct sockaddr_in *)&conn->localendpoint; - if (port == *(unsigned short *)data) + if ((testsin->sin_family == insin->sin_family) && + (testsin->sin_addr.s_addr == insin->sin_addr.s_addr) && + (testsin->sin_port == insin->sin_port)) return 1; - return 0; } -static struct nafconn *findlistenport(struct nafmodule *mod, unsigned short port) +static struct nafconn *findlistenport(struct nafmodule *mod, const char *addr, unsigned short port) { - return naf_conn_find(mod, findlistenport_matcher, (const void *)&port); + struct sockaddr_in sin; + + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + if (addr) { + if (inet_pton(AF_INET, addr, &sin.sin_addr.s_addr) != 1) + return NULL; + } + sin.sin_port = htons(port); + + return naf_conn_find(mod, findlistenport_matcher, (const void *)&sin); } -static int listenport_isconfigured(struct nafmodule *mod, unsigned short port) +static int listenport_isconfigured(struct nafmodule *mod, const char *inaddr, unsigned short inport) { char *conf, *cur; @@ -1158,10 +1171,22 @@ cur = strtok(conf, ","); do { + char *colon; + char *addr = NULL; + if (!cur) break; - if (port == atoi(cur)) { + colon = strchr(cur, ':'); + if (colon) { + addr = cur; + *(colon++) = '\0'; + cur = colon; + } + + if ((inport == atoi(cur)) && + (!!addr == !!inaddr) && + (addr && (strcmp(addr, inaddr) == 0))) { naf_free(mod, conf); return 1; } @@ -1175,15 +1200,20 @@ static int cleanlisteners_matcher(struct nafmodule *mod, struct nafconn *conn, const void *data) { + struct sockaddr_in *testsin; unsigned short port; + char addr[128]; if (!(conn->type & NAF_CONN_TYPE_LISTENER)) return 0; - port = ntohs(((struct sockaddr_in *)&conn->localendpoint)->sin_port); + testsin = (struct sockaddr_in *)&conn->localendpoint; + port = ntohs(testsin->sin_port); + if (!inet_ntop(AF_INET, &testsin->sin_addr, addr, sizeof(addr))) + return 0; - if (!listenport_isconfigured(mod, port)) { - dvprintf(mod, "removing unconfigured listen port %u\n", port); + if (!listenport_isconfigured(mod, addr, port)) { + dvprintf(mod, "removing unconfigured listen port %s:%u\n", addr ? addr : "any", port); naf_conn_free(conn); } @@ -1218,12 +1248,19 @@ struct nafconn *nconn = NULL; struct nafmodule *nconnowner = NULL; const char *owner = NULL; + char *addr = NULL; + char *colon; int portnum = -1; int goahead = 1; if (!cur) break; + if ((colon = strchr(cur, ':'))) { + addr = cur; + *(colon++) = '\0'; + cur = colon; + } portnum = atoi(cur); owner = strchr(cur, '/'); @@ -1242,13 +1279,13 @@ goahead = 0; } - if (findlistenport(mod, (naf_u16_t)atoi(cur))) { + if (findlistenport(mod, addr, (naf_u16_t)atoi(cur))) { dvprintf(mod, "duplicate listener specified on port %d\n", portnum); goahead = 0; } if (goahead) - nconn = listenestablish(mod, (naf_u16_t)portnum, nconnowner); + nconn = listenestablish(mod, addr, (naf_u16_t)portnum, nconnowner); if (nconn) { dvprintf(mod, "listening on port %d (for %s)\n", --- timps-0.25.orig/debian/conf +++ timps-0.25/debian/conf @@ -0,0 +1,29 @@ +[module=conn] +listenports=5190/timps-oscar +;debug=10 + +[module=timps] +;debug=10 + +[module=timps-logging] +; prefixed to filenames below +logfilepath=/var/log/timps +; admin log gets all messages and user (dis)connects +adminlogfile=timps-message.log +; this will create a log file for each local user in the path above, of the +; form 'logfilepath/timps-userlog.SERVICE.screenname' +enableperuserlogs=true + +[module=timps-oscar] +;debug=10 +; if you're using aimdlite for testing +;authorizer=localhost:6190 +; default is login.oscar.aol.com:5190 + +[module=logging] +; this is the low-level logging module (in NAF) -- it does not see IMs +logfilepath=/var/log/timps +systemlogfile=timps-system.log + +[module=gnr] +;debug=10 --- timps-0.25.orig/debian/compat +++ timps-0.25/debian/compat @@ -0,0 +1 @@ +5 --- timps-0.25.orig/debian/rules +++ timps-0.25/debian/rules @@ -0,0 +1,78 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# upstream currently defaults to building without optimation +CFLAGS = -Wall -g + +export QUILT_PATCHES=debian/patches + +patch: patch-stamp +patch-stamp: + dh_testdir + quilt push -a + touch $@ + +configure: configure-stamp +configure-stamp: patch-stamp + dh_testdir + # Add here commands to configure the package. + CFLAGS="$(CFLAGS)" ./configure --prefix=/usr + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp patch-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp patch-stamp + + # Add here commands to clean up after the build process. + [ ! -f Makefile ] || $(MAKE) distclean + + -quilt pop -a + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/mutella. + $(MAKE) DESTDIR=$(CURDIR)/debian/timps install + rm -rf $(CURDIR)/debian/timps/usr/lib + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples $(CURDIR)/debian/conf + dh_installchangelogs + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure patch --- timps-0.25.orig/debian/copyright +++ timps-0.25/debian/copyright @@ -0,0 +1,23 @@ +This package was debianized by Eric Warmenhoven on +Thu May 26 17:03:31 PDT 2005. + +It was downloaded from ftp://ftp.zigamorph.net/pub/timps/ +Its website is http://www.zigamorph.net/timps/ + +Upstream Author: Adam Fritzler + +Copyright 2004-2005 Adam Fritzler +Copyright: GPL Version 2 + + 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. + +On Debian systems, the complete text of the GNU General Public +License, version 2, can be found in /usr/share/common-licenses/GPL-2. --- timps-0.25.orig/debian/dirs +++ timps-0.25/debian/dirs @@ -0,0 +1 @@ +usr/bin --- timps-0.25.orig/debian/README.Debian +++ timps-0.25/debian/README.Debian @@ -0,0 +1,8 @@ +Suggested usage: + + timpsd -c /usr/share/doc/timps/examples/conf -d -D + +Please don't run this as root; it's likely that there are several security +holes (hence the lack of an init.d script). Any user can run the daemon, as +long as the port they specify isn't privileged. Multiple users can run the +daemon simultaneously, as long as each specifies a different port to listen on. --- timps-0.25.orig/debian/control +++ timps-0.25/debian/control @@ -0,0 +1,28 @@ +Source: timps +Section: net +Priority: extra +Maintainer: Ubuntu MOTU Developers +XSBC-Original-Maintainer: Eric Warmenhoven +Build-Depends: debhelper (>> 4.0.0), libreadline5-dev | libreadline-dev, libncurses5-dev | libncurses-dev, libnbio-dev, quilt +Standards-Version: 3.7.3 + +Package: timps +Architecture: any +Depends: ${shlibs:Depends} +Description: Transparent Instant Messaging Proxy Server + timps is an (optionally transparent) proxy server targeted at instant + messaging networks -- particularly AOL's Instant Messenger. One of the more + important features is that when multiple users are connected through the + proxy, messages between those users are kept in the local network and not + routed across the internet. Multiple proxies can be connected together to form + trusted networks for secure message routing. The proxy can also be used for + connecting artificial users, such as interactive agents / bots without rate + limiting. More generically, modules can be written that interact at any stage + of message routing, creating a flexible system for developing applications + with and on IM. + . + Since timps speaks the IM protocols natively (ie, it looks like an IM server), + DNS rerouting or other tricks can be used to invisibly force users through the + proxy. This is particularly useful for companies facing auditing compliance on + employee communications (for example, Sarbanes-Oxley for financial companies, + or normal policy for law firms). --- timps-0.25.orig/debian/changelog +++ timps-0.25/debian/changelog @@ -0,0 +1,35 @@ +timps (0.25-2ubuntu1) intrepid; urgency=low + + * debian/control, debian/rules: Add quilt support + * debian/patches/fix_missing_include: + - #include in naf/conn.c to get INT_MAX and INT_MIN. Fixes FTBFS + + -- Albin Tonnerre Mon, 22 Sep 2008 22:38:55 +0200 + +timps (0.25-2) unstable; urgency=low + + * Fix build with conn.c fix from timps cvs. Closes: #470247. + * Fix lintian warnings (standards version, ignore make clean failure) + + -- Eric Warmenhoven Mon, 10 Mar 2008 12:27:49 -0700 + +timps (0.25-1) unstable; urgency=low + + * New upstream version. + * Build with libreadline5-dev | libreadline-dev. Closes: #350650. + + -- Eric Warmenhoven Fri, 17 Mar 2006 14:17:32 -0800 + +timps (0.20-1) unstable; urgency=low + + * New upstream version. + * Use rl_completion_matches. Closes: #311024. + + -- Eric Warmenhoven Sun, 14 Aug 2005 16:31:35 -0700 + +timps (0.10-1) unstable; urgency=low + + * Initial Release. Closes: #310937. + + -- Eric Warmenhoven Fri, 27 May 2005 00:14:21 -0700 + --- timps-0.25.orig/debian/docs +++ timps-0.25/debian/docs @@ -0,0 +1,3 @@ +README +AUTHORS +NEWS --- timps-0.25.orig/debian/patches/series +++ timps-0.25/debian/patches/series @@ -0,0 +1 @@ +fix_missing_include --- timps-0.25.orig/debian/patches/fix_missing_include +++ timps-0.25/debian/patches/fix_missing_include @@ -0,0 +1,10 @@ +--- a/naf/conn.c ++++ b/naf/conn.c +@@ -63,6 +63,7 @@ + #include + #endif + #ifdef HAVE_LINUX_NETFILTER_IPV4_H ++#include + #include /* XXX */ + #endif +