Add support for GnuTLS certificate reload.
Thanks a lot, Hilko Bengen!
language: c
-sudo: false
addons:
apt:
packages:
David Kingston <deathking1337@aim.com>
DNS <dns@rbose.org>
Eric Grunow <egrunow@ucsd.edu>
+Fabrice Fontaine <fontaine.fabrice@gmail.com>
Federico G. Schwindt <fgsch@lodoss.net>
Gabor Adam Toth <tg@tgbit.net>
Götz Hoffart <goetz@hoffart.de>
ItsOnlyBinary <ItsOnlyBinary@users.noreply.github.com>
James Lu <james@overdrivenetworks.com>
Jari Aalto <jari.aalto@cante.net>
+JRMU <jrmu@lecturify.com>
LucentW <lucent@zebes.info>
Mantas Mikulėnas <grawity@gmail.com>
+Michi <michi+ngircd@dataswamp.org>
Neale Pickett <neale@woozle.org>
Peter Powell <petpow@saberuk.com>
Rolf Eike Beer <eike@sf-mail.de>
Tom Ryder <tom@sanctum.geek.nz>
Unit 193 <unit193@ubuntu.com>
William Pitcock <nenolod@dereferenced.org>
+Windree <57554809+Windree@users.noreply.github.com>
xor <xorboy@gmail.com>
Yecheng Fu <cofyc.jackson@gmail.com>
-- ChangeLog --
+ngIRCd 26
+
+ ngIRCd 26~rc1
+ - Remove deprecated legacy configuration options and related functions that
+ have been marked for removal for quite some time:
+ - PredefChannelsOnly (v22)
+ - NoticeAuth (v24)
+ - NoXXX (v19)
+ - Old '[GLOBAL]' section handling (v19)
+ Thanks to Michi <michi+ngircd@dataswamp.org> for the patch!
+ - Increase read buffer size for server connections: This applies the same
+ logic we have for write buffers to distinguish between server and client
+ connections and sets the maximum buffer size accordingly. As a result
+ peering with servers with many GLINE/KLINEs does not kill the connecting
+ server connection anymore. Thanks to Michi <michi+ngircd@dataswamp.org>!
+ - Fix recursion bug on write errors: Depending on the stack size, too many
+ clients on the same channel quitting at the same time would trigger a crash
+ due to too many recursive calls to Conn_Close(). Thanks to Michi
+ <michi+ngircd@dataswamp.org> for the patch!
+ - Fix builds using GCC option -fno-common, which is the default starting with
+ GCC 10. Thanks to Michi <michi+ngircd@dataswamp.org> for the patch!
+ Closes #266.
+ - Convert INSTALL and README files to Markdown.
+ - Allow setting arbitrary channel modes in the configuration file by handling
+ them like in MODE commands, and allow multiple "Modes =" lines per [Channel]
+ section. Thanks to Michi <michi+ngircd@dataswamp.org>!
+ Closes #55.
+ - Add "FNC" (forced nick changes) to ISUPPORT(005) numeric. Most probably
+ this doesn't make any difference to any client, but it seems correct.
+ See <http://www.irc.org/tech_docs/005.html> for details.
+ - Reuse old SSL key if loading a new one failed.
+ - Remove outdated OpenBSD/NetBSD systrace.policy.
+ - Enhance handling of command line errors, and return with exit code 0 ("no
+ error") when "--help" or "--version" is used (which resulted in exit code 1,
+ "error" before). Exit with code 2 ("command line error") for all other
+ invalid command line options, and show the error message itself on stderr
+ (instead of stdout and exit code 1, "generic error", as before).
+ This new behaviour is more in line with the GNU "coding standards",
+ see <https://www.gnu.org/prep/standards/html_node/_002d_002dhelp.html>.
+ - Fix and update Xcode project: Reference correct contrib/Makefile.am file,
+ correctly sort contrib/nglog.sh and add "ORGANIZATIONNAME" setting.
+ - contrib/ngindent.sh: Add more GNU indent options for better results, and
+ add the ".sh" suffix to bring this script in line with the others in the
+ contrib/ folder.
+ - Add ./contrib/nglog.sh: This script parses the log output of ngircd(8),
+ and colorizes the messages according to their log level. Example usage:
+ ngircd -f $PWD/doc/sample-ngircd.conf -np | ./contrib/nglog.sh
+ - Log received signals with their names using strsignal(3), when available.
+ - Make test suite compatible with Haiku OS.
+ - Fix host mask cloaking bug, don't cloak multiple times: Previously, each
+ server would cloak every user's host mask. The problem is that if a network
+ has more than one server, then a user's host mask would get cloaked twice.
+ This patch ensures that a server only cloaks the host mask if it has not yet
+ been cloaked (the period indicates it's still an IP address). Thanks to
+ JRMU <jrmu@lecturify.com> for the patch!
+ Closes #228.
+ - Enlarge buffers of info texts to 128 bytes. This includes:
+ - "Real name" of a client (4th filed of the USER command).
+ - Server info text ("Info" configuration option).
+ - Admin info texts and email address ("AdminInfo1", "AdminInfo2" and
+ "AdminEmail" configuration options).
+ - Network name ("Network" configuration option).
+ The limit was 64 bytes before ...
+ Closes #258.
+ - Streamline handling of invalid and unset server name: Don't exit during
+ runtime (REHASH command, HUP signal), because the server name can't be
+ changed in this case anyway and the new invalid name will be ignored.
+ - Fix and extend documentation: Fix some typos, fix syntax of LINKS and LIST
+ commands, whitespace and spelling fixes, update dependencies and add some
+ more information about IRCv3 support.
+ Thanks to Thanks Windree, Étienne Mollier <etienne.mollier@mailoo.org> and
+ Christoph Biedl <debian.axhn@manchmal.in-ulm.de>.
+ Closes #264.
+ - Slightly reorder startup steps, and enhance logging:
+ - Show name of configuration file at the beginning of start up.
+ - Add a message when ngIRCd is ready, including its host name.
+ - Show name of configuration file on REHASH (SIGHUP), too.
+ - Change level of "done message" to NOTICE, like "starting" & "ready".
+ - Initialize IO functions before channels, connections, clients, ...
+ - configure.ng: OpenSSL can depends on lz or latomic so use pkg-config to
+ find those dependencies and fallback to existing mechanism.
+ Closes #256.
+ - ngircd.conf.5: Fix wording as suggested by lintian.
ngIRCd 25 (2019-01-23)
Differences to version 25
+- **Attention**:
+ All already deprecated legacy options (besides the newly deprecated *Key* and
+ *MaxUsers* settings, see below) were removed in ngIRCd 26, so make sure to
+ update your configuration before upgrading, if you haven't done so already
+ (you got a warning on daemon startup when using deprecated options): you can
+ check your configuration using `ngircd --configtest` -- which is a good idea
+ anyway ;-)
+
- Setting modes for predefined channels in *[Channel]* sections has been
enhanced: now you can set *all* modes, like in IRC "MODE" commands, and have
this setting multiple times per *[Channel]* block. Modifying lists (ban list,
rm -f config.log debian
testsuite:
- cd src/testsuite && make check
+ cd src/testsuite && ${MAKE} check
lint:
- cd src/ngircd && make lint
+ cd src/ngircd && ${MAKE} lint
srcdoc:
- cd doc && make srcdoc
+ cd doc && ${MAKE} srcdoc
have-xcodebuild:
@xcodebuild -project contrib/MacOSX/ngIRCd.xcodeproj -list \
--out ../../$(distdir).mpkg
rm -f $(distdir).mpkg.zip
zip -ro9 $(distdir).mpkg.zip $(distdir).mpkg
- make osxpkg-clean
+ ${MAKE} osxpkg-clean
osxpkg-clean:
[ ! -r ngircd.dest ] || sudo -n rm -rf ngircd.dest
osxpkg-dest: have-xcodebuild osxpkg-clean clean
./configure --prefix=/opt/ngircd
- make xcode
- make -C contrib/MacOSX de.barton.ngircd.plist
+ ${MAKE} xcode
+ ${MAKE} -C contrib/MacOSX de.barton.ngircd.plist
mkdir -p ngircd.dest/opt/ngircd/sbin
- DESTDIR="$$PWD/ngircd.dest" make -C doc install
- DESTDIR="$$PWD/ngircd.dest" make -C contrib install
- DESTDIR="$$PWD/ngircd.dest" make -C man install
+ DESTDIR="$$PWD/ngircd.dest" ${MAKE} -C doc install
+ DESTDIR="$$PWD/ngircd.dest" ${MAKE} -C contrib install
+ DESTDIR="$$PWD/ngircd.dest" ${MAKE} -C man install
cp contrib/MacOSX/build/Default/ngIRCd \
ngircd.dest/opt/ngircd/sbin/ngircd
rm ngircd.dest/opt/ngircd/etc/ngircd.conf
-- NEWS --
+ngIRCd 26
+
+ ngIRCd 26~rc1
+ - Allow setting arbitrary channel modes in the configuration file by handling
+ them like in MODE commands, and allow multiple "Modes =" lines per [Channel]
+ section. Thanks to Michi <michi+ngircd@dataswamp.org>!
+ Closes #55.
+ - Add "FNC" (forced nick changes) to ISUPPORT(005) numeric. Most probably
+ this doesn't make any difference to any client, but it seems correct.
+ See <http://www.irc.org/tech_docs/005.html> for details.
+ - Enhance handling of command line errors, and return with exit code 0 ("no
+ error") when "--help" or "--version" is used (which resulted in exit code 1,
+ "error" before). Exit with code 2 ("command line error") for all other
+ invalid command line options, and show the error message itself on stderr
+ (instead of stdout and exit code 1, "generic error", as before).
+ This new behaviour is more in line with the GNU "coding standards",
+ see <https://www.gnu.org/prep/standards/html_node/_002d_002dhelp.html>.
+ - Add ./contrib/nglog.sh: This script parses the log output of ngircd(8),
+ and colorizes the messages according to their log level. Example usage:
+ ngircd -f $PWD/doc/sample-ngircd.conf -np | ./contrib/nglog.sh
+ - Enlarge buffers of info texts to 128 bytes. This includes:
+ - "Real name" of a client (4th filed of the USER command).
+ - Server info text ("Info" configuration option).
+ - Admin info texts and email address ("AdminInfo1", "AdminInfo2" and
+ "AdminEmail" configuration options).
+ - Network name ("Network" configuration option).
+ The limit was 64 bytes before ...
+ Closes #258.
+ - Streamline handling of invalid and unset server name: Don't exit during
+ runtime (REHASH command, HUP signal), because the server name can't be
+ changed in this case anyway and the new invalid name will be ignored.
+ - Slightly reorder startup steps, and enhance logging:
+ - Show name of configuration file at the beginning of start up.
+ - Add a message when ngIRCd is ready, including its host name.
+ - Show name of configuration file on REHASH (SIGHUP), too.
+ - Change level of "done message" to NOTICE, like "starting" & "ready".
+ - Initialize IO functions before channels, connections, clients, ...
+ - configure.ng: OpenSSL can depends on lz or latomic so use pkg-config to
+ find those dependencies and fallback to existing mechanism.
+ Closes #256.
+
ngIRCd 25 (2019-01-23)
- Implement new configuration option "MaxPenaltyTime", which configures the
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 1130;
+ LastUpgradeCheck = 1140;
ORGANIZATIONNAME = "ngIRCd Development Team";
};
buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "ngIRCd" */;
1DEB928708733DD80010E9CD /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_OBJC_WEAK = YES;
};
name = Default;
};
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_WARN_ASSIGN_ENUM = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_PEDANTIC = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_SIGN_COMPARE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_WARN_ASSIGN_ENUM = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_PEDANTIC = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_SIGN_COMPARE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
FAB0570D105D917F006AF9E2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_OBJC_WEAK = YES;
};
name = Debug;
};
-#!/bin/sh
+#!/bin/bash
#
# ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2019 Alexander Barton (alex@barton.de) and Contributors
+# Copyright (c)2001-2020 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
# ./src/ngircd/ngircd -f $PWD/doc/sample-ngircd.conf -np | ./contrib/nglog.sh
#
-awk '
+gawk '
/^\[[[:digit:]]+:0 / {print "\033[1;95m" $0 "\033[0m"}
/^\[[[:digit:]]+:1 / {print "\033[1;35m" $0 "\033[0m"}
/^\[[[:digit:]]+:2 / {print "\033[1;91m" $0 "\033[0m"}
/^\[[[:digit:]]+:5 / {print "\033[1m" $0 "\033[0m"}
/^\[[[:digit:]]+:6 / {print $0}
/^\[[[:digit:]]+:7 / {print "\033[90m" $0 "\033[0m"}
-'
+' </dev/stdin &
+
+wait
install-data-hook: $(static_docs) $(toplevel_docs) $(generated_docs)
$(MKDIR_P) -m 755 $(DESTDIR)$(sysconfdir)
@if [ ! -f $(DESTDIR)$(sysconfdir)/ngircd.conf ]; then \
- make install-config; \
+ ${MAKE} install-config; \
fi
$(MKDIR_P) -m 755 $(DESTDIR)$(docdir)
for f in $(static_docs) $(toplevel_docs); do \
uninstall-hook:
rm -rf $(DESTDIR)$(docdir)
@if cmp --silent sample-ngircd.conf $(DESTDIR)$(sysconfdir)/ngircd.conf; then \
- make uninstall-config; \
+ ${MAKE} uninstall-config; \
else \
echo; \
echo " ** NOTE: Not uninstalling changed configuration file:"; \
rm -f $(DESTDIR)$(sysconfdir)/ngircd.conf
srcdoc:
- make -C src srcdoc
+ ${MAKE} -C src srcdoc
.PHONY: install-config uninstall-config srcdoc
assert(Client != NULL);
assert(Hostname != NULL);
- /* Only cloak the hostmask if it has not yet been cloaked (the period
- * indicates it's still an IP address). */
- if (Conf_CloakHost[0] && strchr(Client->host, '.')) {
+ /* Only cloak the hostmask if it has not yet been cloaked.
+ * The period or colon indicates it's still an IP address.
+ * An empty string means a rDNS lookup did not happen (yet). */
+ if (Conf_CloakHost[0] && (!Client->host[0] || strchr(Client->host, '.')
+ || strchr(Client->host, ':'))) {
char cloak[GETID_LEN];
strlcpy(cloak, Hostname, GETID_LEN);
FILE *fd;
DIR *dh;
- Log(LOG_INFO, "Using configuration file \"%s\" ...", NGIRCd_ConfFile);
+ Config_Error(LOG_INFO, "Using configuration file \"%s\" ...", NGIRCd_ConfFile);
/* Open configuration file */
fd = fopen( NGIRCd_ConfFile, "r" );
#endif
}
-/**
- * Handle legacy "NoXXX" options in [GLOBAL] section.
- *
- * TODO: This function and support for "NoXXX" could be removed starting
- * with ngIRCd release 19 (one release after marking it "deprecated").
- *
- * @param Var Variable name.
- * @param Arg Argument string.
- * @returns true if a NoXXX option has been processed; false otherwise.
- */
-static bool
-CheckLegacyNoOption(const char *Var, const char *Arg)
-{
- if(strcasecmp(Var, "NoDNS") == 0) {
- Conf_DNS = !Check_ArgIsTrue( Arg );
- return true;
- }
- if (strcasecmp(Var, "NoIdent") == 0) {
- Conf_Ident = !Check_ArgIsTrue(Arg);
- return true;
- }
- if(strcasecmp(Var, "NoPAM") == 0) {
- Conf_PAM = !Check_ArgIsTrue(Arg);
- return true;
- }
- return false;
-}
-
-/**
- * Handle deprecated legacy options in [GLOBAL] section.
- *
- * TODO: This function and support for these options in the [Global] section
- * could be removed starting with ngIRCd release 19 (one release after
- * marking it "deprecated").
- *
- * @param Var Variable name.
- * @param Arg Argument string.
- * @returns true if a legacy option has been processed; false otherwise.
- */
-static const char*
-CheckLegacyGlobalOption(const char *File, int Line, char *Var, char *Arg)
-{
- if (strcasecmp(Var, "AllowRemoteOper") == 0
- || strcasecmp(Var, "ChrootDir") == 0
- || strcasecmp(Var, "ConnectIPv4") == 0
- || strcasecmp(Var, "ConnectIPv6") == 0
- || strcasecmp(Var, "OperCanUseMode") == 0
- || strcasecmp(Var, "OperChanPAutoOp") == 0
- || strcasecmp(Var, "OperServerMode") == 0
- || strcasecmp(Var, "PredefChannelsOnly") == 0
- || strcasecmp(Var, "SyslogFacility") == 0
- || strcasecmp(Var, "WebircPassword") == 0) {
- Handle_OPTIONS(File, Line, Var, Arg);
- return "[Options]";
- }
- if (strcasecmp(Var, "ConnectRetry") == 0
- || strcasecmp(Var, "IdleTimeout") == 0
- || strcasecmp(Var, "MaxConnections") == 0
- || strcasecmp(Var, "MaxConnectionsIP") == 0
- || strcasecmp(Var, "MaxJoins") == 0
- || strcasecmp(Var, "MaxNickLength") == 0
- || strcasecmp(Var, "PingTimeout") == 0
- || strcasecmp(Var, "PongTimeout") == 0) {
- Handle_LIMITS(File, Line, Var, Arg);
- return "[Limits]";
- }
-#ifdef SSL_SUPPORT
- if (strcasecmp(Var, "SSLCertFile") == 0
- || strcasecmp(Var, "SSLDHFile") == 0
- || strcasecmp(Var, "SSLKeyFile") == 0
- || strcasecmp(Var, "SSLKeyFilePassword") == 0
- || strcasecmp(Var, "SSLPorts") == 0) {
- Handle_SSL(File, Line, Var + 3, Arg);
- return "[SSL]";
- }
-#endif
-
- return NULL;
-}
-
-/**
- * Strip "no" prefix of a string.
- *
- * TODO: This function and support for "NoXXX" should be removed starting
- * with ngIRCd release 19! (One release after marking it "deprecated").
- *
- * @param str Pointer to input string starting with "no".
- * @returns New pointer to string without "no" prefix.
- */
-static const char *
-NoNo(const char *str)
-{
- assert(strncasecmp("no", str, 2) == 0 && str[2]);
- return str + 2;
-}
-
-/**
- * Invert "boolean" string.
- *
- * TODO: This function and support for "NoXXX" should be removed starting
- * with ngIRCd release 19! (One release after marking it "deprecated").
- *
- * @param arg "Boolean" input string.
- * @returns Pointer to inverted "boolean string".
- */
-static const char *
-InvertArg(const char *arg)
-{
- return yesno_to_str(!Check_ArgIsTrue(arg));
-}
/**
* Handle variable in [Global] configuration section.
struct passwd *pwd;
struct group *grp;
size_t len;
- const char *section;
char *ptr;
assert(File != NULL);
return;
}
- if (CheckLegacyNoOption(Var, Arg)) {
- /* TODO: This function and support for "NoXXX" could be
- * be removed starting with ngIRCd release 19 (one release
- * after marking it "deprecated"). */
- Config_Error(LOG_WARNING,
- "%s, line %d (section \"Global\"): \"No\"-Prefix is deprecated, use \"%s = %s\" in [Options] section!",
- File, Line, NoNo(Var), InvertArg(Arg));
- if (strcasecmp(Var, "NoIdent") == 0)
- WarnIdent(File, Line);
- else if (strcasecmp(Var, "NoPam") == 0)
- WarnPAM(File, Line);
- return;
- }
- if ((section = CheckLegacyGlobalOption(File, Line, Var, Arg))) {
- /** TODO: This function and support for these options in the
- * [Global] section could be removed starting with ngIRCd
- * release 19 (one release after marking it "deprecated"). */
- if (strncasecmp(Var, "SSL", 3) == 0) {
- Config_Error(LOG_WARNING,
- "%s, line %d (section \"Global\"): \"%s\" is deprecated here, move it to %s and rename to \"%s\"!",
- File, Line, Var, section,
- Var + 3);
- } else {
- Config_Error(LOG_WARNING,
- "%s, line %d (section \"Global\"): \"%s\" is deprecated here, move it to %s!",
- File, Line, Var, section);
- }
- return;
- }
-
Config_Error_Section(File, Line, Var, "Global");
}
Conf_MorePrivacy = Check_ArgIsTrue(Arg);
return;
}
- if (strcasecmp(Var, "NoticeAuth") == 0) {
- /*
- * TODO: This section and support for "NoticeAuth" variable
- * could be removed starting with ngIRCd release 24 (one
- * release after marking it "deprecated") ...
- */
- Config_Error(LOG_WARNING,
- "%s, line %d (section \"Options\"): \"%s\" is deprecated, please use \"NoticeBeforeRegistration\"!",
- File, Line, Var);
- Conf_NoticeBeforeRegistration = Check_ArgIsTrue(Arg);
- return;
- }
if (strcasecmp(Var, "NoticeBeforeRegistration") == 0) {
Conf_NoticeBeforeRegistration = Check_ArgIsTrue(Arg);
return;
Config_Error_TooLong(File, Line, Var);
return;
}
- if (strcasecmp(Var, "PredefChannelsOnly") == 0) {
- /*
- * TODO: This section and support for "PredefChannelsOnly"
- * could be removed starting with ngIRCd release 22 (one
- * release after marking it "deprecated") ...
- */
- Config_Error(LOG_WARNING,
- "%s, line %d (section \"Options\"): \"%s\" is deprecated, please use \"AllowedChannelTypes\"!",
- File, Line, Var);
- if (Check_ArgIsTrue(Arg))
- Conf_AllowedChannelTypes[0] = '\0';
- else
- strlcpy(Conf_AllowedChannelTypes, CHANTYPES,
- sizeof(Conf_AllowedChannelTypes));
- return;
- }
#ifndef STRICT_RFC
if (strcasecmp(Var, "RequireAuthPing") == 0) {
Conf_AuthPing = Check_ArgIsTrue(Arg);
Conn_UpdatePing(CONN_ID Idx)
{
assert(Idx > NONE);
- My_Connections[Idx].lastping = time(NULL);
+ My_Connections[Idx].lastping = My_Connections[Idx].lastdata = time(NULL);
}
/*
*/
#define CONN_MODULE
+#define CONN_MODULE_GLOBAL_INIT
#include "portab.h"
size_t wdatalen;
struct timeval tv;
time_t t;
+ bool command_available;
Log(LOG_NOTICE, "Server \"%s\" (on \"%s\") ready.",
Client_ID(Client_ThisServer()), Client_Hostname(Client_ThisServer()));
while (!NGIRCd_SignalQuit && !NGIRCd_SignalRestart) {
t = time(NULL);
+ command_available = false;
/* Check configured servers and established links */
Check_Servers();
continue;
}
+ if (array_bytes(&My_Connections[i].rbuf) >= COMMAND_LEN) {
+ /* There is still more data in the read buffer
+ * than a single valid command can get long:
+ * so either there is a complete command, or
+ * invalid data. Therefore don't try to read in
+ * even more data from the network but wait for
+ * this command(s) to be handled first! */
+ io_event_del(My_Connections[i].sock,
+ IO_WANTREAD);
+ command_available = true;
+ continue;
+ }
+
io_event_add(My_Connections[i].sock, IO_WANTREAD);
}
- /* Set the timeout for reading from the network to 1 second,
- * which is the granularity with witch we handle "penalty
- * times" for example.
+ /* Don't wait for data when there is still at least one command
+ * available in a read buffer which can be handled immediately;
+ * set the timeout for reading from the network to 1 second
+ * otherwise, which is the granularity with witch we handle
+ * "penalty times" for example.
* Note: tv_sec/usec are undefined(!) after io_dispatch()
* returns, so we have to set it before each call to it! */
tv.tv_usec = 0;
- tv.tv_sec = 1;
+ tv.tv_sec = command_available ? 0 : 1;
/* Wait for activity ... */
i = io_dispatch(&tv);
if (errno == EAGAIN || errno == EINTR)
return true;
+ /* Log write errors but do not close the connection yet.
+ * Calling Conn_Close() now could result in too many recursive calls.
+ */
if (!Conn_OPTION_ISSET(&My_Connections[Idx], CONN_ISCLOSING))
Log(LOG_ERR,
"Write error on connection %d (socket %d): %s!",
else
LogDebug("Recursive write error on connection %d (socket %d): %s!",
Idx, My_Connections[Idx].sock, strerror(errno));
- Conn_Close(Idx, "Write error", NULL, false);
+
return false;
}
* @param Idx Connection index.
*/
static void
-Read_Request( CONN_ID Idx )
+Read_Request(CONN_ID Idx)
{
ssize_t len;
static const unsigned int maxbps = COMMAND_LEN / 2;
char readbuf[READBUFFER_LEN];
time_t t;
CLIENT *c;
- assert( Idx > NONE );
- assert( My_Connections[Idx].sock > NONE );
+ assert(Idx > NONE);
+ assert(My_Connections[Idx].sock > NONE);
+
+ /* Check if the read buffer is "full". Basically this shouldn't happen
+ * here, because as long as there possibly are commands in the read
+ * buffer (buffer usage > COMMAND_LEN), the socket shouldn't be
+ * scheduled for reading in Conn_Handler() at all ... */
#ifdef ZLIB
if ((array_bytes(&My_Connections[Idx].rbuf) >= READBUFFER_LEN) ||
(array_bytes(&My_Connections[Idx].zip.rbuf) >= READBUFFER_LEN))
if (array_bytes(&My_Connections[Idx].rbuf) >= READBUFFER_LEN)
#endif
{
- /* Read buffer is full */
Log(LOG_ERR,
"Receive buffer space exhausted (connection %d): %d/%d bytes",
Idx, array_bytes(&My_Connections[Idx].rbuf), READBUFFER_LEN);
return;
}
+ /* Now read new data from the network, up to READBUFFER_LEN bytes ... */
#ifdef SSL_SUPPORT
if (Conn_OPTION_ISSET(&My_Connections[Idx], CONN_SSL))
- len = ConnSSL_Read( &My_Connections[Idx], readbuf, sizeof(readbuf));
+ len = ConnSSL_Read(&My_Connections[Idx], readbuf, sizeof(readbuf));
else
#endif
- len = read(My_Connections[Idx].sock, readbuf, sizeof(readbuf));
+ len = read(My_Connections[Idx].sock, readbuf, sizeof(readbuf));
+
if (len == 0) {
LogDebug("Client \"%s:%u\" is closing connection %d ...",
My_Connections[Idx].host,
}
if (len < 0) {
- if( errno == EAGAIN ) return;
+ if (errno == EAGAIN)
+ return;
+
Log(LOG_ERR, "Read error on connection %d (socket %d): %s!",
Idx, My_Connections[Idx].sock, strerror(errno));
Conn_Close(Idx, "Read error", "Client closed connection",
false);
return;
}
+
+ /* Now append the newly received data to the connection buffer.
+ * NOTE: This can lead to connection read buffers being bigger(!) than
+ * READBUFFER_LEN bytes, as we add up to READBUFFER_LEN new bytes to a
+ * buffer possibly being "almost" READBUFFER_LEN bytes already! */
#ifdef ZLIB
if (Conn_OPTION_ISSET(&My_Connections[Idx], CONN_ZIP)) {
if (!array_catb(&My_Connections[Idx].zip.rbuf, readbuf,
#endif
} CONNECTION;
-GLOBAL CONNECTION *My_Connections;
-GLOBAL CONN_ID Pool_Size;
-GLOBAL long WCounter;
+
+#ifdef CONN_MODULE_GLOBAL_INIT
+CONNECTION *My_Connections;
+CONN_ID Pool_Size;
+long WCounter;
+#else
+extern CONNECTION *My_Connections;
+extern CONN_ID Pool_Size;
+extern long WCounter;
+#endif
+
#define CONNECTION2ID(x) (long)(x - My_Connections)
if (Class_AddMask(class, Req->argv[0],
timeout,
Req->argv[2])) {
- Log(LOG_NOTICE|LOG_snotice,
- "\"%s\" added \"%s\" to %c-Line list: \"%s\" (%ld seconds).",
- Client_Mask(from), Req->argv[0], class_c,
- Req->argv[2], atol(Req->argv[1]));
+ if (Client_Type(from) != CLIENT_SERVER)
+ Log(LOG_NOTICE|LOG_snotice,
+ "\"%s\" added \"%s\" to %c-Line list: \"%s\" (%ld seconds).",
+ Client_Mask(from), Req->argv[0], class_c,
+ Req->argv[2], atol(Req->argv[1]));
if (class == CLASS_GLINE) {
/* Inform other servers */
IRC_WriteStrServersPrefix(Client, from,
* Please read the file COPYING, README and AUTHORS for more information.
*/
+#define GLOBAL_INIT
#include "portab.h"
/**
#endif
#undef GLOBAL
+#ifdef GLOBAL_INIT
#define GLOBAL
+#else
+#define GLOBAL extern
+#endif
/* SPLint */