]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Merge branch 'bug153-ServerMask' into master
authorAlexander Barton <alex@barton.de>
Fri, 15 Feb 2013 20:59:06 +0000 (21:59 +0100)
committerAlexander Barton <alex@barton.de>
Fri, 15 Feb 2013 20:59:06 +0000 (21:59 +0100)
* bug153-ServerMask:
  Update irc-info.c to use irc-macros.h
  Add new irc-macros.h to project
  irc-info.c: add/streamline function documentation comments
  irc-info: move static functions at the top of the file
  Implement new function Client_SearchServer()

Conflicts:
src/ngircd/irc-info.c

21 files changed:
ChangeLog
NEWS
configure.ng
contrib/Debian/changelog
contrib/Makefile.am
contrib/README
contrib/ngircd.socket [new file with mode: 0644]
contrib/ngircd.spec
doc/Commands.txt
doc/sample-ngircd.conf.tmpl
man/ngircd.conf.5.tmpl
src/ngircd/channel.c
src/ngircd/conf.c
src/ngircd/conf.h
src/ngircd/conn.c
src/ngircd/irc-info.c
src/ngircd/irc-login.c
src/ngircd/log.c
src/ngircd/login.c
src/ngircd/messages.h
src/ngircd/sighandlers.c

index a4cfdb91ea07ab432ce23eb6aafdcf06433b06f1..08d337fa72e47940a87f34f74ded362ece29f23e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,35 @@
                                -- ChangeLog --
 
 
+ngIRCd 20.2 (2013-02-15)
+
+  - Security: Fix a denial of service bug in the function handling KICK
+    commands that could be used by arbitrary users to to crash the daemon.
+  - WHO command: Use the currently "displayed hostname" (which can be cloaked!)
+    for hostname matching, not the real one. In other words: don't display all
+    the cloaked users on a specific real hostname!
+  - configure: The header file "netinet/in_systm.h" already is optional in
+    ngIRCd, so don't require it in the configure script. Now ngIRCd can be
+    built on Minix 3 again :-)
+  - Return better "Connection not registered as server link" errors: Now ngIRCd
+    returns a more specific error message for numeric ERR_NOTREGISTERED(451)
+    when a regular user tries to use a command that isn't allowed for users but
+    for servers.
+  - Don't report ERR_NEEDMOREPARAMS(461) when a MDOE command with more modes
+    than nicknames is handled, as well as for channel limit and key changes
+    without specifying the limit or key parameters.
+    This is how a lot (all?) other IRC servers behave, including ircd2.11,
+    InspIRCd, and ircd-seven. And because of clients (tested with Textual and
+    mIRC) sending bogus MODE commands like "MODE -ooo nick", end-users got the
+    expected result as well as correct but misleading error messages ...
+  - Correctly detect when SSL subsystem must be initialized and take
+    outgoing connections (server links!) into account, too.
+  - autogen.sh: Enforce serial test harness on GNU automake >=1.13. The
+    new parallel test harness which is enabled by default starting with
+    automake 1.13 isn't compatible with our test suite.
+    And don't use "egrep -o", insetead use "sed", because it isn't portable
+    and not available on OpenBSD, for example.
+
 ngIRCd 20.1 (2013-01-02)
 
   - Allow ERROR command on server and service links only, ignore them and
diff --git a/NEWS b/NEWS
index be743e681266239fc91caf1265f7e59b94e4acea..38f6029c5b32b397d3522d258da919f74aa109df 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,12 @@
                                   -- NEWS --
 
 
+ngIRCd 20.2 (2013-02-15)
+
+  - This release is a bugfix release only, without new features.
+  - Security: Fix a denial of service bug in the function handling KICK
+    commands that could be used by arbitrary users to to crash the daemon.
+
 ngIRCd 20.1 (2013-01-02)
 
   - This release is a bugfix release only, without new features.
index 034b565305232131f5e63126c49cab0a7768a150..c0309965de4fb16c492c4244b0a3821bf3c4324c 100644 (file)
@@ -519,7 +519,7 @@ if test "$x_ircplus_on" = "yes"; then
        x_iconv_on=no
        AC_ARG_WITH(iconv,
                AS_HELP_STRING([--with-iconv],
-                              [enable character conversation using libiconv]),
+                              [enable character conversion using libiconv]),
                [ if test "$withval" != "no"; then
                        if test "$withval" != "yes"; then
                                CFLAGS="-I$withval/include $CFLAGS"
index 03c3df6804d0d863f5f0ee2bd6879893cb6454d4..2e39af03bb82030ea810427f700f846e0e851f83 100644 (file)
@@ -1,3 +1,9 @@
+ngircd (20.2-0ab1) unstable; urgency=high
+
+  * New "upstream" release, fixing a security related bug: ngIRCd 20.2.
+
+ -- Alexander Barton <alex@barton.de>  Fri, 15 Feb 2013 12:17:00 +0100
+
 ngircd (20.1-0ab1) unstable; urgency=low
 
   * New "upstream" release: ngIRCd 20.1.
index 09b43a68a8bb71ef5ba2fb3dd02f9cee1f04bf14..6d16f7cac50f8b177fb4d336201906733b0a3607 100644 (file)
@@ -1,6 +1,6 @@
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors
+# Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors
 #
 # 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
@@ -17,6 +17,7 @@ EXTRA_DIST = README \
        ngIRCd-Logo.gif \
        ngircd-redhat.init \
        ngircd.service \
+       ngircd.socket \
        ngircd.spec \
        platformtest.sh \
        systrace.policy
index 1aebd1ebf6fe0f0d9cd944a99f99b1e4cb5f3cdf..2d639e664076d19c8b20a23e50a4d6426ddd6953 100644 (file)
@@ -2,18 +2,21 @@
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
 
-               (c)2001-2011 Alexander Barton and Contributors.
+               (c)2001-2013 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 
-                            -- Contributions --
+                             -- Contributions --
 
 
 Debian/
  - Various files for building Debian GNU/Linux packages (".deb's").
+       - ngircd.init; ngircd.default: init script for Debian-based systems.
+       - ngircd.pam: example PAM configuraton.
 
 MacOSX/
  - Project files for XCode, the "project builder" of Apple Mac OS X.
+       - de.barton.ngircd.plist[.tmpl]: launchd(8) property list.
 
 ngindent
  - Script to indent the code of ngIRCd in the "standard way".
@@ -24,6 +27,12 @@ ngircd-bsd.sh
 ngircd-redhat.init
  - Start/stop script for RedHat-based distributions (like CentOS).
 
+ngircd.service
+ - systemd(8) service unit configuration file.
+
+ngircd.socket
+ - systemd(8) socket unit configuration file for "socket activation".
+
 ngircd.spec
  - RPM "spec" file.
 
diff --git a/contrib/ngircd.socket b/contrib/ngircd.socket
new file mode 100644 (file)
index 0000000..1c0cc00
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=Next Generation IRC Daemon (Socket)
+
+[Socket]
+BindIPv6Only=ipv6-only
+ListenStream=0.0.0.0:6667
+#ListenStream=[::]:6667
+IPTOS=low-delay
+
+[Install]
+WantedBy=sockets.target
index fa0a6a1527dc7deddaf70e53e7005bda7a9a3a18..e2448a42c9108d05751665d95f4cbe3450e63b9d 100644 (file)
@@ -1,5 +1,5 @@
 %define name    ngircd
-%define version 20.1
+%define version 20.2
 %define release 1
 %define prefix  %{_prefix}
 
index e9b78731080b6a8ed3785e233d4bfa2f551e4bbd..2d3cab2f3892bcbda76b38e8c0254aeb4561a4f2 100644 (file)
@@ -13,8 +13,8 @@ This file lists all commands available on ngIRCd. It is written in a format
 that is human readable as well as machine parseable and therefore can be used
 as "help text file" of the daemon.
 
-In short, the HELP command parses this file as following when a user user
-issues a "HELP <cmd>" command:
+In short, the daemon reads this file on startup and parses it as following
+when an user issues a "HELP <cmd>" command:
 
  1. Search the file for a line "- <cmd>",
  2. Output all subsequent lines that start with a TAB (ASCII 9) character
@@ -25,7 +25,8 @@ issues a "HELP <cmd>" command:
 This format allows to have information to each command stored in this file
 which will not be sent to an IRC user requesting help which enables us to
 have additional annotations stored here which further describe the origin,
-implementation details, or limits of the specific command.
+implementation details, or limits of the specific command which are not
+relevant to an end-user but administrators and developers.
 
 A special "Intro" block is returned to the user when the HELP command is
 used without a command name:
@@ -41,14 +42,120 @@ used without a command name:
        example "HELP quit" or "HELP privmsg".
 
 
-General Commands
-~~~~~~~~~~~~~~~~
-
-- AWAY
+Connection Handling Commands
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 - CAP
+       CAP LS
+       CAP LIST
+       CAP REQ <capabilities>
+       CAP ACK <capabilities>
+       CAP NAK <capabilities>
+       CAP CLEAR
+       CAP END
+       .
+       List, request, and clear "IRC Capabilities".
+       .
+       Using this command, an IRC client can request additional "IRC
+       capabilities" during login or later on, which influences the
+       communication between server and client. Normally, these commands
+       aren't directly used by humans, but automatically by their client
+       software. And please note that issuing such commands manually can
+       irritate the client software used, because of the "non-standard"
+       behavior of the server!
+       .
+       - CAP LS: list all available capabilities.
+       - CAP LIST: list active capabilities of this connection.
+       - CAP REQ: Request particular capabilities.
+       - CAP ACK: Acknowledge a set of capabilities to be enabled/disabled.
+       - CAP NAK: Reject a set of capabilities.
+       - CAP CLEAR: Clear all set capabilities.
+       - CAP END: Indicate end of capability negotiation during login,
+         ignored in an fully registered session.
+
+       Please note that the <capabilities> must be given in a single
+       parameter but whitespace separated, therefore a command could look
+       like this: "CAP REQ :capability1 capability2 capability3" for example.
+
+       References:
+        - <http://ircv3.atheme.org/specification/capability-negotiation-3.1>
+        - <http://ngircd.barton.de/doc/Capabilities.txt>
+        - doc/Capabilities.txt
 
 - CHARCONV
+       CHARCONV <client-charset>
+       .
+       Set client character set encoding to <client-charset>.
+       .
+       After receiving such a command, the server translates all message
+       data received from the client using the set <client-charset> to the
+       server encoding (UTF-8), and all message data which is to be sent to
+       the client from the server encoding (UTF-8) to <client-charset>.
+       .
+       This enables older clients and clients using "strange" character sets
+       to transparently participate in channels and direct messages to
+       clients using UTF-8, which should be the default today.
+
+       References:
+        - <http://ngircd.barton.de/doc/Protocol.txt>
+        - doc/Protocol.txt
+
+- NICK
+       NICK <nick>
+       .
+       Change your nickname to <nick>.
+
+- PASS
+       PASS <password> <version> <flags> [<options>]
+       .
+       Set a connection <password>. This command must be sent before the
+       NICK/USER registration combination.
+       .
+       See doc/Protocol.txt for more info.
+
+- PING
+       PING <server1> [<server2>]
+       .
+       Tests the presence of a connection. A PING message results in a PONG
+       reply. If <server2> is specified, the message gets passed on to it.
+
+- PONG
+       PONG <server1> [<server2>]
+       .
+       This command is a reply to the PING command and works in much the
+       same way.
+
+- QUIT
+       QUIT [<quit-message>]
+       .
+       End IRC session and disconnect from the server.
+       .
+       If a <quit-message> has been given, it is displayed to all the
+       channels that you are a member of when leaving.
+
+- USER
+       USER <user> <modes> <realname>
+       .
+       This command is used at the beginning of a connection to specify the
+       <user>name, hostname, <realname> and initial user <modes> of the
+       connecting client.
+       .
+       <realname> may contain spaces, and thus must be prefixed with a colon.
+
+- WEBIRC
+       See doc/Protocol.txt
+
+
+General Commands
+~~~~~~~~~~~~~~~~
+
+- AWAY
+       AWAY [<message>]
+       .
+       Provides the server with a message to automatically send in reply to a
+       PRIVMSG directed at the user, but not to a channel they are on.
+       .
+       If <message> is omitted, the away status is removed.
 
 - HELP
        HELP [<command>]
@@ -68,118 +175,387 @@ General Commands
 
 
 - MODE
-
-- NICK
+       MODE <nickname> <flags> (user)
+       MODE <channel> <flags> [<args>]
+       .
+       The MODE command is dual-purpose. It can be used to set both (user) and
+       <channel> modes.
+       .
+       See doc/Modes.txt for more information.
 
 - NOTICE
-
-- PASS
-
-- PING
-
-- PONG
+       NOTICE <target> <notice>
+       .
+       Send <notice> to <target> (nick or channel).
+       .
+       This command works similarly to PRIVMSG, except automatic replies must
+       never be sent in reply to NOTICE messages.
 
 - PRIVMSG
-
-- QUIT
-       QUIT [<quit-message>]
+       PRIVMSG <target> <message>
        .
-       End IRC session and disconnect from the server.
+       Send <message> to <target> (nick or channel).
        .
-       If a <quit-message> has been given, it is displayed to all the
-       channels that you are a member of when leaving.
-
-- USER
-
-- WALLOPS
-
-- WEBIRC
+       Common IRC clients use MSG as PRIVMSG alias.
+       (Some clients use "QUERY <nick> [<message>]" to open a private chat.)
 
 
 Status and Informational Commands
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+- ADMIN
+       ADMIN [<target>]
+       .
+       Show administrative information about an IRC server in the network.
+       .
+       <target> can be a server name, the nickname of a client connected to
+       a specific server, or a mask matching a server name in the network.
+       The server of the current connection is used when <target> is omitted.
+
+       References:
+        - RFC 2812, 3.4.9 "Admin command"
+
 - INFO
+       INFO [<target>]
+       .
+       Show the version, birth & online time of an IRC server in the network.
+       .
+       <target> can be a server name, the nickname of a client connected to
+       a specific server, or a mask matching a server name in the network.
+       The server of the current connection is used when <target> is omitted.
+
+       References:
+        - RFC 2812, 3.4.10 "Info command"
 
 - ISON
+       ISON <nickname> [<nickname> [...]]
+       .
+       Query online status of a list of nicknames. The server replies with
+       a list only containing nicknames actually connected to a server in
+       the network. If no nicknames of the given list are online, an empty
+       list is returned to the client requesting the information.
+
+       Please note that "all" IRC daemons even parse separate nicknames in
+       a single parameter (like ":nick1 nick2"), and therefore ngIRCd
+       implements this behaviour, too.
+
+       References:
+        - RFC 2812, 4.9 "Ison message"
 
 - LINKS
+       LINKS [[<target>] [<mask>]
+       .
+       List all servers currently registered in the network matching <mask>,
+       or all servers if <mask> has been omitted, as seen by the server
+       specified by <target> or the local server when <target> is omitted.
+       .
+       <target> can be a server name, the nickname of a client connected to
+       a specific server, or a mask matching a server name in the network.
+
+       References:
+        - RFC 2812, 3.4.5 "Links message"
 
 - LUSERS
+       LUSERS [<mask> [<target>]]
+       .
+       Return statistics about the number of clients (users, servers,
+       services, ...) in the network as seen by the server <target>.
+       .
+       <target> can be a server name, the nickname of a client connected to
+       a specific server, or a mask matching a server name in the network.
+       The server of the current connection is used when <target> is omitted.
 
-- METADATA
+       Please note that ngIRCd ignores the <mask> parameter entirely: it
+       is not possible to get information for a part of the network only.
+
+       References:
+        - RFC 2812, 3.4.2 "Lusers message"
 
 - MOTD
+       MOTD [<target>]
+       .
+       Show the "Message of the Day" (MOTD) of an IRC server in the network.
+       .
+       <target> can be a server name, the nickname of a client connected to
+       a specific server, or a mask matching a server name in the network.
+       The server of the current connection is used when <target> is omitted.
+
+       References:
+        - RFC 2812, 3.4.1 "Motd message"
 
 - NAMES
+       NAMES [<channel>[,<channel>[,...]] [<target>]]
+       .
+       Show the list of users that are members of a particular <channel>
+       (and that are visible for the client requesting this information) as
+       seen by the server <target>. More than one <channel> can be given
+       separated by "," (but not whitespaces!).
+       .
+       If <channel> has been omitted, all visible users are shown, grouped
+       by channel name, and all visible users not being members of at least
+       one channel are shown as members of the pseudo channel "*".
+       .
+       <target> can be a server name, the nickname of a client connected to
+       a specific server, or a mask matching a server name in the network.
+       The server of the current connection is used when <target> is omitted.
+
+       References:
+        - RFC 2812, 3.2.5 "Names message"
 
 - STATS
+       STATS [<query> [<target>]]
+       .
+       Show statistics and other information of type <query> of a particular
+       IRC server in the network.
+       .
+       The following <query> types are supported (case-insensitive):
+       .
+        - g  Network-wide bans ("G-Lines").
+        - k  Server-local bans ("K-Lines").
+        - l  Link status (parent server and own link only).
+        - m  Command usage count.
+        - u  Server uptime.
+       .
+       <target> can be a server name, the nickname of a client connected to
+       a specific server, or a mask matching a server name in the network.
+       The server of the current connection is used when <target> is omitted.
+
+       References:
+        - RFC 2812, 3.4.4 "Stats message"
 
 - TIME
+       TIME [<target>]
+       .
+       Show the local time of an IRC server in the network.
+       .
+       <target> can be a server name, the nickname of a client connected to
+       a specific server, or a mask matching a server name in the network.
+       The server of the current connection is used when <target> is omitted.
+
+       References
+        - RFC 2812, 3.4.6 "Time message"
 
 - TRACE
+       TRACE [<server>]
+       .
+       Trace a path across the IRC network of the current server, or if given
+       of a specific <server>, in a similar method to traceroute.
 
 - USERHOST
+       USERHOST <nickname> [<nickname> [...]]
+       .
+       Show flags and the hostmasks (<user>@<host>) of the <nickname>s,
+       separated by spaces. The following flags are used:
+       .
+        - "-"  The client is "away" (the mode "+a" is set on this client).
+        - "+"  Client seems to be available, at least it isn't marked "away".
+        - "*"  The client is an IRC operator (the mode "+o" is set).
+
+       References:
+        - RFC 2812, 4.8 "Userhost message"
 
 - VERSION
+       VERSION [<target>]
+       .
+       Show version information about a particular IRC server in the network.
+       .
+       <target> can be a server name, the nickname of a client connected to
+       a specific server, or a mask matching a server name in the network.
+       The server of the current connection is used when <target> is omitted.
+       .
+       Please note: in normal operation, the version number ends in a dot
+       (".", for example "ngIRCd-20.1."). If it ends in ".1" (for example
+       "ngIRCd-20.1.1", same version than before!), the server is running in
+       debug-mode; and if it ends in ".2", the "network sniffer" is active!
+       Keep your privacy in mind ...
+
+       References:
+        - RFC 2812, 3.4.3 "Version message"
 
 - WHO
+       WHO [<mask> ["o"]]
+       .
+       Show a list of users who match the <mask>, or all visible users when
+       the <mask> has been omitted. (Special case: the <mask> "0" is
+       equivalent to "*")
+       .
+       If the flag "o" is given, the server will only return information about
+       IRC Operators.
+
+       References:
+        - RFC 2812, 3.6.1 "Who query"
 
 - WHOIS
+       WHOIS [<target>] <mask>[,<mask>[,...]]
+       .
+       Query information about users matching the <mask> parameter(s) as seen
+       by the server <target>; up to 3 <masks> are supported.
+       .
+       <target> can be a server name, the nickname of a client connected to a
+       specific server, or a mask matching a server name in the network. The
+       server of the current connection is used when <target> is omitted.
+
+       References:
+        - RFC 2812, 3.6.2 "Whois query"
 
 - WHOWAS
+       WHOWAS <nickname>[,<nickname>[,...]] [<count> [<target>]]
+       .
+       Query information about nicknames no longer in use in the network,
+       either because of nickname changes or disconnects. The history is
+       searched backwards, returning the most recent entry first. If there
+       are multiple entries, up to <count> entries will be shown (or all of
+       them, if no <count> has been given).
+       .
+       <target> can be a server name, the nickname of a client connected to a
+       specific server, or a mask matching a server name in the network. The
+       server of the current connection is used when <target> is omitted.
+
+       References:
+        - RFC 2812, 3.6.3 "Whowas"
 
 
 Channel Commands
 ~~~~~~~~~~~~~~~~
 
 - INVITE
+       INVITE <nick> <channel>
+       .
+       Invites <nick> to <channel>.
+       <channel> does not have to exist, but if it does, only members of the
+       channel are allowed to invite other clients.
+       .
+       If the <channel> mode "+i" is set, only <channel> operators may invite
+       other clients.
 
 - JOIN
+       JOIN <channels> [<channel-keys>]
+       .
+       Makes the client join the <channels> (comma-separated list), specifying
+       the passwords, if needed, in the comma-separated <channel-keys> list.
+       A <channel-key> is only needed, if the <channel> mode "+k" is set.
+       .
+       If the channel(s) do not exist, then they will be created.
 
 - KICK
+       KICK <channel> <nick> [<kick-message>]
+       .
+       Remove <nick> from <channel>, optional with a <kick-message>.
+       .
+       Only <channel> operators are able to KICK.
 
 - LIST
+       LIST [<channels> [<server>]]
+       .
+       List all visible <channels> (comma-seperated list) on the current
+       server.
+       If <server> is given, the command will be forwarded to <server> for
+       evaluation.
 
 - PART
+       PART <channels> [<part-message>]
+       .
+       Leave <channels> (comma-separated list), optional with a
+       <part-message>.
 
 - TOPIC
+       TOPIC <channel> <topic>
+       .
+       Set a <topic> for <channel>.
+       .
+       Only <channel> operators are able to set a <topic>.
 
 
 Administrative Commands
 ~~~~~~~~~~~~~~~~~~~~~~~
 
-- ADMIN
-       ADMIN [<server>]
-       .
-       Show administartive information about an IRC server in the network.
-       If no server name has been given, the local server will respond.
-
 - CONNECT
+       CONNECT <target server> [<port> [<remote server> [<mypwd> <peerpwd>]]]
+       .
+       Instructs the current server, or <remote server> if specified,
+       to connect to <target server>.
+       .
+       To connect <remote server> you need to have remote oper status.
+       If <port> is omitted, it uses the server port of the configuration.
+       If <mypwd> and <peerpwd> is given, it uses those passwords instead
+       of the ones in the configuration.
 
 - DIE
+       DIE
+       .
+       Instructs the server to shut down.
 
 - DISCONNECT
+       DISCONNECT [<remote server>]
+       .
+       Disconnects the current server, or <remote server> if specified.
+       To disconnect a <remote server> you need to have remote oper status.
 
 - GLINE
+       GLINE <nick!user@hostmask> <seconds> :<reason>
+       .
+       This command provides timed G-Lines (Network-wide bans).
+       If a client matches a G-Line, it cannot connect to any server on
+       the IRC network. If you put 0 as <seconds>, it makes the G-Line
+       permanent.
+       .
+       To remove a G-Line, type "GLINE <nick!user@hostmask>".
+       To list the G-Lines, type "STATS g".
 
 - KILL
+       KILL <nick> <reason>
+       .
+       Forcibly removes <nick> from the IRC network with a <reason>.
 
 - KLINE
+       KLINE <nick!user@hostmask> <seconds> :<reason>
+       .
+       This command provides timed K-Lines (Server-local bans).
+       If a client matches a K-Line, it cannot connect to the issued server.
+       If you put 0 as <seconds>, it makes the K-Line permanent.
+       .
+       To remove a K-Line, type "KLINE <nick!user@hostmask>".
+       To list the K-Lines, type "STATS k".
 
 - OPER
+       OPER <user> <password>
+       .
+       Authenticates <user> as an IRC operator on the current server/network.
 
 - REHASH
+       REHASH
+       .
+       Causes the server to re-read and re-process its configuration file(s).
 
 - RESTART
+       RESTART
+       .
+       Restart the server.
+
+- WALLOPS
+       WALLOPS <message>
+       .
+       Sends <message> to all users with user mode "+w".
 
 
 IRC Service Commands
-~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~
 
 - SERVICE
 
 - SERVLIST
+       SERVLIST [<mask> [<type>]]
+       .
+       List all IRC services currently registered in the network.
+       .
+       The optional <mask> and <type> parameters can be used to limit the
+       listing to services matching the <mask> and that are of type <type>.
+       .
+       Please note that ngIRCd doesn't use any service types at the moment
+       and therefore all services are of type "0".
+
+       References:
+        - RFC 2812, 3.5.1 "Servlist message"
 
 - SQUERY
 
@@ -190,6 +566,12 @@ Server Protocol Commands
 ~~~~~~~~~~~~~~~~~~~~~~~~
 
 - CHANINFO
+       CHANINFO <channel> +<modes> [[<key> <limit>] <topic>]
+       .
+       CHANINFO is used by servers to inform each other about a channel:
+       its modes, channel key, user limits and its topic.
+       .
+       See doc/Protocol.txt for more information.
 
 - ERROR
        ERROR [<message> [<> [...]]]
@@ -200,19 +582,50 @@ Server Protocol Commands
        .
        This command is silently ignored on non-server and non-service links.
 
+- METADATA
+       METADATA <target> <key> <value>
+       .
+       The METADATA command is used on server-links to update "metadata"
+       information of clients, like the hostname, the info text ("real name"),
+       or the user name.
+       .
+       See doc/Protocol.txt for more information.
+
 - NJOIN
 
 - SERVER
 
 - SQUIT
+       SQUIT <server>
+       .
+       Disconnects an IRC Server from the network.
 
 
 Dummy Commands
 ~~~~~~~~~~~~~~
 
 - SUMMON
+       SUMMON <user> [<target> [<channel>]]
+       .
+       This command was intended to call people into IRC who are directly
+       connected to the terminal console of the IRC server -- but is
+       deprecated today. Therefore ngIRCd doesn't really implement this
+       command and always returns an error message, regardless of the
+       parameters given.
+
+       References:
+        - RFC 2812, 4.5 "Summon message"
 
 - USERS
+       USERS [<target>]
+       .
+       This command was intended to list users directly logged in into the
+       console of the IRC server -- but is deprecated today. Therefore ngIRCd
+       doesn't really implement this command and always returns an error
+       message, regardless of the parameters given.
+
+       References:
+        - RFC 2812, 4.6 "Users"
 
 - GET
 
index 1c3998ad61368fca9448013206c2cd35e5187779..822fd5d4fb9dd5b99f2694b5be98ce88075c68c5 100644 (file)
        # to not yet (or no longer) connected servers.
        ;ConnectRetry = 60
 
+       # Number of seconds after which the whole daemon should shutdown when
+       # no connections are left active after handling at least one client
+       # (0: never, which is the default).
+       # This can be useful for testing or when ngIRCd is started using
+       # "socket activation" with systemd(8), for example.
+       ;IdleTimeout = 0
+
        # Maximum number of simultaneous in- and outbound connections the
        # server is allowed to accept (0: unlimited):
        ;MaxConnections = 0
index 859c6a8ac0eb547b915e73fbed78cbf4e726c8a5..e5485dbf10edddc2c7c0532b79902bd696fedbc4 100644 (file)
@@ -1,7 +1,7 @@
 .\"
 .\" ngircd.conf(5) manual page template
 .\"
-.TH ngircd.conf 5 "Nov 2012" ngIRCd "ngIRCd Manual"
+.TH ngircd.conf 5 "Feb 2013" ngIRCd "ngIRCd Manual"
 .SH NAME
 ngircd.conf \- configuration file of ngIRCd
 .SH SYNOPSIS
@@ -170,6 +170,12 @@ should be safe, but it is wise to double-check :-)
 The server tries every <ConnectRetry> seconds to establish a link to not yet
 (or no longer) connected servers. Default: 60.
 .TP
+\fBIdleTimeout\fR (number)
+Number of seconds after which the whole daemon should shutdown when no
+connections are left active after handling at least one client (0: never). This
+can be useful for testing or when ngIRCd is started using "socket activation"
+with systemd(8), for example. Default: 0.
+.TP
 \fBMaxConnections\fR (number)
 Maximum number of simultaneous in- and outbound connections the server is
 allowed to accept (0: unlimited). Default: 0.
index 4eab2726a04393f40bc08ddec9ecfd4a4d5144c0..45bf615c29d604b453807e2a1e6c2b07c8c3f02c 100644 (file)
@@ -326,6 +326,13 @@ Channel_Kick(CLIENT *Peer, CLIENT *Target, CLIENT *Origin, const char *Name,
                }
        }
 
+       /* Check that the client to be kicked is on the specified channel */
+       if (!Channel_IsMemberOf(chan, Target)) {
+               IRC_WriteStrClient(Origin, ERR_USERNOTINCHANNEL_MSG,
+                                  Client_ID(Origin), Client_ID(Target), Name );
+               return;
+       }
+
        if(Client_Type(Peer) == CLIENT_USER) {
                /* Channel mode 'Q' and user mode 'q' on target: nobody but
                 * IRC Operators and servers can kick the target user */
@@ -382,13 +389,6 @@ Channel_Kick(CLIENT *Peer, CLIENT *Target, CLIENT *Origin, const char *Name,
                }
        }
 
-       /* Check that the client to be kicked is on the specified channel */
-       if (!Channel_IsMemberOf(chan, Target)) {
-               IRC_WriteStrClient(Origin, ERR_USERNOTINCHANNEL_MSG,
-                                  Client_ID(Origin), Client_ID(Target), Name );
-               return;
-       }
-
        /* Kick Client from channel */
        Remove_Client( REMOVE_KICK, chan, Target, Origin, Reason, true);
 } /* Channel_Kick */
index 929ab05403734b8cd43e851955828072c38a0e33..e46dcfee43669644091285586fd956b9c9a6c94c 100644 (file)
@@ -370,6 +370,7 @@ Conf_Test( void )
 
        puts("[LIMITS]");
        printf("  ConnectRetry = %d\n", Conf_ConnectRetry);
+       printf("  IdleTimeout = %d\n", Conf_IdleTimeout);
        printf("  MaxConnections = %d\n", Conf_MaxConnections);
        printf("  MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP);
        printf("  MaxJoins = %d\n", Conf_MaxJoins > 0 ? Conf_MaxJoins : -1);
@@ -736,6 +737,7 @@ Set_Defaults(bool InitServers)
 
        /* Limits */
        Conf_ConnectRetry = 60;
+       Conf_IdleTimeout = 0;
        Conf_MaxConnections = 0;
        Conf_MaxConnectionsIP = 5;
        Conf_MaxJoins = 10;
@@ -830,8 +832,8 @@ Read_TextFile(const char *Filename, const char *Name, array *Destination)
 
        fp = fopen(Filename, "r");
        if (!fp) {
-               Config_Error(LOG_WARNING, "Can't read %s file \"%s\": %s",
-                                       Name, Filename, strerror(errno));
+               Config_Error(LOG_ERR, "Can't read %s file \"%s\": %s",
+                            Name, Filename, strerror(errno));
                return false;
        }
 
@@ -841,7 +843,7 @@ Read_TextFile(const char *Filename, const char *Name, array *Destination)
 
                /* add text including \0 */
                if (!array_catb(Destination, line, strlen(line) + 1)) {
-                       Log(LOG_WARNING, "Cannot read/add \"%s\", line %d: %s",
+                       Log(LOG_ERR, "Cannot read/add \"%s\", line %d: %s",
                            Filename, line_no, strerror(errno));
                        break;
                }
@@ -1241,6 +1243,7 @@ CheckLegacyGlobalOption(int Line, char *Var, char *Arg)
                return "[Options]";
        }
        if (strcasecmp(Var, "ConnectRetry") == 0
+           || strcasecmp(Var, "IdleTimeout") == 0
            || strcasecmp(Var, "MaxConnections") == 0
            || strcasecmp(Var, "MaxConnectionsIP") == 0
            || strcasecmp(Var, "MaxJoins") == 0
@@ -1490,6 +1493,12 @@ Handle_LIMITS(int Line, char *Var, char *Arg)
                }
                return;
        }
+       if (strcasecmp(Var, "IdleTimeout") == 0) {
+               Conf_IdleTimeout = atoi(Arg);
+               if (!Conf_IdleTimeout && strcmp(Arg, "0"))
+                       Config_Error_NaN(Line, Var);
+               return;
+       }
        if (strcasecmp(Var, "MaxConnections") == 0) {
                Conf_MaxConnections = atoi(Arg);
                if (!Conf_MaxConnections && strcmp(Arg, "0"))
index c203b57032a9558a3d3e6efcf44dad9019e5a355..bbf4f36c24c4ff29d1c2b3dc99ba58897f658443 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
  *
  * 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
@@ -211,6 +211,9 @@ GLOBAL bool Conf_ConnectIPv6;
 /** Try to connect to remote systems using the IPv4 protocol (true) */
 GLOBAL bool Conf_ConnectIPv4;
 
+/** Idle timout (seconds), after which the daemon should exit */
+GLOBAL int Conf_IdleTimeout;
+
 /** Maximum number of simultaneous connections to this server */
 GLOBAL int Conf_MaxConnections;
 
index 142cf23a012592332ae6096ae72a093423e98c95..3c1427d5461272ac83a68c21e769f557bc80d472 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
  *
  * 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
@@ -82,6 +82,8 @@
 #define MAX_COMMANDS_SERVER_MIN 10
 #define MAX_COMMANDS_SERVICE 10
 
+#define SD_LISTEN_FDS_START 3
+
 
 static bool Handle_Write PARAMS(( CONN_ID Idx ));
 static bool Conn_Write PARAMS(( CONN_ID Idx, char *Data, size_t Len ));
@@ -119,6 +121,42 @@ static void cb_Read_Resolver_Result PARAMS((int sock, UNUSED short what));
 static void cb_Connect_to_Server PARAMS((int sock, UNUSED short what));
 static void cb_clientserver PARAMS((int sock, short what));
 
+time_t idle_t = 0;
+
+
+/**
+ * Get number of sockets available from systemd(8).
+ *
+ * ngIRCd needs to implement its own sd_listen_fds(3) function and can't
+ * use the one provided by systemd itself, becaus the sockets will be
+ * used in a forked child process with a new PID, and this would trigger
+ * an error in the standard implementation.
+ *
+ * @return Number of sockets available, -1 if sockets have already been
+ *         initialized, or 0 when no sockets have been passed.
+ */
+static int
+my_sd_listen_fds(void)
+{
+       const char *e;
+       int count;
+
+       /* Check if LISTEN_PID exists; but we ignore the result, because
+        * normally ngircd forks a child before checking this, and therefore
+        * the PID set in the environment is always wrong ... */
+       e = getenv("LISTEN_PID");
+       if (!e || !*e)
+               return 0;
+
+       e = getenv("LISTEN_FDS");
+       if (!e || !*e)
+               return -1;
+       count = atoi(e);
+       unsetenv("LISTEN_FDS");
+
+       return count;
+}
+
 
 /**
  * IO callback for listening sockets: handle new connections. This callback
@@ -454,7 +492,7 @@ Conn_CloseAllSockets(int ExceptOf)
  * @returns            Number of listening sockets created.
  */
 static unsigned int
-ports_initlisteners(array *a, const char *listen_addr, void (*func)(int,short))
+Init_Listeners(array *a, const char *listen_addr, void (*func)(int,short))
 {
        unsigned int created = 0;
        size_t len;
@@ -470,8 +508,9 @@ ports_initlisteners(array *a, const char *listen_addr, void (*func)(int,short))
                        continue;
                }
                if (!io_event_create( fd, IO_WANTREAD, func )) {
-                       Log( LOG_ERR, "io_event_create(): Could not add listening fd %d (port %u): %s!",
-                                               fd, (unsigned int) *port, strerror(errno));
+                       Log(LOG_ERR,
+                           "io_event_create(): Can't add fd %d (port %u): %s!",
+                           fd, (unsigned int) *port, strerror(errno));
                        close(fd);
                        port++;
                        continue;
@@ -493,14 +532,76 @@ Conn_InitListeners( void )
 {
        /* Initialize ports on which the server should accept connections */
        unsigned int created = 0;
-       char *copy, *listen_addr;
+       char *af_str, *copy, *listen_addr;
+       int count, fd, i, addr_len;
+       ng_ipaddr_t addr;
 
        assert(Conf_ListenAddress);
 
+       count = my_sd_listen_fds();
+       if (count < 0) {
+               Log(LOG_INFO,
+                   "Not re-initializing listening sockets of systemd(8) ...");
+               return 0;
+       }
+       if (count > 0) {
+               /* systemd(8) passed sockets to us, so don't try to initialize
+                * listening sockets on our own but use the passed ones */
+               LogDebug("Initializing %d systemd sockets ...", count);
+               for (i = 0; i < count; i++) {
+                       fd = SD_LISTEN_FDS_START + i;
+                       addr_len = (int)sizeof(addr);
+                       getsockname(fd, (struct sockaddr *)&addr, (socklen_t*)&addr_len);
+#ifdef WANT_IPV6
+                       if (addr.sin4.sin_family != AF_INET && addr.sin4.sin_family != AF_INET6)
+#else
+                       if (addr.sin4.sin_family != AF_INET)
+#endif
+                       {
+                               /* Socket is of unsupported type! For example, systemd passed in
+                                * an IPv6 socket but ngIRCd isn't compiled with IPv6 support. */
+                               switch (addr.sin4.sin_family)
+                               {
+                                       case AF_UNSPEC: af_str = "AF_UNSPEC"; break;
+                                       case AF_UNIX: af_str = "AF_UNIX"; break;
+                                       case AF_INET: af_str = "AF_INET"; break;
+#ifdef AF_INET6
+                                       case AF_INET6: af_str = "AF_INET6"; break;
+#endif
+#ifdef AF_NETLINK
+                                       case AF_NETLINK: af_str = "AF_NETLINK"; break;
+#endif
+                                       default: af_str = "unknown"; break;
+                               }
+                               Log(LOG_CRIT,
+                                   "Socket %d is of unsupported type \"%s\" (%d), have to ignore it!",
+                                   fd, af_str, addr.sin4.sin_family);
+                               close(fd);
+                               continue;
+                       }
+
+                       Init_Socket(fd);
+                       if (!io_event_create(fd, IO_WANTREAD, cb_listen)) {
+                               Log(LOG_ERR,
+                                   "io_event_create(): Can't add fd %d: %s!",
+                                   fd, strerror(errno));
+                               continue;
+                       }
+                       Log(LOG_INFO,
+                           "Initialized socket %d from systemd(8): %s:%d.", fd,
+                           ng_ipaddr_tostr(&addr), ng_ipaddr_getport(&addr));
+                       created++;
+               }
+               return created;
+       }
+
+       /* not using systemd socket activation, initialize listening sockets: */
+
        /* can't use Conf_ListenAddress directly, see below */
        copy = strdup(Conf_ListenAddress);
        if (!copy) {
-               Log(LOG_CRIT, "Cannot copy %s: %s", Conf_ListenAddress, strerror(errno));
+               Log(LOG_CRIT, "Cannot copy %s: %s", Conf_ListenAddress,
+                   strerror(errno));
                return 0;
        }
        listen_addr = strtok(copy, ",");
@@ -508,9 +609,11 @@ Conn_InitListeners( void )
        while (listen_addr) {
                ngt_TrimStr(listen_addr);
                if (*listen_addr) {
-                       created += ports_initlisteners(&Conf_ListenPorts, listen_addr, cb_listen);
+                       created += Init_Listeners(&Conf_ListenPorts,
+                                                 listen_addr, cb_listen);
 #ifdef SSL_SUPPORT
-                       created += ports_initlisteners(&Conf_SSLOptions.ListenPorts, listen_addr, cb_listen_ssl);
+                       created += Init_Listeners(&Conf_SSLOptions.ListenPorts,
+                                                 listen_addr, cb_listen_ssl);
 #endif
                }
 
@@ -537,7 +640,12 @@ Conn_ExitListeners( void )
        int *fd;
        size_t arraylen;
 
+       /* Get number of listening sockets to shut down. There can be none
+        * if ngIRCd has been "socket activated" by systemd. */
        arraylen = array_length(&My_Listeners, sizeof (int));
+       if (arraylen < 1)
+               return;
+
        Log(LOG_INFO,
            "Shutting down all listening sockets (%d total) ...", arraylen);
        fd = array_start(&My_Listeners);
@@ -620,8 +728,9 @@ NewListener(const char *listen_addr, UINT16 Port)
 
        af = ng_ipaddr_af(&addr);
        sock = socket(af, SOCK_STREAM, 0);
-       if( sock < 0 ) {
-               Log(LOG_CRIT, "Can't create socket (af %d) : %s!", af, strerror(errno));
+       if (sock < 0) {
+               Log(LOG_CRIT, "Can't create socket (af %d) : %s!", af,
+                   strerror(errno));
                return -1;
        }
 
@@ -632,21 +741,22 @@ NewListener(const char *listen_addr, UINT16 Port)
 
        if (bind(sock, (struct sockaddr *)&addr, ng_ipaddr_salen(&addr)) != 0) {
                Log(LOG_CRIT, "Can't bind socket to address %s:%d - %s!",
-                       ng_ipaddr_tostr(&addr), Port, strerror(errno));
+                   ng_ipaddr_tostr(&addr), Port, strerror(errno));
                close(sock);
                return -1;
        }
 
-       if( listen( sock, 10 ) != 0 ) {
-               Log( LOG_CRIT, "Can't listen on socket: %s!", strerror( errno ));
-               close( sock );
+       if (listen(sock, 10) != 0) {
+               Log(LOG_CRIT, "Can't listen on socket: %s!", strerror(errno));
+               close(sock);
                return -1;
        }
 
        /* keep fd in list so we can close it when ngircd restarts/shuts down */
-       if (!array_catb( &My_Listeners,(char*) &sock, sizeof(int) )) {
-               Log( LOG_CRIT, "Can't add socket to My_Listeners array: %s!", strerror( errno ));
-               close( sock );
+       if (!array_catb(&My_Listeners, (char *)&sock, sizeof(int))) {
+               Log(LOG_CRIT, "Can't add socket to My_Listeners array: %s!",
+                   strerror(errno));
+               close(sock);
                return -1;
        }
 
@@ -830,6 +940,15 @@ Conn_Handler(void)
                            PACKAGE_NAME);
                        exit(1);
                }
+
+               /* Should ngIRCd timeout when idle? */
+               if (Conf_IdleTimeout > 0 && NumConnectionsAccepted > 0
+                   && idle_t > 0 && time(NULL) - idle_t >= Conf_IdleTimeout) {
+                       LogDebug("Server idle timeout reached: %d second%s. Initiating shutdown ...",
+                                Conf_IdleTimeout,
+                                Conf_IdleTimeout == 1 ? "" : "s");
+                       NGIRCd_SignalQuit = true;
+               }
        }
 
        if (NGIRCd_SignalQuit)
@@ -1191,6 +1310,8 @@ Conn_Close( CONN_ID Idx, const char *LogMsg, const char *FwdMsg, bool InformClie
                NumConnections--;
        LogDebug("Shutdown of connection %d completed, %ld connection%s left.",
                 Idx, NumConnections, NumConnections != 1 ? "s" : "");
+
+       idle_t = NumConnections > 0 ? 0 : time(NULL);
 } /* Conn_Close */
 
 
@@ -1562,6 +1683,7 @@ static void
 Account_Connection(void)
 {
        NumConnections++;
+       idle_t = 0;
        if (NumConnections > NumConnectionsMax)
                NumConnectionsMax = NumConnections;
        LogDebug("Total number of connections now %lu (max %lu).",
index 3c8dcd51aee374527900d8422535c46ef4f46e09..24d65651611411d1d83447dad0782e87617b3d2d 100644 (file)
@@ -1251,7 +1251,8 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
                 */
                if (!has_wildcards || is_remote) {
                        c = Client_Search(query);
-                       if (c && Client_Type(c) == CLIENT_USER) {
+                       if (c && (Client_Type(c) == CLIENT_USER
+                                 || Client_Type(c) == CLIENT_SERVICE)) {
                                if (!IRC_WHOIS_SendReply(Client, from, c))
                                        return DISCONNECTED;
                        } else {
index e7d83eff301c3491c83d71f9892944c0f6e5c480..52c6e46e6585ad5e9f4767f83b33e4a1b109c123 100644 (file)
@@ -444,7 +444,7 @@ IRC_USER(CLIENT * Client, REQUEST * Req)
                ptr = Req->argv[0];
                while (*ptr) {
                        if (!isalnum((int)*ptr) &&
-                           *ptr != '+' && *ptr != '-' &&
+                           *ptr != '+' && *ptr != '-' && *ptr != '@' &&
                            *ptr != '.' && *ptr != '_') {
                                Conn_Close(Client_Conn(Client), NULL,
                                           "Invalid user name", true);
@@ -453,6 +453,13 @@ IRC_USER(CLIENT * Client, REQUEST * Req)
                        ptr++;
                }
 
+               /* Save the received username for authentication, and use
+                * it up to the first '@' as default user name (like ircd2.11,
+                * bahamut, ircd-seven, ...), prefixed with '~', if needed: */
+               Client_SetOrigUser(Client, Req->argv[0]);
+               ptr = strchr(Req->argv[0], '@');
+               if (ptr)
+                       *ptr = '\0';
 #ifdef IDENTAUTH
                ptr = Client_User(Client);
                if (!ptr || !*ptr || *ptr == '~')
@@ -460,7 +467,6 @@ IRC_USER(CLIENT * Client, REQUEST * Req)
 #else
                Client_SetUser(Client, Req->argv[0], false);
 #endif
-               Client_SetOrigUser(Client, Req->argv[0]);
 
                /* "Real name" or user info text: Don't set it to the empty
                 * string, the original ircd can't deal with such "real names"
index 375f4bc1f6ab605ecbfe659367c82812b981a1a0..e5bed7912f28401ab93884ee5e84ad4c0c5f7465 100644 (file)
@@ -109,7 +109,7 @@ Log_ReInit(void)
 GLOBAL void
 Log_Exit( void )
 {
-       Log(LOG_NOTICE, "%s done%s, served %lu connection%s.", PACKAGE_NAME,
+       Log(LOG_INFO, "%s done%s, served %lu connection%s.", PACKAGE_NAME,
            NGIRCd_SignalRestart ? " (restarting)" : "", Conn_CountAccepted(),
            Conn_CountAccepted() == 1 ? "" : "s");
 #ifdef SYSLOG
index d79344b5941bcfa59ab61ff4a0acd49131fb4b48..d8c8c40a2d6c0d0bf9f510c8299cf8f11c160d6b 100644 (file)
@@ -202,6 +202,7 @@ Login_User_PostAuth(CLIENT *Client)
 static void
 cb_Read_Auth_Result(int r_fd, UNUSED short events)
 {
+       char user[CLIENT_USER_LEN], *ptr;
        CONN_ID conn;
        CLIENT *client;
        int result;
@@ -233,7 +234,14 @@ cb_Read_Auth_Result(int r_fd, UNUSED short events)
        }
 
        if (result == true) {
-               Client_SetUser(client, Client_OrigUser(client), true);
+               /* Authentication succeeded, now set the correct user name
+                * supplied by the client (without prepended '~' for exmaple),
+                * but cut it at the first '@' character: */
+               strlcpy(user, Client_OrigUser(client), sizeof(user));
+               ptr = strchr(user, '@');
+               if (ptr)
+                       *ptr = '\0';
+               Client_SetUser(client, user, true);
                (void)Login_User_PostAuth(client);
        } else
                Client_Reject(client, "Bad password", false);
index a6a6d8c24559457d70adacc5cffb78dc3152f214..371abc262d7dc6f708a7cee156884d6d2186efa5 100644 (file)
@@ -56,6 +56,7 @@
 #define RPL_UNAWAY_MSG                 "305 %s :You are no longer marked as being away"
 #define RPL_NOWAWAY_MSG                        "306 %s :You have been marked as being away"
 #define RPL_WHOISREGNICK_MSG           "307 %s %s :is a registered nick"
+#define RPL_WHOISSERVICE_MSG           "310 %s %s :is an IRC service"
 #define RPL_WHOISUSER_MSG              "311 %s %s %s %s * :%s"
 #define RPL_WHOISSERVER_MSG            "312 %s %s %s :%s"
 #define RPL_WHOISOPERATOR_MSG          "313 %s %s :is an IRC operator"
index 8f0a5a1b8cd3c8b1fd4a193af8a7c38119d21315..6d5ea8f83b9a97727727f39d0665e4be695cf241 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
  *
  * 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,7 +41,6 @@ static const int signals_catch[] = {
        SIGINT, SIGQUIT, SIGTERM, SIGHUP, SIGCHLD, SIGUSR1, SIGUSR2
 };
 
-
 #ifdef DEBUG
 
 static void
@@ -57,7 +57,6 @@ Dump_State(void)
 
 #endif
 
-
 static void
 Signal_Block(int sig)
 {
@@ -73,7 +72,6 @@ Signal_Block(int sig)
 #endif
 }
 
-
 static void
 Signal_Unblock(int sig)
 {
@@ -90,7 +88,6 @@ Signal_Unblock(int sig)
 #endif
 }
 
-
 /**
  * Reload the server configuration file.
  */
@@ -117,18 +114,21 @@ Rehash(void)
         * be changed during run-time */
        if (strcmp(old_name, Conf_ServerName) != 0 ) {
                strlcpy(Conf_ServerName, old_name, sizeof Conf_ServerName);
-               Log(LOG_ERR, "Can't change \"ServerName\" on runtime! Ignored new name.");
+               Log(LOG_ERR,
+                   "Can't change \"ServerName\" on runtime! Ignored new name.");
        }
        if (old_nicklen != Conf_MaxNickLength) {
                Conf_MaxNickLength = old_nicklen;
-               Log(LOG_ERR, "Can't change \"MaxNickLength\" on runtime! Ignored new value.");
+               Log(LOG_ERR,
+                   "Can't change \"MaxNickLength\" on runtime! Ignored new value.");
        }
 
        /* Create new pre-defined channels */
        Channel_InitPredefined( );
 
        if (!ConnSSL_InitLibrary())
-               Log(LOG_WARNING, "Re-Initializing SSL failed, using old keys");
+               Log(LOG_WARNING,
+                   "Re-Initializing of SSL failed, using old keys!");
 
        /* Start listening on sockets */
        Conn_InitListeners( );
@@ -139,7 +139,6 @@ Rehash(void)
        Log( LOG_NOTICE|LOG_snotice, "Re-reading of configuration done." );
 } /* Rehash */
 
-
 /**
  * Signal handler of ngIRCd.
  * This function is called whenever ngIRCd catches a signal sent by the
@@ -198,7 +197,6 @@ Signal_Handler(int Signal)
                Signal_Block(Signal);
 } /* Signal_Handler */
 
-
 /**
  * Signal processing handler of ngIRCd.
  * This function is called from the main conn event loop in (io_dispatch)
@@ -231,7 +229,6 @@ Signal_Handler_BH(int Signal)
        Signal_Unblock(Signal);
 }
 
-
 static void
 Signal_Callback(int fd, short UNUSED what)
 {
@@ -248,15 +245,15 @@ Signal_Callback(int fd, short UNUSED what)
                if (errno == EAGAIN || errno == EINTR)
                        return;
 
-               Log(LOG_EMERG, "read from signal pipe: %s", strerror(errno));
+               Log(LOG_EMERG, "Read from signal pipe: %s - Exiting!",
+                   strerror(errno));
                exit(1);
        }
 
-       Log(LOG_EMERG, "EOF on signal pipe");
+       Log(LOG_EMERG, "EOF on signal pipe!? - Exiting!");
        exit(1);
 }
 
-
 /**
  * Initialize the signal handlers, catch
  * those signals we are interested in and sets SIGPIPE to be ignored.
@@ -306,7 +303,6 @@ Signals_Init(void)
        return io_event_create(signalpipe[0], IO_WANTREAD, Signal_Callback);
 } /* Signals_Init */
 
-
 /**
  * Restores signals to their default behaviour.
  *