aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorulim <a.sporto+bee@gmail.com>2008-06-02 14:58:57 +0200
committerulim <a.sporto+bee@gmail.com>2008-06-02 14:58:57 +0200
commitc821e8ad0d1cf9ab71e6e34c685d0adea2dde923 (patch)
tree0273986e236651d17157ccd3907f64242fd13da9
parentcce0450184b4358ef06d91cca985fa3ca389fcd6 (diff)
parentde8e584d7f4fea214934af094a4df2672d7e0be8 (diff)
merged in upstream r384. No conflicts.
-rw-r--r--bitlbee.c4
-rw-r--r--bitlbee.conf14
-rw-r--r--conf.c16
-rw-r--r--conf.h2
-rw-r--r--debian/changelog7
-rw-r--r--debian/control9
-rwxr-xr-xdebian/rules44
-rw-r--r--doc/README33
-rw-r--r--doc/bitlbee.812
-rw-r--r--lib/proxy.c11
-rw-r--r--protocols/msn/ns.c24
-rw-r--r--root_commands.c6
12 files changed, 116 insertions, 66 deletions
diff --git a/bitlbee.c b/bitlbee.c
index 230b8ce8..17431546 100644
--- a/bitlbee.c
+++ b/bitlbee.c
@@ -53,11 +53,11 @@ int bitlbee_daemon_init()
#endif
;
- i = getaddrinfo( global.conf->iface, global.conf->port, &hints, &addrinfo_bind );
+ i = getaddrinfo( global.conf->iface_in, global.conf->port, &hints, &addrinfo_bind );
if( i )
{
log_message( LOGLVL_ERROR, "Couldn't parse address `%s': %s",
- global.conf->iface, gai_strerror(i) );
+ global.conf->iface_in, gai_strerror(i) );
return -1;
}
diff --git a/bitlbee.conf b/bitlbee.conf
index 99e8106d..5fce2820 100644
--- a/bitlbee.conf
+++ b/bitlbee.conf
@@ -9,10 +9,9 @@
## RunMode:
##
## Inetd -- Run from inetd (default)
-## Daemon -- Run as a stand-alone daemon -- EXPERIMENTAL! BitlBee is not yet
-## stable enough to serve lots of users from one process. Because of this
-## and other reasons, the use of daemon-mode is *STRONGLY* discouraged,
-## don't even *think* of reporting bugs when you use this.
+## Daemon -- Run as a stand-alone daemon, serving all users from one process.
+## This saves memory if there are more users, the downside is that when one
+## user hits a crash-bug, all other users will also lose their connection.
## ForkDaemon -- Run as a stand-alone daemon, but keep all clients in separate
## child processes. This should be pretty safe and reliable to use instead
## of inetd mode.
@@ -34,6 +33,13 @@
# DaemonInterface = 0.0.0.0
# DaemonPort = 6667
+## ClientInterface:
+##
+## If for any reason, you want BitlBee to use a specific address/interface
+## for outgoing traffic (IM connections, HTTP(S), etc.), set it here.
+##
+# ClientInterface = 0.0.0.0
+
## AuthMode
##
## Open -- Accept connections from anyone, use NickServ for user authentication.
diff --git a/conf.c b/conf.c
index 6955b23f..c5fcb11a 100644
--- a/conf.c
+++ b/conf.c
@@ -44,7 +44,8 @@ conf_t *conf_load( int argc, char *argv[] )
conf = g_new0( conf_t, 1 );
- conf->iface = NULL;
+ conf->iface_in = NULL;
+ conf->iface_out = NULL;
conf->port = g_strdup( "6667" );
conf->nofork = 0;
conf->verbose = 0;
@@ -82,7 +83,7 @@ conf_t *conf_load( int argc, char *argv[] )
{
if( opt == 'i' )
{
- conf->iface = g_strdup( optarg );
+ conf->iface_in = g_strdup( optarg );
}
else if( opt == 'p' )
{
@@ -131,7 +132,7 @@ conf_t *conf_load( int argc, char *argv[] )
"An IRC-to-other-chat-networks gateway\n"
"\n"
" -I Classic/InetD mode. (Default)\n"
- " -D Daemon mode. (Still EXPERIMENTAL!)\n"
+ " -D Daemon mode. (one process serves all)\n"
" -F Forking daemon. (one process per client)\n"
" -u Run daemon as specified user.\n"
" -P Specify PID-file (not for inetd mode)\n"
@@ -202,14 +203,19 @@ static int conf_loadini( conf_t *conf, char *file )
}
else if( g_strcasecmp( ini->key, "daemoninterface" ) == 0 )
{
- g_free( conf->iface );
- conf->iface = g_strdup( ini->value );
+ g_free( conf->iface_in );
+ conf->iface_in = g_strdup( ini->value );
}
else if( g_strcasecmp( ini->key, "daemonport" ) == 0 )
{
g_free( conf->port );
conf->port = g_strdup( ini->value );
}
+ else if( g_strcasecmp( ini->key, "clientinterface" ) == 0 )
+ {
+ g_free( conf->iface_out );
+ conf->iface_out = g_strdup( ini->value );
+ }
else if( g_strcasecmp( ini->key, "authmode" ) == 0 )
{
if( g_strcasecmp( ini->value, "registered" ) == 0 )
diff --git a/conf.h b/conf.h
index b30d10e2..7fcd0ede 100644
--- a/conf.h
+++ b/conf.h
@@ -31,7 +31,7 @@ typedef enum authmode { AUTHMODE_OPEN, AUTHMODE_CLOSED, AUTHMODE_REGISTERED } au
typedef struct conf
{
- char *iface;
+ char *iface_in, *iface_out;
char *port;
int nofork;
int verbose;
diff --git a/debian/changelog b/debian/changelog
index b964ee0e..f4b71762 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,12 @@
bitlbee (1.2-4) unstable; urgency=low
- * Not a real release, just a placeholder for the changelog.
* Fixed init script to use the BITLBEE_OPTS variable, not an undefined
- DAEMON_OPT.
+ DAEMON_OPT. (Closes: #474583)
* Added dependency information to the init script. (Closes: #472567)
+ * Added bitlbee-dev package. Patch from RISKO Gergely <risko@debian.org>
+ with some small modifications. (Closes: #473480)
- -- Wilmer van der Gaast <wilmer@gaast.net> Sat, 29 Mar 2008 21:10:33 +0000
+ -- Wilmer van der Gaast <wilmer@gaast.net> Wed, 07 May 2008 22:40:40 -0700
bitlbee (1.2-3) unstable; urgency=low
diff --git a/debian/control b/debian/control
index 8383391b..8faa27b8 100644
--- a/debian/control
+++ b/debian/control
@@ -11,3 +11,12 @@ Depends: ${shlibs:Depends}, adduser, net-tools, ${debconf-depends}, debianutils
Description: An IRC to other chat networks gateway
This program can be used as an IRC server which forwards everything you
say to people on other chat networks: Jabber, ICQ, AIM, MSN and Yahoo.
+
+Package: bitlbee-dev
+Architecture: all
+Depends: bitlbee (= ${binary:Version})
+Description: An IRC to other chat networks gateway
+ This program can be used as an IRC server which forwards everything you
+ say to people on other chat networks: Jabber, ICQ, AIM, MSN and Yahoo.
+ .
+ This package holds development stuff for compiling plug-ins.
diff --git a/debian/rules b/debian/rules
index 252fb742..67cb79a3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,21 +12,21 @@ endif
build-arch: build-arch-stamp
build-arch-stamp:
- if [ ! -d debian ]; then exit 1; fi
+ [ -d debian ]
./configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent
$(MAKE)
# $(MAKE) -C doc/ all
touch build-arch-stamp
clean:
- if [ "`whoami`" != "root" -o ! -d debian ]; then exit 1; fi
- rm -rf build-arch-stamp debian/bitlbee debian/*.substvars debian/files
+ [ "`whoami`" = "root" -a -d debian ]
+ rm -rf build-arch-stamp debian/bitlbee debian/*.substvars debian/files debian/bitlbee-dev
-$(MAKE) distclean
# -$(MAKE) -C doc/ clean
install-arch: build-arch
- if [ "`whoami`" != "root" -o ! -d debian ]; then exit 1; fi
+ [ "`whoami`" = "root" -a -d debian ]
mkdir -p debian/bitlbee/DEBIAN/
$(MAKE) install install-etc DESTDIR=`pwd`/debian/bitlbee
@@ -34,8 +34,15 @@ install-arch: build-arch
cp doc/user-guide/user-guide.txt debian/bitlbee/usr/share/doc/bitlbee/
cp doc/user-guide/user-guide.html debian/bitlbee/usr/share/doc/bitlbee/
+install-indep: install-arch
+ [ "`whoami`" = "root" -a -d debian ]
+ mkdir -p debian/bitlbee-dev/DEBIAN/
+ $(MAKE) install-dev DESTDIR=`pwd`/debian/bitlbee-dev
+
+ mkdir -p debian/bitlbee-dev/usr/share/doc/bitlbee-dev/
+
binary-arch: build-arch install-arch
- if [ "`whoami`" != "root" -o ! -d debian ]; then exit 1; fi
+ [ "`whoami`" = "root" -a -d debian ]
chmod 755 debian/post* debian/pre* debian/config debian/bitlbee.init
@@ -51,7 +58,7 @@ binary-arch: build-arch install-arch
gzip -9 doc/bitlbee/changelog.Debian doc/bitlbee/changelog doc/bitlbee/user-guide.txt \
doc/bitlbee/examples/* man/man8/bitlbee.8 man/man5/bitlbee.conf.5
- chown -R root.root debian/bitlbee/
+ chown -R root:root debian/bitlbee/
find debian/bitlbee/usr/share/ -type d -exec chmod 755 {} \;
find debian/bitlbee/usr/share/ -type f -exec chmod 644 {} \;
@@ -76,11 +83,26 @@ endif
dpkg --build debian/bitlbee ..
-debug-build:
- BITLBEE_VERSION=\"`date +%Y%m%d`-`hostname`-debug\" debian/rules clean binary DEBUG=1
+binary-indep: install-indep
+ [ "`whoami`" = "root" -a -d debian ]
+
+ chown -R root.root debian/bitlbee-dev/
+ find debian/bitlbee-dev/usr/share/ -type d -exec chmod 755 {} \;
+ find debian/bitlbee-dev/usr/share/ -type f -exec chmod 644 {} \;
+
+ cp debian/changelog debian/bitlbee-dev/usr/share/doc/bitlbee-dev/changelog.Debian
+ gzip -9 debian/bitlbee-dev/usr/share/doc/bitlbee-dev/changelog.Debian
+ cp debian/copyright debian/bitlbee-dev/usr/share/doc/bitlbee-dev/copyright
+
+ cd debian/bitlbee-dev; \
+ find usr -type f -exec md5sum {} \; > DEBIAN/md5sums
+
+ dpkg-gencontrol -ldebian/changelog -isp -pbitlbee-dev -Pdebian/bitlbee-dev
+
+ dpkg --build debian/bitlbee-dev ..
-binary: binary-arch
+binary: binary-arch binary-indep
build: build-arch
-install: install-arch
+install: install-arch install-indep
-.PHONY: build-arch build clean binary-arch binary install-arch install
+.PHONY: build-arch build clean binary-arch binary install-arch install binary-indep install-indep
diff --git a/doc/README b/doc/README
index ca392573..9e681625 100644
--- a/doc/README
+++ b/doc/README
@@ -55,6 +55,11 @@ it in bitlbee.conf. You probably want to write an init script to start
BitlBee automatically after a reboot. (This is where you realise using
a package from your distro would've been a better idea. :-P)
+Note that the BitlBee code is getting stable enough for daemon mode to be
+useful. Some public servers use it, and it saves a lot of memory by serving
+tens of users from a single process. One crash affects all users, but these
+are becoming quite rare.
+
DEPENDENCIES
============
@@ -99,34 +104,6 @@ versions of make, we'd love to hear it, but it seems this just isn't
possible.
-RUNNING ON SERVERS WITH MANY USERS
-==================================
-
-BitlBee is not yet bug-free. Sometimes a bug causes the program to get into
-an infinite loop. Something you really don't want on a public server,
-especially when that machine is also used for other (mission-critical) things.
-For now we can't do much about it. We haven't seen that happen for a long
-time already on our own machines, but some people still manage to get
-themselves in nasty situations we haven't seen before.
-
-For now the best we can offer against this problem is bitlbeed, which allows
-you to setrlimit() the child processes to use no more than a specified
-number of CPU seconds. Not the best solution (not really a solution anyway),
-but certainly trashing one busy daemon process is better than trashing your
-whole machine.
-
-We don't believe adding a limit for bitlbee to /etc/security/limits.conf will
-work, because that file is only read by PAM (ie just for real login users,
-not daemons).
-
-See utils/bitlbeed.c for more information about the program.
-
-Just a little note: Now that we reach version 1.0, this shouldn't be that
-much of an issue anymore. However, on a public server, especially if you
-also use it for other things, it can't hurt to protect yourself against
-possible problems.
-
-
USAGE
=====
diff --git a/doc/bitlbee.8 b/doc/bitlbee.8
index ae1cfb05..9e634844 100644
--- a/doc/bitlbee.8
+++ b/doc/bitlbee.8
@@ -43,13 +43,8 @@ protocol plugins. BitlBee currently supports Oscar (aim and icq),
MSN, Jabber and Yahoo.
\fBbitlbee\fP should be called by
-.BR inetd (8).
-(Or \fBbitlbeed\fP,
-if you can't run and/or configure \fBinetd\fP.) There is an experimental
-daemon mode too, in which BitlBee will serve all clients in one process
-(and does not require inetd), but this mode is still experimental.
-There are still some bugs left in BitlBee, and if they cause a crash,
-that would terminate the BitlBee connection for all clients.
+.BR inetd (8),
+or you can run it as a stand-alone daemon.
.PP
.SH OPTIONS
.PP
@@ -61,10 +56,9 @@ option.
.IP "-D"
Run in daemon mode. In this mode, BitlBee forks to the background and
waits for new connections. All clients will be served from one process.
-This is still experimental. See the note above for more information.
.IP "-F"
Run in ForkDaemon mode. This is similar to ordinary daemon mode, but every
-client gets its own process. Easier to set up than inetd mode, but without
+client gets its own process. Easier to set up than inetd mode, and without
the possible stability issues.
.IP "-i \fIaddress\fP"
Only useful when running in daemon mode, to specify the network interface
diff --git a/lib/proxy.c b/lib/proxy.c
index 53b89d64..91493557 100644
--- a/lib/proxy.c
+++ b/lib/proxy.c
@@ -113,6 +113,7 @@ static gboolean gaim_io_connected(gpointer data, gint source, b_input_condition
static int proxy_connect_none(const char *host, unsigned short port, struct PHB *phb)
{
struct sockaddr_in *sin;
+ struct sockaddr_in me;
int fd = -1;
if (!(sin = gaim_gethostbyname(host, port))) {
@@ -127,6 +128,16 @@ static int proxy_connect_none(const char *host, unsigned short port, struct PHB
sock_make_nonblocking(fd);
+ if( global.conf->iface_out )
+ {
+ me.sin_family = AF_INET;
+ me.sin_port = 0;
+ me.sin_addr.s_addr = inet_addr( global.conf->iface_out );
+
+ if( bind( fd, (struct sockaddr *) &me, sizeof( me ) ) != 0 )
+ event_debug( "bind( %d, \"%s\" ) failure\n", fd, global.conf->iface_out );
+ }
+
event_debug("proxy_connect_none( \"%s\", %d ) = %d\n", host, port, fd);
if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0 && !sockerr_again()) {
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c
index ff7da6ed..ffaa90a7 100644
--- a/protocols/msn/ns.c
+++ b/protocols/msn/ns.c
@@ -177,7 +177,15 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
}
debug( "Connecting to a new switchboard with key %s", cmd[5] );
- sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW );
+
+ if( ( sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW ) ) == NULL )
+ {
+ /* Although this isn't strictly fatal for the NS connection, it's
+ definitely something serious (we ran out of file descriptors?). */
+ imcb_error( ic, "Could not create new switchboard" );
+ imc_logout( ic, TRUE );
+ return( 0 );
+ }
if( md->msgq )
{
@@ -467,8 +475,18 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
debug( "Got a call from %s (session %d). Key = %s", cmd[5], session, cmd[4] );
- sb = msn_sb_create( ic, server, port, cmd[4], session );
- sb->who = g_strdup( cmd[5] );
+ if( ( sb = msn_sb_create( ic, server, port, cmd[4], session ) ) == NULL )
+ {
+ /* Although this isn't strictly fatal for the NS connection, it's
+ definitely something serious (we ran out of file descriptors?). */
+ imcb_error( ic, "Could not create new switchboard" );
+ imc_logout( ic, TRUE );
+ return( 0 );
+ }
+ else
+ {
+ sb->who = g_strdup( cmd[5] );
+ }
}
else if( strcmp( cmd[0], "ADD" ) == 0 )
{
diff --git a/root_commands.c b/root_commands.c
index b3a77a10..93bd86d1 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -422,6 +422,12 @@ static void cmd_account( irc_t *irc, char **cmd )
else
acc_handle = g_strdup( cmd[2] );
+ if( !acc_handle )
+ {
+ irc_usermsg( irc, "Not enough parameters given (need %d)", 3 );
+ return;
+ }
+
if( ( tmp = strchr( acc_handle, '/' ) ) )
{
*tmp = 0;