Commit Graph

2885 Commits

Author SHA1 Message Date
Alexander Barton 8ab097afb7 Implement support for systemd(8) "socket activation"
This patch enables ngIRCd to work with listening sockets already
initialized and passed-in by systemd(8) and hereby to support on-demand
"socket activation".

systemd(8) uses two environment variables to pass information about the
sockets to ngIRCd, LISTEN_PID and LISTEN_FDS, and this mechanism only
kicks in when both variables are set. In all other cases, and therefore
in most installations out there, nothing changes at all.

Please note:
If socket activation is in effect, ngIRCd will not initialize any (other)
soeckets on its own! All sockets must be configured in the systemd(8)
socket unit configuration file in this case, see ./contrib/ngircd.socket
for example.

Probably it would be interesting to match passed-in sockets to configured
listening sockets and to initialize all the remaining ones not already
set up by systemd(8), but this is kept back for an other patch ...

See
 - <http://0pointer.de/blog/projects/socket-activation.html>
 - <http://0pointer.de/blog/projects/socket-activation2.html>
 - <http://www.freedesktop.org/software/systemd/man/systemd.socket.html>
2013-02-04 21:52:27 +01:00
Alexander Barton 84e24afd2f contrib/README: add more files 2013-02-04 21:31:42 +01:00
Alexander Barton f16d230530 Rename ports_initlisteners() to Init_Listeners() 2013-02-03 21:43:29 +01:00
Alexander Barton 3a3b3225d4 NewListener(): Code cleanup 2013-02-03 21:43:29 +01:00
Alexander Barton 84a599ece4 Enable WHOIS to display information about IRC Services
This patch introduces the new numeric 310(RPL_WHOISSERVICE) and enables
WHOIS to display information about IRC services. This numeric is used
for this purpose by InspIRCd, for example -- but as usual, other numerics
are in use, too, like 613 in UltimateIRCd ...

Please note that neither the Operator (+o) not the "bot status" (+B)
of an IRC service id displayed in the output.

Change suggested by Federico G. Schwindt <fgsch@lodoss.net>, Thanks.
2013-02-03 21:32:53 +01:00
Alexander Barton 999c11ad49 Exit message: use singular & plural :-) 2013-01-27 23:22:00 +01:00
Alexander Barton c891b5f250 autogen.sh: Check for autoconf/automake wrapper scripts
For example OpenBSD uses a "autoconf" and "automake" wrapper script which
tells the user to set AUTOCONF_VERSION and AUTOMAKE_VERSION environment
variables. This patch enhances autogen.sh to not detect these wrapper
scripts as regular autoconf/automake commands but to set the required
environment variables after detecting the real "command-X.Y" commands.

Tested on OpenBSD 5.1.
2013-01-27 12:54:48 +01:00
Alexander Barton 419ff38a07 autogen.sh: Don't use "egrep -o", use "sed"
"egrep -o" isn't portable and not available on OpenBSD, for example. So
let's use sed instead to get the automake version. The expression used
now is less specific but should work as well ...
2013-01-27 12:25:58 +01:00
Alexander Barton 8d8201502f IRC_WHO_Channel(): Use strlcpy() instead of strcpy()
This fixes the following warning, at least on OpenBSD 4.8:

 irc-info.o(.text+0x2427): In function `IRC_WHO':
 src/ngircd/irc-info.c:896: warning: strcpy() is almost always misused,
                            please use strlcpy()
2013-01-27 01:00:32 +01:00
Alexander Barton d38d153f51 Streamline punctuation of log messages
Make sure that all log messages end with a correct punctuation mark.

The rules for formatting log messages are:

 1. Add punctuation marks to all messages passed to the actual logging
    functions like Log() and LogDebug().
 2. Don't add any punctuation marks to messages that are stored in
    variables for later use or are passed over the network.
 3. IP addresses, DNS host names and IRC server names should be quoted.
 4. Messages originating in the network should be quoted (at least if
    they are "untrusted" or variable).

Most probably this patch doesn't fix all mistakes, but it should be a
good starting point ...
2013-01-26 17:00:03 +01:00
Alexander Barton fd260404ca configure: "netinet/in_systm.h" is optional
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 :-)
2013-01-24 22:45:00 +01:00
DNS a551942635 contrib/Debian/rules: Do no compress Commands.txt
This is required, because ngIRCd can't use a compressed file as
help text ...

(cherry picked from commit 6d09b4f366f656f6d2732ea96a653e086380e458)
2013-01-23 19:55:56 +01:00
Alexander Barton b60d5a0a11 AUTHORS: Update list of contributors 2013-01-23 19:45:00 +01:00
Alexander Barton fae0054d31 AUTHORS: Use "email address syntax" 2013-01-23 19:41:52 +01:00
Alexander Barton 3d49e8ac84 ngircd.service: Use "forking" service type
Don't run ngIRCd in forground mode but let it daemonize itself. This
enhances the log output of "systemctl status ngircd.service", because
now ngIRCd doesn't print out its PID and timestamp on each log message
which is redundant: it becomes logged by systemd/journald already.
2013-01-23 00:44:16 +01:00
Alexander Barton 508ca3044d 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: ERR_NOTREGISTEREDSERVER(451).
2013-01-22 10:54:06 +01:00
Alexander Barton d8f2964710 MODE: don't report error on "more modes than parameters"
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 ...

If ngIRCd is compiled using "strict mode", these errors are still reported.

Reported-by: Tim <tim@stackwatch.net>
2013-01-13 17:18:04 +01:00
Alexander Barton ab00997698 Correctly detect when SSL subsystem must be initialized
This patch introduces the new function Conf_SSLInUse() to check when the
current server configuration requires the SSL subsystem to be initialized
and accounts incoming as well as outgoing connections -- so this fixes
commit bb20aeb9 ("Initialize SSL when needed only, and disable SSL on
errors") which only handled the inbound case  ...

Tested-by: Brett Smith <brett@w3.org>
2013-01-07 20:34:55 +01:00
Alexander Barton b4966aa1bd configure: use AS_HELP_STRING for --with-iconv 2013-01-06 17:46:06 +01:00
Alexander Barton 0703fcd719 autogen.sh: Enforce serial test harness on automake >=1.13 2013-01-05 03:05:56 +01:00
Alexander Barton 4594583f52 autogen.sh: Reformat messages. 2013-01-05 02:39:06 +01:00
Alexander Barton 68cb1a8c2e Merge branch 'bug145-ProvideHelp'
* bug145-ProvideHelp:
  Use "${docdir}/Commands.txt" as help text file
  Add a note that "help file" is updated on startup and REHASH only
  Add doc/Commands.txt which should document all commands
  Implement Help() function parsing and returning the help text
  Document "HelpFile" in sample-ngircd.conf and ngircd.conf.5
  Implement new configuration option "HelpFile"
  IRC_HELP(): Code cleanup
  Refactor Read_Motd() into Read_TextFile()
2013-01-02 23:41:46 +01:00
Alexander Barton 21493731df ngIRCd Release 20.1 2013-01-02 22:37:55 +01:00
Alexander Barton 950aeec3ff Use "${docdir}/Commands.txt" as help text file 2013-01-01 19:25:06 +01:00
Alexander Barton 1f59821270 Update Copyright notices for 2013 2013-01-01 19:23:56 +01:00
Alexander Barton 60a9a7f118 Add a note that "help file" is updated on startup and REHASH only 2013-01-01 15:35:58 +01:00
Alexander Barton 8ec09e3ca4 Add doc/Commands.txt which should document all commands
This document can be used as "help text", too, see configuration option
"HelpFile" in ngircd.conf(5).

Please note that this file in its current state is far from complete, only
a few commands are documented, but you should get an idea how it works.

So please send in patches adding the remaining parts! :-)
2013-01-01 15:11:31 +01:00
Alexander Barton 289a26e9e4 Implement Help() function parsing and returning the help text
This function parses the already read in help text and sends the requested
portions to the user. Parsing is done as following when a user 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
    to the client using NOTICE commands, treat lines containing a single "."
    after the TAB as empty lines.
 3. Break at the first line not starting with a TAB character.

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.

A special "Intro" block is returned to the user when the HELP command is
used without a command name.
2013-01-01 14:57:03 +01:00
Alexander Barton 3e47bc9af5 Allow ERROR command on server and service links only
Ignore it and add a penalty time on all other link types.
2012-12-31 21:46:48 +01:00
Alexander Barton d2a1f6aa4b Document "HelpFile" in sample-ngircd.conf and ngircd.conf.5 2012-12-31 21:03:23 +01:00
Alexander Barton f68aa02272 Implement new configuration option "HelpFile"
This new configuration option allows to specify a specially formatted
text file which can be used by the HELP command to provide information
about the commands and their syntaxes.
2012-12-31 19:29:52 +01:00
Alexander Barton 588af510a3 IRC_HELP(): Code cleanup 2012-12-31 19:27:32 +01:00
Alexander Barton 9e1c25a889 Refactor Read_Motd() into Read_TextFile()
Now this function allows to read arbitrary text files into arrays.
2012-12-31 19:26:31 +01:00
Alexander Barton 5d92198487 Get rid of Conn_ResetPenalty(), it is unused 2012-12-31 18:23:21 +01:00
Alexander Barton 20ddffca0d Mode setting: only check channel user modes when on channel
Only check the channel user modes of the initiator if he is joined to
this channel and not an IRC operator enforcing modes (which requires
the configuration option "OperCanUseMode" to be enabled), because trying
to check channel user modes of a non-member results in this assertion:

 Assertion failed: (cl2chan != NULL), function Channel_UserModes,
  file channel.c, line 742.

This closes bug #147, thanks to James Kirwill <james.kirwill@bk.ru>
for tracking this down!
2012-12-31 18:13:18 +01:00
Alexander Barton 25e56a5e83 Add some more casts in assert() statemens
This fixes the following warning messages of gcc 4.5.3 on Cygwin when
building with debug code enabled:

 ng_ipaddr.c: In function ‘ng_ipaddr_init’:
 ng_ipaddr.c:52:2: warning: comparison between signed and
                   unsigned integer expressions
 ng_ipaddr.c:53:20: warning: comparison between signed and
                    unsigned integer expressions

 resolve.c: In function ‘ForwardLookup’:
 resolve.c:271:3: warning: comparison between signed and
                  unsigned integer expressions
2012-12-25 19:21:40 +01:00
Alexander Barton 1e5a7aac87 Makefiles: Correctly quote sed expressions
Now the Makefiles support spaces in "$sysconfdir", which isn't uncommon
for Cygwin for example, when $HOME contains whitespaces ("/home/User Name")
and ngIRCd is installed into the user home ("./configure --prefix=$HOME").
2012-12-25 19:14:31 +01:00
Alexander Barton b5b3dd9cfd Add Cygwin binaries (*.exe) to .gitignore files 2012-12-25 18:52:49 +01:00
Alexander Barton 92fba63ad8 Add a cast in ForwardLookup() to fix a gcc warning on Cygwin
This fixes the following warning message of 4.5.3 on Cygwin:

 resolve.c: In function ‘ForwardLookup’:
 resolve.c:273:21: warning: comparison between signed and
                   unsigned integer expressions
2012-12-25 18:49:28 +01:00
Alexander Barton 25d35dd6f4 ngIRCd Release 20 2012-12-17 13:14:32 +01:00
Alexander Barton a445abc10e Update NEWS and ChangeLog files 2012-12-12 11:06:35 +01:00
Alexander Barton 1342f78b09 Allow user names up to 20 characters
This patch allows user names up to 20 characters when ngIRCd has not been
configured for "strict RFC mode".

Patch suggested by Brett Smith <brett@w3.org>, see
<http://arthur.barton.de/pipermail/ngircd-ml/2012-October/000579.html>.
2012-12-10 10:41:36 +01:00
Alexander Barton a0d57a6afd ngIRCd 20~rc2 2012-12-02 18:51:51 +01:00
Alexander Barton c6ae353756 Update NEWS and ChangeLog files 2012-12-02 18:49:11 +01:00
Alexander Barton 12768e7a54 Update doc/Platforms.txt 2012-11-26 11:54:23 +01:00
Alexander Barton 35e2dcff88 Rework cloaked hostname handling, implement "METADATA cloakhost"
Now ngIRCd uses two fields internally, one to store the "real" hostname
and one to save the "cloaked" hostname. And both fields can be set
independently using the "METADATA host" and "METADATA cloakhost" commands.

This allows "foreign servers" (aka "IRC services") to alter the real and
cloaked hostnames of clients without problems, even when the user itself
issues additional "MODE +x" and "MODE -x" commands.
2012-11-24 16:15:35 +01:00
Alexander Barton dc89e42ef5 RPL_UMODEIS: send correct target name, even on server links 2012-11-24 15:57:45 +01:00
Alexander Barton 4a2d74c9ab Client_HostnameCloaked() -> Client_HostnameDisplayed() 2012-11-24 13:37:56 +01:00
Alexander Barton cd48b8128e platformtest.sh: Only generate configure script when missing 2012-11-13 23:21:09 +01:00
Alexander Barton 301d4915bc Update platformtest.sh to follow autoconf changes 2012-11-13 22:46:06 +01:00