1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-10-22 17:57:39 +00:00

Compare commits

...

36 Commits

Author SHA1 Message Date
Alexander Barton
52512462a2 ngIRCd 0.10.1. 2006-12-17 14:06:19 +00:00
Alexander Barton
d9323ada46 Updated documentation for release 0.10.1. 2006-12-17 13:55:29 +00:00
Alexander Barton
ec1847f018 Added support for Solaris 11. [from HEAD] 2006-12-17 13:49:49 +00:00
Florian Westphal
0af8fafdfb add PredefChannelsOnly to manpage [from HEAD] 2006-12-11 22:08:14 +00:00
Florian Westphal
c9e26562ce Changed Numerics 265 and 266 to follow ircd 2.11.x "standards". [from HEAD]
Allow PASS syntax defined in RFC 1459 for server links, too. [from HEAD]
Enhanced ISUPPORT message (005 numeric). [from HEAD]
2006-12-02 14:26:52 +00:00
Florian Westphal
a64e33b317 cleanups [from HEAD] 2006-12-02 14:21:26 +00:00
Florian Westphal
7e2e23d12f make several counters unsigned, char *s -> const char *s [from HEAD] 2006-12-02 14:00:00 +00:00
Florian Westphal
ab7bb74581 cleanups [from HEAD] 2006-12-02 13:54:10 +00:00
Florian Westphal
254bf129dc merge Conf_PredefChannelsOnly [from HEAD] 2006-12-02 13:33:52 +00:00
Florian Westphal
14cdb7fdd0 char* -> const char* [from HEAD] 2006-12-02 13:18:22 +00:00
Florian Westphal
740d876c44 backport checks for inline keyword and strcspn() [from HEAD] 2006-12-02 13:13:53 +00:00
Florian Westphal
de9a130bd9 merge Conf_PredefChannelsOnly Config Option [from HEAD] 2006-12-02 13:10:43 +00:00
Florian Westphal
a0e0da74f8 make several counters unsigned [from HEAD] 2006-12-02 13:08:02 +00:00
Florian Westphal
83c14a6383 - whitespace damage [from HEAD] 2006-12-02 13:06:50 +00:00
Florian Westphal
6c12659bcf #define MASK_LEN should use parentheses [from HEAD] 2006-12-02 13:05:38 +00:00
Florian Westphal
83d4d66818 make LogDebug() 'static inline' if DEBUG is not defined [from HEAD] 2006-12-02 13:02:07 +00:00
Florian Westphal
2434e86e14 char *foo -> const char *foo [from HEAD] 2006-12-02 13:01:11 +00:00
Florian Westphal
2b4b416d2f cleanups [from HEAD] 2006-12-02 13:00:25 +00:00
Alexander Barton
62f74db6f6 Fixed validation of server names containing digits. [from HEAD] 2006-11-10 10:06:14 +00:00
Florian Westphal
cf4ae77991 fix Channel_Join() [from HEAD] 2006-10-05 18:30:47 +00:00
Alexander Barton
1f652554dd Update info text of local server after re-reading configuration. [from HEAD] 2006-10-03 11:01:05 +00:00
Alexander Barton
032bf78ed4 ngIRCd 0.10.0 2006-10-01 16:21:55 +00:00
Alexander Barton
ce66aa1028 Removed "~sid" postfix; ooopsa. 2006-10-01 16:13:21 +00:00
Alexander Barton
9296c27cac Added "Provides: ircd" and bumped standards version. 2006-10-01 16:10:47 +00:00
Alexander Barton
921a5434af Updated ChangeLog. 2006-09-16 13:51:35 +00:00
Alexander Barton
7c7d417fd2 Fix file handle leak [from HEAD]. 2006-09-16 13:49:15 +00:00
Alexander Barton
ed71217b31 ngIRCd 0.10.0-pre2 2006-09-09 19:00:06 +00:00
Alexander Barton
57fb95eb1d ngircd 0.10.0-pre2 release. 2006-09-09 18:50:47 +00:00
Alexander Barton
6f2f2ecd3b only test for stack smashing protector if we are using gcc;
use -fstack-protector-all for the test to make sure the guard variable is added.
[from HEAD.]
2006-09-09 18:34:00 +00:00
Alexander Barton
cf824dd8e7 Updated list of supported/tested platforms. [from HEAD] 2006-09-09 18:10:56 +00:00
Alexander Barton
01ba196d7d fix gcc 4.1 -fstack-protector detection. [from HEAD] 2006-08-13 18:21:31 +00:00
Alexander Barton
af6c532007 New release: 0.10.0-pre1 2006-08-02 10:29:11 +00:00
Alexander Barton
1ca10ff590 Updated debian changelog (from HEAD). 2006-08-02 09:54:19 +00:00
Alexander Barton
cd7862cec4 Updated documentation. 2006-08-02 09:04:20 +00:00
Alexander Barton
f9a928451d Updated documentation. 2006-08-02 08:19:38 +00:00
Alexander Barton
2a22629e74 Increased version number to 0.10.x :-) 2006-07-31 20:32:20 +00:00
37 changed files with 551 additions and 392 deletions

View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2005 Alexander Barton,
(c)2001-2006 Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -10,8 +10,27 @@
-- ChangeLog --
ngIRCd CVSHEAD
ngIRCd 0.10.1 (2006-12-17)
- Fixed validation of server names containing digits.
- Update the "info text" of the local server after re-reading configuration.
- Changed Numerics 265 and 266 to follow ircd 2.11.x "standards".
- Allow PASS syntax defined in RFC 1459 for server links, too.
- Enhanced ISUPPORT message (005 numeric).
- New configuration option "PredefChannelsOnly": if set, clients can only
join predefined channels.
- Code cleanups: use "LogDebug(...)" instead of "Log(LOG_DEBUG, ...)", use
"strcspn()", unsigned vs. signed, use "const", fix whitespaces, ...
ngIRCd 0.10.0 (2006-10-01)
- Fixed file handle leak when daemon is not able to send MOTD to a client.
ngIRCd 0.10.0-pre2 (2006-09-09)
- Fixed build problems with GCC option -fstack-protector.
- Minor documentation updates.
ngIRCd 0.10.0-pre1 (2006-08-02)
- Validate "ServerName" (see RFC 2812, section 2.3.1).
- Enhanced DIE to accept a single parameter ("comment text") which is sent
to all locally connected clients before the server goes down.
@@ -654,4 +673,4 @@ ngIRCd 0.0.1, 31.12.2001
--
$Id: ChangeLog,v 1.302 2006/07/23 16:42:45 alex Exp $
$Id: ChangeLog,v 1.302.2.9 2006/12/17 13:55:29 alex Exp $

View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2004 by Alexander Barton,
(c)2001-2006 by Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -241,4 +241,4 @@ number. In both cases the server exits after the output.
--
$Id: INSTALL,v 1.23 2005/12/30 22:43:23 alex Exp $
$Id: INSTALL,v 1.23.2.1 2006/08/02 08:19:38 alex Exp $

25
NEWS
View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2005 Alexander Barton,
(c)2001-2006 Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -10,6 +10,27 @@
-- NEWS --
ngIRCd 0.10.1 (2006-12-17)
- Allow PASS syntax defined in RFC 1459 for server links, too.
- New configuration option "PredefChannelsOnly": if set, clients can only
join predefined channels.
ngIRCd 0.10.0 (2006-10-01)
ngIRCd 0.10.0-pre1 (2006-08-02)
- Enhanced DIE to accept a single parameter ("comment text") which is sent
to all locally connected clients before the server goes down.
- JOIN now supports more than one channel key at a time.
- Implemented numeric "333": Time and user name who set a channel topic.
- Channel topics are no longer limited to 127 characters: now the only limit
is the maximum length of an IRC command, i. e. 512 bytes (in practice, this
limits the topic to about 490 characters due to protocol overhead).
- Reverse DNS lookup code now checks the result by doing an additional
lookup to prevent spoofing.
- Added new IO layer which (optionally) supports epoll() and kqueue() in
addition to the select() interface.
ngIRCd 0.9.0 (2005-07-24)
- Never run with root privileges but always switch the user ID.
@@ -208,4 +229,4 @@ ngIRCd 0.0.1, 31.12.2001
--
$Id: NEWS,v 1.75 2005/07/26 19:41:49 alex Exp $
$Id: NEWS,v 1.75.2.4 2006/12/17 13:55:29 alex Exp $

4
README
View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2005 Alexander Barton,
(c)2001-2006 Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -84,4 +84,4 @@ mail to <alex@barton.de>.
--
$Id: README,v 1.21 2005/07/09 14:39:42 alex Exp $
$Id: README,v 1.21.2.1 2006/08/02 08:19:38 alex Exp $

View File

@@ -1,6 +1,6 @@
#
# ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2005 Alexander Barton <alex@barton.de>
# Copyright (c)2001-2006 Alexander Barton <alex@barton.de>
#
# 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
@@ -8,13 +8,13 @@
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
# $Id: configure.in,v 1.118 2006/05/17 16:44:14 alex Exp $
# $Id: configure.in,v 1.118.2.8 2006/12/17 14:06:19 alex Exp $
#
# -- Initialisation --
AC_PREREQ(2.50)
AC_INIT(ngircd, CVSHEAD)
AC_INIT(ngircd, 0.10.1)
AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(1.6)
@@ -53,33 +53,33 @@ AC_PROG_RANLIB
AM_C_PROTOTYPES
AC_C_CONST
AC_C_INLINE
# -- Hard coded system and compiler dependencies/features/options ... --
AC_DEFUN([GCC_STACK_PROTECT_CC],[
ssp_cc=yes
# we use -fstack-protector-all for the test to enfoce the use of the guard variable
AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
ssp_old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fstack-protector-all"
AC_TRY_LINK(,,, ssp_cc=no)
echo $ssp_cc
CFLAGS="$ssp_old_cflags"
if test "X$ssp_cc" = "Xyes"; then
CFLAGS="$CFLAGS -fstack-protector"
AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
fi
])
if test "$GCC" = "yes"; then
# We are using the GNU C compiler. Good!
CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
GCC_STACK_PROTECT_CC
fi
AC_DEFUN([GCC_STACK_PROTECT_CC],[
ssp_cc=yes
if test "X$CC" != "X"; then
AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
ssp_old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fstack-protector"
AC_TRY_COMPILE(,,, ssp_cc=no)
echo $ssp_cc
if test "X$ssp_cc" = "Xno"; then
CFLAGS="$ssp_old_cflags"
else
AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
fi
fi
])
GCC_STACK_PROTECT_CC
case "$target_os" in
hpux*)
# This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
@@ -138,7 +138,7 @@ AC_FUNC_STRFTIME
AC_CHECK_FUNCS([ \
bind gethostbyaddr gethostbyname gethostname inet_ntoa malloc memmove \
memset realloc setsid setsockopt socket strcasecmp strchr strerror \
memset realloc setsid setsockopt socket strcasecmp strchr strcspn strerror \
strstr waitpid],,AC_MSG_ERROR([required function missing!]))
AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strdup strlcpy strlcat)
@@ -199,7 +199,7 @@ if test "$x_zlib_on" = "yes"; then
fi
x_io_backend=select
x_io_backend=select\(\)
AC_ARG_WITH(epoll,
[ --without-epoll disable epoll support (autodetected by default)],
[ if test "$withval" != "no"; then
@@ -208,16 +208,17 @@ AC_ARG_WITH(epoll,
CPPFLAGS="-I$withval/include $CPPFLAGS"
LDFLAGS="-L$withval/lib $LDFLAGS"
fi
AC_CHECK_FUNCS(epoll_create, x_io_backend=epoll,
AC_CHECK_FUNCS(epoll_create, x_io_backend=epoll\(\),
AC_MSG_ERROR([Can't enable epoll support!])
)
fi
],
[
AC_CHECK_FUNCS(epoll_create, x_io_backend=epoll)
AC_CHECK_FUNCS(epoll_create, x_io_backend=epoll\(\))
]
)
AC_ARG_WITH(kqueue,
[ --without-kqueue disable kqueue support (autodetected by default)],
[ if test "$withval" != "no"; then
@@ -226,13 +227,13 @@ AC_ARG_WITH(kqueue,
CPPFLAGS="-I$withval/include $CPPFLAGS"
LDFLAGS="-L$withval/lib $LDFLAGS"
fi
AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue,
AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\),
AC_MSG_ERROR([Can't enable kqueue support!])
)
fi
],
[
AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue)
AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\))
]
)
@@ -482,7 +483,7 @@ test "$x_identauth_on" = "yes" \
&& echo $ECHO_N "yes $ECHO_C" \
|| echo $ECHO_N "no $ECHO_C"
echo $ECHO_N " I/O backend: $ECHO_C"
echo "\"$x_io_backend()\""
echo "\"$x_io_backend\""
echo

View File

@@ -1,3 +1,46 @@
ngircd (0.10.1-0ab1) unstable; urgency=low
* New "upstream" release: 0.10.1
-- Alexander Barton <alex@barton.de> Sun, 17 Dec 2006 14:52:06 +0100
ngircd (0.10.0-0ab1) unstable; urgency=low
* New "upstream" release: 0.10.0
-- Alexander Barton <alex@barton.de> Sun, 1 Oct 2006 18:14:21 +0200
ngircd (0.10.0-0ab0-pre2-1) unstable; urgency=low
* Bumped standards version to 3.7.2.1.
* Added "Provides: ircd" to Debian control file.
-- Alexander Barton <alex@barton.de> Sun, 1 Oct 2006 16:25:33 +0200
ngircd (0.10.0-0ab0-pre2) unstable; urgency=low
* Second "upstream" prerelease of upcoming 0.10.0 release.
-- Alexander Barton <alex@barton.de> Sat, 9 Sep 2006 20:57:52 +0200
ngircd (0.10.0-0ab0-pre1) unstable; urgency=low
* Prerelease of upcoming new "upstream release".
-- Alexander Barton <alex@barton.de> Wed, 2 Aug 2006 12:01:07 +0200
ngircd (0.9.2-0ab1) unstable; urgency=low
* New "upstream release" fixing a few bugs in 0.9.1.
-- Alexander Barton <alex@barton.de> Sat, 15 Oct 2005 14:10:34 +0200
ngircd (0.9.1-0ab1) unstable; urgency=medium
* New "upstream release" addressing two problems in ngIRCd 0.9.0.
-- Alexander Barton <alex@barton.de> Wed, 3 Aug 2005 15:10:41 +0200
ngircd (0.9.0-0ab2) unstable; urgency=medium
* Init script: fixed a problem with symbolic links in runlevel directories

View File

@@ -3,11 +3,12 @@ Section: net
Priority: optional
Maintainer: Alexander Barton <alex@barton.de>
Build-Depends: debhelper (>> 4.0.0), libz-dev, libwrap-dev, libident-dev
Standards-Version: 3.5.8
Standards-Version: 3.7.2.1
Package: ngircd
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Provides: ircd
Description: A lightweight daemon for the Internet Relay Chat (IRC)
ngIRCd is a free open source daemon for the Internet Relay Chat (IRC)
network. It is written from scratch and is not based upon the original
@@ -28,6 +29,7 @@ Description: A lightweight daemon for the Internet Relay Chat (IRC)
Package: ngircd-full
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Provides: ircd
Conflicts: ngircd
Description: A lightweight daemon for the Internet Relay Chat (IRC)
ngIRCd is a free open source daemon for the Internet Relay Chat (IRC)

View File

@@ -1,5 +1,5 @@
%define name ngircd
%define version CVSHEAD
%define version 0.10.1
%define release 1
%define prefix %{_prefix}

View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2003 by Alexander Barton,
(c)2001-2006 Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -47,11 +47,11 @@ Updating the CVS tree:
You can update a single file or the complete source tree.
III. Write Access
~~~~~~~~~~~~~~~~~
II. Write Access
~~~~~~~~~~~~~~~~
If you want to contribute a couple of patches and write access to the CVS
repository would be handy, please contact Alex Barton, <alex@barton.de>.
--
$Id: CVS.txt,v 1.8 2006/07/23 12:43:15 alex Exp $
$Id: CVS.txt,v 1.8.2.1 2006/08/02 09:04:20 alex Exp $

View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2004 Alexander Barton
(c)2001-2006 Alexander Barton
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -26,23 +26,30 @@ list can be updated. Thanks for your help!
| | | |
Platform Compiler ngIRCd Date Tester C M T R See
--------------------------- ------------ ---------- -------- ------ - - - - ---
alpha/unknown/netbsd3.0 gcc 3.3.3 CVSHEAD 06-05-07 fw Y Y Y Y (3)
alpha/unknown/netbsd3.0 gcc 3.3.3 CVSHEAD 06-05-07 fw Y Y Y Y (3)
hppa/unknown/openbsd3.5 gcc 2.95.3 CVSHEAD 04-05-25 alex Y Y Y Y
hppa1.1/unknown/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y
hppa2.0/unknown/linux-gnu gcc 3.3.5 0.9.x-CVS 05-06-27 alex Y Y Y Y
i386/pc/solaris2.9 gcc 3.2.2 CVSHEAD 04-02-24 alex Y Y Y Y
i386/pc/solaris2.11 gcc 3.4.3 CVSHEAD 06-08-04 alex Y Y Y Y
i386/unknown/freebsd5.2.1 gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y
i386/unknown/freebsd6.1 gcc 3.4.4 CVSHEAD 06-05-07 fw Y Y Y Y (4)
i386/unknown/freebsd6.0 gcc 3.4.4 0.10.0-p1 06-08-04 alex Y Y Y Y (3)
i386/unknown/freebsd6.1 gcc 3.4.4 CVSHEAD 06-05-07 fw Y Y Y Y (3)
i386/unknown/gnu0.3 gcc 3.3.3 0.8.0 04-05-30 alex Y Y n Y
i386/unknown/netbsdelf1.6.1 gcc 2.95.3 CVSHEAD 04-02-24 alex Y Y Y Y
i386/unknown/netbsdelf3.0.1 gcc 3.3.3 0.10.0-p1 06-08-30 alex Y Y Y Y (3)
i386/unknown/openbsd3.9 gcc 3.3.5 0.10.0-p1 06-08-30 alex Y Y Y Y (3)
i686/pc/cygwin gcc 3.3.1 0.8.0 04-05-30 alex Y Y n Y
i686/pc/linux-gnu gcc 2.95.4 0.8.0 04-05-30 alex Y Y Y Y (1)
i686/pc/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y (1)
i386/pc/linux-gnu gcc 4.1.2 0.10.0-p1 06-08-30 alex Y Y Y Y (1)
m68k/apple/aux3.1.1 Orig. A/UX 0.7.x-CVS 03-04-22 alex Y Y Y Y (2)
m68k/hp/hp-ux9.10 Orig. HPUX 0.7.x-CVS 03-04-30 goetz Y Y Y Y
m88k/dg/dgux5.4R3.10 gcc 2.5.8 CVSHEAD 04-03-15 alex Y Y ? ?
powerpc/apple/darwin6.5 gcc 3.1 0.7.x-CVS 03-04-23 alex Y Y Y Y
powerpc/apple/darwin7.4.0 gcc 3.3 0.8.0 04-05-30 alex Y Y Y Y
powerpc/apple/darwin7.9.0 gcc 3.3 CVSHEAD 06-05-07 fw Y Y Y Y (3)
powerpc/apple/darwin8.1.0 gcc 4.0 0.9.x-CVS 05-06-27 alex Y Y Y Y
powerpc/unknown/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y
sparc/sun/solaris2.6 gcc 2.95.3 0.7.x-CVS 03-04-22 alex Y Y Y Y
sparc/sun/solaris2.7 gcc 3.3 0.8.0 04-05-30 alex Y Y Y Y
@@ -51,16 +58,19 @@ sparc/unkn./netbsdelf1.6.1 gcc 2.95.3 0.8.0 04-05-30 alex Y Y Y Y
Notes
~~~~~
(1) i686/pc/linux-gnu:
ngIRCd has been tested with various Linux distributions, such as SuSE,
RedHat, Debian, and Gentoo using Kernels 2.2.x, 2.4.x and 2.6.x with
various versions of the GNU C compiler (2.95.3, 3.0, 3.2, and 3.3). The
eldest glibc used was glibc-2.0.7. ngIRCd compiled and run on all these
systems without problems.
various versions of the GNU C compiler (starting with 2.95.x and up to
version 4.1.x). The eldest glibc used was glibc-2.0.7. ngIRCd compiled
and run on all these systems without problems.
Actual Linux kernels (2.6.x) and glic's support the epoll() IO interface.
(2) This compiler is an pre-ANSI C compiler, therefore the source code is
automatically converted using the included ansi2knr tool while building.
(3) kqueue io backend
(4) 6.1-PRERELEASE
(3) Using the kqueue() IO interface.
--
$Id: Platforms.txt,v 1.14 2006/05/07 11:07:13 fw Exp $
$Id: Platforms.txt,v 1.14.2.1 2006/09/09 18:10:56 alex Exp $

View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2005 Alexander Barton
(c)2001-2006 Alexander Barton
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -16,7 +16,8 @@ with DNS Service Discovery (DNS-SD[3]).
To use this features you can use one of two APIs:
a) Apple "Bonjour" API as used by Mac OS X,
b) the Howl[4] Zeroconf library.
b) the Howl[4] Zeroconf library or the Howl compatibility layer
of the newer Avahi[5] library.
When calling the configure script using the "--with-zeroconf" switch the
avalable API will be autodetected and the required additional libraries will
@@ -32,7 +33,8 @@ Links:
[2] http://www.multicastdns.org/
[3] http://www.dns-sd.org/
[4] http://www.porchdogsoft.com/products/howl/
[5] http://avahi.org/
--
$Id: Zeroconf.txt,v 1.1 2005/07/08 16:19:03 alex Exp $
$Id: Zeroconf.txt,v 1.1.2.1 2006/08/02 09:04:20 alex Exp $

View File

@@ -1,4 +1,4 @@
# $Id: sample-ngircd.conf,v 1.37 2006/04/09 12:27:23 alex Exp $
# $Id: sample-ngircd.conf,v 1.37.2.1 2006/12/02 13:10:43 fw Exp $
#
# This is a sample configuration file for the ngIRCd, which must be adepted
@@ -93,6 +93,9 @@
# server? (This is a compatibility hack for ircd-irc2 servers)
;OperServerMode = no
# Allow Pre-Defined Channels only (see Section [Channels])
;PredefChannelsOnly = no
# Maximum number of simultaneous connection the server is allowed
# to accept (<=0: unlimited):
;MaxConnections = -1

View File

@@ -1,5 +1,5 @@
.\"
.\" $Id: ngircd.conf.5,v 1.20 2005/09/02 14:39:00 fw Exp $
.\" $Id: ngircd.conf.5,v 1.20.2.1 2006/12/11 22:08:14 fw Exp $
.\"
.TH ngircd.conf 5 "August 2005" ngircd "ngIRCd Manual"
.SH NAME
@@ -146,6 +146,11 @@ If OperCanUseMode is enabled, this may lead the compatibility problems with
Servers that run the ircd-irc2 Software. This Option "masks" mode requests
by non-chanops as if they were coming from the server. Default: no.
.TP
\fBPredefChannelsOnly\fR
If enabled, no new channels can be created. Useful if
you do not want to have channels other than those defined in
the config file.
.TP
\fBMaxConnections\fR
Maximum number of simultaneous connection the server is allowed to accept
(<=0: unlimited). Default: -1.

View File

@@ -12,7 +12,7 @@
#include "array.h"
static char UNUSED id[] = "$Id: array.c,v 1.11 2006/07/01 22:11:48 fw Exp $";
static char UNUSED id[] = "$Id: array.c,v 1.11.2.1 2006/12/02 13:00:25 fw Exp $";
#include <assert.h>
@@ -66,10 +66,7 @@ array_alloc(array * a, size_t size, size_t pos)
assert(size > 0);
if (pos_plus1 < pos)
return NULL;
if (!safemult_sizet(size, pos_plus1, &alloc))
if (pos_plus1 == 0 || !safemult_sizet(size, pos_plus1, &alloc))
return NULL;
if (a->allocated < alloc) {
@@ -263,7 +260,7 @@ array_get(array * a, size_t membersize, size_t pos)
if (a->allocated < totalsize)
return NULL;
return a->mem + pos * membersize;
return a->mem + totalsize;
}
@@ -283,16 +280,6 @@ array_free(array * a)
}
void
array_free_wipe(array * a)
{
if (!array_UNUSABLE(a))
memset(a->mem, 0, a->allocated);
array_free(a);
}
void *
array_start(const array * const a)
{
@@ -331,9 +318,6 @@ array_moveleft(array * a, size_t membersize, size_t pos)
assert(a != NULL);
assert(membersize > 0);
if (!pos)
return;
if (!safemult_sizet(membersize, pos, &bytepos)) {
a->used = 0;
return;

View File

@@ -17,7 +17,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: channel.c,v 1.56 2006/07/24 22:54:09 alex Exp $";
static char UNUSED id[] = "$Id: channel.c,v 1.56.2.1 2006/12/02 13:08:02 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -114,7 +114,7 @@ Channel_InitPredefined( void )
c = Conf_Channel[i].modes;
while (*c)
Channel_ModeAdd(chan, *c++);
Log(LOG_INFO, "Created pre-defined channel \"%s\".",
Conf_Channel[i].name );
}
@@ -173,7 +173,7 @@ Channel_Join( CLIENT *Client, char *Name )
{
/* Gibt es noch nicht? Dann neu anlegen: */
chan = Channel_Create( Name );
if( ! chan ) return false;
if (!chan) return false;
}
/* User dem Channel hinzufuegen */
@@ -214,7 +214,6 @@ Channel_Kick( CLIENT *Client, CLIENT *Origin, char *Name, char *Reason )
assert( Name != NULL );
assert( Reason != NULL );
/* Channel suchen */
chan = Channel_Search( Name );
if( ! chan )
{
@@ -266,11 +265,11 @@ Channel_Quit( CLIENT *Client, char *Reason )
} /* Channel_Quit */
GLOBAL long
GLOBAL unsigned long
Channel_Count( void )
{
CHANNEL *c;
long count = 0;
unsigned long count = 0;
c = My_Channels;
while( c )
@@ -282,11 +281,11 @@ Channel_Count( void )
} /* Channel_Count */
GLOBAL long
GLOBAL unsigned long
Channel_MemberCount( CHANNEL *Chan )
{
CL2CHAN *cl2chan;
long count = 0;
unsigned long count = 0;
assert( Chan != NULL );
@@ -340,8 +339,8 @@ Channel_PCount( void )
} /* Channel_PCount */
GLOBAL char *
Channel_Name( CHANNEL *Chan )
GLOBAL const char *
Channel_Name( const CHANNEL *Chan )
{
assert( Chan != NULL );
return Chan->name;
@@ -364,7 +363,7 @@ Channel_Key( CHANNEL *Chan )
} /* Channel_Key */
GLOBAL long
GLOBAL unsigned long
Channel_MaxUsers( CHANNEL *Chan )
{
assert( Chan != NULL );
@@ -463,25 +462,13 @@ Channel_GetChannel( CL2CHAN *Cl2Chan )
GLOBAL bool
Channel_IsValidName( char *Name )
Channel_IsValidName( const char *Name )
{
/* Pruefen, ob Name als Channelname gueltig */
char *ptr, badchars[10];
assert( Name != NULL );
if(( Name[0] != '#' ) || ( strlen( Name ) >= CHANNEL_NAME_LEN )) return false;
ptr = Name;
strcpy( badchars, " ,:\007" );
while( *ptr )
{
if( strchr( badchars, *ptr )) return false;
ptr++;
}
return true;
return Name[strcspn(Name, " ,:\007")] == 0;
} /* Channel_IsValidName */
@@ -548,7 +535,7 @@ Channel_UserModeAdd( CHANNEL *Chan, CLIENT *Client, char Mode )
cl2chan = Get_Cl2Chan( Chan, Client );
assert( cl2chan != NULL );
x[0] = Mode; x[1] = '\0';
if( ! strchr( cl2chan->modes, x[0] ))
{
@@ -594,7 +581,7 @@ GLOBAL char *
Channel_UserModes( CHANNEL *Chan, CLIENT *Client )
{
/* return Users' Channel-Modes */
CL2CHAN *cl2chan;
assert( Chan != NULL );
@@ -661,12 +648,9 @@ Channel_SetTopic(CHANNEL *Chan, CLIENT *Client, char *Topic)
if (len < array_bytes(&Chan->topic))
array_free(&Chan->topic);
if (!array_copyb(&Chan->topic, Topic, len))
if (len >= COMMAND_LEN || !array_copyb(&Chan->topic, Topic, len+1))
Log(LOG_WARNING, "could not set new Topic \"%s\" on %s: %s",
Topic, Chan->name, strerror(errno));
array_cat0(&Chan->topic);
#ifndef STRICT_RFC
Chan->topic_time = time(NULL);
if (Client != NULL && Client_Type(Client) != CLIENT_SERVER)
@@ -698,17 +682,17 @@ Channel_SetKey( CHANNEL *Chan, char *Key )
assert( Key != NULL );
strlcpy( Chan->key, Key, sizeof( Chan->key ));
Log( LOG_DEBUG, "Channel %s: Key is now \"%s\".", Chan->name, Chan->key );
LogDebug("Channel %s: Key is now \"%s\".", Chan->name, Chan->key );
} /* Channel_SetKey */
GLOBAL void
Channel_SetMaxUsers( CHANNEL *Chan, long Count )
Channel_SetMaxUsers(CHANNEL *Chan, unsigned long Count)
{
assert( Chan != NULL );
Chan->maxusers = Count;
Log( LOG_DEBUG, "Channel %s: Member limit is now %ld.", Chan->name, Chan->maxusers );
LogDebug("Channel %s: Member limit is now %lu.", Chan->name, Chan->maxusers );
} /* Channel_SetMaxUsers */
@@ -730,7 +714,7 @@ Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, char *Text )
ok = true;
if( strchr( Channel_Modes( Chan ), 'n' ) && ( ! is_member )) ok = false;
if( strchr( Channel_Modes( Chan ), 'm' ) && ( ! is_op ) && ( ! has_voice )) ok = false;
/* Is the client banned? */
if( Lists_CheckBanned( From, Chan ))
{
@@ -753,7 +737,7 @@ Channel_Create( char *Name )
CHANNEL *c;
assert( Name != NULL );
c = (CHANNEL *)malloc( sizeof( CHANNEL ));
if( ! c )
{
@@ -765,9 +749,7 @@ Channel_Create( char *Name )
c->hash = Hash( c->name );
c->next = My_Channels;
My_Channels = c;
#ifdef DEBUG
Log( LOG_DEBUG, "Created new channel structure for \"%s\".", Name );
#endif
LogDebug("Created new channel structure for \"%s\".", Name);
return c;
} /* Channel_Create */
@@ -851,25 +833,42 @@ Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, char *Re
switch( Type )
{
case REMOVE_QUIT:
/* QUIT: andere Server wurden bereits informiert, vgl. Client_Destroy();
* hier also "nur" noch alle User in betroffenen Channeln infomieren */
/* QUIT: other servers have already been notified, see Client_Destroy();
* so only inform other clients in same channel. */
assert( InformServer == false );
Log( LOG_DEBUG, "User \"%s\" left channel \"%s\" (%s).", Client_Mask( Client ), c->name, Reason );
LogDebug("User \"%s\" left channel \"%s\" (%s).",
Client_Mask( Client ), c->name, Reason );
break;
case REMOVE_KICK:
/* User wurde geKICKed: ggf. andere Server sowie alle betroffenen User
* im entsprechenden Channel informieren */
if( InformServer ) IRC_WriteStrServersPrefix( Client_NextHop( Origin ), Origin, "KICK %s %s :%s", c->name, Client_ID( Client ), Reason );
IRC_WriteStrChannelPrefix( Client, c, Origin, false, "KICK %s %s :%s", c->name, Client_ID( Client ), Reason );
if(( Client_Conn( Client ) > NONE ) && ( Client_Type( Client ) == CLIENT_USER )) IRC_WriteStrClientPrefix( Client, Origin, "KICK %s %s :%s", c->name, Client_ID( Client ), Reason );
Log( LOG_DEBUG, "User \"%s\" has been kicked of \"%s\" by \"%s\": %s.", Client_Mask( Client ), c->name, Client_ID( Origin ), Reason );
/* User was KICKed: inform other servers and all users in channel */
if( InformServer )
IRC_WriteStrServersPrefix( Client_NextHop( Origin ),
Origin, "KICK %s %s :%s", c->name, Client_ID( Client ), Reason);
IRC_WriteStrChannelPrefix(Client, c, Origin, false, "KICK %s %s :%s",
c->name, Client_ID( Client ), Reason );
if ((Client_Conn(Client) > NONE) &&
(Client_Type(Client) == CLIENT_USER))
{
IRC_WriteStrClientPrefix(Client, Origin, "KICK %s %s :%s",
c->name, Client_ID( Client ), Reason);
}
LogDebug("User \"%s\" has been kicked of \"%s\" by \"%s\": %s.",
Client_Mask( Client ), c->name, Client_ID(Origin), Reason);
break;
default:
/* PART */
if( InformServer ) IRC_WriteStrServersPrefix( Origin, Client, "PART %s :%s", c->name, Reason );
IRC_WriteStrChannelPrefix( Origin, c, Client, false, "PART %s :%s", c->name, Reason );
if(( Client_Conn( Origin ) > NONE ) && ( Client_Type( Origin ) == CLIENT_USER )) IRC_WriteStrClientPrefix( Origin, Client, "PART %s :%s", c->name, Reason );
Log( LOG_DEBUG, "User \"%s\" left channel \"%s\" (%s).", Client_Mask( Client ), c->name, Reason );
default: /* PART */
if (InformServer)
IRC_WriteStrServersPrefix(Origin, Client, "PART %s :%s", c->name, Reason);
IRC_WriteStrChannelPrefix(Origin, c, Client, false, "PART %s :%s",
c->name, Reason);
if ((Client_Conn(Origin) > NONE) &&
(Client_Type(Origin) == CLIENT_USER))
{
IRC_WriteStrClientPrefix( Origin, Client, "PART %s :%s", c->name, Reason);
LogDebug("User \"%s\" left channel \"%s\" (%s).",
Client_Mask(Client), c->name, Reason);
}
}
/* Wenn Channel nun leer und nicht pre-defined: loeschen */

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: channel.h,v 1.29 2005/09/02 12:50:25 alex Exp $
* $Id: channel.h,v 1.29.2.1 2006/12/02 13:08:02 fw Exp $
*
* Channel management (header)
*/
@@ -35,7 +35,7 @@ typedef struct _CHANNEL
char topic_who[CLIENT_NICK_LEN];/* Nickname of user that set topic */
#endif
char key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
long maxusers; /* Maximum number of members (mode "l") */
unsigned long maxusers; /* Maximum number of members (mode "l") */
} CHANNEL;
typedef struct _CLIENT2CHAN
@@ -65,21 +65,21 @@ GLOBAL void Channel_Quit PARAMS(( CLIENT *Client, char *Reason ));
GLOBAL void Channel_Kick PARAMS(( CLIENT *Client, CLIENT *Origin, char *Name, char *Reason ));
GLOBAL long Channel_Count PARAMS(( void ));
GLOBAL long Channel_MemberCount PARAMS(( CHANNEL *Chan ));
GLOBAL unsigned long Channel_Count PARAMS(( void ));
GLOBAL unsigned long Channel_MemberCount PARAMS(( CHANNEL *Chan ));
GLOBAL int Channel_CountForUser PARAMS(( CLIENT *Client ));
GLOBAL int Channel_PCount PARAMS(( void ));
GLOBAL char *Channel_Name PARAMS(( CHANNEL *Chan ));
GLOBAL const char *Channel_Name PARAMS(( const CHANNEL *Chan ));
GLOBAL char *Channel_Modes PARAMS(( CHANNEL *Chan ));
GLOBAL char *Channel_Topic PARAMS(( CHANNEL *Chan ));
GLOBAL char *Channel_Key PARAMS(( CHANNEL *Chan ));
GLOBAL long Channel_MaxUsers PARAMS(( CHANNEL *Chan ));
GLOBAL unsigned long Channel_MaxUsers PARAMS(( CHANNEL *Chan ));
GLOBAL void Channel_SetTopic PARAMS(( CHANNEL *Chan, CLIENT *Client, char *Topic ));
GLOBAL void Channel_SetModes PARAMS(( CHANNEL *Chan, char *Modes ));
GLOBAL void Channel_SetKey PARAMS(( CHANNEL *Chan, char *Key ));
GLOBAL void Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, long Count ));
GLOBAL void Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, unsigned long Count ));
GLOBAL CHANNEL *Channel_Search PARAMS(( char *Name ));
@@ -94,7 +94,7 @@ GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS(( CLIENT *Client, CL2CHAN *Cl2Chan
GLOBAL CLIENT *Channel_GetClient PARAMS(( CL2CHAN *Cl2Chan ));
GLOBAL CHANNEL *Channel_GetChannel PARAMS(( CL2CHAN *Cl2Chan ));
GLOBAL bool Channel_IsValidName PARAMS(( char *Name ));
GLOBAL bool Channel_IsValidName PARAMS(( const char *Name ));
GLOBAL bool Channel_ModeAdd PARAMS(( CHANNEL *Chan, char Mode ));
GLOBAL bool Channel_ModeDel PARAMS(( CHANNEL *Chan, char Mode ));

View File

@@ -17,7 +17,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: client.c,v 1.91 2006/04/23 10:37:27 fw Exp $";
static char UNUSED id[] = "$Id: client.c,v 1.91.2.1 2006/12/02 14:00:00 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -57,8 +57,8 @@ static WHOWAS My_Whowas[MAX_WHOWAS];
static int Last_Whowas = -1;
static long Count PARAMS(( CLIENT_TYPE Type ));
static long MyCount PARAMS(( CLIENT_TYPE Type ));
static unsigned long Count PARAMS(( CLIENT_TYPE Type ));
static unsigned long MyCount PARAMS(( CLIENT_TYPE Type ));
static CLIENT *New_Client_Struct PARAMS(( void ));
static void Generate_MyToken PARAMS(( CLIENT *Client ));
@@ -211,8 +211,8 @@ Init_New_Client(CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer,
if( Modes ) Client_SetModes( client, Modes );
if( Type == CLIENT_SERVER ) Generate_MyToken( client );
/* ist der User away? */
if( strchr( client->modes, 'a' )) strlcpy( client->away, DEFAULT_AWAY_MSG, sizeof( client->away ));
if( strchr( client->modes, 'a' ))
strlcpy( client->away, DEFAULT_AWAY_MSG, sizeof( client->away ));
/* Verketten */
client->next = (POINTER *)My_Clients;
@@ -399,7 +399,7 @@ Client_SetUser( CLIENT *Client, char *User, bool Idented )
assert( Client != NULL );
assert( User != NULL );
if( Idented ) strlcpy( Client->user, User, sizeof( Client->user ));
else
{
@@ -416,7 +416,7 @@ Client_SetInfo( CLIENT *Client, char *Info )
assert( Client != NULL );
assert( Info != NULL );
strlcpy( Client->info, Info, sizeof( Client->info ));
} /* Client_SetInfo */
@@ -452,7 +452,7 @@ Client_SetPassword( CLIENT *Client, char *Pwd )
assert( Client != NULL );
assert( Pwd != NULL );
strlcpy( Client->pwd, Pwd, sizeof( Client->pwd ));
} /* Client_SetPassword */
@@ -522,7 +522,7 @@ Client_ModeAdd( CLIENT *Client, char Mode )
*/
char x[2];
assert( Client != NULL );
x[0] = Mode; x[1] = '\0';
@@ -734,11 +734,13 @@ GLOBAL CLIENT *
Client_NextHop( CLIENT *Client )
{
CLIENT *c;
assert( Client != NULL );
c = Client;
while( c->introducer && ( c->introducer != c ) && ( c->introducer != This_Server )) c = c->introducer;
while( c->introducer && ( c->introducer != c ) && ( c->introducer != This_Server ))
c = c->introducer;
return c;
} /* Client_NextHop */
@@ -750,7 +752,7 @@ Client_Mask( CLIENT *Client )
* Prefixe benoetigt wird. */
assert( Client != NULL );
if( Client->type == CLIENT_SERVER ) return Client->id;
snprintf( GetID_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, Client->host );
@@ -795,12 +797,9 @@ Client_Away( CLIENT *Client )
GLOBAL bool
Client_CheckNick( CLIENT *Client, char *Nick )
{
/* Nick ueberpruefen */
assert( Client != NULL );
assert( Nick != NULL );
/* Nick ungueltig? */
if( ! Client_IsValidNick( Nick ))
{
IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), Nick );
@@ -913,11 +912,11 @@ Client_MyServiceCount( void )
} /* Client_MyServiceCount */
GLOBAL long
GLOBAL unsigned long
Client_MyServerCount( void )
{
CLIENT *c;
long cnt;
unsigned long cnt;
cnt = 0;
c = My_Clients;
@@ -930,11 +929,11 @@ Client_MyServerCount( void )
} /* Client_MyServerCount */
GLOBAL long
GLOBAL unsigned long
Client_OperCount( void )
{
CLIENT *c;
long cnt;
unsigned long cnt;
cnt = 0;
c = My_Clients;
@@ -947,19 +946,19 @@ Client_OperCount( void )
} /* Client_OperCount */
GLOBAL long
GLOBAL unsigned long
Client_UnknownCount( void )
{
CLIENT *c;
long cnt;
unsigned long cnt = 0;
cnt = 0;
c = My_Clients;
while( c )
{
if( c && ( c->type != CLIENT_USER ) && ( c->type != CLIENT_SERVICE ) && ( c->type != CLIENT_SERVER )) cnt++;
c = (CLIENT *)c->next;
}
return cnt;
} /* Client_UnknownCount */
@@ -979,16 +978,13 @@ Client_MyMaxUserCount( void )
GLOBAL bool
Client_IsValidNick( char *Nick )
Client_IsValidNick( const char *Nick )
{
/* Ist der Nick gueltig? */
const char *ptr;
static const char goodchars[] = ";0123456789-";
char *ptr, goodchars[20];
assert( Nick != NULL );
strcpy( goodchars, ";0123456789-" );
if( Nick[0] == '#' ) return false;
if( strchr( goodchars, Nick[0] )) return false;
if( strlen( Nick ) >= CLIENT_NICK_LEN ) return false;
@@ -996,11 +992,11 @@ Client_IsValidNick( char *Nick )
ptr = Nick;
while( *ptr )
{
if(( *ptr < 'A' ) && ( ! strchr( goodchars, *ptr ))) return false;
if(( *ptr > '}' ) && ( ! strchr( goodchars, *ptr ))) return false;
if (( *ptr < 'A' ) && ( ! strchr( goodchars, *ptr ))) return false;
if ( *ptr > '}' ) return false;
ptr++;
}
return true;
} /* Client_IsValidNick */
@@ -1037,13 +1033,12 @@ Client_StartTime(CLIENT *Client)
} /* Client_Uptime */
static long
static unsigned long
Count( CLIENT_TYPE Type )
{
CLIENT *c;
long cnt;
unsigned long cnt = 0;
cnt = 0;
c = My_Clients;
while( c )
{
@@ -1054,13 +1049,12 @@ Count( CLIENT_TYPE Type )
} /* Count */
static long
static unsigned long
MyCount( CLIENT_TYPE Type )
{
CLIENT *c;
long cnt;
unsigned long cnt = 0;
cnt = 0;
c = My_Clients;
while( c )
{
@@ -1075,9 +1069,9 @@ static CLIENT *
New_Client_Struct( void )
{
/* Neue CLIENT-Struktur pre-initialisieren */
CLIENT *c;
c = (CLIENT *)malloc( sizeof( CLIENT ));
if( ! c )
{
@@ -1130,7 +1124,7 @@ Adjust_Counters( CLIENT *Client )
assert( Client != NULL );
if( Client->type != CLIENT_USER ) return;
if( Client->conn_id != NONE )
{
/* Local connection */
@@ -1153,7 +1147,7 @@ Client_RegisterWhowas( CLIENT *Client )
{
int slot;
time_t now;
assert( Client != NULL );
now = time(NULL);
@@ -1167,7 +1161,7 @@ Client_RegisterWhowas( CLIENT *Client )
#ifdef DEBUG
Log( LOG_DEBUG, "Saving WHOWAS information to slot %d ...", slot );
#endif
My_Whowas[slot].time = now;
strlcpy( My_Whowas[slot].id, Client_ID( Client ),
sizeof( My_Whowas[slot].id ));
@@ -1179,7 +1173,7 @@ Client_RegisterWhowas( CLIENT *Client )
sizeof( My_Whowas[slot].info ));
strlcpy( My_Whowas[slot].server, Client_ID( Client_Introducer( Client )),
sizeof( My_Whowas[slot].server ));
Last_Whowas = slot;
} /* Client_RegisterWhowas */

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: client.h,v 1.42 2006/04/23 10:37:27 fw Exp $
* $Id: client.h,v 1.42.2.2 2006/12/02 14:26:53 fw Exp $
*
* Client management (header)
*/
@@ -23,10 +23,9 @@
#define CLIENT_GOTNICK 4 /* client did send NICK */
#define CLIENT_GOTUSER 8 /* client did send USER */
#define CLIENT_USER 16 /* client is an IRC user */
#define CLIENT_UNKNOWNSERVER 32 /* unregistered server connection */
#define CLIENT_GOTPASSSERVER 64 /* client did send PASS in "server style" */
#define CLIENT_SERVER 128 /* client is a server */
#define CLIENT_SERVICE 256 /* client is a service */
#define CLIENT_SERVER 32 /* client is a server */
#define CLIENT_SERVICE 64 /* client is a service */
#define CLIENT_UNKNOWNSERVER 128 /* unregistered server connection */
#define CLIENT_TYPE int
@@ -138,15 +137,15 @@ GLOBAL bool Client_CheckID PARAMS(( CLIENT *Client, char *ID ));
GLOBAL long Client_UserCount PARAMS(( void ));
GLOBAL long Client_ServiceCount PARAMS(( void ));
GLOBAL long Client_ServerCount PARAMS(( void ));
GLOBAL long Client_OperCount PARAMS(( void ));
GLOBAL long Client_UnknownCount PARAMS(( void ));
GLOBAL unsigned long Client_OperCount PARAMS(( void ));
GLOBAL unsigned long Client_UnknownCount PARAMS(( void ));
GLOBAL long Client_MyUserCount PARAMS(( void ));
GLOBAL long Client_MyServiceCount PARAMS(( void ));
GLOBAL long Client_MyServerCount PARAMS(( void ));
GLOBAL unsigned long Client_MyServerCount PARAMS(( void ));
GLOBAL long Client_MaxUserCount PARAMS(( void ));
GLOBAL long Client_MyMaxUserCount PARAMS(( void ));
GLOBAL bool Client_IsValidNick PARAMS(( char *Nick ));
GLOBAL bool Client_IsValidNick PARAMS(( const char *Nick ));
GLOBAL WHOWAS *Client_GetWhowas PARAMS(( void ));
GLOBAL int Client_GetLastWhowasIndex PARAMS(( void ));

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: conf.c,v 1.92 2006/07/23 16:42:45 alex Exp $";
static char UNUSED id[] = "$Id: conf.c,v 1.92.2.3 2006/12/02 13:10:43 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -146,6 +146,9 @@ Conf_Rehash( void )
Set_Defaults( false );
Read_Config( );
Validate_Config(false, true);
/* Update CLIENT structure of local server */
Client_SetInfo(Client_ThisServer(), Conf_ServerInfo);
} /* Config_Rehash */
@@ -199,15 +202,16 @@ Conf_Test( void )
printf( " PingTimeout = %d\n", Conf_PingTimeout );
printf( " PongTimeout = %d\n", Conf_PongTimeout );
printf( " ConnectRetry = %d\n", Conf_ConnectRetry );
printf( " OperCanUseMode = %s\n", Conf_OperCanMode == true? "yes" : "no" );
printf( " OperCanUseMode = %s\n", Conf_OperCanMode == true ? "yes" : "no" );
printf( " OperServerMode = %s\n", Conf_OperServerMode == true? "yes" : "no" );
printf( " PredefChannelsOnly = %s\n", Conf_PredefChannelsOnly == true ? "yes" : "no" );
printf( " MaxConnections = %ld\n", Conf_MaxConnections>0 ? Conf_MaxConnections : -1);
printf( " MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP>0 ? Conf_MaxConnectionsIP : -1);
printf( " MaxJoins = %d\n\n", Conf_MaxJoins>0 ? Conf_MaxJoins : -1);
for( i = 0; i < Conf_Oper_Count; i++ ) {
if( ! Conf_Oper[i].name[0] ) continue;
/* Valid "Operator" section */
puts( "[OPERATOR]" );
printf( " Name = %s\n", Conf_Oper[i].name );
@@ -218,7 +222,7 @@ Conf_Test( void )
for( i = 0; i < MAX_SERVERS; i++ ) {
if( ! Conf_Server[i].name[0] ) continue;
/* Valid "Server" section */
puts( "[SERVER]" );
printf( " Name = %s\n", Conf_Server[i].name );
@@ -231,7 +235,7 @@ Conf_Test( void )
for( i = 0; i < Conf_Channel_Count; i++ ) {
if( ! Conf_Channel[i].name[0] ) continue;
/* Valid "Channel" section */
puts( "[CHANNEL]" );
printf( " Name = %s\n", Conf_Channel[i].name );
@@ -240,7 +244,7 @@ Conf_Test( void )
topic = (char*)array_start(&Conf_Channel[i].topic);
printf( " Topic = %s\n\n", topic ? topic : "");
}
return 0;
} /* Conf_Test */
@@ -268,14 +272,14 @@ Conf_UnsetServer( CONN_ID Idx )
Init_Server_Struct( &Conf_Server[i] );
} else {
/* Set time for next connect attempt */
t = time(NULL);
if (Conf_Server[i].lasttry < t - Conf_ConnectRetry) {
/* The connection has been "long", so we don't
* require the next attempt to be delayed. */
Conf_Server[i].lasttry =
t - Conf_ConnectRetry + RECONNECT_DELAY;
} else
Conf_Server[i].lasttry = t;
t = time(NULL);
if (Conf_Server[i].lasttry < t - Conf_ConnectRetry) {
/* The connection has been "long", so we don't
* require the next attempt to be delayed. */
Conf_Server[i].lasttry =
t - Conf_ConnectRetry + RECONNECT_DELAY;
} else
Conf_Server[i].lasttry = t;
}
}
} /* Conf_UnsetServer */
@@ -297,9 +301,9 @@ GLOBAL int
Conf_GetServer( CONN_ID Idx )
{
/* Get index of server in configuration structure */
int i = 0;
assert( Idx > NONE );
for( i = 0; i < MAX_SERVERS; i++ ) {
@@ -377,7 +381,7 @@ Conf_AddServer( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd
strlcpy( Conf_Server[i].pwd_in, PeerPwd, sizeof( Conf_Server[i].pwd_in ));
Conf_Server[i].port = Port;
Conf_Server[i].flags = CONF_SFLAG_ONCE;
return true;
} /* Conf_AddServer */
@@ -409,7 +413,7 @@ Set_Defaults( bool InitServers )
strcpy( Conf_ListenAddress, "" );
Conf_UID = Conf_GID = 0;
Conf_PingTimeout = 120;
Conf_PongTimeout = 20;
@@ -419,8 +423,9 @@ Set_Defaults( bool InitServers )
Conf_Channel_Count = 0;
Conf_OperCanMode = false;
Conf_PredefChannelsOnly = false;
Conf_OperServerMode = false;
Conf_MaxConnections = -1;
Conf_MaxConnectionsIP = 5;
Conf_MaxJoins = 10;
@@ -750,6 +755,11 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
}
return;
}
if( strcasecmp( Var, "PredefChannelsOnly" ) == 0 ) {
/* Should we only allow pre-defined-channels? (i.e. users cannot create their own channels) */
Conf_PredefChannelsOnly = Check_ArgIsTrue( Arg );
return;
}
if( strcasecmp( Var, "OperCanUseMode" ) == 0 ) {
/* Are IRC operators allowed to use MODE in channels they aren't Op in? */
Conf_OperCanMode = Check_ArgIsTrue( Arg );
@@ -912,6 +922,21 @@ Handle_SERVER( int Line, char *Var, char *Arg )
} /* Handle_SERVER */
static bool
Handle_Channelname(size_t chancount, const char *name)
{
size_t size = sizeof( Conf_Channel[chancount].name );
char *dest = Conf_Channel[chancount].name;
if (*name && *name != '#') {
*dest = '#';
--size;
++dest;
}
return size > strlcpy(dest, name, size);
}
static void
Handle_CHANNEL( int Line, char *Var, char *Arg )
{
@@ -925,9 +950,7 @@ Handle_CHANNEL( int Line, char *Var, char *Arg )
chancount = Conf_Channel_Count - 1;
if( strcasecmp( Var, "Name" ) == 0 ) {
/* Name of the channel */
len = strlcpy( Conf_Channel[chancount].name, Arg, sizeof( Conf_Channel[chancount].name ));
if (len >= sizeof( Conf_Channel[chancount].name ))
if (!Handle_Channelname(chancount, Arg))
Config_Error_TooLong( Line, Var );
return;
}
@@ -965,7 +988,7 @@ Validate_Config(bool Configtest, bool Rehash)
do {
if (*ptr >= 'a' && *ptr <= 'z') continue;
if (*ptr >= 'A' && *ptr <= 'Z') continue;
if (*ptr >= '1' && *ptr <= '0') continue;
if (*ptr >= '0' && *ptr <= '9') continue;
if (ptr > Conf_ServerName) {
if (*ptr == '.' || *ptr == '-')
continue;

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: conf.h,v 1.40 2006/05/10 21:24:01 alex Exp $
* $Id: conf.h,v 1.40.2.1 2006/12/02 13:10:43 fw Exp $
*
* Configuration management (header)
*/
@@ -110,6 +110,8 @@ GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
/* Pre-defined channels */
GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
GLOBAL unsigned int Conf_Channel_Count;
/* Pre-defined channels only */
GLOBAL bool Conf_PredefChannelsOnly;
/* Are IRC operators allowed to always use MODE? */
GLOBAL bool Conf_OperCanMode;

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: hash.c,v 1.12 2005/07/31 20:13:08 alex Exp $";
static char UNUSED id[] = "$Id: hash.c,v 1.12.2.1 2006/12/02 13:18:22 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -31,7 +31,7 @@ static UINT32 jenkins_hash PARAMS(( register UINT8 *k, register UINT32 length, r
GLOBAL UINT32
Hash( char *String )
Hash( const char *String )
{
/* Hash-Wert ueber String berechnen */

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: hash.h,v 1.5 2005/03/19 18:43:48 fw Exp $
* $Id: hash.h,v 1.5.4.1 2006/12/02 13:18:22 fw Exp $
*
* Hash calculation (header)
*/
@@ -17,8 +17,7 @@
#ifndef __hash_h__
#define __hash_h__
GLOBAL UINT32 Hash PARAMS((char *String ));
GLOBAL UINT32 Hash PARAMS((const char *String ));
#endif

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-channel.c,v 1.35 2006/03/16 20:14:16 fw Exp $";
static char UNUSED id[] = "$Id: irc-channel.c,v 1.35.2.2 2006/12/02 13:33:52 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -78,8 +78,17 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
chan = NULL; flags = NULL;
/* wird der Channel neu angelegt? */
if( Channel_Search( channame )) is_new_chan = false;
else is_new_chan = true;
if( Channel_Search( channame )) {
is_new_chan = false;
} else {
if (Conf_PredefChannelsOnly) { /* this server does not allow creation of channels */
IRC_WriteStrClient( Client, ERR_BANNEDFROMCHAN_MSG, Client_ID( Client ), channame );
/* Try next name, if any */
channame = strchr(channame, ',');
continue;
}
is_new_chan = true;
}
/* Hat ein Server Channel-User-Modes uebergeben? */
if( Client_Type( Client ) == CLIENT_SERVER )
@@ -123,7 +132,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
IRC_WriteStrClient( Client, ERR_BANNEDFROMCHAN_MSG, Client_ID( Client ), channame );
/* Try next name, if any */
channame = strtok( NULL, "," );
channame = strchr(channame, ',');
continue;
}
@@ -134,7 +143,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
IRC_WriteStrClient( Client, ERR_INVITEONLYCHAN_MSG, Client_ID( Client ), channame );
/* Try next name, if any */
channame = strtok( NULL, "," );
channame = strchr(channame, ',');
continue;
}
@@ -145,7 +154,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
IRC_WriteStrClient( Client, ERR_BADCHANNELKEY_MSG, Client_ID( Client ), channame );
/* Try next name, if any */
channame = strtok( NULL, "," );
channame = strchr(channame, ',');
continue;
}
@@ -156,7 +165,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
IRC_WriteStrClient( Client, ERR_CHANNELISFULL_MSG, Client_ID( Client ), channame );
/* Try next name, if any */
channame = strtok( NULL, "," );
channame = strchr(channame, ',');
continue;
}
}
@@ -176,7 +185,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
if( ! Channel_Join( target, channame ))
{
/* naechsten Namen ermitteln */
channame = strtok( NULL, "," );
channame = strchr(channame, ',');
continue;
}
if( ! chan ) chan = Channel_Search( channame );
@@ -491,7 +500,7 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
{
if( *ptr == 'l' )
{
snprintf( l, sizeof( l ), " %ld", Channel_MaxUsers( chan ));
snprintf( l, sizeof( l ), " %lu", Channel_MaxUsers( chan ));
strlcat( modes_add, l, sizeof( modes_add ));
}
if( *ptr == 'k' )

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-info.c,v 1.33 2006/05/10 21:24:01 alex Exp $";
static char UNUSED id[] = "$Id: irc-info.c,v 1.33.2.2 2006/12/02 14:26:53 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -542,7 +542,8 @@ GLOBAL bool
IRC_WHO( CLIENT *Client, REQUEST *Req )
{
bool ok, only_ops;
char flags[8], *ptr;
char flags[8];
const char *ptr;
CL2CHAN *cl2chan;
CHANNEL *chan, *cn;
CLIENT *c;
@@ -832,7 +833,10 @@ IRC_WHOWAS( CLIENT *Client, REQUEST *Req )
GLOBAL bool
IRC_Send_LUSERS( CLIENT *Client )
{
long cnt;
unsigned long cnt;
#ifndef STRICT_RFC
unsigned long max;
#endif
assert( Client != NULL );
@@ -861,9 +865,17 @@ IRC_Send_LUSERS( CLIENT *Client )
#ifndef STRICT_RFC
/* Maximum number of local users */
if( ! IRC_WriteStrClient( Client, RPL_LOCALUSERS_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyMaxUserCount( ))) return DISCONNECTED;
cnt = Client_MyUserCount();
max = Client_MyMaxUserCount();
if (! IRC_WriteStrClient(Client, RPL_LOCALUSERS_MSG, Client_ID(Client),
cnt, max, cnt, max))
return DISCONNECTED;
/* Maximum number of users in the network */
if( ! IRC_WriteStrClient( Client, RPL_NETUSERS_MSG, Client_ID( Client ), Client_UserCount( ), Client_MaxUserCount( ))) return DISCONNECTED;
cnt = Client_UserCount();
max = Client_MaxUserCount();
if(! IRC_WriteStrClient(Client, RPL_NETUSERS_MSG, Client_ID(Client),
cnt, max, cnt, max))
return DISCONNECTED;
#endif
return CONNECTED;
@@ -910,8 +922,10 @@ IRC_Show_MOTD( CLIENT *Client )
return IRC_WriteStrClient( Client, ERR_NOMOTD_MSG, Client_ID( Client ) );
}
if (!Show_MOTD_Start( Client ))
return DISCONNECTED;
if (!Show_MOTD_Start( Client )) {
fclose(fd);
return false;
}
while (fgets( line, (int)sizeof line, fd )) {
ngt_TrimLastChr( line, '\n');

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-login.c,v 1.49 2005/09/01 10:51:24 alex Exp $";
static char UNUSED id[] = "$Id: irc-login.c,v 1.49.2.2 2006/12/02 14:26:53 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -45,101 +45,119 @@ static bool Hello_User PARAMS(( CLIENT *Client ));
static void Kill_Nick PARAMS(( char *Nick, char *Reason ));
/**
* Handler for the IRC command "PASS".
* See RFC 2813 section 4.1.1, and RFC 2812 section 3.1.1.
*/
GLOBAL bool
IRC_PASS( CLIENT *Client, REQUEST *Req )
{
char *type, *orig_flags;
int protohigh, protolow;
assert( Client != NULL );
assert( Req != NULL );
/* Fehler liefern, wenn kein lokaler Client */
if( Client_Conn( Client ) <= NONE ) return IRC_WriteStrClient( Client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( Client ), Req->command );
/* Return an error if this is not a local client */
if (Client_Conn(Client) <= NONE)
return IRC_WriteStrClient(Client, ERR_UNKNOWNCOMMAND_MSG,
Client_ID(Client), Req->command);
if(( Client_Type( Client ) == CLIENT_UNKNOWN ) && ( Req->argc == 1))
{
/* noch nicht registrierte unbekannte Verbindung */
Log( LOG_DEBUG, "Connection %d: got PASS command ...", Client_Conn( Client ));
/* Passwort speichern */
Client_SetPassword( Client, Req->argv[0] );
Client_SetType( Client, CLIENT_GOTPASS );
return CONNECTED;
if (Client_Type(Client) == CLIENT_UNKNOWN && Req->argc == 1) {
/* Not yet registered "unknown" connection, PASS with one
* argument: either a regular client, service, or server
* using the old RFC 1459 section 4.1.1 syntax. */
LogDebug("Connection %d: got PASS command ...",
Client_Conn(Client));
} else if ((Client_Type(Client) == CLIENT_UNKNOWN ||
Client_Type(Client) == CLIENT_UNKNOWNSERVER) &&
(Req->argc == 3 || Req->argc == 4)) {
/* Not yet registered "unknown" connection or outgoing server
* link, PASS with three or four argument: server using the
* RFC 2813 section 4.1.1 syntax. */
LogDebug("Connection %d: got PASS command (new server link) ...",
Client_Conn(Client));
} else if (Client_Type(Client) == CLIENT_UNKNOWN ||
Client_Type(Client) == CLIENT_UNKNOWNSERVER) {
/* Unregistered connection, but wrong number of arguments: */
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
} else {
/* Registered connection, PASS command is not allowed! */
return IRC_WriteStrClient(Client, ERR_ALREADYREGISTRED_MSG,
Client_ID(Client));
}
else if((( Client_Type( Client ) == CLIENT_UNKNOWN ) || ( Client_Type( Client ) == CLIENT_UNKNOWNSERVER )) && (( Req->argc == 3 ) || ( Req->argc == 4 )))
{
char c2, c4, *type, *impl, *serverver, *flags, *ptr, *ircflags;
int protohigh, protolow;
/* noch nicht registrierte Server-Verbindung */
Log( LOG_DEBUG, "Connection %d: got PASS command (new server link) ...", Client_Conn( Client ));
Client_SetPassword(Client, Req->argv[0]);
Client_SetType(Client, CLIENT_GOTPASS);
/* Passwort speichern */
Client_SetPassword( Client, Req->argv[0] );
/* Protocol version */
if (Req->argc >= 2 && strlen(Req->argv[1]) >= 4) {
int c2, c4;
/* Protokollversion ermitteln */
if( strlen( Req->argv[1] ) >= 4 )
{
c2 = Req->argv[1][2];
c4 = Req->argv[1][4];
c2 = Req->argv[1][2];
c4 = Req->argv[1][4];
Req->argv[1][4] = '\0';
protolow = atoi( &Req->argv[1][2] );
Req->argv[1][2] = '\0';
protohigh = atoi( Req->argv[1] );
Req->argv[1][4] = '\0';
protolow = atoi(&Req->argv[1][2]);
Req->argv[1][2] = '\0';
protohigh = atoi(Req->argv[1]);
Req->argv[1][2] = c2;
Req->argv[1][4] = c4;
}
else protohigh = protolow = 0;
Req->argv[1][2] = c2;
Req->argv[1][4] = c4;
} else
protohigh = protolow = 0;
/* Protokoll-Typ */
if( strlen( Req->argv[1] ) > 4 ) type = &Req->argv[1][4];
else type = NULL;
/* Protocol type, see doc/Protocol.txt */
if (Req->argc >= 2 && strlen(Req->argv[1]) > 4)
type = &Req->argv[1][4];
else
type = NULL;
/* Protocol flags/options */
if (Req->argc >= 4)
orig_flags = Req->argv[3];
else
orig_flags = "";
/* IRC-Flags (nach RFC 2813) */
if( Req->argc >= 4 ) ircflags = Req->argv[3];
else ircflags = "";
/* Implementation, version and IRC+ flags */
if (Req->argc >= 3) {
char *impl, *ptr, *serverver, *flags;
/* Implementation, Version und ngIRCd-Flags */
impl = Req->argv[2];
ptr = strchr( impl, '|' );
if( ptr ) *ptr = '\0';
ptr = strchr(impl, '|');
if (ptr)
*ptr = '\0';
if( type && ( strcmp( type, PROTOIRCPLUS ) == 0 ))
{
/* auf der anderen Seite laeuft ein Server, der
* ebenfalls das IRC+-Protokoll versteht */
if (type && strcmp(type, PROTOIRCPLUS) == 0) {
/* The peer seems to be a server which supports the
* IRC+ protocol (see doc/Protocol.txt). */
serverver = ptr + 1;
flags = strchr( serverver, ':' );
if( flags )
{
flags = strchr(serverver, ':');
if (flags) {
*flags = '\0';
flags++;
}
else flags = "";
Log( LOG_INFO, "Peer announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").", impl, serverver, protohigh, protolow, flags );
}
else
{
/* auf der anderen Seite laeuft ein Server, der
* nur das Originalprotokoll unterstuetzt */
} else
flags = "";
Log(LOG_INFO,
"Peer announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").",
impl, serverver, protohigh, protolow, flags);
} else {
/* The peer seems to be a server supporting the
* "original" IRC protocol (RFC 2813). */
serverver = "";
if( strchr( ircflags, 'Z' )) flags = "Z";
else flags = "";
Log( LOG_INFO, "Peer announces itself as \"%s\" using protocol %d.%d (flags: \"%s\").", impl, protohigh, protolow, flags );
if (strchr(orig_flags, 'Z'))
flags = "Z";
else
flags = "";
Log(LOG_INFO,
"Peer announces itself as \"%s\" using protocol %d.%d (flags: \"%s\").",
impl, protohigh, protolow, flags);
}
Client_SetType( Client, CLIENT_GOTPASSSERVER );
Client_SetFlags( Client, flags );
return CONNECTED;
Client_SetFlags(Client, flags);
}
else if(( Client_Type( Client ) == CLIENT_UNKNOWN ) || ( Client_Type( Client ) == CLIENT_UNKNOWNSERVER ))
{
/* Falsche Anzahl Parameter? */
return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
}
else return IRC_WriteStrClient( Client, ERR_ALREADYREGISTRED_MSG, Client_ID( Client ));
return CONNECTED;
} /* IRC_PASS */
@@ -268,13 +286,13 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
"NICK :%s", Req->argv[0] );
IRC_WriteStrRelatedPrefix( target, target, false,
"NICK :%s", Req->argv[0] );
/* Register old nickname for WHOWAS queries */
Client_RegisterWhowas( target );
/* Save new nickname */
Client_SetID( target, Req->argv[0] );
IRC_SetPenalty( target, 2 );
}
@@ -598,9 +616,15 @@ Hello_User( CLIENT *Client )
if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, USERMODES, CHANMODES )) return false;
#endif
/* Features */
if( ! IRC_WriteStrClient( Client, RPL_ISUPPORT_MSG, Client_ID( Client ), CLIENT_NICK_LEN - 1,
COMMAND_LEN - 23, CLIENT_AWAY_LEN - 1, Conf_MaxJoins )) return DISCONNECTED;
/* Features supported by this server (005 numeric, ISUPPORT),
* see <http://www.irc.org/tech_docs/005.html> for details. */
if (! IRC_WriteStrClient(Client, RPL_ISUPPORT1_MSG, Client_ID(Client),
Conf_MaxJoins))
return DISCONNECTED;
if (! IRC_WriteStrClient(Client, RPL_ISUPPORT2_MSG, Client_ID(Client),
CHANNEL_NAME_LEN-1, CLIENT_NICK_LEN-1, COMMAND_LEN-23,
CLIENT_AWAY_LEN-1, COMMAND_LEN-113))
return DISCONNECTED;
Client_SetType( Client, CLIENT_USER );

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-mode.c,v 1.45 2006/05/10 21:24:01 alex Exp $";
static char UNUSED id[] = "$Id: irc-mode.c,v 1.45.2.1 2006/12/02 14:21:26 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -69,7 +69,7 @@ IRC_MODE( CLIENT *Client, REQUEST *Req )
if( ! origin ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
}
else origin = Client;
/* Channel or user mode? */
cl = NULL; chan = NULL;
if (Client_IsValidNick(Req->argv[0]))
@@ -268,7 +268,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
switch( *mode_ptr )
{
case 'l':
snprintf( argadd, sizeof( argadd ), " %ld", Channel_MaxUsers( Channel ));
snprintf( argadd, sizeof( argadd ), " %lu", Channel_MaxUsers( Channel ));
strlcat( the_args, argadd, sizeof( the_args ));
break;
case 'k':

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-op.c,v 1.15 2005/04/27 07:39:18 alex Exp $";
static char UNUSED id[] = "$Id: irc-op.c,v 1.15.4.1 2006/12/02 14:21:26 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -101,15 +101,14 @@ IRC_INVITE( CLIENT *Client, REQUEST *Req )
/* If the target user is banned on that channel: remember invite */
if( Lists_CheckBanned( target, chan )) remember = true;
if( remember )
{
/* We must memember this invite */
if (remember) {
/* We must remember this invite */
if( ! Lists_AddInvited( Client_Mask( target ), chan, true)) return CONNECTED;
}
}
Log( LOG_DEBUG, "User \"%s\" invites \"%s\" to \"%s\" ...", Client_Mask( from ), Req->argv[0], Req->argv[1] );
LogDebug("User \"%s\" invites \"%s\" to \"%s\" ...", Client_Mask(from), Req->argv[0], Req->argv[1]);
/* Inform target client */
IRC_WriteStrClientPrefix( target, from, "INVITE %s %s", Req->argv[0], Req->argv[1] );

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-server.c,v 1.39 2006/04/30 21:31:43 alex Exp $";
static char UNUSED id[] = "$Id: irc-server.c,v 1.39.2.2 2006/12/02 14:26:53 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -41,6 +41,10 @@ static char UNUSED id[] = "$Id: irc-server.c,v 1.39 2006/04/30 21:31:43 alex Exp
#include "irc-server.h"
/**
* Handler for the IRC command "SERVER".
* See RFC 2813 section 4.1.2.
*/
GLOBAL bool
IRC_SERVER( CLIENT *Client, REQUEST *Req )
{
@@ -55,13 +59,16 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
/* Fehler liefern, wenn kein lokaler Client */
if( Client_Conn( Client ) <= NONE ) return IRC_WriteStrClient( Client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( Client ), Req->command );
/* Return an error if this is not a local client */
if (Client_Conn(Client) <= NONE)
return IRC_WriteStrClient(Client, ERR_UNKNOWNCOMMAND_MSG,
Client_ID(Client), Req->command);
if( Client_Type( Client ) == CLIENT_GOTPASSSERVER )
{
/* Verbindung soll als Server-Server-Verbindung registriert werden */
Log( LOG_DEBUG, "Connection %d: got SERVER command (new server link) ...", Client_Conn( Client ));
if (Client_Type(Client) == CLIENT_GOTPASS) {
/* We got a PASS command from the peer, and now a SERVER
* command: the peer tries to register itself as a server. */
LogDebug("Connection %d: got SERVER command (new server link) ...",
Client_Conn(Client));
/* Falsche Anzahl Parameter? */
if(( Req->argc != 2 ) && ( Req->argc != 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -207,7 +214,13 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
else
{
/* "CHANINFO <chan> +<modes> <key> <limit> :<topic>" */
if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s %s %ld :%s", Channel_Name( chan ), modes, strchr( Channel_Modes( chan ), 'k' ) ? Channel_Key( chan ) : "*", strchr( Channel_Modes( chan ), 'l' ) ? Channel_MaxUsers( chan ) : 0L, topic )) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s %s %lu :%s",
Channel_Name( chan ), modes,
strchr( Channel_Modes( chan ), 'k' ) ? Channel_Key( chan ) : "*",
strchr( Channel_Modes( chan ), 'l' ) ? Channel_MaxUsers( chan ) : 0UL, topic ))
{
return DISCONNECTED;
}
}
}
}

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-write.c,v 1.20 2006/05/10 21:24:01 alex Exp $";
static char UNUSED id[] = "$Id: irc-write.c,v 1.20.2.1 2006/12/02 13:06:50 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -378,7 +378,7 @@ va_dcl
}
cl2chan = Channel_NextMember( chan, cl2chan );
}
/* naechsten Channel */
chan_cl2chan = Channel_NextChannelOf( Client, chan_cl2chan );
}
@@ -403,12 +403,12 @@ GLOBAL void
IRC_SetPenalty( CLIENT *Client, time_t Seconds )
{
CONN_ID c;
assert( Client != NULL );
assert( Seconds > 0 );
if( Client_Type( Client ) == CLIENT_SERVER ) return;
c = Client_Conn( Client );
if (c > NONE)
Conn_SetPenalty(c, Seconds);

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: lists.c,v 1.18 2005/07/31 20:13:08 alex Exp $";
static char UNUSED id[] = "$Id: lists.c,v 1.18.2.1 2006/12/02 13:05:38 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -36,7 +36,7 @@ static char UNUSED id[] = "$Id: lists.c,v 1.18 2005/07/31 20:13:08 alex Exp $";
#include "lists.h"
#define MASK_LEN 2*CLIENT_HOST_LEN
#define MASK_LEN (2*CLIENT_HOST_LEN)
typedef struct _C2C
@@ -106,7 +106,7 @@ Lists_IsInviteEntry( char *Mask, CHANNEL *Chan )
{
assert( Mask != NULL );
assert( Chan != NULL );
return Already_Registered( My_Invites, Mask, Chan );
} /* Lists_IsInviteEntry */

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: log.c,v 1.61 2006/07/23 23:23:45 alex Exp $";
static char UNUSED id[] = "$Id: log.c,v 1.61.2.1 2006/12/02 13:02:07 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -166,25 +166,21 @@ Log_Exit( void )
* Log function for debug messages.
* This function is only functional when the program is compiled with debug
* code enabled; otherwise it is an empty function which the compiler will
* hopefully mangle down to "nothing". Therefore you should use LogDebug(...)
* in favor to Log(LOG_DEBUG, ...).
* hopefully mangle down to "nothing" (see log.h). Therefore you should use
* LogDebug(...) in favor to Log(LOG_DEBUG, ...).
* @param Format Format string like printf().
* @param ... Further arguments.
*/
#ifdef DEBUG
# ifdef PROTOTYPES
GLOBAL void
#ifdef DEBUG
LogDebug( const char *Format, ... )
#else
LogDebug( UNUSED const char *Format, ... )
#endif /* DEBUG */
# else
GLOBAL void
LogDebug( Format, va_alist )
const char *Format;
va_dcl
# endif /* PROTOTYPES */
#ifdef DEBUG
{
char msg[MAX_LOG_MSG_LEN];
va_list ap;
@@ -199,14 +195,9 @@ va_dcl
va_end( ap );
Log(LOG_DEBUG, "%s", msg);
}
#else
{
/* Do nothing.
* The compiler should optimize this out, please ;-) */
}
#endif /* DEBUG */
/**
* Logging function of ngIRCd.
* This function logs messages to the console and/or syslog, whichever is

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: log.h,v 1.19 2006/02/08 17:33:28 fw Exp $
* $Id: log.h,v 1.19.2.1 2006/12/02 13:02:07 fw Exp $
*
* Logging functions (header)
*/
@@ -39,7 +39,13 @@ GLOBAL void Log_Init PARAMS(( bool Daemon_Mode ));
GLOBAL void Log_Exit PARAMS(( void ));
GLOBAL void Log PARAMS(( int Level, const char *Format, ... ));
#ifdef DEBUG
GLOBAL void LogDebug PARAMS(( const char *Format, ... ));
#else
static inline void LogDebug PARAMS(( UNUSED const char *Format, ... )){/* Do nothing. The compiler should optimize this out, please ;-) */}
#endif
GLOBAL void Log_Init_Resolver PARAMS(( void ));
GLOBAL void Log_Exit_Resolver PARAMS(( void ));

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: match.c,v 1.4 2005/07/31 20:13:08 alex Exp $";
static char UNUSED id[] = "$Id: match.c,v 1.4.2.1 2006/12/02 13:01:11 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -32,8 +32,8 @@ static char UNUSED id[] = "$Id: match.c,v 1.4 2005/07/31 20:13:08 alex Exp $";
*/
static int Matche PARAMS(( char *p, char *t ));
static int Matche_After_Star PARAMS(( char *p, char *t ));
static int Matche PARAMS(( const char *p, const char *t ));
static int Matche_After_Star PARAMS(( const char *p, const char *t ));
#define MATCH_PATTERN 6 /* bad pattern */
@@ -45,7 +45,7 @@ static int Matche_After_Star PARAMS(( char *p, char *t ));
GLOBAL bool
Match( char *Pattern, char *String )
Match( const char *Pattern, const char *String )
{
/* Pattern mit String vergleichen */
if( Matche( Pattern, String ) == MATCH_VALID ) return true;
@@ -54,7 +54,7 @@ Match( char *Pattern, char *String )
static int
Matche( char *p, char *t )
Matche( const char *p, const char *t )
{
register char range_start, range_end;
bool invert;
@@ -201,7 +201,7 @@ Matche( char *p, char *t )
static int
Matche_After_Star( char *p, char *t )
Matche_After_Star( const char *p, const char *t )
{
register int nextp, match = 0;

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: match.h,v 1.3 2005/03/19 18:43:49 fw Exp $
* $Id: match.h,v 1.3.4.1 2006/12/02 13:01:11 fw Exp $
*
* Wildcard pattern matching (header)
*/
@@ -18,7 +18,7 @@
#define __match_h__
GLOBAL bool Match PARAMS(( char *Pattern, char *String ));
GLOBAL bool Match PARAMS(( const char *Pattern, const char *String ));
#endif

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: messages.h,v 1.67 2005/09/02 12:50:25 alex Exp $
* $Id: messages.h,v 1.67.2.2 2006/12/02 14:26:53 fw Exp $
*
* IRC numerics (Header)
*/
@@ -22,7 +22,8 @@
#define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
#define RPL_CREATED_MSG "003 %s :This server has been started %s"
#define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s"
#define RPL_ISUPPORT_MSG "005 %s NICKLEN=%d TOPICLEN=%d AWAYLEN=%d MAXCHANNELS=%d :are supported on this server"
#define RPL_ISUPPORT1_MSG "005 %s RFC2812 CASEMAPPING=ascii PREFIX=(ov)@+ CHANTYPES=# CHANMODES=bI,k,l,imnPst CHANLIMIT=#:%d :are supported on this server"
#define RPL_ISUPPORT2_MSG "005 %s CHANNELLEN=%d NICKLEN=%d TOPICLEN=%d AWAYLEN=%d KICKLEN=%d PENALTY :are supported on this server"
#define RPL_TRACELINK_MSG "200 %s Link %s-%s %s %s V%s %ld %d %d"
#define RPL_TRACEOPERATOR_MSG "204 %s Oper 2 :%s"
@@ -32,17 +33,17 @@
#define RPL_ENDOFSTATS_MSG "219 %s %c :End of STATS report"
#define RPL_UMODEIS_MSG "221 %s +%s"
#define RPL_LUSERCLIENT_MSG "251 %s :There are %ld users and %ld services on %ld servers"
#define RPL_LUSEROP_MSG "252 %s %ld :operator(s) online"
#define RPL_LUSERUNKNOWN_MSG "253 %s %ld :unknown connection(s)"
#define RPL_LUSERCHANNELS_MSG "254 %s %ld :channels formed"
#define RPL_LUSERME_MSG "255 %s :I have %ld users, %ld services and %ld servers"
#define RPL_LUSEROP_MSG "252 %s %lu :operator(s) online"
#define RPL_LUSERUNKNOWN_MSG "253 %s %lu :unknown connection(s)"
#define RPL_LUSERCHANNELS_MSG "254 %s %lu :channels formed"
#define RPL_LUSERME_MSG "255 %s :I have %lu users, %lu services and %lu servers"
#define RPL_ADMINME_MSG "256 %s %s :Administrative info"
#define RPL_ADMINLOC1_MSG "257 %s :%s"
#define RPL_ADMINLOC2_MSG "258 %s :%s"
#define RPL_ADMINEMAIL_MSG "259 %s :%s"
#define RPL_TRACEEND_MSG "262 %s %s %s-%s.%s :End of TRACE"
#define RPL_LOCALUSERS_MSG "265 %s :Current local users: %ld, Max: %ld"
#define RPL_NETUSERS_MSG "266 %s :Current global users: %ld, Max: %ld"
#define RPL_LOCALUSERS_MSG "265 %s %lu %lu :Current local users: %lu, Max: %lu"
#define RPL_NETUSERS_MSG "266 %s %lu %lu :Current global users: %lu, Max: %lu"
#define RPL_AWAY_MSG "301 %s %s :%s"
#define RPL_USERHOST_MSG "302 %s :"

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: resolve.c,v 1.24 2006/05/10 21:24:01 alex Exp $";
static char UNUSED id[] = "$Id: resolve.c,v 1.24.2.1 2006/12/02 13:00:25 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -340,33 +340,24 @@ Resolve_Shutdown( RES_STAT *s)
GLOBAL size_t
Resolve_Read( RES_STAT *s, void* readbuf, size_t buflen)
{
int err;
ssize_t bytes_read;
assert(buflen > 0);
/* Read result from pipe */
errno = 0;
bytes_read = read(s->resolver_fd, readbuf, buflen);
if (bytes_read < 0) {
if (errno != EAGAIN) {
err = errno;
Log( LOG_CRIT, "Resolver: Can't read result: %s!", strerror(err));
Resolve_Shutdown(s);
errno = err;
if (errno == EAGAIN)
return 0;
}
return 0;
}
Resolve_Shutdown(s);
if (bytes_read == 0) { /* EOF: lookup failed */
Log( LOG_CRIT, "Resolver: Can't read result: %s!", strerror(errno));
bytes_read = 0;
}
#ifdef DEBUG
else if (bytes_read == 0)
Log( LOG_DEBUG, "Resolver: Can't read result: EOF");
#endif
return 0;
}
Resolve_Shutdown(s);
return (size_t)bytes_read;
}
/* -eof- */

View File

@@ -1,16 +1,17 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: getpid.sh,v 1.4 2003/08/22 11:31:18 alex Exp $
# $Id: getpid.sh,v 1.4.6.1 2006/12/17 13:49:49 alex Exp $
# did we get a name?
[ $# -ne 1 ] && exit 1
# detect flags for "ps" and "head"
if [ `uname` = "FreeBSD" ]; then
UNAME=`uname`
if [ $UNAME = "FreeBSD" -o $UNAME = "SunOS" ]; then
PS_FLAGS="-a"; PS_PIDCOL="1"; HEAD_FLAGS="-n 1"
elif [ `uname` = "A/UX" ]; then
elif [ $UNAME = "A/UX" ]; then
PS_FLAGS="-ae"; PS_PIDCOL="1"; HEAD_FLAGS="-1"
elif [ `uname` = "GNU" ]; then
elif [ $UNAME = "GNU" ]; then
PS_FLAGS="-ax"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1"
else
PS_FLAGS="-f"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1"
@@ -19,13 +20,17 @@ else
fi
# debug output
#echo "$0: UNAME=$UNAME"
#echo "$0: PS_FLAGS=$PS_FLAGS"
#echo "$0: PS_PIDCOL=$PS_PIDCOL"
#echo "$0: HEAD_FLAGS=$HEAD_FLAGS"
# search PID
ps $PS_FLAGS > procs.tmp
cat procs.tmp | grep -v "$0" | grep "$1" | awk "{print \$$PS_PIDCOL}" | sort -n > pids.tmp
cat procs.tmp | \
grep -v "$0" | grep "$1" | \
awk "{print \$$PS_PIDCOL}" | \
sort -n > pids.tmp
pid=`head $HEAD_FLAGS pids.tmp`
rm -rf procs.tmp pids.tmp