Module: ngircd.git
Branch: master
Commit: 5d88030bd1a197041f84530a88c2590e6bb1bbb1
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=5d88030b…
Author: Alexander Barton <alex(a)barton.de>
Date: Sat Jan 4 23:57:05 2014 +0100
Support non-standard vsnprintf() return code
C99 states that vsnprintf() "returns the number of characters that
would have been printed if the n were unlimited"; but according to the
Linux manual page "glibc until 2.0.6 would return -1 when the output
was truncated" -- so we have to handle both cases ...
---
src/ngircd/conn.c | 13 +++++++++++--
src/portab/portabtest.c | 25 ++++++++++++++++++++++---
2 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index 3f447c6..fef568e 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2013 Alexander Barton (alex(a)barton.de) and Contributors.
+ * Copyright (c)2001-2014 Alexander Barton (alex(a)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
@@ -984,6 +984,7 @@ va_dcl
size_t len;
bool ok;
va_list ap;
+ int r;
assert( Idx > NONE );
assert( Format != NULL );
@@ -993,7 +994,8 @@ va_dcl
#else
va_start( ap );
#endif
- if (vsnprintf( buffer, COMMAND_LEN - 2, Format, ap ) >= COMMAND_LEN - 2 ) {
+ r = vsnprintf(buffer, COMMAND_LEN - 2, Format, ap);
+ if (r >= COMMAND_LEN - 2 || r == -1) {
/*
* The string that should be written to the socket is longer
* than the allowed size of COMMAND_LEN bytes (including both
@@ -1014,6 +1016,13 @@ va_dcl
* an other server only routing the message!), so the only
* option left is to shorten the string and to hope that the
* result is still somewhat useful ...
+ *
+ * Note:
+ * C99 states that vsnprintf() "returns the number of characters
+ * that would have been printed if the n were unlimited"; but
+ * according to the Linux manual page "glibc until 2.0.6 would
+ * return -1 when the output was truncated" -- so we have to
+ * handle both cases ...
* -alex-
*/
diff --git a/src/portab/portabtest.c b/src/portab/portabtest.c
index 9e6bd22..b104739 100644
--- a/src/portab/portabtest.c
+++ b/src/portab/portabtest.c
@@ -139,16 +139,35 @@ va_dcl
{
char str[5];
va_list ap;
+ int r;
#ifdef PROTOTYPES
va_start(ap, Format);
#else
va_start(ap);
#endif
- if (vsnprintf(str, sizeof(str), Format, ap) != Len)
- Panic("vsnprintf return code");
+ r = vsnprintf(str, sizeof(str), Format, ap);
va_end(ap);
-
+ if (r != Len) {
+ /* C99 states that vsnprintf() "returns the number of
+ * characters that would have been printed if the n were
+ * unlimited", but according to the Linux manual page "glibc
+ * until 2.0.6 would return -1 when the output was truncated",
+ * and other implementations (libUTIL on A/UX) even return the
+ * number of characters processed ... so we only test our own
+ * implementation and warn on errors otherwise :-/ */
+#ifdef HAVE_VSNPRINTF
+ fprintf(stderr,
+ "\n ** WARNING: The vsnprintf() function of this system isn't standard\n");
+ fprintf(stderr,
+ " ** conformant and returns a WRONG result: %d (should be %d)! The test\n",
+ r, Len);
+ fprintf(stderr,
+ " ** result has been ignored but may lead to errors during execution!\n\n");
+#else
+ Panic("vsnprintf return code");
+#endif
+ }
if (str[4] != '\0')
Panic("vsnprintf NULL byte");
if (strlen(str) != 4)
Module: ngircd.git
Branch: master
Commit: 4d4512cd726ddec3d9aac7648cca00c59b8adfdf
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=4d4512cd…
Author: Alexander Barton <alex(a)barton.de>
Date: Thu Jan 2 18:36:18 2014 +0100
doc/Platforms.txt: Update some systems to ngIRCd 21
- update i686/pc/cygwin, gcc 4.8.2
- update x86_64/apple/darwin13.0.0, Apple clang 5.0
- update x86_64/unknown/freebsd8.4, gcc 4.2.1
- update x86_64/unknown/freebsd9.1, gcc 4.2.1
- update x86_64/unknown/linux-gnu, gcc 4.8.2
- update x86_64/unknown/linux-gnu, Open64
- update x86_64/unknown/openbsd4.8, gcc 4.2.1
- update x86_64/unknown/openbsd5.1, gcc 4.2.1
---
doc/Platforms.txt | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/doc/Platforms.txt b/doc/Platforms.txt
index 233d402..9dea717 100644
--- a/doc/Platforms.txt
+++ b/doc/Platforms.txt
@@ -59,7 +59,7 @@ i386/unknown/openbsd5.3 gcc 4.2.1 21 13-11-28 goetz Y Y Y Y 3
i386/unknown/openbsd5.4 gcc 4.2.1 21 13-11-28 goetz Y Y Y Y 3
i586/pc/haiku gcc 2.95.3 19.2~138 12-10-11 user Y Y N N
i586/pc/interix3.5 gcc 3.3 19 12-02-29 alex Y Y N Y
-i686/pc/cygwin gcc 3.3.1 0.8.0 04-05-30 alex Y Y N Y
+i686/pc/cygwin gcc 4.8.2 21 14-01-02 alex Y Y N Y
i686/pc/linux-gnu gcc 2.7.2 19.1 12-05-30 goetz Y Y Y Y 1
i686/pc/linux-gnu gcc 2.95.4 0.8.0 04-05-30 alex Y Y Y Y 1
i686/pc/linux-gnu gcc 3.3.5 14.1 09-08-04 alex Y Y Y Y 1
@@ -83,20 +83,20 @@ sparc/sun/solaris2.7 gcc 3.3 0.8.0 04-05-30 alex Y Y Y Y
sparc/unkn./netbsdelf1.6.1 gcc 2.95.3 0.8.0 04-05-30 alex Y Y Y Y
x86_64/apple/darwin10.8.0 gcc 4.2.1 21~rc2 13-10-30 alex Y Y Y Y 3
x86_64/apple/darwin12.3.0 gcc 4.2.1 20.2 13-04-01 alex Y Y Y Y 3
-x86_64/apple/darwin13.0.0 A-clang 5.0 21~rc2 13-10-20 alex Y Y Y Y 3
+x86_64/apple/darwin13.0.0 A-clang 5.0 21 14-01-02 alex Y Y Y Y 3
x86_64/unknown/dragonfly3.4 gcc 4.7.2 21 13-11-12 goetz Y Y N Y 3
-x86_64/unknown/freebsd8.4 gcc 4.2.1 21~rc2 13-10-27 alex Y Y Y Y 3
-x86_64/unknown/freebsd9.1 gcc 4.2.1 21~rc2 13-10-27 alex Y Y Y Y 3
+x86_64/unknown/freebsd8.4 gcc 4.2.1 21 14-01-02 alex Y Y Y Y 3
+x86_64/unknown/freebsd9.1 gcc 4.2.1 21 14-01-02 alex Y Y Y Y 3
x86_64/unkn./freebsd8.1-gnu gcc 4.4.5 19 12-02-26 alex Y Y Y Y 3
x86_64/unknown/linux-gnu clang 3.2 21~rc2 13-10-20 alex Y Y Y Y 1
-x86_64/unknown/linux-gnu gcc 4.8.1 21~rc2 13-10-20 alex Y Y Y Y 1
+x86_64/unknown/linux-gnu gcc 4.8.2 21 13-12-29 alex Y Y Y Y 1
x86_64/unknown/linux-gnu nwcc 0.8.2 21 13-12-01 goetz Y Y Y Y 1
-x86_64/unknown/linux-gnu Open64 20.3 13-10-16 goetz Y Y Y Y 1
+x86_64/unknown/linux-gnu Open64 21 13-11-30 goetz Y Y Y Y 1
x86_64/unknown/linux-gnu Sun C 5.12 21 13-11-22 goetz Y Y Y Y 1
x86_64/unknown/linux-gnu tcc 0.9.25 21 13-11-30 goetz Y Y Y Y 1
x86_64/unknown/openbsd4.7 gcc 3.3.5 20~rc1 12-02-26 alex Y Y Y Y 3
-x86_64/unknown/openbsd4.8 gcc 4.2.1 21~rc2 13-10-27 alex Y Y Y Y 3
-x86_64/unknown/openbsd5.1 gcc 4.2.1 21~rc2 13-10-27 alex Y Y Y Y 3
+x86_64/unknown/openbsd4.8 gcc 4.2.1 21 13-12-28 alex Y Y Y Y 3
+x86_64/unknown/openbsd5.1 gcc 4.2.1 21 13-12-28 alex Y Y Y Y 3
* Notes
Module: ngircd.git
Branch: master
Commit: 788da901ee3fa525a38dc99016d2612f6b945352
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=788da901…
Author: Alexander Barton <alex(a)barton.de>
Date: Thu Jan 2 15:27:07 2014 +0100
Update Copyright notices for 2014
---
AUTHORS | 2 +-
INSTALL | 2 +-
NEWS | 2 +-
README | 2 +-
contrib/MacOSX/ngIRCd.pmdoc/index.xml | 2 +-
src/ngircd/ngircd.c | 4 ++--
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 605df2d..a91c59e 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/
- (c)2001-2013 Alexander Barton and Contributors.
+ (c)2001-2014 Alexander Barton and Contributors.
ngIRCd is free software and published under the
terms of the GNU General Public License.
diff --git a/INSTALL b/INSTALL
index bbff1f2..998274a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/
- (c)2001-2013 Alexander Barton and Contributors.
+ (c)2001-2014 Alexander Barton and Contributors.
ngIRCd is free software and published under the
terms of the GNU General Public License.
diff --git a/NEWS b/NEWS
index 7cada91..accdbc6 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/
- (c)2001-2013 Alexander Barton and Contributors.
+ (c)2001-2014 Alexander Barton and Contributors.
ngIRCd is free software and published under the
terms of the GNU General Public License.
diff --git a/README b/README
index c903aa1..4bcafb2 100644
--- a/README
+++ b/README
@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/
- (c)2001-2013 Alexander Barton and Contributors.
+ (c)2001-2014 Alexander Barton and Contributors.
ngIRCd is free software and published under the
terms of the GNU General Public License.
diff --git a/contrib/MacOSX/ngIRCd.pmdoc/index.xml b/contrib/MacOSX/ngIRCd.pmdoc/index.xml
index 90e3aed..0c8cc55 100644
--- a/contrib/MacOSX/ngIRCd.pmdoc/index.xml
+++ b/contrib/MacOSX/ngIRCd.pmdoc/index.xml
@@ -5,7 +5,7 @@
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\qc\pardirnatural
\f0\i\fs24 \cf0 ngIRCd -- The Next Generation IRC Daemon\
-Copyright (c)2001-2013 Alexander Barton and Contributors.\
+Copyright (c)2001-2014 Alexander Barton and Contributors.\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
\i0 \cf0 \
diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c
index da53705..05f7a71 100644
--- a/src/ngircd/ngircd.c
+++ b/src/ngircd/ngircd.c
@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2013 Alexander Barton (alex(a)barton.de) and Contributors.
+ * Copyright (c)2001-2014 Alexander Barton (alex(a)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
@@ -460,7 +460,7 @@ static void
Show_Version( void )
{
puts( NGIRCd_Version );
- puts( "Copyright (c)2001-2013 Alexander Barton (<alex(a)barton.de>) and Contributors." );
+ puts( "Copyright (c)2001-2014 Alexander Barton (<alex(a)barton.de>) and Contributors." );
puts( "Homepage: <http://ngircd.barton.de/>\n" );
puts( "This is free software; see the source for copying conditions. There is NO" );
puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
Module: ngircd.git
Branch: master
Commit: 86bdf6e1d4539da1076afe10b57b177fb54dd147
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=86bdf6e1…
Author: Alexander Barton <alex(a)barton.de>
Date: Fri Dec 27 23:16:11 2013 +0100
Implement new configuration option "Network"
The new configuration variable "Network" is used to set the (completely
optional) "network name", to which this instance of the daemon belongs.
When set, this name is used in the ISUPPORT(005) numeric which is sent to
all clients connecting to the server after logging in.
Closes bug #165.
---
doc/sample-ngircd.conf.tmpl | 6 ++++++
man/ngircd.conf.5.tmpl | 6 ++++++
src/ngircd/conf.c | 16 ++++++++++++++++
src/ngircd/conf.h | 3 +++
src/ngircd/irc-info.c | 4 ++++
src/ngircd/messages.h | 1 +
6 files changed, 36 insertions(+)
diff --git a/doc/sample-ngircd.conf.tmpl b/doc/sample-ngircd.conf.tmpl
index 65da360..ec425bd 100644
--- a/doc/sample-ngircd.conf.tmpl
+++ b/doc/sample-ngircd.conf.tmpl
@@ -54,6 +54,12 @@
# A simple Phrase (<256 chars) if you don't want to use a motd file.
;MotdPhrase = "Hello world!"
+ # The name of the IRC network to which this server belongs. This name
+ # is optional, should only contain ASCII characters, and can't contain
+ # spaces. It is only used to inform clients. The default is empty,
+ # so no network name is announced to clients.
+ ;Network = aIRCnetwork
+
# Global password for all users needed to connect to the server.
# (Default: not set)
;Password = abc
diff --git a/man/ngircd.conf.5.tmpl b/man/ngircd.conf.5.tmpl
index 5ca6ee3..3de2fbe 100644
--- a/man/ngircd.conf.5.tmpl
+++ b/man/ngircd.conf.5.tmpl
@@ -126,6 +126,12 @@ configuration file.
\fBMotdPhrase\fR (string)
A simple Phrase (<256 chars) if you don't want to use a MOTD file.
.TP
+\fBNetwork\fR (string)
+The name of the IRC network to which this server belongs. This name is
+optional, should only contain ASCII characters, and can't contain spaces.
+It is only used to inform clients. The default is empty, so no network
+name is announced to clients.
+.TP
\fBPassword\fR (string)
Global password for all users needed to connect to the server. The default is
empty, so no password is required. Please note: This feature is not available
diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c
index 1627587..bdbb506 100644
--- a/src/ngircd/conf.c
+++ b/src/ngircd/conf.c
@@ -369,6 +369,7 @@ Conf_Test( void )
printf(" MotdPhrase = %s\n", array_bytes(&Conf_Motd)
? (const char*) array_start(&Conf_Motd) : "");
}
+ printf(" Network = %s\n", Conf_Network);
#ifndef PAM
printf(" Password = %s\n", Conf_ServerPwd);
#endif
@@ -749,6 +750,7 @@ Set_Defaults(bool InitServers)
strcpy(Conf_ServerAdminMail, "");
snprintf(Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s",
PACKAGE_NAME, PACKAGE_VERSION);
+ strcpy(Conf_Network, "");
free(Conf_ListenAddress);
Conf_ListenAddress = NULL;
array_free(&Conf_ListenPorts);
@@ -1409,6 +1411,7 @@ Handle_GLOBAL(const char *File, int Line, char *Var, char *Arg )
struct group *grp;
size_t len;
const char *section;
+ char *ptr;
assert(File != NULL);
assert(Line > 0);
@@ -1491,6 +1494,19 @@ Handle_GLOBAL(const char *File, int Line, char *Var, char *Arg )
Using_MotdFile = false;
return;
}
+ if (strcasecmp(Var, "Network") == 0) {
+ len = strlcpy(Conf_Network, Arg, sizeof(Conf_Network));
+ if (len >= sizeof(Conf_Network))
+ Config_Error_TooLong(File, Line, Var);
+ ptr = strchr(Conf_Network, ' ');
+ if (ptr) {
+ Config_Error(LOG_WARNING,
+ "%s, line %d: \"Network\" can't contain spaces!",
+ File, Line);
+ *ptr = '\0';
+ }
+ return;
+ }
if(strcasecmp(Var, "Password") == 0) {
len = strlcpy(Conf_ServerPwd, Arg, sizeof(Conf_ServerPwd));
if (len >= sizeof(Conf_ServerPwd))
diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h
index 02d2331..aa80b8d 100644
--- a/src/ngircd/conf.h
+++ b/src/ngircd/conf.h
@@ -109,6 +109,9 @@ GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
+/** Network name (optional, no spaces allowed) */
+GLOBAL char Conf_Network[CLIENT_INFO_LEN];
+
/** Message of the day (MOTD) of this server */
GLOBAL array Conf_Motd;
diff --git a/src/ngircd/irc-info.c b/src/ngircd/irc-info.c
index 56cae2a..aa98a5b 100644
--- a/src/ngircd/irc-info.c
+++ b/src/ngircd/irc-info.c
@@ -1539,6 +1539,10 @@ IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan)
GLOBAL bool
IRC_Send_ISUPPORT(CLIENT * Client)
{
+ if (Conf_Network[0] && !IRC_WriteStrClient(Client, RPL_ISUPPORTNET_MSG,
+ Client_ID(Client),
+ Conf_Network))
+ return DISCONNECTED;
if (!IRC_WriteStrClient(Client, RPL_ISUPPORT1_MSG, Client_ID(Client),
CHANTYPES, CHANTYPES, Conf_MaxJoins))
return DISCONNECTED;
diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h
index 53b9658..f3a0ba4 100644
--- a/src/ngircd/messages.h
+++ b/src/ngircd/messages.h
@@ -21,6 +21,7 @@
#define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
#define RPL_CREATED_MSG "003 %s :This server has been started %s"
#define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s"
+#define RPL_ISUPPORTNET_MSG "005 %s NETWORK=%s :is my network name"
#define RPL_ISUPPORT1_MSG "005 %s RFC2812 IRCD=ngIRCd CHARSET=UTF-8 CASEMAPPING=ascii PREFIX=(qaohv)~&@%%+ CHANTYPES=%s CHANMODES=beI,k,l,imMnOPQRstVz CHANLIMIT=%s:%d :are supported on this server"
#define RPL_ISUPPORT2_MSG "005 %s CHANNELLEN=%d NICKLEN=%d TOPICLEN=%d AWAYLEN=%d KICKLEN=%d MODES=%d MAXLIST=beI:%d EXCEPTS=e INVEX=I PENALTY :are supported on this server"