1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-09-22 20:24:03 +00:00

Compare commits

...

48 Commits

Author SHA1 Message Date
Alexander Barton
68835a1d1a ngIRCd release 14 2009-04-20 11:36:27 +02:00
Alexander Barton
54879b432b Display IPv6 addresses as "[<addr>]" when accepting connections.
With this patch ngIRCd displays IPv6 addresses as "[<addr>]:<port>" when
accepting new connections and later, if no successful DNS lookup could
be made (or DNS is disabled altogether).
2009-04-10 13:22:03 +02:00
Alexander Barton
d9355d53f8 Xcode: #define include __DATE__ in VERSION
Change VERSION to include the __DATE__ when compiling from within Xcode.

When building using "make xcode" or "make osxpkg" VERSION already is defined
to the "real" version number set in configure.in.
2009-04-10 13:08:04 +02:00
Alexander Barton
8c0137a6e0 Fix ChangeLog: Local channels are already implemented in Release 13 2009-04-09 15:17:44 +02:00
Alexander Barton
166ab3925e Fix up last Debian changelog entry 2009-03-30 13:44:04 +02:00
Alexander Barton
1f6a5744f6 ngIRCd release 14~rc1 2009-03-29 17:16:02 +02:00
Alexander Barton
156569d263 Updated NEWS and ChangeLog files 2009-03-29 17:05:37 +02:00
Alexander Barton
c3a8d6a73e Updated Debian/Linux init script
- PidFile, ServerUID and ServerGID are read from actual server configuration
- Exit code and behaviour is more LSB compliant
- New "status" and "test" sub-functions
2009-03-29 16:37:06 +02:00
Dana Dahlstrom
3a7d59c1ac misspelling in ERR_NORECIPIENT reply 2009-03-25 20:44:40 +01:00
Alexander Barton
51b88b12f3 Add missing contributors to AUTHORS file 2009-03-11 11:51:59 +01:00
Florian Westphal
ea35ba74b6 testsuite: add more predefined channels to server config
make sure it creates & and +, and accepts channel names without
a special character (ngircd should treat
'Name = chan' as 'Name = #chan').
2009-03-07 00:30:11 +01:00
Florian Westphal
2d4361d088 allow creation of persistent modeless channels 2009-03-07 00:21:43 +01:00
Florian Westphal
e9e7fc33f1 add and use Channel_IsModeless()
avoid "name[0] == '+'" where possible, having Channel_IsModeless()
makes things much more obvious.
2009-03-07 00:13:25 +01:00
Alexander Barton
c09742c518 Enhance INFO command to report compile time, if available 2009-03-05 16:04:36 +01:00
Alexander Barton
c56ab96270 Update NEWS and ChangeLog files 2009-03-03 17:59:43 +01:00
Alexander Barton
0a9608a26f Channel mode changes: break on error
Don't echo multiple syntax error messages (461) on invalid commands,
but break after the first one.
In addition, this solves corrupted 'Unknown mode "+' messages.
2009-03-03 16:33:40 +01:00
Alexander Barton
dee89c2355 Channel_Mode(): code cleanup (no functional changes) 2009-03-03 15:06:34 +01:00
Florian Westphal
b8c6dd503f TLS/SSL: remove useless error message when ssl connection is closed
When using OpenSSL, the following annoying "error" message was logged whenever
an encrypted connection was shut down in a orderly fashion:
TLS/SSL Connection shutdown: ConnSSL_Read: Unable to determine error

of course, this isn't an error at all.
2009-02-05 23:47:28 +01:00
Florian Westphal
66d6c3c84b update ChangeLog. 2009-02-04 23:33:46 +01:00
Florian Westphal
2fce4667a8 SSL/TLS: clear all ssl realted flags on shutdown
one ssl related flags was not cleared on ssl shutdown.
introduce and use CONN_SSL_FLAGS_ALL to zap them all.
2009-02-04 23:23:12 +01:00
Florian Westphal
c6a43fbaf0 TLS/SSL: fix memory leak when using compressed server links with ssl
commit 6bc2d3d06e
(New connection option CONN_RFC1459) forgot to adjust the ssl bitmasks.

The result is that when a compressed AND encrypted server link goes down
the memory allocated by zlib and the r/w buffers are no longer
free'd as the previous ConnSSL_Free() would then also remove the CONN_ZIP flag
from the flag mask.
2009-02-04 23:01:53 +01:00
Alexander Barton
3be9c477be Fix spelling of log message: "channek" vs. "channel" ... 2009-01-20 17:20:30 +01:00
Alexander Barton
d09094812f Channel key file: store file name and open on each access.
Store the file name of channel key files and reopen them on each access
(on each JOIN command) insted of just storing the file handles.

This eliminates the special requirements (no delete) and makes sure
that always the actual file contents are used in all circumstances.
2009-01-20 17:20:30 +01:00
Alexander Barton
c5000694d1 Support individual channel keys for pre-defined channels.
This patch introduces the new configuration variable "KeyFile" for
[Channel] sections in ngircd.conf. Here a file can be configured for each
pre-defined channel which contains individual channel keys for different
users. This file is line-based and must have the following syntax:

  <user>:<nick>:<key>

<user> and <nick> can contain the wildcard character "*".

Please not that these channel keys are only in effect, when the channel
has a regular key set using channel mode "k"!
2009-01-20 17:20:30 +01:00
Alexander Barton
2c1b6280fa RFC 2812, sec. 3.3.1: really check for the last dot
This fixes commit 5a3128243f and makes the test suite ("make check")
run again without errors.
2009-01-20 16:49:34 +01:00
Florian Westphal
5a3128243f irc.c: reject masks with wildcard after last dot
RFC 2812 says in section 3.3.1 ("Private Messages"):

The mask MUST have at least 1 (one) "." in it and no wildcards
following the last ".".
2009-01-18 00:36:38 +01:00
Florian Westphal
95e8320ca9 irc.c: Fix handling of channels containing dots
commit 2546a13ad2
('Cumulative Message Patch') broke PRIVMSG to channels
containing dots.

Fix this by switching evaluation order:
Check first if the target matches a existing channel and only do a check
for target masks if that failed.

PRIVMSG with host/server masks is described in RFC 2812, section 3.3.1.

Makes one wonder how a server is _really_ supposed to tell the difference
between hostmasks and channel names.

Sigh.
2009-01-18 00:20:38 +01:00
Ask Bjørn Hansen
8f46681bc8 Update ngircd.spec file
- Change Copyright to License
- Update URL
- Make BuildRoot use %{_tmppath} macro
- Add basic BuildRequires
- Compile with zlib and openssl
- Install all docs in standard document location

Signed-off-by: Ask Bjørn Hansen <ask@develooper.com>
2009-01-13 11:01:09 +01:00
Florian Westphal
1c7b9dbe93 remove unneeded LOG_DEBUG when not compiling with DEBUG support
when ngircd is build without DEBUG enabled, LOG_DEBUG messages
are always discarded.

To avoid the extra code, ngircd has a LogDebug() wrapper which
gets removed by the compiler when compiling without DEBUG defined.

Update a few functings which were using the
Log(LOG_DEBUG, .. interface directly without #ifdef DEBUG guards.

   text	   data	    bss	    dec	    hex	filename
 127748	   1900	  28280	 157928	  268e8	ngircd.before
 126836	   1896	  28280	 157012	  26554	ngircd.after
2009-01-10 00:54:07 +01:00
Florian Westphal
0acef7c598 documentation: gnutls does not support password-protected privkeys
already mentioned in man page and sample config file, but for
completeness also document it in doc/SSL.txt.
2009-01-09 21:33:19 +01:00
Alexander Barton
00c8dfa8be Mac OS X: update texts for Mac OS X Installer.app 2009-01-06 17:40:25 +01:00
Alexander Barton
75243ffb37 Xcode: build ngIRCd with IPv6 support on Mac OS X 2009-01-06 17:39:11 +01:00
Alexander Barton
5468ba3744 Xcode: get release number dynamically; new make target "xcode-clean".
- make target "xcode" now detects the release number stored in the
  configure.in file and passes it to Xcode.
- new make target "xcode-clean" which removes all files generated by
  "make xcode" and removes the Xcode build directory.
2009-01-06 16:02:27 +01:00
Alexander Barton
eb159e0a8d Xcode: define TARGET_VENDOR and TARGET_OS 2009-01-06 16:00:15 +01:00
Alexander Barton
df3473c9c1 Add new and missing files to Mac OS X Xcode project 2009-01-06 15:09:39 +01:00
Alexander Barton
a11e895045 Rename Channel_Free() to Free_Channel(), it is a local function 2009-01-05 13:53:33 +01:00
Alexander Barton
175f0af979 Clean up channel allocation table on shutdown/restart.
Silly bug: the condition of a while() loop in the Channel_Exit() function
used the wrong variable and therefore got never executed ...

This bug is in the code since the beginning (see commit bb19cfda in 2002);
shame on me!
2009-01-05 12:58:37 +01:00
Florian Westphal
40a0e9abbe Add Channel_Free().
Central function to free a channel structure and all its resources
(invite/ban lists, topic, ...).
2009-01-05 12:48:48 +01:00
Alexander Barton
0659503afd Clean up (reformat and comment) Delete_Channel() function. 2009-01-04 15:25:07 +01:00
Alexander Barton
18efc7469c Free topic array on channel deletion.
The topic array in the CHANNEL structure must be free()'d before the
channel itself becomes deleted.
2009-01-04 15:22:32 +01:00
Alexander Barton
fd9266df78 Fix spelling in some documents. 2009-01-01 17:56:42 +01:00
Alexander Barton
0e4e22a7a6 Allow pre-defined server local channels ("&"). 2008-12-30 19:23:03 +01:00
Alexander Barton
9d20397470 Spell check and enhance ngIRCd manual pages. 2008-12-30 19:20:09 +01:00
Florian Westphal
307cdce908 man ngircd.conf: line break missing before the SSLConnect description
reported by Christoph Biedl.
2008-12-29 23:34:20 +01:00
Florian Westphal
dc9f42dc3c defines.h: remove MAX_LISTEN_PORTS, MAX_SERVICES
_SERVICES was never used; _LISTEN_PORTS is a leftover from
commit 51ccb5928a
('internal changes needed for future ssl support').
2008-12-27 23:51:52 +01:00
Florian Westphal
a971047bc5 Remove limit on max number of predefined channels.
This resolves Bugzilla Bug 68 ('Too many pre-defined channels configured.')
2008-12-26 01:07:56 +01:00
Florian Westphal
6500d443fc channel.c: constify a few function arguments. 2008-12-26 01:07:52 +01:00
Florian Westphal
d26a283ea9 use %ld as format specifier for posix data types
in the same vein as the earlier commit:
cast posix data types (pid_t, ...) to long and use
%ld as format specifier. This will avoid problems
when sizeof(int) != sizeof(type).

We could also cast to int, but this might truncate the value.
2008-12-26 01:07:13 +01:00
38 changed files with 860 additions and 387 deletions

View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2007 Alexander Barton,
(c)2001-2009 Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -25,6 +25,7 @@ Florian Westphal, <westphal@foo.fh-furtwangen.de> (fw)
Contributors
~~~~~~~~~~~~
Ali Shemiran, <ashemira@ucsd.edu>
Ask Bjørn Hansen, <ask@develooper.com>
Benjamin Pineau, <ben@zouh.org>
Brandon Beresini, <beresini@google.com>
Bryan Caldwell, <bcaldwel@ucsd.edu>
@@ -32,6 +33,7 @@ Dana Dahlstrom, <dana+ngIRCd@cs.ucsd.edu>
Eric Grunow, <egrunow@ucsd.edu>
Goetz Hoffart, <goetz@hoffart.de>
Ilja Osthoff, <i.osthoff@gmx.net>
Jari Aalto, <jari.aalto@cante.net>
Rolf Eike Beer, <eike@sf-mail.de>
Scott Perry, <scperry@ucsd.edu>
Sean Reifschneider, <jafo-rpms@tummy.com>

View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2008 Alexander Barton,
(c)2001-2009 Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -10,14 +10,38 @@
-- ChangeLog --
ngIRCd Release 14 (2009-04-20)
- Display IPv6 addresses as "[<addr>]" when accepting connections.
ngIRCd 14~rc1 (2009-03-29)
- Updated Debian/Linux init script (see contrib/Debian/ngircd.init).
- Allow creation of persistent modeless channels.
- The INFO command reports the compile time now (if available).
- Spell check and enhance ngIRCd manual pages.
- Channel mode changes: break on syntax errors in MODE command.
- Support individual channel keys for pre-defined channels: introduce
new configuration variable "KeyFile" in [Channel] sections in ngircd.conf,
here a file can be configured for each pre-defined channel which contains
individual channel keys for different users.
- Remove limit on maximum number of predefined channels in ngircd.conf.
- Updated ngircd.spec file for building RPM packages.
- Add new and missing files to Mac OS X Xcode project, and update project.
- Reject masks with wildcard after last dot.
- TLS/SSL: remove useless error message when ssl connection is closed.
- Fix memory leak when a encrypted and compressed server link goes down.
(closes bug #95, reported by Christoph, fiesh@fiesh.homeip.net)
- Fix handling of channels containing dots.
(closes ug #93, reported by Gonosz Csiga)
ngIRCd Release 13 (2008-12-25)
- Updated documentation, especially doc/Services.txt and doc/SSL.txt.
- Make the test suite work on OpenSolaris.
ngIRCd 13~rc1 (2008-11-21):
- New version numer scheme :-)
- Initial support for IRC services, using a RFC1459 styel interface,
- New version number scheme :-)
- Initial support for IRC services, using a RFC1459 style interface,
tested with IRCServices (http://www.ircservices.za.net/) version 5.1.13.
For this to work, ngIRCd now supports server-server links conforming
to RFC 1459. New ngircd.conf(5) option: ServiceMask.
@@ -49,7 +73,7 @@ ngIRCd 0.12.1 (2008-07-09)
- Update ngIRCd manual pages
- Add option aliases -V (for --version) and -h (for --help).
- Fix 'no-ipv6' compile error.
- Make Listen parameter a comma-seperated list of addresses. This also
- Make Listen parameter a comma-separated list of addresses. This also
obsoletes ListenIPv4 and ListenIPv6 options. If Listen is unset, it
is treated as Listen="::,0.0.0.0".
Note: ListenIPv4 and ListenIPv6 options are still recognized,
@@ -59,11 +83,11 @@ ngIRCd 0.12.0 (2008-05-13)
- Fix Bug: 85: "WHO #SecretChannel" that user is not a member of now returns
proper RPL_ENDOFWHO_MSG instead of nothing. (Ali Shemiran)
- Fix complie on FreeBSD 5.4 and AIX.
- If bind() fails, also print ip address and not just the port number.
- Fix compile on FreeBSD 5.4 and AIX.
- If bind() fails, also print IP address and not just the port number.
ngIRCd 0.12.0-pre2 (2008-04-29)
- IPv6: Add config options to disabe ipv4/ipv6 support.
- IPv6: Add config options to disable ipv4/ipv6 support.
- Don't include doc/CVS.txt in distribution archive, use doc/GIT.txt now!
- Documentation: get rid of some more references to CVS, switch to GIT.
- Get rid of cvs-version.* and CVSDATE definition.
@@ -106,11 +130,11 @@ ngIRCd 0.11.0 (2008-01-15)
- Use dotted-decimal IP address if hostname is >= 64.
- Add support for /STAT u (server uptime) command.
- New [Server] configuration Option "Bind" allows to specify
the source ip adress to use when connecting to remote server.
the source IP address to use when connecting to remote server.
- New configuration option "MaxNickLength" to specify the allowed maximum
length of user nick names. Note: must be unique in an IRC network!
- Enhanced the IRC+ protocol to support an enhanced "server handshake" and
enable server to recognice numeric 005 (ISUPPORT) and 376 (ENDOFMOTD).
enable server to recognize numeric 005 (ISUPPORT) and 376 (ENDOFMOTD).
See doc/Protocol.txt for details.
- Re-added doc/SSL.txt to distribution -- got lost somewhere!?
- Fixes the wrong logging output when nested servers are introduced
@@ -439,7 +463,7 @@ ngIRCd 0.7.0 (2003-05-01)
- Better error reporting to clients on connect.
- Enhanced manual pages ngircd(8) and ngircd.conf(5).
- Documentation is now installed in $(datadir)/doc/ngircd.
- Enhanced hanling of NJOIN in case of nick collisions.
- Enhanced handling of NJOIN in case of nick collisions.
ngIRCd 0.6.1, 2003-01-21

View File

@@ -32,12 +32,21 @@ lint:
srcdoc:
make -C doc srcdoc
xcode:
have-xcodebuild:
@xcodebuild -project contrib/MacOSX/ngIRCd.xcodeproj -list \
>/dev/null 2>&1 \
|| ( echo; echo "Error: \"xcodebuild\" not found!"; echo; exit 1 )
xcode: have-xcodebuild
rel=`grep AC_INIT configure.in | cut -d' ' -f2 | cut -d')' -f1`; \
def="GCC_PREPROCESSOR_DEFINITIONS=\"VERSION=\\\"$$rel\\\"\""; \
xcodebuild -project contrib/MacOSX/ngIRCd.xcodeproj -alltargets \
-configuration Default $$def build
xcode-clean: have-xcodebuild
xcodebuild -project contrib/MacOSX/ngIRCd.xcodeproj -alltargets \
-buildstyle Development
-configuration Default clean
rm -fr contrib/MacOSX/build
rpm: distcheck
rpm -ta ngircd-*.tar.gz
@@ -46,7 +55,7 @@ deb:
[ -f debian/rules ] || ln -s contrib/Debian debian
dpkg-buildpackage -rfakeroot -i
osxpkg:
osxpkg: have-xcodebuild
@packagemaker >/dev/null 2>&1; [ $$? -ge 1 ] \
|| ( echo; echo "Error: \"packagemaker\" not found!"; echo; exit 2)
make clean

23
NEWS
View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2008 Alexander Barton,
(c)2001-2009 Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -10,11 +10,22 @@
-- NEWS --
ngIRCd Release 14 (2009-04-20)
ngIRCd 14~rc1 (2009-03-29)
- Allow creation of persistent modeless channels.
- The INFO command reports the compile time now (if available).
- Support individual channel keys for pre-defined channels: introduce
new configuration variable "KeyFile" in [Channel] sections in ngircd.conf,
here a file can be configured for each pre-defined channel which contains
individual channel keys for different users.
- Remove limit on maximum number of predefined channels in ngircd.conf.
ngIRCd Release 13 (2008-12-25)
ngIRCd 13~rc1 (2008-11-21):
- New version numer scheme :-)
- Initial support for IRC services, using a RFC1459 styel interface,
- New version number scheme :-)
- Initial support for IRC services, using a RFC1459 style interface,
tested with IRCServices (http://www.ircservices.za.net/) version 5.1.13.
For this to work, ngIRCd now supports server-server links conforming
to RFC 1459. New ngircd.conf(5) option: ServiceMask.
@@ -33,7 +44,7 @@ ngIRCd Release 13 (2008-12-25)
ngIRCd 0.12.1 (2008-07-09)
- Add option aliases -V (for --version) and -h (for --help).
- Make Listen parameter a comma-seperated list of addresses. This also
- Make Listen parameter a comma-separated list of addresses. This also
obsoletes ListenIPv4 and ListenIPv6 options. If Listen is unset, it
is treated as Listen="::,0.0.0.0".
Note: ListenIPv4 and ListenIPv6 options are still recognized,
@@ -42,7 +53,7 @@ ngIRCd 0.12.1 (2008-07-09)
ngIRCd 0.12.0 (2008-05-13)
ngIRCd 0.12.0-pre2 (2008-04-29)
- IPv6: Add config options to disabe ipv4/ipv6 support.
- IPv6: Add config options to disable ipv4/ipv6 support.
ngIRCd 0.12.0-pre1 (2008-04-20)
- Add IPv6 support.
@@ -61,7 +72,7 @@ ngIRCd 0.11.0 (2008-01-15)
- Add support for /STAT u (server uptime) command.
- New [Server] configuration Option "Bind" allows to specify
the source ip adress to use when connecting to remote server.
the source IP address to use when connecting to remote server.
- New configuration option "MaxNickLength" to specify the allowed maximum
length of user nick names. Note: must be unique in an IRC network!
- Numeric 317: implemented "signon time" (displayed in WHOIS result).

View File

@@ -12,7 +12,7 @@
# -- Initialisation --
AC_PREREQ(2.50)
AC_INIT(ngircd, 13)
AC_INIT(ngircd, 14)
AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(1.6)

View File

@@ -1,3 +1,15 @@
ngircd (14-0ab1) unstable; urgency=low
* New "upstream" release: ngIRCd 14.
-- Alexander Barton <alex@barton.de> Mon, 20 Apr 2009 11:09:12 +0200
ngircd (14~rc1-0ab1) unstable; urgency=low
* New "upstream" release candidate 1 for ngIRCd Release 14.
-- Alexander Barton <alex@barton.de> Sun, 29 Mar 2009 17:09:17 +0200
ngircd (13-0ab1) unstable; urgency=low
* New "upstream" release: ngIRCd 13.

View File

@@ -1,18 +1,19 @@
#!/bin/sh
#
# ngIRCd start and stop script for Debian-based systems
# Copyright 2008 Alexander Barton <alex@barton.de>
# Copyright 2008,2009 Alexander Barton <alex@barton.de>
#
### BEGIN INIT INFO
# Provides: ircd
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Should-Start: $syslog
# Provides: ngircd ircd
# Required-Start: $network $local_fs
# Required-Stop:
# Should-Start: $syslog $named
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Next Generation IRC Server
# Description: IRC daemon written from scratch
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -20,14 +21,16 @@ DAEMON=/usr/sbin/ngircd
NAME=ngIRCd
DESC="IRC daemon"
PARAMS=""
STARTTIME=1
DIETIME=10
test -x $DAEMON || exit 5
test -h "$0" && me=`readlink $0` || me="$0"
BASENAME=`basename $me`
test -r /etc/default/$BASENAME && . /etc/default/$BASENAME
test -x $DAEMON || exit 0
# LSB compatibility functions that become used if there is no local
# include file available.
log_daemon_msg() {
@@ -39,69 +42,134 @@ log_end_msg() {
log_failure_msg() {
echo "$*"
}
log_warning_msg() {
log_failure_msg "$*"
}
# Include LSB functions, if available:
test -r /lib/lsb/init-functions && . /lib/lsb/init-functions
PIDFILE=`$DAEMON $PARAMS -t | tr -d ' ' | grep "^PidFile=" | cut -d'=' -f2`
[ -n "$PIDFILE" ] || PIDFILE="/var/run/ircd/ngircd.pid"
r=3
Check_Config()
{
# Make sure that the configuration of ngIRCd is valid:
$DAEMON --configtest >/dev/null 2>&1
if [ $? -ne 0 ]; then
log_failure_msg "Configuration of $NAME is not valid, won't (re)start!"
log_failure_msg "Run \"$DAEMON --configtest\" and fix it up ..."
exit 1
fi
$DAEMON $PARAMS --configtest >/dev/null 2>&1
[ $? -eq 0 ] && return 0
log_end_msg 1
log_failure_msg "Configuration of $NAME is not valid, won't (re)start!"
log_failure_msg "Run \"$DAEMON --configtest\" and fix it up ..."
exit 6
}
Prepare() {
# Make sure the PID file directory exists and is writable:
if [ ! -d /var/run/ircd ]; then
mkdir -p /var/run/ircd
user=`$DAEMON $PARAMS -t|tr -d ' '|grep "^ServerUID="|cut -d'=' -f2`
group=`$DAEMON $PARAMS -t|tr -d ' '|grep "^ServerGID="|cut -d'=' -f2`
piddir=`dirname "$PIDFILE"`
[ -d "$piddir" ] || mkdir -p "$piddir" 2>/dev/null
chown "$user:$group" "$piddir" 2>/dev/null
[ $? -eq 0 ] && return 0
log_end_msg 1
log_failure_msg "Failed to prepare '$piddir' for user '$user'!"
exit 1
}
Do_Start() {
if Do_Status; then
log_end_msg 0
log_warning_msg "$NAME seems to be already running, nothing to do."
exit 0
fi
chown irc:irc /var/run/ircd
start-stop-daemon --start \
--quiet --exec $DAEMON -- $PARAMS
sleep $STARTTIME
Do_Status || return 7
return 0
}
Do_Stop() {
if ! Do_Status; then
log_end_msg 0
log_warning_msg "$NAME seems not to be running, nothing to do."
exit 0
fi
Do_ForceStop
return $?
}
Do_ForceStop() {
[ -e $PIDFILE ] \
&& pidfile="--pidfile $PIDFILE" \
|| pidfile=""
start-stop-daemon --stop \
--quiet --oknodo --exec $DAEMON $pidfile
for i in `seq 1 $DIETIME`; do
Do_Status || return 0
sleep 1
done
return 1
}
Do_Reload() {
start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
return $?
}
Do_Status() {
[ -e $PIDFILE ] \
&& pidfile="--pidfile $PIDFILE" \
|| pidfile=""
start-stop-daemon --stop \
--quiet --signal 0 --exec $DAEMON $pidfile >/dev/null
return $?
}
case "$1" in
start)
Check_Config
log_daemon_msg "Starting $DESC" "$NAME"
start-stop-daemon --start \
--quiet --exec $DAEMON -- $PARAMS
log_end_msg $?
Check_Config
Prepare
Do_Start; r=$?
log_end_msg $r
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
[ -r /var/run/ircd/ngircd.pid ] \
&& PIDFILE="--pidfile /var/run/ircd/ngircd.pid" \
|| PIDFILE=""
start-stop-daemon --stop \
--quiet --oknodo --exec $DAEMON $PIDFILE
log_end_msg $?
Do_Stop; r=$?
log_end_msg $r
;;
reload|force-reload)
Check_Config
log_daemon_msg "Reloading $DESC" "$NAME"
start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
log_end_msg $?
Check_Config
Do_Reload; r=$?
log_end_msg $r
;;
restart)
Check_Config
log_daemon_msg "Restarting $DESC" "$NAME"
[ -r /var/run/ircd/ngircd.pid ] \
&& PIDFILE="--pidfile /var/run/ircd/ngircd.pid" \
|| PIDFILE=""
start-stop-daemon --stop \
--quiet --oknodo --exec $DAEMON $PIDFILE
sleep 1
start-stop-daemon --start \
--quiet --exec $DAEMON -- $PARAMS
log_end_msg $?
Check_Config
Prepare
Do_ForceStop
Do_Start; r=$?
log_end_msg $r
;;
status)
log_daemon_msg "Checking for $DESC" "$NAME"
Do_Status; r=$?
log_end_msg $r
;;
test)
Check_Config
echo "Configuration of $DAEMON seems to be ok."; r=0
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
exit 1
N=/etc/init.d/$NAME; r=2
echo "Usage: $N {start|stop|restart|reload|force-reload|status|test}" >&2
;;
esac
exit 0
exit $r
# -eof-

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2007 Alexander Barton (alex@barton.de).
* Copyright (c)2001-2009 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,15 +8,20 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: config.h,v 1.1 2007/11/19 22:11:36 alex Exp $
*
* Static configuration file for Mac OS X Xcode project
*/
#define PACKAGE_NAME "ngircd"
#define VERSION "??"
#ifndef VERSION
#define VERSION "??("__DATE__")"
#endif
#define SYSCONFDIR "/etc/ngircd"
#ifndef TARGET_VENDOR
#define TARGET_VENDOR "apple"
#define TARGET_OS "darwin"
#endif
/* -- Build options -- */
/* Define if debug-mode should be enabled */
@@ -43,6 +48,9 @@
/* Define if zlib compression should be enabled */
#define ZLIB 1
/* Define if IPV6 protocol should be enabled */
#define WANT_IPV6 1
/* -- Supported features -- */
/* Define if SSP C support is enabled. */
@@ -78,6 +86,12 @@
#define HAVE_STRDUP 1
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
/* Define to 1 if you have the `inet_aton' function. */
#define HAVE_INET_ATON 1
/* Define to 1 if you have the `getaddrinfo' function. */
#define HAVE_GETADDRINFO 1
/* Define to 1 if you have the `getnameinfo' function. */
#define HAVE_GETNAMEINFO 1
/* Define if socklen_t exists */
#define HAVE_socklen_t 1

View File

@@ -1,10 +1,10 @@
<pkmkdoc spec="1.12"><properties><title>ngIRCd</title><build>/Users/alex/Desktop/ngIRCd.mpkg</build><organization>de.barton.ngircd</organization><userSees ui="both"/><min-target os="2"/><domain anywhere="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><description>ngIRCd next generation IRC (Internet Relay Chat) server daemon</description><contents><choice title="ngIRCd daemon" id="choicengircd" tooltip="ngIRCd daemon, documentation and manual pages" description="Binaries, documentation and manual pages of the ngIRCd, the next generation IRC (Internet Relay Chat) daemon. This package will be installed into /opt/ngircd." starts_selected="true" starts_enabled="true" starts_hidden="false"><customLoc>/</customLoc><pkgref id="de.barton.ngircd.daemon.pkg"/></choice><choice title="Start and stop script" id="choicelaunchscript" tooltip="LaunchDaemon start and stop script" description="Installs the ngIRCd start and stop script for the &quot;launch daemon&quot;. If this is an update/upgrade, and ngIRCd is already running, it will be automatically restarted." starts_selected="true" starts_enabled="true" starts_hidden="false"><customLoc>/Library/LaunchDaemons</customLoc><pkgref id="de.barton.ngircd.launchscript.pkg"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="en"><resource mime-type="text/rtf" kind="embedded" type="license"><![CDATA[{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf330
<pkmkdoc spec="1.12"><properties><title>ngIRCd</title><build>/Users/alex/Desktop/ngIRCd.mpkg</build><organization>de.barton.ngircd</organization><userSees ui="both"/><min-target os="2"/><domain anywhere="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><description>ngIRCd next generation IRC (Internet Relay Chat) server daemon</description><contents><choice title="ngIRCd daemon" id="choicengircd" tooltip="ngIRCd daemon, documentation and manual pages" description="Binaries, documentation and manual pages of the ngIRCd, the next generation IRC (Internet Relay Chat) daemon. This package will be installed into /opt/ngircd." starts_selected="true" starts_enabled="true" starts_hidden="false"><customLoc>/</customLoc><pkgref id="de.barton.ngircd.daemon.pkg"/></choice><choice title="Start and stop script" id="choicelaunchscript" tooltip="LaunchDaemon start and stop script" description="Installs the ngIRCd start and stop script for the &quot;launch daemon&quot;. If this is an update/upgrade, and ngIRCd is already running, it will be automatically restarted." starts_selected="true" starts_enabled="true" starts_hidden="false"><customLoc>/Library/LaunchDaemons</customLoc><pkgref id="de.barton.ngircd.launchscript.pkg"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="en"><resource mime-type="text/rtf" kind="embedded" type="license"><![CDATA[{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf430
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\qc\pardirnatural
\f0\i\fs24 \cf0 ngIRCd -- The Next Generation IRC Daemon\
Copyright (c)2001-2008 Alexander Barton and Contributors.\
Copyright (c)2001-2009 Alexander Barton and Contributors.\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
\i0 \cf0 \
@@ -151,7 +151,7 @@ Each version is given a distinguishing version number. If the Program specifies
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\
\
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\
}]]></resource><resource mime-type="text/rtf" kind="embedded" type="welcome"><![CDATA[{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf330
}]]></resource><resource mime-type="text/rtf" kind="embedded" type="welcome"><![CDATA[{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf430
{\fonttbl\f0\fnil\fcharset0 LucidaGrande;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
@@ -160,7 +160,7 @@ Each version is given a distinguishing version number. If the Program specifies
\
Homepage: http://ngircd.barton.de\
\
You will be guided through all steps necessary to install this software.}]]></resource><resource mime-type="text/rtf" kind="embedded" type="conclusion"><![CDATA[{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf330
You will be guided through all steps necessary to install this software.}]]></resource><resource mime-type="text/rtf" kind="embedded" type="conclusion"><![CDATA[{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf430
{\fonttbl\f0\fnil\fcharset0 LucidaGrande;\f1\fnil\fcharset0 Monaco;}
{\colortbl;\red255\green255\blue255;}
{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1}
@@ -168,7 +168,9 @@ You will be guided through all steps necessary to install this software.}]]></re
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\f0\fs26 \cf0 ngIRCd has been successfully installed/upgraded, and has been restarted if it was already running before and you have installed the LaunchDaemon start and stop script (which is the default).\
\f0\fs26 \cf0 ngIRCd has been successfully installed/upgraded.\
\
It has been restarted if it was already running before and you have installed the LaunchDaemon start and stop script (which is the default).\
\
If you installed ngIRCd the first time (or had the LaunchDaemon script disabled before), you can start ngIRCd using the following terminal command:\
\

View File

@@ -35,6 +35,7 @@
FA322DBE0CEF7766001761B3 /* tool.c in Sources */ = {isa = PBXBuildFile; fileRef = FA322D330CEF74B1001761B3 /* tool.c */; };
FA322DC10CEF77CB001761B3 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA322DC00CEF77CB001761B3 /* libz.dylib */; };
FA407F2E0DB159F400271AF1 /* ng_ipaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = FA407F2C0DB159F400271AF1 /* ng_ipaddr.c */; };
FAA3D27B0F139CDC00B2447E /* conn-ssl.c in Sources */ = {isa = PBXBuildFile; fileRef = FAA3D2790F139CDC00B2447E /* conn-ssl.c */; };
FAE5CC2E0CF2308A007D69B6 /* numeric.c in Sources */ = {isa = PBXBuildFile; fileRef = FAE5CC2D0CF2308A007D69B6 /* numeric.c */; };
/* End PBXBuildFile section */
@@ -126,7 +127,6 @@
FA322D210CEF74B1001761B3 /* getpid.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = getpid.sh; sourceTree = "<group>"; };
FA322D220CEF74B1001761B3 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Makefile.am; sourceTree = "<group>"; };
FA322D230CEF74B1001761B3 /* mode-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "mode-test.e"; sourceTree = "<group>"; };
FA322D240CEF74B1001761B3 /* ngircd-test.conf */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "ngircd-test.conf"; sourceTree = "<group>"; };
FA322D250CEF74B1001761B3 /* README */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
FA322D260CEF74B1001761B3 /* start-server.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = "start-server.sh"; sourceTree = "<group>"; };
FA322D270CEF74B1001761B3 /* stop-server.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = "stop-server.sh"; sourceTree = "<group>"; };
@@ -193,6 +193,28 @@
FA407F2C0DB159F400271AF1 /* ng_ipaddr.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = ng_ipaddr.c; path = ipaddr/ng_ipaddr.c; sourceTree = "<group>"; };
FA407F2D0DB159F400271AF1 /* ng_ipaddr.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = ng_ipaddr.h; path = ipaddr/ng_ipaddr.h; sourceTree = "<group>"; };
FA407F380DB15AC700271AF1 /* GIT.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = GIT.txt; sourceTree = "<group>"; };
FAA3D2700F139CB300B2447E /* invite-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "invite-test.e"; sourceTree = "<group>"; };
FAA3D2710F139CB300B2447E /* join-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "join-test.e"; sourceTree = "<group>"; };
FAA3D2720F139CB300B2447E /* kick-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "kick-test.e"; sourceTree = "<group>"; };
FAA3D2730F139CB300B2447E /* message-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "message-test.e"; sourceTree = "<group>"; };
FAA3D2740F139CB300B2447E /* ngircd-test1.conf */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "ngircd-test1.conf"; sourceTree = "<group>"; };
FAA3D2750F139CB300B2447E /* ngircd-test2.conf */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "ngircd-test2.conf"; sourceTree = "<group>"; };
FAA3D2760F139CB300B2447E /* opless-channel-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "opless-channel-test.e"; sourceTree = "<group>"; };
FAA3D2770F139CB300B2447E /* server-link-test.e */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "server-link-test.e"; sourceTree = "<group>"; };
FAA3D2780F139CDC00B2447E /* conf-ssl.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "conf-ssl.h"; sourceTree = "<group>"; };
FAA3D2790F139CDC00B2447E /* conn-ssl.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = "conn-ssl.c"; sourceTree = "<group>"; };
FAA3D27A0F139CDC00B2447E /* conn-ssl.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = "conn-ssl.h"; sourceTree = "<group>"; };
FAA3D27C0F139CF800B2447E /* strtok_r.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = strtok_r.c; sourceTree = "<group>"; };
FAA3D27D0F139CF800B2447E /* waitpid.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = waitpid.c; sourceTree = "<group>"; };
FAA3D2800F139D1500B2447E /* Services.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Services.txt; sourceTree = "<group>"; };
FAA3D2820F139D2E00B2447E /* 01ngircd-contents.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = "01ngircd-contents.xml"; sourceTree = "<group>"; };
FAA3D2830F139D2E00B2447E /* 01ngircd.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = 01ngircd.xml; sourceTree = "<group>"; };
FAA3D2840F139D2E00B2447E /* 02de-contents.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = "02de-contents.xml"; sourceTree = "<group>"; };
FAA3D2850F139D2E00B2447E /* 02de.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = 02de.xml; sourceTree = "<group>"; };
FAA3D2860F139D2E00B2447E /* index.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; path = index.xml; sourceTree = "<group>"; };
FAA3D2880F139D2E00B2447E /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Makefile.am; sourceTree = "<group>"; };
FAA3D28A0F139D2E00B2447E /* postinstall.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = postinstall.sh; sourceTree = "<group>"; };
FAA3D28B0F139D2E00B2447E /* preinstall.sh */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.script.sh; path = preinstall.sh; sourceTree = "<group>"; };
FAE5CC2C0CF2308A007D69B6 /* numeric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = numeric.h; sourceTree = "<group>"; };
FAE5CC2D0CF2308A007D69B6 /* numeric.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = numeric.c; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -258,6 +280,9 @@
FA322CD70CEF74B1001761B3 /* ngircd */ = {
isa = PBXGroup;
children = (
FAA3D2780F139CDC00B2447E /* conf-ssl.h */,
FAA3D2790F139CDC00B2447E /* conn-ssl.c */,
FAA3D27A0F139CDC00B2447E /* conn-ssl.h */,
FA322CD90CEF74B1001761B3 /* array.c */,
FA322CDA0CEF74B1001761B3 /* array.h */,
FA322CDB0CEF74B1001761B3 /* channel.c */,
@@ -320,6 +345,8 @@
FA322D0E0CEF74B1001761B3 /* portab */ = {
isa = PBXGroup;
children = (
FAA3D27C0F139CF800B2447E /* strtok_r.c */,
FAA3D27D0F139CF800B2447E /* waitpid.c */,
FA322D100CEF74B1001761B3 /* ansi2knr.1 */,
FA322D110CEF74B1001761B3 /* ansi2knr.c */,
FA322D120CEF74B1001761B3 /* exp.h */,
@@ -338,6 +365,14 @@
FA322D1B0CEF74B1001761B3 /* testsuite */ = {
isa = PBXGroup;
children = (
FAA3D2700F139CB300B2447E /* invite-test.e */,
FAA3D2710F139CB300B2447E /* join-test.e */,
FAA3D2720F139CB300B2447E /* kick-test.e */,
FAA3D2730F139CB300B2447E /* message-test.e */,
FAA3D2740F139CB300B2447E /* ngircd-test1.conf */,
FAA3D2750F139CB300B2447E /* ngircd-test2.conf */,
FAA3D2760F139CB300B2447E /* opless-channel-test.e */,
FAA3D2770F139CB300B2447E /* server-link-test.e */,
FA322D1D0CEF74B1001761B3 /* channel-test.e */,
FA322D1E0CEF74B1001761B3 /* check-idle.e */,
FA322D1F0CEF74B1001761B3 /* connect-test.e */,
@@ -346,7 +381,6 @@
FA322D220CEF74B1001761B3 /* Makefile.am */,
FA1A6BBC0D6857BB00AA8F71 /* misc-test.e */,
FA322D230CEF74B1001761B3 /* mode-test.e */,
FA322D240CEF74B1001761B3 /* ngircd-test.conf */,
FA322D250CEF74B1001761B3 /* README */,
FA322D260CEF74B1001761B3 /* start-server.sh */,
FA322D270CEF74B1001761B3 /* stop-server.sh */,
@@ -408,6 +442,9 @@
FA322D730CEF7523001761B3 /* MacOSX */ = {
isa = PBXGroup;
children = (
FAA3D2810F139D2E00B2447E /* ngIRCd.pmdoc */,
FAA3D28A0F139D2E00B2447E /* postinstall.sh */,
FAA3D28B0F139D2E00B2447E /* preinstall.sh */,
FA322D750CEF7523001761B3 /* build */,
FA322D8D0CEF7523001761B3 /* Makefile.am */,
FA322D8E0CEF7523001761B3 /* ngIRCd.xcodeproj */,
@@ -497,6 +534,7 @@
FA322D970CEF752C001761B3 /* doc */ = {
isa = PBXGroup;
children = (
FAA3D2800F139D1500B2447E /* Services.txt */,
FA407F380DB15AC700271AF1 /* GIT.txt */,
FA322D9A0CEF752C001761B3 /* FAQ.txt */,
FA322D9B0CEF752C001761B3 /* Makefile.am */,
@@ -547,6 +585,19 @@
name = ipaddr;
sourceTree = "<group>";
};
FAA3D2810F139D2E00B2447E /* ngIRCd.pmdoc */ = {
isa = PBXGroup;
children = (
FAA3D2820F139D2E00B2447E /* 01ngircd-contents.xml */,
FAA3D2830F139D2E00B2447E /* 01ngircd.xml */,
FAA3D2840F139D2E00B2447E /* 02de-contents.xml */,
FAA3D2850F139D2E00B2447E /* 02de.xml */,
FAA3D2860F139D2E00B2447E /* index.xml */,
FAA3D2880F139D2E00B2447E /* Makefile.am */,
);
path = ngIRCd.pmdoc;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -624,6 +675,7 @@
FA322DBE0CEF7766001761B3 /* tool.c in Sources */,
FAE5CC2E0CF2308A007D69B6 /* numeric.c in Sources */,
FA407F2E0DB159F400271AF1 /* ng_ipaddr.c in Sources */,
FAA3D27B0F139CDC00B2447E /* conn-ssl.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -1,5 +1,5 @@
%define name ngircd
%define version 13
%define version 14
%define release 1
%define prefix %{_prefix}
@@ -7,12 +7,12 @@ Summary: A lightweight daemon for the Internet Relay Chat (IRC)
Name: %{name}
Version: %{version}
Release: %{release}
Copyright: GPL
Group: Networking/Daemons
URL: http://arthur.ath.cx/~alex/ngircd/
License: GPLv2+
Group: System Environment/Daemons
URL: http://ngircd.barton.de/
Source: %{name}-%{version}.tar.gz
Packager: Sean Reifschneider <jafo-rpms@tummy.com>
BuildRoot: /var/tmp/%{name}-root
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: zlib-devel, openssl-devel
%description
ngIRCd is a free open source daemon for the Internet Relay Chat (IRC),
@@ -29,10 +29,13 @@ ngIRCd is compatible to the "original" ircd 2.10.3p3, so you can run
mixed networks.
%prep
%setup
%setup -q
%build
%configure
make
%configure \
--with-zlib \
--with-openssl
make %{?_smp_mflags}
%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"
@@ -42,6 +45,7 @@ make
( cd usr/sbin; mv *-ngircd ngircd )
( cd usr/share/man/man5; mv *-ngircd.conf.5 ngircd.conf.5 )
( cd usr/share/man/man8; mv *-ngircd.8 ngircd.8 )
rm -fr usr/share/doc/ngircd
)
%clean
@@ -49,7 +53,8 @@ make
%files
%defattr(755,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README doc/*
%config(noreplace) /etc
%{_prefix}/sbin
%{_prefix}/share/man/
%{_mandir}/man5/ngircd.conf*
%{_mandir}/man8/ngircd.8*

View File

@@ -37,7 +37,7 @@ The following software packages are needed:
ftp://arthur.barton.de/pub/unix/aux/libraries/libUTIL-2.1.tar.gz
This library contains functions that are common on other UNIX
systems but not on A/UX e.g. memmove(), strerror() und strdup().
systems but not on A/UX e.g. memmove(), strerror() and strdup().
After installation of these packages just do a "./configure" and "make" to
@@ -60,7 +60,7 @@ A few hints in case of errors:
the 'config.status' script. Better rename /bin/sh to /bin/sh.AUX and
replace it by a symbolic link to /bin/ksh (ln -s /bin/ksh /bin/sh as
root).
These procedure should'nt cause you into problems and is recommended
These procedure shouldn't cause you into problems and is recommended
even if you don't use ngIRCd.
--

View File

@@ -24,7 +24,7 @@ mit diesem Fehler ab:
select(): Bad file descriptor!
Es sieht leider so aus, als ob das select() von BeOS nicht mit File-Handles
von Pipes verschiedener Prozesse umgehen kann: sobald der Resolver asyncron
von Pipes verschiedener Prozesse umgehen kann: sobald der Resolver asynchron
gestartet wird, also Pipe-Handles im select() vorhanden sind, fuehrt das zu
obiger Meldung.

View File

@@ -20,8 +20,11 @@ options of the ./configure script to enable it:
--with-openssl enable SSL support using OpenSSL
--with-gnutls enable SSL support using GnuTLS
You need a SSL certificate, see below for how to create a self-signed one.
You also need a key/certificate, see below for how to create a self-signed one.
From a feature point of view, ngIRCds support for both libraries is
comparable. The only major difference (at this time) is that ngircd with gnutls
does not support password protected private keys.
Configuration
~~~~~~~~~~~~~
@@ -64,7 +67,7 @@ Create DH parameters (optional):
Alternate approach using stunnel(1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Alternatively (or if you are using ngIRCd without compiled without support
Alternatively (or if you are using ngIRCd compiled without support
for GnuTLS/OpenSSL), you can use external programs/tools like stunnel(1) to
get SSL encrypted connections:
@@ -101,4 +104,7 @@ short "how-to", thanks Stefan!
That's it.
Don't forget to activate ssl support in your irc client ;)
The main drawback of this approach compared to using builtin ssl
is that from ngIRCds point of view, all ssl-enabled client connections will
originate from the host running stunnel.
=== snip ===

View File

@@ -20,7 +20,7 @@ To use this features you can use one of two APIs:
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
available API will be autodetected and the required additional libraries will
be linked to the ngircd binary as required.
ngIRCd then registers a DNS-SD service for each port it is listening on using

View File

@@ -56,7 +56,7 @@
# Diffie-Hellman parameters
;SSLDHFile = /usr/local/etc/ngircd/ssl/dhparams.pem
# comma seperated list of IP addresses on which the server should
# comma separated list of IP addresses on which the server should
# listen. Default values are:
# "0.0.0.0" or (if compiled with IPv6 support) "::,0.0.0.0"
# so the server listens on all IP addresses of the system by default.
@@ -212,13 +212,13 @@
# Connect to the remote server using TLS/SSL (Default: false)
;SSLConnect = yes
# Define a (case insensitive) mask matching nick names that sould be
# Define a (case insensitive) mask matching nick names that should be
# treated as IRC services when introduced via this remote server.
# REGULAR SERVERS DON'T NEED this parameter, so leave it empty
# (which is the default).
# When you are connecting IRC services which mask as a IRC server
# and which use "virtual users" to communicate with, for example
# "NickServ" amd "ChanServ", you should set this parameter to
# "NickServ" and "ChanServ", you should set this parameter to
# something like "*Serv".
;ServiceMask = *Serv
@@ -245,6 +245,10 @@
# initial channel password (mode k)
;Key = Secret
# Key file, syntax for each line: "<user>:<nick>:<key>".
# Default: none.
;KeyFile = /etc/ngircd/#chan.key
# maximum users per channel (mode l)
;MaxUsers = 23

View File

@@ -64,15 +64,16 @@ The system wide default configuration file.
.RS
Default "message of the day" (MOTD).
.RE
.SH HINTS
It's wise to use "ngircd \-\-configtest" to validate the configuration file
after changing it.
.SH AUTHOR
Alexander Barton,
.UR mailto:alex@barton.de
alex@barton.de
.UE
.br
Homepage:
.UR http://ngircd.barton.de/
http://ngircd.barton.de/
.UE
.SH "SEE ALSO"
.BR ngircd.conf (5),

View File

@@ -12,6 +12,9 @@ is the configuration file of the
.BR ngircd (8)
Internet Relay Chat (IRC) daemon which you should adept to your local
preferences and needs.
.PP
Most variables can be modified while the ngIRCd daemon is already running:
It will reload its configuration when a HUP signal is received.
.SH "FILE FORMAT"
The file consists of sections and parameters. A section begins with the name
of the section in square brackets and continues until the next section
@@ -58,7 +61,9 @@ section is used to define the server main configuration, like the server
name and the ports on which the server should be listening.
.TP
\fBName\fR
Server name in the IRC network, must contain at least one dot (".").
Server name in the IRC network. This is an individual name of the IRC
server, it is not related to the DNS host name. It must be unique in the
IRC network and must contain at least one dot (".") character.
.TP
\fBInfo\fR
Info text of the server. This will be shown by WHOIS and LINKS requests for
@@ -70,11 +75,12 @@ command.
.TP
\fBPorts\fR
Ports on which the server should listen. There may be more than one port,
separated with ','. Default: 6667.
separated with commas (","). Default: 6667.
.TP
\fBSSLPorts\fR
Same as \fBPorts\fR , except that ngircd will expect incoming connections
to be SSL/TLS encrypted. Default: None
Same as \fBPorts\fR , except that ngIRCd will expect incoming connections
to be SSL/TLS encrypted. Common port numbers for SSL-encrypted IRC are 6669
and 6697. Default: none.
.TP
\fBSSLKeyFile\fR
Filename of SSL Server Key to be used for SSL connections. This is required for
@@ -84,20 +90,20 @@ SSL/TLS support.
(OpenSSL only:) Password to decrypt private key.
.TP
\fBSSLCertFile\fR
Certificate of the private key
Certificate file of the private key.
.TP
\fBSSLDHFile\fR
Name of the Diffie-Hellman Parameter file. Can be created with gnutls
"certtool \-\-generate-dh-params" or "openssl dhparam".
If this file is not present, it will be generated on startup when ngircd
was compiled with gnutls support (this may take some time). If ngircd
If this file is not present, it will be generated on startup when ngIRCd
was compiled with gnutls support (this may take some time). If ngIRCd
was compiled with OpenSSL, then (Ephemeral)-Diffie-Hellman Key Exchanges and several
Cipher Suites will not be available.
.TP
\fBListen\fR
A comma seperated list of IP address on which the server should listen.
If unset, the defaults value is "0.0.0.0", or, if ngircd was compiled
with IPv6 support, "::,0.0.0.0", so the server listens on all configured
A comma separated list of IP address on which the server should listen.
If unset, the defaults value is "0.0.0.0" or, if ngIRCd was compiled
with IPv6 support, "::,0.0.0.0". So the server listens on all configured
IP addresses and interfaces by default.
.TP
\fBMotdFile\fR
@@ -106,8 +112,8 @@ to all users connecting to the server.
.TP
\fBMotdPhrase\fR
A simple Phrase (<256 chars) if you don't want to use a MOTD file.
If it is set no MotdFile will be read at all which can be handy if the
daemon should run inside a chroot directory.
If this variable is set, no \fBMotdFile\fR will be read at all which can be
handy if the daemon should run inside a chroot directory.
.TP
\fBServerUID\fR
User ID under which the server should run; you can use the name of the user
@@ -168,35 +174,35 @@ Should IRC Operators be allowed to use the MODE command even if they are
not(!) channel-operators? Default: no.
.TP
\fBOperServerMode\fR
If OperCanUseMode is enabled, this may lead the compatibility problems with
If \fBOperCanUseMode\fR 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.
Default: No.
[Channel] sections in the configuration file.
Default: no.
.TP
\fBNoDNS\fR
If set to true, ngircd will not make DNS lookups when clients connect.
If you configure ngircd to connect to other servers, ngircd may still
If set to true, ngIRCd will not make DNS lookups when clients connect.
If you configure the daemon to connect to other servers, ngIRCd may still
perform a DNS lookup if required.
Default: false.
Default: no.
.TP
\fBNoIdent\fR
If ngircd is compiled with IDENT support this can be used to disable IDENT
If ngIRCd is compiled with IDENT support this can be used to disable IDENT
lookups at run time.
Default: false.
Default: no.
.TP
\fBConnectIPv4\fR
Set this to no if you do not want ngircd to connect to other irc servers using ipv4.
This allows use of ngircd in ipv6-only setups.
Default: Yes.
Set this to no if you do not want ngIRCd to connect to other IRC servers using
IPv4. This allows usage of ngIRCd in IPv6-only setups.
Default: yes.
.TP
\fBConnectIPv6\fR
Set this to no if you do not want ngircd to connect to other irc servers using ipv6.
Default: Yes.
Set this to no if you do not want ngIRCd to connect to other irc servers using IPv6.
Default: yes.
.TP
\fBMaxConnections\fR
Maximum number of simultaneous in- and outbound connections the server is
@@ -215,8 +221,9 @@ Default: 10.
Maximum length of an user nick name (Default: 9, as in RFC 2812). Please
note that all servers in an IRC network MUST use the same maximum nick name
length!
.TP
\fBSSLConnect\fR
Connect to the remote server using TLS/SSL (Default: false)
Connect to the remote server using TLS/SSL. Default: false.
.SH [OPERATOR]
.I [Operator]
sections are used to define IRC Operators. There may be more than one
@@ -257,21 +264,21 @@ IRC name of the remote server.
Internet host name (or IP address) of the peer.
.TP
\fBBind\fR
IP address to use as source IP for the outgoing connection. Default ist
IP address to use as source IP for the outgoing connection. Default is
to let the operating system decide.
.TP
\fBPort\fR
Port of the remote server to which ngIRCd should connect (active).
If no port is assigned to a configured server, the daemon only waits for
incoming connections (passive).
incoming connections (passive, default).
.TP
\fBMyPassword\fR
Own password for this connection. This password has to be configured as
"PeerPassword" on the other server. Must not have ':' as first character.
\fBPeerPassword\fR on the other server. Must not have ':' as first character.
.TP
\fBPeerPassword\fR
Foreign password for this connection. This password has to be configured as
"MyPassword" on the other server.
\fBMyPassword\fR on the other server.
.TP
\fBGroup\fR
Group of this server (optional).
@@ -281,13 +288,13 @@ Disable automatic connection even if port value is specified. Default: false.
You can use the IRC Operator command CONNECT later on to create the link.
.TP
\fBServiceMask\fR
Define a (case insensitive) mask matching nick names that sould be treated as
Define a (case insensitive) mask matching nick names that should be treated as
IRC services when introduced via this remote server. REGULAR SERVERS DON'T NEED
this parameter, so leave it empty (which is the default).
.PP
.RS
When you are connecting IRC services which mask as a IRC server and which use
"virtual users" to communicate with, for example "NickServ" amd "ChanServ",
"virtual users" to communicate with, for example "NickServ" and "ChanServ",
you should set this parameter to something like "*Serv".
.SH [CHANNEL]
Pre-defined channels can be configured in
@@ -303,7 +310,7 @@ There may be more than one
block.
.TP
\fBName\fR
Name of the channel, including channel prefix ("#").
Name of the channel, including channel prefix ("#" or "&").
.TP
\fBTopic\fR
Topic for this channel.
@@ -312,10 +319,54 @@ Topic for this channel.
Initial channel modes.
.TP
\fBKey\fR
Sets initial channel key (only relevant if mode k is set).
Sets initial channel key (only relevant if channel mode "k" is set).
.TP
\fBKeyFile\fR
Path and file name of a "key file" containing individual channel keys for
different users. The file consists of plain text lines with the following
syntax (without spaces!):
.PP
.RS
.RS
.I user
:
.I nick
:
.I key
.RE
.PP
.I user
and
.I nick
can contain the wildcard character "*".
.br
.I key
is an arbitrary password.
.PP
Valid examples are:
.PP
.RS
*:*:KeY
.br
*:nick:123
.br
~user:*:xyz
.RE
.PP
The key file is read on each JOIN command when this channel has a key
(channel mode +k). Access is granted, if a) the channel key set using the
MODE +k command or b) one of the lines in the key file match.
.PP
.B Please note:
.br
The file is not reopened on each access, so you can modify and overwrite it
without problems, but moving or deleting the file will have not effect until
the daemon re-reads its configuration!
.RE
.TP
\fBMaxUsers\fR
Set maximum user limit for this channel (only relevant if mode l is set).
Set maximum user limit for this channel (only relevant if channel mode "l"
is set).
.SH HINTS
It's wise to use "ngircd \-\-configtest" to validate the configuration file
after changing it. See
@@ -324,12 +375,10 @@ for details.
.SH AUTHOR
Alexander Barton,
.UR mailto:alex@barton.de
alex@barton.de
.UE
.br
Homepage:
.UR http://ngircd.barton.de/
http://ngircd.barton.de/
.UE
.SH "SEE ALSO"
.BR ngircd (8)

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2008 by Alexander Barton (alex@barton.de)
* Copyright (c)2001-2009 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
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <strings.h>
#include "defines.h"
@@ -39,6 +40,7 @@
#include "lists.h"
#include "log.h"
#include "messages.h"
#include "match.h"
#include "exp.h"
@@ -57,7 +59,9 @@ static CL2CHAN *Add_Client PARAMS(( CHANNEL *Chan, CLIENT *Client ));
static bool Remove_Client PARAMS(( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const char *Reason, bool InformServer ));
static CL2CHAN *Get_First_Cl2Chan PARAMS(( CLIENT *Client, CHANNEL *Chan ));
static CL2CHAN *Get_Next_Cl2Chan PARAMS(( CL2CHAN *Start, CLIENT *Client, CHANNEL *Chan ));
static bool Delete_Channel PARAMS(( CHANNEL *Chan ));
static void Delete_Channel PARAMS(( CHANNEL *Chan ));
static void Free_Channel PARAMS(( CHANNEL *Chan ));
static void Set_KeyFile PARAMS((CHANNEL *Chan, const char *KeyFile));
GLOBAL void
@@ -97,58 +101,70 @@ Channel_InitPredefined( void )
{
/* Generate predefined persistent channels */
CHANNEL *chan;
char *c;
unsigned int i;
CHANNEL *new_chan;
const struct Conf_Channel *conf_chan;
const char *c;
size_t i, channel_count = array_length(&Conf_Channels, sizeof(*conf_chan));
for( i = 0; i < Conf_Channel_Count; i++ )
{
/* Check for Name configuration */
if( ! Conf_Channel[i].name[0] ) continue;
conf_chan = array_start(&Conf_Channels);
/* Check for invalid channel name */
if( ! Channel_IsValidName( Conf_Channel[i].name ))
{
Log( LOG_ERR, "Can't create pre-defined channel: invalid name: \"%s\"!", Conf_Channel[i].name );
array_free(&Conf_Channel[i].topic);
assert(channel_count == 0 || conf_chan != NULL);
for (i = 0; i < channel_count; i++, conf_chan++) {
if (!conf_chan->name[0] || !Channel_IsValidName(conf_chan->name)) {
Log(LOG_ERR, "Can't create pre-defined channel: invalid name: \"%s\"",
conf_chan->name);
continue;
}
/* Check if the channel name is already in use */
chan = Channel_Search( Conf_Channel[i].name );
if( chan )
{
Log( LOG_INFO, "Can't create pre-defined channel \"%s\": name already in use.", Conf_Channel[i].name );
array_free(&Conf_Channel[i].topic);
new_chan = Channel_Search(conf_chan->name);
if (new_chan) {
Log(LOG_INFO,
"Can't create pre-defined channel \"%s\": name already in use.",
conf_chan->name);
Set_KeyFile(new_chan, conf_chan->keyfile);
continue;
}
/* Create channel */
chan = Channel_Create(Conf_Channel[i].name);
if (chan) {
Channel_ModeAdd(chan, 'P');
if (array_start(&Conf_Channel[i].topic) != NULL)
Channel_SetTopic(chan, NULL,
array_start(&Conf_Channel[i].topic));
array_free(&Conf_Channel[i].topic);
c = Conf_Channel[i].modes;
while (*c)
Channel_ModeAdd(chan, *c++);
Channel_SetKey(chan, Conf_Channel[i].key);
Channel_SetMaxUsers(chan, Conf_Channel[i].maxusers);
Log(LOG_INFO, "Created pre-defined channel \"%s\".",
Conf_Channel[i].name );
new_chan = Channel_Create(conf_chan->name);
if (!new_chan) {
Log(LOG_ERR, "Can't create pre-defined channel \"%s\"",
conf_chan->name);
continue;
}
else Log(LOG_ERR, "Can't create pre-defined channel \"%s\"!",
Conf_Channel[i].name );
Log(LOG_INFO, "Created pre-defined channel \"%s\"",
conf_chan->name);
Channel_ModeAdd(new_chan, 'P');
if (conf_chan->topic[0])
Channel_SetTopic(new_chan, NULL, conf_chan->topic);
c = conf_chan->modes;
while (*c)
Channel_ModeAdd(new_chan, *c++);
Channel_SetKey(new_chan, conf_chan->key);
Channel_SetMaxUsers(new_chan, conf_chan->maxusers);
Set_KeyFile(new_chan, conf_chan->keyfile);
}
if (channel_count)
array_free(&Conf_Channels);
} /* Channel_InitPredefined */
static void
Free_Channel(CHANNEL *chan)
{
array_free(&chan->topic);
array_free(&chan->keyfile);
Lists_Free(&chan->list_bans);
Lists_Free(&chan->list_invites);
free(chan);
}
GLOBAL void
Channel_Exit( void )
{
@@ -157,20 +173,17 @@ Channel_Exit( void )
/* free struct Channel */
c = My_Channels;
while( c )
{
while (c) {
c_next = c->next;
array_free(&c->topic);
free( c );
Free_Channel(c);
c = c_next;
}
/* Free Channel allocation table */
cl2chan = My_Cl2Chan;
while( c )
{
while (cl2chan) {
cl2chan_next = cl2chan->next;
free( cl2chan );
free(cl2chan);
cl2chan = cl2chan_next;
}
} /* Channel_Exit */
@@ -690,7 +703,7 @@ Channel_TopicWho(CHANNEL *Chan)
GLOBAL void
Channel_SetTopic(CHANNEL *Chan, CLIENT *Client, char *Topic)
Channel_SetTopic(CHANNEL *Chan, CLIENT *Client, const char *Topic)
{
size_t len;
assert( Chan != NULL );
@@ -728,7 +741,7 @@ Channel_SetModes( CHANNEL *Chan, char *Modes )
GLOBAL void
Channel_SetKey( CHANNEL *Chan, char *Key )
Channel_SetKey( CHANNEL *Chan, const char *Key )
{
assert( Chan != NULL );
assert( Key != NULL );
@@ -806,7 +819,7 @@ Channel_Write(CHANNEL *Chan, CLIENT *From, CLIENT *Client, const char *Command,
GLOBAL CHANNEL *
Channel_Create( char *Name )
Channel_Create( const char *Name )
{
/* Create new CHANNEL structure and add it to linked list */
CHANNEL *c;
@@ -870,7 +883,7 @@ Add_Client( CHANNEL *Chan, CLIENT *Client )
cl2chan->next = My_Cl2Chan;
My_Cl2Chan = cl2chan;
Log( LOG_DEBUG, "User \"%s\" joined channel \"%s\".", Client_Mask( Client ), Chan->name );
LogDebug("User \"%s\" joined channel \"%s\".", Client_Mask(Client), Chan->name);
return cl2chan;
} /* Add_Client */
@@ -1045,6 +1058,56 @@ Channel_LogServer(char *msg)
} /* Channel_LogServer */
GLOBAL bool
Channel_CheckKey(CHANNEL *Chan, CLIENT *Client, const char *Key)
{
char *file_name, line[COMMAND_LEN], *nick, *pass;
FILE *fd;
assert(Chan != NULL);
assert(Client != NULL);
assert(Key != NULL);
if (!strchr(Chan->modes, 'k'))
return true;
if (strcmp(Chan->key, Key) == 0)
return true;
if (*Key == '\0')
return false;
file_name = array_start(&Chan->keyfile);
if (!file_name)
return false;
fd = fopen(file_name, "r");
if (!fd) {
Log(LOG_ERR, "Can't open channel key file \"%s\" for %s: %s",
file_name, Chan->name, strerror(errno));
return false;
}
while (fgets(line, sizeof(line), fd) != NULL) {
ngt_TrimStr(line);
if (! (nick = strchr(line, ':')))
continue;
*nick++ = '\0';
if (!Match(line, Client_User(Client)))
continue;
if (! (pass = strchr(nick, ':')))
continue;
*pass++ = '\0';
if (!Match(nick, Client_ID(Client)))
continue;
if (strcmp(Key, pass) != 0)
continue;
fclose(fd);
return true;
}
fclose(fd);
return false;
} /* Channel_CheckKey */
static CL2CHAN *
Get_First_Cl2Chan( CLIENT *Client, CHANNEL *Chan )
{
@@ -1070,35 +1133,64 @@ Get_Next_Cl2Chan( CL2CHAN *Start, CLIENT *Client, CHANNEL *Channel )
} /* Get_Next_Cl2Chan */
static bool
Delete_Channel( CHANNEL *Chan )
/**
* Remove a channel and free all of its data structures.
*/
static void
Delete_Channel(CHANNEL *Chan)
{
/* delete channel structure */
CHANNEL *chan, *last_chan;
last_chan = NULL;
chan = My_Channels;
while( chan )
{
if( chan == Chan ) break;
while (chan) {
if (chan == Chan)
break;
last_chan = chan;
chan = chan->next;
}
if( ! chan ) return false;
Log( LOG_DEBUG, "Freed channel structure for \"%s\".", Chan->name );
/* free invite and ban lists */
Lists_Free( &chan->list_bans );
Lists_Free( &chan->list_invites );
assert(chan != NULL);
if (!chan)
return;
/* maintain channel list */
if( last_chan ) last_chan->next = chan->next;
else My_Channels = chan->next;
free( chan );
if (last_chan)
last_chan->next = chan->next;
else
My_Channels = chan->next;
return true;
LogDebug("Freed channel structure for \"%s\".", Chan->name);
Free_Channel(Chan);
} /* Delete_Channel */
static void
Set_KeyFile(CHANNEL *Chan, const char *KeyFile)
{
size_t len;
assert(Chan != NULL);
assert(KeyFile != NULL);
len = strlen(KeyFile);
if (len < array_bytes(&Chan->keyfile)) {
Log(LOG_INFO, "Channel key file of %s removed.", Chan->name);
array_free(&Chan->keyfile);
}
if (len < 1)
return;
if (!array_copyb(&Chan->keyfile, KeyFile, len+1))
Log(LOG_WARNING,
"Could not set new channel key file \"%s\" for %s: %s",
KeyFile, Chan->name, strerror(errno));
else
Log(LOG_INFO|LOG_snotice,
"New local channel key file \"%s\" for %s activated.",
KeyFile, Chan->name);
} /* Set_KeyFile */
/* -eof- */

View File

@@ -37,6 +37,7 @@ typedef struct _CHANNEL
unsigned long maxusers; /* Maximum number of members (mode "l") */
struct list_head list_bans; /* list head of banned users */
struct list_head list_invites; /* list head of invited users */
array keyfile; /* Name of the channel key file */
} CHANNEL;
typedef struct _CLIENT2CHAN
@@ -79,9 +80,9 @@ GLOBAL char *Channel_Topic PARAMS(( CHANNEL *Chan ));
GLOBAL char *Channel_Key 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_SetTopic PARAMS(( CHANNEL *Chan, CLIENT *Client, const char *Topic ));
GLOBAL void Channel_SetModes PARAMS(( CHANNEL *Chan, char *Modes ));
GLOBAL void Channel_SetKey PARAMS(( CHANNEL *Chan, char *Key ));
GLOBAL void Channel_SetKey PARAMS(( CHANNEL *Chan, const char *Key ));
GLOBAL void Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, unsigned long Count ));
GLOBAL CHANNEL *Channel_Search PARAMS(( const char *Name ));
@@ -112,7 +113,7 @@ GLOBAL bool Channel_Write PARAMS((CHANNEL *Chan, CLIENT *From, CLIENT *Client,
const char *Command, bool SendErrors,
const char *Text));
GLOBAL CHANNEL *Channel_Create PARAMS(( char *Name ));
GLOBAL CHANNEL *Channel_Create PARAMS(( const char *Name ));
#ifndef STRICT_RFC
GLOBAL unsigned int Channel_TopicTime PARAMS(( CHANNEL *Chan ));
@@ -127,8 +128,11 @@ GLOBAL bool Channel_ShowInvites PARAMS((CLIENT *client, CHANNEL *c));
GLOBAL void Channel_LogServer PARAMS((char *msg));
#define Channel_IsLocal(c) (Channel_Name(c)[0] == '&')
GLOBAL bool Channel_CheckKey PARAMS((CHANNEL *Chan, CLIENT *Client,
const char *Key));
#define Channel_IsLocal(c) (Channel_Name(c)[0] == '&')
#define Channel_IsModeless(c) (Channel_Name(c)[0] == '+')
#endif

View File

@@ -1047,7 +1047,7 @@ Generate_MyToken( CLIENT *Client )
else c = (CLIENT *)c->next;
}
Client->mytoken = token;
Log( LOG_DEBUG, "Assigned token %d to server \"%s\".", token, Client->id );
LogDebug("Assigned token %d to server \"%s\".", token, Client->id);
} /* Generate_MyToken */

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 Alexander Barton (alex@barton.de)
* Copyright (c)2001-2008 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
@@ -40,6 +40,7 @@
#include "ngircd.h"
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "defines.h"
#include "log.h"
#include "match.h"
@@ -54,7 +55,7 @@ static bool Use_Log = true;
static CONF_SERVER New_Server;
static int New_Server_Idx;
static size_t Conf_Channel_Count;
static void Set_Defaults PARAMS(( bool InitServers ));
static bool Read_Config PARAMS(( bool ngircd_starting ));
static bool Validate_Config PARAMS(( bool TestOnly, bool Rehash ));
@@ -206,8 +207,9 @@ Conf_Test( void )
struct passwd *pwd;
struct group *grp;
unsigned int i;
char *topic;
bool config_valid;
size_t predef_channel_count;
struct Conf_Channel *predef_chan;
Use_Log = false;
@@ -299,18 +301,21 @@ Conf_Test( void )
printf( " Passive = %s\n\n", Conf_Server[i].flags & CONF_SFLAG_DISABLED ? "yes" : "no");
}
for( i = 0; i < Conf_Channel_Count; i++ ) {
if( ! Conf_Channel[i].name[0] ) continue;
predef_channel_count = array_length(&Conf_Channels, sizeof(*predef_chan));
predef_chan = array_start(&Conf_Channels);
for (i = 0; i < predef_channel_count; i++, predef_chan++) {
if (!predef_chan->name[0])
continue;
/* Valid "Channel" section */
puts( "[CHANNEL]" );
printf( " Name = %s\n", Conf_Channel[i].name );
printf( " Modes = %s\n", Conf_Channel[i].modes );
printf( " Key = %s\n", Conf_Channel[i].key );
printf( " MaxUsers = %lu\n", Conf_Channel[i].maxusers );
topic = (char*)array_start(&Conf_Channel[i].topic);
printf( " Topic = %s\n\n", topic ? topic : "");
printf(" Name = %s\n", predef_chan->name);
printf(" Modes = %s\n", predef_chan->modes);
printf(" Key = %s\n", predef_chan->key);
printf(" MaxUsers = %lu\n", predef_chan->maxusers);
printf(" Topic = %s\n", predef_chan->topic);
printf(" KeyFile = %s\n\n", predef_chan->keyfile);
}
return (config_valid ? 0 : 1);
@@ -656,20 +661,11 @@ Read_Config( bool ngircd_starting )
else New_Server_Idx = i;
continue;
}
if( strcasecmp( section, "[CHANNEL]" ) == 0 ) {
if( Conf_Channel_Count + 1 > MAX_DEFCHANNELS ) {
Config_Error( LOG_ERR, "Too many pre-defined channels configured." );
} else {
/* Initialize new channel structure */
strcpy( Conf_Channel[Conf_Channel_Count].name, "" );
strcpy( Conf_Channel[Conf_Channel_Count].modes, "" );
strcpy( Conf_Channel[Conf_Channel_Count].key, "" );
Conf_Channel[Conf_Channel_Count].maxusers = 0;
array_free(&Conf_Channel[Conf_Channel_Count].topic);
Conf_Channel_Count++;
}
if (strcasecmp(section, "[CHANNEL]") == 0) {
Conf_Channel_Count++;
continue;
}
Config_Error( LOG_ERR, "%s, line %d: Unknown section \"%s\"!", NGIRCd_ConfFile, line, section );
section[0] = 0x1;
}
@@ -1162,19 +1158,23 @@ Handle_SERVER( int Line, char *Var, char *Arg )
Config_Error_TooLong(Line, Var);
return;
}
Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Unknown variable \"%s\"!",
NGIRCd_ConfFile, Line, Var );
} /* Handle_SERVER */
static bool
Handle_Channelname(size_t chancount, const char *name)
Handle_Channelname(struct Conf_Channel *new_chan, const char *name)
{
size_t size = sizeof( Conf_Channel[chancount].name );
char *dest = Conf_Channel[chancount].name;
size_t size = sizeof(new_chan->name);
char *dest = new_chan->name;
if (*name && *name != '#') {
if (!Channel_IsValidName(name)) {
/*
* maybe user forgot to add a '#'.
* This is only here for user convenience.
*/
*dest = '#';
--size;
++dest;
@@ -1184,51 +1184,64 @@ Handle_Channelname(size_t chancount, const char *name)
static void
Handle_CHANNEL( int Line, char *Var, char *Arg )
Handle_CHANNEL(int Line, char *Var, char *Arg)
{
size_t len;
size_t chancount = 0;
size_t chancount;
struct Conf_Channel *chan;
assert( Line > 0 );
assert( Var != NULL );
assert( Arg != NULL );
if (Conf_Channel_Count > 0)
chancount = Conf_Channel_Count - 1;
assert(Conf_Channel_Count > 0);
if( strcasecmp( Var, "Name" ) == 0 ) {
if (!Handle_Channelname(chancount, Arg))
Config_Error_TooLong( Line, Var );
chancount = Conf_Channel_Count - 1;
chan = array_alloc(&Conf_Channels, sizeof(*chan), chancount);
if (!chan) {
Config_Error(LOG_ERR, "Could not allocate memory for predefined channel (%d:%s = %s)", Line, Var, Arg);
return;
}
if( strcasecmp( Var, "Modes" ) == 0 ) {
if (strcasecmp(Var, "Name") == 0) {
if (!Handle_Channelname(chan, Arg))
Config_Error_TooLong(Line, Var);
return;
}
if (strcasecmp(Var, "Modes") == 0) {
/* Initial modes */
len = strlcpy( Conf_Channel[chancount].modes, Arg, sizeof( Conf_Channel[chancount].modes ));
if (len >= sizeof( Conf_Channel[chancount].modes ))
len = strlcpy(chan->modes, Arg, sizeof(chan->modes));
if (len >= sizeof(chan->modes))
Config_Error_TooLong( Line, Var );
return;
}
if( strcasecmp( Var, "Topic" ) == 0 ) {
/* Initial topic */
if (!array_copys( &Conf_Channel[chancount].topic, Arg))
len = strlcpy(chan->topic, Arg, sizeof(chan->topic));
if (len >= sizeof(chan->topic))
Config_Error_TooLong( Line, Var );
return;
}
if( strcasecmp( Var, "Key" ) == 0 ) {
/* Initial Channel Key (mode k) */
len = strlcpy(Conf_Channel[chancount].key, Arg, sizeof(Conf_Channel[chancount].key));
if (len >= sizeof( Conf_Channel[chancount].key ))
len = strlcpy(chan->key, Arg, sizeof(chan->key));
if (len >= sizeof(chan->key))
Config_Error_TooLong(Line, Var);
return;
}
if( strcasecmp( Var, "MaxUsers" ) == 0 ) {
/* maximum user limit, mode l */
Conf_Channel[chancount].maxusers = (unsigned long) atol(Arg);
if (Conf_Channel[chancount].maxusers == 0)
chan->maxusers = (unsigned long) atol(Arg);
if (chan->maxusers == 0)
Config_Error_NaN(Line, Var);
return;
}
if (strcasecmp(Var, "KeyFile") == 0) {
/* channel keys */
len = strlcpy(chan->keyfile, Arg, sizeof(chan->keyfile));
if (len >= sizeof(chan->keyfile))
Config_Error_TooLong(Line, Var);
return;
}
Config_Error( LOG_ERR, "%s, line %d (section \"Channel\"): Unknown variable \"%s\"!",
NGIRCd_ConfFile, Line, Var );

View File

@@ -67,14 +67,14 @@ struct SSLOptions {
#endif
typedef struct _Conf_Channel
{
struct Conf_Channel {
char name[CHANNEL_NAME_LEN]; /* Name of the channel */
char modes[CHANNEL_MODE_LEN]; /* Initial channel modes */
char key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
char topic[COMMAND_LEN]; /* Initial topic */
char keyfile[512]; /* Path and name of channel key file */
unsigned long maxusers; /* maximum usercount for this channel, mode "l" */
array topic; /* Initial topic */
} CONF_CHANNEL;
};
#define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */
@@ -132,8 +132,8 @@ GLOBAL unsigned int Conf_Oper_Count;
GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
/* Pre-defined channels */
GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
GLOBAL unsigned int Conf_Channel_Count;
GLOBAL array Conf_Channels;
/* Pre-defined channels only */
GLOBAL bool Conf_PredefChannelsOnly;

View File

@@ -228,7 +228,8 @@ void ConnSSL_Free(CONNECTION *c)
}
#endif
assert(Conn_OPTION_ISSET(c, CONN_SSL));
Conn_OPTION_DEL(c, (CONN_SSL_CONNECT|CONN_SSL|CONN_SSL_WANT_WRITE));
/* can't just set bitmask to 0 -- there are other, non-ssl related flags, e.g. CONN_ZIP. */
Conn_OPTION_DEL(c, CONN_SSL_FLAGS_ALL);
}
@@ -483,8 +484,8 @@ ConnSSL_HandleError( CONNECTION *c, const int code, const char *fname )
Conn_OPTION_ADD(c, CONN_SSL_WANT_WRITE); /* fall through */
case SSL_ERROR_NONE:
return 0; /* try again later */
case SSL_ERROR_ZERO_RETURN: /* TLS/SSL Connection was shut down */
LogOpenSSLError("TLS/SSL Connection shutdown", fname);
case SSL_ERROR_ZERO_RETURN:
LogDebug("TLS/SSL connection shut down normally");
break;
/*
SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT, SSL_ERROR_WANT_X509_LOOKUP

View File

@@ -1261,14 +1261,21 @@ New_Connection( int Sock )
My_Connections[new_sock].addr = new_addr;
My_Connections[new_sock].client = c;
Log( LOG_INFO, "Accepted connection %d from %s:%d on socket %d.", new_sock,
ip_str, ng_ipaddr_getport(&new_addr), Sock);
/* Hostnamen ermitteln */
strlcpy(My_Connections[new_sock].host, ip_str, sizeof(My_Connections[new_sock].host));
/* Set initial hostname to IP address. This becomes overwritten when
* the DNS lookup is enabled and succeeds, but is used otherwise. */
if (ng_ipaddr_af(&new_addr) != AF_INET)
snprintf(My_Connections[new_sock].host,
sizeof(My_Connections[new_sock].host), "[%s]", ip_str);
else
strlcpy(My_Connections[new_sock].host, ip_str,
sizeof(My_Connections[new_sock].host));
Client_SetHostname(c, My_Connections[new_sock].host);
Log(LOG_INFO, "Accepted connection %d from %s:%d on socket %d.",
new_sock, My_Connections[new_sock].host,
ng_ipaddr_getport(&new_addr), Sock);
identsock = new_sock;
#ifdef IDENTAUTH
if (Conf_NoIdent)

View File

@@ -18,7 +18,13 @@
#include <time.h> /* for time_t, see below */
/*
* connection state flags. this is a bitmask -- all values must
* be unique and a power of two.
*
* If you introduce new ones in between, make sure to adjust all
* remaining ones.
*/
#define CONN_ISCLOSING 1 /* Conn_Close() already called */
#define CONN_ISCONNECTING 2 /* connect() in progress */
#define CONN_RFC1459 4 /* RFC 1459 compatibility mode */
@@ -29,10 +35,11 @@
#include "conf-ssl.h"
#ifdef SSL_SUPPORT
#define CONN_SSL_CONNECT 8 /* wait for ssl connect to finish */
#define CONN_SSL 16 /* this connection is SSL encrypted */
#define CONN_SSL_WANT_WRITE 32 /* SSL/TLS library needs to write protocol data */
#define CONN_SSL_WANT_READ 64 /* SSL/TLS library needs to read protocol data */
#define CONN_SSL_CONNECT 16 /* wait for ssl connect to finish */
#define CONN_SSL 32 /* this connection is SSL encrypted */
#define CONN_SSL_WANT_WRITE 64 /* SSL/TLS library needs to write protocol data */
#define CONN_SSL_WANT_READ 128 /* SSL/TLS library needs to read protocol data */
#define CONN_SSL_FLAGS_ALL (CONN_SSL_CONNECT|CONN_SSL|CONN_SSL_WANT_WRITE|CONN_SSL_WANT_READ)
#endif
typedef int CONN_ID;

View File

@@ -30,16 +30,10 @@
#define HOST_LEN 256 /* Max. lenght of fully qualified host
names (e. g. "abc.domain.tld") */
#define MAX_LISTEN_PORTS 16 /* Max. count of listening ports */
#define MAX_OPERATORS 16 /* Max. count of configurable IRC Ops */
#define MAX_SERVERS 16 /* Max. count of configurable servers */
#define MAX_DEFCHANNELS 16 /* Max. count of predefined channels */
#define MAX_SERVICES 8 /* Max. count of services */
#define MAX_WHOWAS 64 /* Max. number of WHOWAS items */
#define DEFAULT_WHOWAS 5 /* default count for WHOWAS command */

View File

@@ -89,10 +89,9 @@ join_allowed(CLIENT *Client, CLIENT *target, CHANNEL *chan,
}
/* Is the channel protected by a key? */
if (strchr(channel_modes, 'k') &&
strcmp(Channel_Key(chan), key ? key : ""))
{
IRC_WriteStrClient(Client, ERR_BADCHANNELKEY_MSG, Client_ID(Client), channame);
if (!Channel_CheckKey(chan, target, key ? key : "")) {
IRC_WriteStrClient(Client, ERR_BADCHANNELKEY_MSG,
Client_ID(Client), channame);
return false;
}
/* Are there already too many members? */
@@ -304,7 +303,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
if (!chan) { /* channel is new; it has been created above */
chan = Channel_Search(channame);
assert(chan != NULL);
if (*channame == '+') { /* modeless channel... */
if (Channel_IsModeless(chan)) {
Channel_ModeAdd(chan, 't'); /* /TOPIC not allowed */
Channel_ModeAdd(chan, 'n'); /* no external msgs */
}

View File

@@ -133,8 +133,14 @@ IRC_INFO(CLIENT * Client, REQUEST * Req)
if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix),
NGIRCd_Version))
return DISCONNECTED;
strlcpy(msg, "Server has been started ", sizeof(msg));
#if defined(__DATE__) && defined(__TIME__)
snprintf(msg, sizeof(msg), "Birth Date: %s at %s", __DATE__, __TIME__);
if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), msg))
return DISCONNECTED;
#endif
strlcpy(msg, "On-line since ", sizeof(msg));
strlcat(msg, NGIRCd_StartStr, sizeof(msg));
if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), msg))
return DISCONNECTED;

View File

@@ -242,7 +242,7 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
Client_Type(target) != CLIENT_SERVICE &&
Client_Type(target) != CLIENT_SERVER) {
/* New client */
Log( LOG_DEBUG, "Connection %d: got valid NICK command ...",
LogDebug("Connection %d: got valid NICK command ...",
Client_Conn( Client ));
/* Register new nickname of this client */
@@ -723,7 +723,7 @@ IRC_PONG(CLIENT *Client, REQUEST *Req)
/* The connection timestamp has already been updated when the data has
* been read from so socket, so we don't need to update it here. */
#ifdef DEBUG
if (Client_Conn(Client) > NONE)
Log(LOG_DEBUG,
"Connection %d: received PONG. Lag: %ld seconds.",
@@ -732,7 +732,7 @@ IRC_PONG(CLIENT *Client, REQUEST *Req)
else
Log(LOG_DEBUG,
"Connection %d: received PONG.", Client_Conn(Client));
#endif
return CONNECTED;
} /* IRC_PONG */

View File

@@ -276,20 +276,21 @@ Channel_Mode_Answer_Request(CLIENT *Origin, CHANNEL *Channel)
}
/**
* Handle channel mode and channel-user mode changes
*/
static bool
Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
{
/* Handle channel and channel-user modes */
char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2], argadd[CLIENT_PASS_LEN], *mode_ptr;
char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2],
argadd[CLIENT_PASS_LEN], *mode_ptr;
bool ok, set, modeok = true, skiponce, use_servermode = false, retval;
int mode_arg, arg_arg;
CLIENT *client;
long l;
size_t len;
/* Are modes allowed on channel? */
if (Channel_Name(Channel)[0] == '+')
if (Channel_IsModeless(Channel))
return IRC_WriteStrClient(Client, ERR_NOCHANMODES_MSG,
Client_ID(Client), Channel_Name(Channel));
@@ -307,7 +308,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
/* channel operator? */
if (strchr(Channel_UserModes(Channel, Origin), 'o'))
modeok = true;
else if(Conf_OperCanMode) {
else if (Conf_OperCanMode) {
/* IRC-Operators can use MODE as well */
if (Client_OperByMe(Origin)) {
modeok = true;
@@ -327,8 +328,12 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
/* Initial state: set or unset modes? */
skiponce = false;
switch (*mode_ptr) {
case '-': set = false; break;
case '+': set = true; break;
case '-':
set = false;
break;
case '+':
set = true;
break;
default:
set = true;
skiponce = true;
@@ -341,7 +346,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
x[1] = '\0';
ok = CONNECTED;
while (mode_ptr) {
if (! skiponce)
if (!skiponce)
mode_ptr++;
if (!*mode_ptr) {
/* Try next argument if there's any */
@@ -364,10 +369,11 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
switch (*mode_ptr) {
case '+':
case '-':
if (((*mode_ptr == '+') && !set) || ((*mode_ptr == '-') && set)) {
if (((*mode_ptr == '+') && !set)
|| ((*mode_ptr == '-') && set)) {
/* Action modifier ("+"/"-") must be changed ... */
len = strlen( the_modes ) - 1;
if ((the_modes[len] == '+') || (the_modes[len] == '-')) {
len = strlen(the_modes) - 1;
if (the_modes[len] == '+' || the_modes[len] == '-') {
/* Adjust last action modifier in result */
the_modes[len] = *mode_ptr;
} else {
@@ -381,7 +387,8 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
}
/* Are there arguments left? */
if( arg_arg >= Req->argc ) arg_arg = -1;
if (arg_arg >= Req->argc)
arg_arg = -1;
/* Validate modes */
x[0] = '\0';
@@ -397,29 +404,42 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
if (modeok)
x[0] = *mode_ptr;
else
ok = IRC_WriteStrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel));
ok = IRC_WriteStrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin), Channel_Name(Channel));
break;
case 'k': /* Channel key */
if (! set) {
if (!set) {
if (modeok)
x[0] = *mode_ptr;
else
ok = IRC_WriteStrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel));
ok = IRC_WriteStrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
break;
}
if (arg_arg > mode_arg) {
if (modeok) {
Channel_ModeDel(Channel, 'k');
Channel_SetKey(Channel, Req->argv[arg_arg]);
strlcpy(argadd, Channel_Key(Channel), sizeof(argadd));
Channel_SetKey(Channel,
Req->argv[arg_arg]);
strlcpy(argadd, Channel_Key(Channel),
sizeof(argadd));
x[0] = *mode_ptr;
} else {
ok = IRC_WriteStrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel));
ok = IRC_WriteStrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
}
Req->argv[arg_arg][0] = '\0';
arg_arg++;
} else {
ok = IRC_WriteStrClient(Origin, ERR_NEEDMOREPARAMS_MSG, Client_ID(Origin), Req->command);
ok = IRC_WriteStrClient(Origin,
ERR_NEEDMOREPARAMS_MSG,
Client_ID(Origin), Req->command);
goto chan_exit;
}
break;
case 'l': /* Member limit */
@@ -427,7 +447,10 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
if (modeok)
x[0] = *mode_ptr;
else
ok = IRC_WriteStrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel));
ok = IRC_WriteStrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
break;
}
if (arg_arg > mode_arg) {
@@ -436,28 +459,41 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
if (l > 0 && l < 0xFFFF) {
Channel_ModeDel(Channel, 'l');
Channel_SetMaxUsers(Channel, l);
snprintf(argadd, sizeof(argadd), "%ld", l);
snprintf(argadd, sizeof(argadd),
"%ld", l);
x[0] = *mode_ptr;
}
} else {
ok = IRC_WriteStrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel));
ok = IRC_WriteStrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
}
Req->argv[arg_arg][0] = '\0';
arg_arg++;
} else {
ok = IRC_WriteStrClient(Origin, ERR_NEEDMOREPARAMS_MSG, Client_ID(Origin), Req->command);
ok = IRC_WriteStrClient(Origin,
ERR_NEEDMOREPARAMS_MSG,
Client_ID(Origin), Req->command);
goto chan_exit;
}
break;
case 'P': /* Persistent channel */
if (modeok) {
/* Only IRC operators are allowed to
* set the 'P' channel mode! */
if (set && !(Client_OperByMe(Client) || Client_Type(Client) == CLIENT_SERVER))
ok = IRC_WriteStrClient(Origin, ERR_NOPRIVILEGES_MSG, Client_ID(Origin));
if (set && !(Client_OperByMe(Client)
|| Client_Type(Client) == CLIENT_SERVER))
ok = IRC_WriteStrClient(Origin,
ERR_NOPRIVILEGES_MSG,
Client_ID(Origin));
else
x[0] = 'P';
x[0] = 'P';
} else
ok = IRC_WriteStrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel));
ok = IRC_WriteStrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
break;
/* --- Channel user modes --- */
case 'o': /* Channel operator */
@@ -468,14 +504,23 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
if (client)
x[0] = *mode_ptr;
else
ok = IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->argv[arg_arg]);
ok = IRC_WriteStrClient(Client,
ERR_NOSUCHNICK_MSG,
Client_ID(Client),
Req->argv[arg_arg]);
} else {
ok = IRC_WriteStrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin), Channel_Name(Channel));
ok = IRC_WriteStrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
}
Req->argv[arg_arg][0] = '\0';
arg_arg++;
} else {
ok = IRC_WriteStrClient(Origin, ERR_NEEDMOREPARAMS_MSG, Client_ID(Origin), Req->command);
ok = IRC_WriteStrClient(Origin,
ERR_NEEDMOREPARAMS_MSG,
Client_ID(Origin), Req->command);
goto chan_exit;
}
break;
/* --- Channel lists --- */
@@ -484,11 +529,18 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
if (arg_arg > mode_arg) {
/* modify list */
if (modeok) {
ok = set ? Add_Ban_Invite(*mode_ptr, Origin, Client, Channel, Req->argv[arg_arg])
: Del_Ban_Invite(*mode_ptr, Origin, Client, Channel, Req->argv[arg_arg]);
ok = set
? Add_Ban_Invite(*mode_ptr, Origin,
Client, Channel,
Req->argv[arg_arg])
: Del_Ban_Invite(*mode_ptr, Origin,
Client, Channel,
Req->argv[arg_arg]);
} else {
ok = IRC_WriteStrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin), Channel_Name(Channel));
ok = IRC_WriteStrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
}
Req->argv[arg_arg][0] = '\0';
arg_arg++;
@@ -500,13 +552,18 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
}
break;
default:
Log(LOG_DEBUG, "Unknown mode \"%c%c\" from \"%s\" on %s!?",
set ? '+' : '-', *mode_ptr, Client_ID(Origin), Channel_Name(Channel));
Log(LOG_DEBUG,
"Unknown mode \"%c%c\" from \"%s\" on %s!?",
set ? '+' : '-', *mode_ptr, Client_ID(Origin),
Channel_Name(Channel));
if (Client_Type(Client) != CLIENT_SERVER)
ok = IRC_WriteStrClient(Origin, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID(Origin), set ? '+' : '-', *mode_ptr);
ok = IRC_WriteStrClient(Origin,
ERR_UMODEUNKNOWNFLAG2_MSG,
Client_ID(Origin),
set ? '+' : '-', *mode_ptr);
x[0] = '\0';
goto chan_exit;
} /* switch() */
} /* switch() */
if (!ok)
break;
@@ -517,29 +574,40 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
/* Validate target client */
if (client && (!Channel_IsMemberOf(Channel, client))) {
if (!IRC_WriteStrClient(Origin, ERR_USERNOTINCHANNEL_MSG,
Client_ID(Origin), Client_ID(client), Channel_Name(Channel)))
break;
if (!IRC_WriteStrClient
(Origin, ERR_USERNOTINCHANNEL_MSG,
Client_ID(Origin), Client_ID(client),
Channel_Name(Channel)))
break;
continue;
}
if (client) {
/* Channel-User-Mode */
retval = set ? Channel_UserModeAdd(Channel, client, x[0]) : Channel_UserModeDel(Channel, client, x[0]);
retval = set
? Channel_UserModeAdd(Channel, client, x[0])
: Channel_UserModeDel(Channel, client, x[0]);
if (retval) {
strlcat(the_args, " ", sizeof(the_args));
strlcat(the_args, Client_ID(client), sizeof(the_args));
strlcat(the_args, Client_ID(client),
sizeof(the_args));
strlcat(the_modes, x, sizeof(the_modes));
Log(LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"",
Client_Mask(client), Channel_Name(Channel), Channel_UserModes(Channel, client));
LogDebug
("User \"%s\": Mode change on %s, now \"%s\"",
Client_Mask(client), Channel_Name(Channel),
Channel_UserModes(Channel, client));
}
} else {
/* Channel-Mode */
retval = set ? Channel_ModeAdd(Channel, x[0]) : Channel_ModeDel(Channel, x[0]);
retval = set
? Channel_ModeAdd(Channel, x[0])
: Channel_ModeDel(Channel, x[0]);
if (retval) {
strlcat(the_modes, x, sizeof(the_modes));
Log(LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name(Channel), Channel_Modes(Channel));
LogDebug("Channel %s: Mode change, now \"%s\".",
Channel_Name(Channel),
Channel_Modes(Channel));
}
}
@@ -549,7 +617,8 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
strlcat(the_args, argadd, sizeof(the_args));
}
}
chan_exit:
chan_exit:
/* Are there changed modes? */
if (the_modes[1]) {
/* Clean up mode string */
@@ -567,14 +636,19 @@ chan_exit:
/* Forward mode changes to channel users and all the
* other remote servers: */
IRC_WriteStrServersPrefix(Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args);
IRC_WriteStrChannelPrefix(Client, Channel, Origin, false, "MODE %s %s%s", Channel_Name(Channel), the_modes, the_args);
IRC_WriteStrServersPrefix(Client, Origin,
"MODE %s %s%s", Channel_Name(Channel),
the_modes, the_args);
IRC_WriteStrChannelPrefix(Client, Channel, Origin,
false, "MODE %s %s%s", Channel_Name(Channel),
the_modes, the_args);
} else {
if (use_servermode)
Origin = Client_ThisServer();
/* Send reply to client and inform other servers and channel users */
ok = IRC_WriteStrClientPrefix(Client, Origin, "MODE %s %s%s",
Channel_Name(Channel), the_modes, the_args);
ok = IRC_WriteStrClientPrefix(Client, Origin,
"MODE %s %s%s", Channel_Name(Channel),
the_modes, the_args);
/* Only forward requests for non-local channels */
if (!Channel_IsLocal(Channel))
IRC_WriteStrServersPrefix(Client, Origin,

View File

@@ -467,18 +467,18 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
Req->argv[1]))
return DISCONNECTED;
} else if (ForceType != CLIENT_SERVICE
&& (chan = Channel_Search(currentTarget))) {
if (!Channel_Write(chan, from, Client, Req->command,
SendErrors, Req->argv[1]))
return DISCONNECTED;
} else if (ForceType != CLIENT_SERVICE
/* $#: server/target mask, RFC 2812, sec. 3.3.1 */
&& strchr("$#", currentTarget[0])
&& strchr(currentTarget, '.')) {
/* targetmask */
if (!Send_Message_Mask(from, Req->command, currentTarget,
Req->argv[1], SendErrors))
return DISCONNECTED;
} else if (ForceType != CLIENT_SERVICE
&& (chan = Channel_Search(currentTarget))) {
/* channel */
if (!Channel_Write(chan, from, Client, Req->command,
SendErrors, Req->argv[1]))
return DISCONNECTED;
} else {
if (!SendErrors)
return CONNECTED;
@@ -501,6 +501,7 @@ Send_Message_Mask(CLIENT * from, char * command, char * targetMask,
CLIENT *cl;
bool client_match;
char *mask = targetMask + 1;
const char *check_wildcards;
cl = NULL;
@@ -511,6 +512,21 @@ Send_Message_Mask(CLIENT * from, char * command, char * targetMask,
Client_ID(from));
}
/*
* RFC 2812, sec. 3.3.1 requires that targetMask have at least one
* dot (".") and no wildcards ("*", "?") following the last one.
*/
check_wildcards = strrchr(targetMask, '.');
assert(check_wildcards != NULL);
if (check_wildcards &&
check_wildcards[strcspn(check_wildcards, "*?")])
{
if (!SendErrors)
return true;
return IRC_WriteStrClient(from, ERR_WILDTOPLEVEL, targetMask);
}
/* #: hostmask, see RFC 2812, sec. 3.3.1 */
if (targetMask[0] == '#') {
for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) {
if (Client_Type(cl) != CLIENT_USER)
@@ -522,6 +538,7 @@ Send_Message_Mask(CLIENT * from, char * command, char * targetMask,
return false;
}
} else {
assert(targetMask[0] == '$'); /* $: server mask, see RFC 2812, sec. 3.3.1 */
for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) {
if (Client_Type(cl) != CLIENT_USER)
continue;

View File

@@ -14,8 +14,6 @@
#include "portab.h"
static char UNUSED id[] = "$Id: log.c,v 1.62 2006/08/05 09:16:21 fw Exp $";
#include "imp.h"
#include <assert.h>
#include <errno.h>
@@ -54,6 +52,22 @@ static char Error_File[FNAME_LEN];
static void Wall_ServerNotice PARAMS(( char *Msg ));
static void
Log_Message(int Level, const char *msg)
{
if (!Is_Daemon) {
/* log to console */
fprintf(stdout, "[%ld:%d %4ld] %s\n", (long)getpid(), Level,
(long)time(NULL) - NGIRCd_Start, msg);
fflush(stdout);
}
#ifdef SYSLOG
else {
syslog(Level, "%s", msg);
}
#endif
}
GLOBAL void
Log_Init( bool Daemon_Mode )
@@ -248,25 +262,12 @@ va_dcl
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
va_end( ap );
if (!Is_Daemon) {
/* log to console */
fprintf(stdout, "[%d:%d %4ld] %s\n", (int)getpid( ), Level,
time(NULL) - NGIRCd_Start, msg);
fflush(stdout);
}
#ifdef SYSLOG
else
{
/* Syslog */
syslog( Level, "%s", msg );
}
#endif
Log_Message(Level, msg);
if( Level <= LOG_CRIT )
{
if (Level <= LOG_CRIT) {
/* log critical messages to stderr */
fprintf( stderr, "%s\n", msg );
fflush( stderr );
fprintf(stderr, "%s\n", msg);
fflush(stderr);
}
if (snotice) {
@@ -285,7 +286,7 @@ Log_Init_Resolver( void )
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
#endif
#ifdef DEBUG
Log_Resolver( LOG_DEBUG, "Resolver sub-process starting, PID %d.", getpid( ));
Log_Resolver(LOG_DEBUG, "Resolver sub-process starting, PID %ld.", (long)getpid());
#endif
} /* Log_Init_Resolver */
@@ -294,7 +295,7 @@ GLOBAL void
Log_Exit_Resolver( void )
{
#ifdef DEBUG
Log_Resolver( LOG_DEBUG, "Resolver sub-process %d done.", getpid( ));
Log_Resolver(LOG_DEBUG, "Resolver sub-process %ld done.", (long)getpid());
#endif
#ifdef SYSLOG
closelog( );
@@ -335,15 +336,7 @@ va_dcl
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
va_end( ap );
if (!Is_Daemon) {
/* Output to console */
fprintf(stdout, "[%d:%d %4ld] %s\n", (int)getpid( ), Level,
time(NULL) - NGIRCd_Start, msg);
fflush(stdout);
}
#ifdef SYSLOG
else syslog( Level, "%s", msg );
#endif
Log_Message(Level, msg);
} /* Log_Resolver */

View File

@@ -94,8 +94,9 @@
#define ERR_TOOMANYCHANNELS_MSG "405 %s %s :You have joined too many channels"
#define ERR_WASNOSUCHNICK_MSG "406 %s %s :There was no such nickname"
#define ERR_NOORIGIN_MSG "409 %s :No origin specified"
#define ERR_NORECIPIENT_MSG "411 %s :No receipient given (%s)"
#define ERR_NORECIPIENT_MSG "411 %s :No recipient given (%s)"
#define ERR_NOTEXTTOSEND_MSG "412 %s :No text to send"
#define ERR_WILDTOPLEVEL "414 %s :Wildcard in toplevel domain"
#define ERR_UNKNOWNCOMMAND_MSG "421 %s %s :Unknown command"
#define ERR_NOMOTD_MSG "422 %s :MOTD file is missing"
#define ERR_NONICKNAMEGIVEN_MSG "431 %s :No nickname given"

View File

@@ -316,7 +316,7 @@ main( int argc, const char *argv[] )
#ifdef ZLIB
strlcat( NGIRCd_ProtoID, "Z", sizeof NGIRCd_ProtoID );
#endif
Log( LOG_DEBUG, "Protocol and server ID is \"%s\".", NGIRCd_ProtoID );
LogDebug("Protocol and server ID is \"%s\".", NGIRCd_ProtoID);
/* Vordefinierte Channels anlegen */
Channel_InitPredefined( );

View File

@@ -180,7 +180,7 @@ Parse_Request( CONN_ID Idx, char *Request )
ptr = strchr( Request, ' ' );
if( ! ptr )
{
Log( LOG_DEBUG, "Connection %d: Parse error: prefix without command!?", Idx );
LogDebug("Connection %d: Parse error: prefix without command!?", Idx);
return Conn_WriteStr( Idx, "ERROR :Prefix without command!?" );
}
*ptr = '\0';

View File

@@ -14,8 +14,6 @@
#include "portab.h"
static char UNUSED id[] = "$Id: resolve.c,v 1.29 2008/02/26 22:04:17 fw Exp $";
#include "imp.h"
#include <assert.h>
#include <errno.h>
@@ -92,7 +90,7 @@ Resolve_Addr(RES_STAT * s, const ng_ipaddr_t *Addr, int identsock,
pid = Resolver_fork(pipefd);
if (pid > 0) {
Log(LOG_DEBUG, "Resolver for %s created (PID %d).", ng_ipaddr_tostr(Addr), pid);
LogDebug("Resolver for %s created (PID %d).", ng_ipaddr_tostr(Addr), pid);
s->pid = pid;
s->resolver_fd = pipefd[0];

View File

@@ -22,7 +22,8 @@
PeerPassword = pwd2
[Channel]
Name = #InviteChannel
# This name should be accepted as '#InviteChannel' by ngircd.
Name = InviteChannel
Modes = i
[Channel]
@@ -35,10 +36,17 @@
Name = #TopicChannel
Modes = t
Topic = the topic
[Channel]
Name = #SecretChannel
Modes = s
Topic = A secret Channel
[Channel]
Name = &LocalChannel
Topic = A local Channel
[Channel]
Name = +ModelessChannel
Topic = A modeless Channel
# -eof-