ChangeLog | 16 +++++++++++++++ NEWS | 6 +++++ README | 10 ++++---- contrib/Debian/changelog | 6 +++++ contrib/ngircd.spec | 2 +- doc/Makefile.am | 6 ++-- man/ngircd.8.tmpl | 23 ++++++++++++++------- man/ngircd.conf.5.tmpl | 12 ++++------ src/ngircd/channel.c | 11 ++++++++++ src/ngircd/channel.h | 2 + src/ngircd/conf.c | 14 ++++++++++-- src/ngircd/conn.c | 17 +++++++++++---- src/ngircd/irc-mode.c | 13 ++++++++++- src/ngircd/log.c | 47 ---------------------------------------------- src/ngircd/messages.h | 1 + src/ngircd/ngircd.c | 5 ---- 16 files changed, 105 insertions(+), 86 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83cdfd5..93206ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,22 @@ -- ChangeLog -- +ngIRCd Release 17.1 (2010-12-19) + + - --configtest: remember if MOTD is configured by file or phrase + - Enhance log messages when establishing server links a little bit + - Reset ID of outgoing server link on DNS error correctly + - Don't log critical (or worse) messages to stderr + - Manual page ngircd(8): add SIGNALS section + - Manual pages: update and simplyfy AUTHORS section + - Remove "error file" when compiled with debug code enabled + - README: Updated list of implemented commands + - add doc/README-Interix.txt and doc/Bopm.txt to distribution tarball + - Merge branch 'numeric-329' + - add doc/PAM.txt to distribution tarball + - New numeric 329: get channel creation time on "MODE #chan" commands + - Save channel creation time; new function Channel_CreationTime() + ngIRCd Release 17 (2010-11-07) - doc: change path names in sample-ngircd.conf depending on sysconfdir diff --git a/NEWS b/NEWS index 47cb72d..9524e8b 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,12 @@ -- NEWS -- +ngIRCd Release 17.1 (2010-12-19) + + - Don't log critical (or worse) messages to stderr + - Remove "error file" when compiled with debug code enabled + - New numeric 329: get channel creation time on "MODE #chan" commands + ngIRCd Release 17 (2010-11-07) - doc: change path names in sample-ngircd.conf depending on sysconfdir diff --git a/README b/README index dc11a9f..1feedfe 100644 --- a/README +++ b/README @@ -34,11 +34,11 @@ used in real IRC networks. Implemented IRC-commands are: -ADMIN, AWAY, CHANINFO, CONNECT, DIE, DISCONNECT, ERROR, HELP, INVITE, ISON, -JOIN, KICK, KILL, LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, NOTICE, -OPER, PART, PASS, PING, PONG, PRIVMSG, QUIT, REHASH, RESTART, SERVER, SQUIT, -STATS, TIME, TOPIC, TRACE, USER, USERHOST, VERSION, WALLOPS, WHO, WHOIS, -WHOWAS. +ADMIN, AWAY, CHANINFO, CONNECT, DIE, DISCONNECT, ERROR, HELP, INFO, INVITE, +ISON, JOIN, KICK, KILL, LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, +NOTICE, OPER, PART, PASS, PING, PONG, PRIVMSG, QUIT, REHASH, RESTART, SERVER, +SERVICE, SERVLIST, SQUERY, SQUIT, STATS, SUMMON, TIME, TOPIC, TRACE, USER, +USERHOST, USERS, VERSION, WALLOPS, WEBIRC, WHO, WHOIS, WHOWAS. III. Features (or: why use ngIRCd?) diff --git a/contrib/Debian/changelog b/contrib/Debian/changelog index 907a31a..06e9194 100644 --- a/contrib/Debian/changelog +++ b/contrib/Debian/changelog @@ -1,3 +1,9 @@ +ngircd (17.1-0ab1) unstable; urgency=low + + * New "upstream" release: ngIRCd 17.1. + + -- Alexander Barton Sun, 19 Dec 2010 15:56:42 +0100 + ngircd (17-0ab1) unstable; urgency=low * New "upstream" release: ngIRCd 17. diff --git a/contrib/ngircd.spec b/contrib/ngircd.spec index 5240c88..da0c2f7 100644 --- a/contrib/ngircd.spec +++ b/contrib/ngircd.spec @@ -1,5 +1,5 @@ %define name ngircd -%define version 17 +%define version 17.1 %define release 1 %define prefix %{_prefix} diff --git a/doc/Makefile.am b/doc/Makefile.am index 4b20e70..6a8578f 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -17,9 +17,9 @@ SUFFIXES = .tmpl -static_docs = FAQ.txt GIT.txt Protocol.txt Platforms.txt README-AUX.txt \ - README-BeOS.txt RFC.txt Services.txt SSL.txt Zeroconf.txt \ - HowToRelease.txt +static_docs = Bopm.txt FAQ.txt GIT.txt HowToRelease.txt PAM.txt Platforms.txt \ + Protocol.txt README-AUX.txt README-BeOS.txt README-Interix.txt RFC.txt \ + SSL.txt Services.txt Zeroconf.txt doc_templates = sample-ngircd.conf.tmpl diff --git a/man/ngircd.8.tmpl b/man/ngircd.8.tmpl index bd5b67d..4a01d71 100644 --- a/man/ngircd.8.tmpl +++ b/man/ngircd.8.tmpl @@ -1,7 +1,7 @@ .\" .\" ngircd(8) manual page template .\" -.TH ngircd 8 "Dec 2008" ngircd "ngIRCd Manual" +.TH ngircd 8 "Dec 2010" ngircd "ngIRCd Manual" .SH NAME ngIRCd \- the next generation IRC daemon .SH SYNOPSIS @@ -64,17 +64,24 @@ The system wide default configuration file. .RS Default "message of the day" (MOTD). .RE +.SH SIGNALS +The daemon understands the following signals: +.TP +\fBTERM\fR +Shut down all conections and terminate the daemon. +.TP +\fBHUP\fR +Shut down all listening sockets, re-read the configuration file and +re-initialize the daemon. .SH HINTS It's wise to use "ngircd \-\-configtest" to validate the configuration file after changing it. -.SH AUTHOR -Alexander Barton, -.UR mailto:alex@barton.de -.UE +.SH AUTHORS +Alexander Barton, .br -Homepage: -.UR http://ngircd.barton.de/ -.UE +Florian Westphal, +.PP +Homepage: http://ngircd.barton.de/ .SH "SEE ALSO" .BR ngircd.conf (5), .BR ircd (8) diff --git a/man/ngircd.conf.5.tmpl b/man/ngircd.conf.5.tmpl index 2645729..8fa7623 100644 --- a/man/ngircd.conf.5.tmpl +++ b/man/ngircd.conf.5.tmpl @@ -1,7 +1,7 @@ .\" .\" ngircd.conf(5) manual page template .\" -.TH ngircd.conf 5 "Dec 2008" ngircd "ngIRCd Manual" +.TH ngircd.conf 5 "Dec 2010" ngircd "ngIRCd Manual" .SH NAME ngircd.conf \- configuration file of ngIRCd .SH SYNOPSIS @@ -406,13 +406,11 @@ after changing it. See .BR ngircd (8) for details. .SH AUTHOR -Alexander Barton, -.UR mailto:alex@barton.de -.UE +Alexander Barton, .br -Homepage: -.UR http://ngircd.barton.de/ -.UE +Florian Westphal, +.PP +Homepage: http://ngircd.barton.de/ .SH "SEE ALSO" .BR ngircd (8) .\" diff --git a/src/ngircd/channel.c b/src/ngircd/channel.c index 175f23b..edbbc38 100644 --- a/src/ngircd/channel.c +++ b/src/ngircd/channel.c @@ -697,6 +697,14 @@ Channel_TopicWho(CHANNEL *Chan) return Chan->topic_who; } /* Channel_TopicWho */ + +GLOBAL unsigned int +Channel_CreationTime(CHANNEL *Chan) +{ + assert(Chan != NULL); + return (unsigned int) Chan->creation_time; +} /* Channel_CreationTime */ + #endif @@ -834,6 +842,9 @@ Channel_Create( const char *Name ) strlcpy( c->name, Name, sizeof( c->name )); c->hash = Hash( c->name ); c->next = My_Channels; +#ifndef STRICT_RFC + c->creation_time = time(NULL); +#endif My_Channels = c; LogDebug("Created new channel structure for \"%s\".", Name); return c; diff --git a/src/ngircd/channel.h b/src/ngircd/channel.h index 46e7e13..030f910 100644 --- a/src/ngircd/channel.h +++ b/src/ngircd/channel.h @@ -30,6 +30,7 @@ typedef struct _CHANNEL char modes[CHANNEL_MODE_LEN]; /* Channel modes */ array topic; /* Topic of the channel */ #ifndef STRICT_RFC + time_t creation_time; /* Channel creation time */ time_t topic_time; /* Time when topic was set */ char topic_who[CLIENT_NICK_LEN];/* Nickname of user that set topic */ #endif @@ -118,6 +119,7 @@ GLOBAL CHANNEL *Channel_Create PARAMS(( const char *Name )); #ifndef STRICT_RFC GLOBAL unsigned int Channel_TopicTime PARAMS(( CHANNEL *Chan )); GLOBAL char *Channel_TopicWho PARAMS(( CHANNEL *Chan )); +GLOBAL unsigned int Channel_CreationTime PARAMS(( CHANNEL *Chan )); #endif GLOBAL bool Channel_AddInvite PARAMS((CHANNEL *c, const char *Mask, bool OnlyOnce )); diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index 4804f2b..4a255b2 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -49,7 +49,7 @@ #include "conf.h" -static bool Use_Log = true; +static bool Use_Log = true, Using_MotdFile = true; static CONF_SERVER New_Server; static int New_Server_Idx; @@ -300,8 +300,14 @@ Conf_Test( void ) printf(" AdminInfo1 = %s\n", Conf_ServerAdmin1); printf(" AdminInfo2 = %s\n", Conf_ServerAdmin2); printf(" AdminEMail = %s\n", Conf_ServerAdminMail); - printf(" MotdFile = %s\n", Conf_MotdFile); - printf(" MotdPhrase = %.32s\n", array_bytes(&Conf_Motd) ? (const char*) array_start(&Conf_Motd) : ""); + if (Using_MotdFile) { + printf(" MotdFile = %s\n", Conf_MotdFile); + printf(" MotdPhrase =\n"); + } else { + printf(" MotdFile = \n"); + printf(" MotdPhrase = %s\n", array_bytes(&Conf_Motd) + ? (const char*) array_start(&Conf_Motd) : ""); + } printf(" ChrootDir = %s\n", Conf_Chroot); printf(" PidFile = %s\n", Conf_PidFile); printf(" Listen = %s\n", Conf_ListenAddress); @@ -649,6 +655,7 @@ Read_Motd(const char *filename) } array_free(&Conf_Motd); + Using_MotdFile = true; while (fgets(line, (int)sizeof line, fp)) { ngt_TrimLastChr( line, '\n'); @@ -951,6 +958,7 @@ Handle_GLOBAL( int Line, char *Var, char *Arg ) if (!array_copyb(&Conf_Motd, Arg, len + 1)) Config_Error(LOG_WARNING, "%s, line %d: Could not append MotdPhrase: %s", NGIRCd_ConfFile, Line, strerror(errno)); + Using_MotdFile = false; return; } if( strcasecmp( Var, "ChrootDir" ) == 0 ) { diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 2d5e129..9daca85 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -1774,6 +1774,9 @@ Check_Servers(void) } /* Okay, try to connect now */ + Log(LOG_NOTICE, + "Preparing to establish a new server link for \"%s\" ...", + Conf_Server[i].name); Conf_Server[i].lasttry = time_now; Conf_Server[i].conn_id = SERVER_WAIT; assert(Proc_GetPipeFd(&Conf_Server[i].res_stat) < 0); @@ -1798,8 +1801,9 @@ New_Server( int Server , ng_ipaddr_t *dest) return; } - Log( LOG_INFO, "Establishing connection to \"%s\", %s, port %d ... ", - Conf_Server[Server].host, ip_str, Conf_Server[Server].port ); + Log(LOG_INFO, "Establishing connection for \"%s\" to \"%s\" (%s) port %d ... ", + Conf_Server[Server].name, Conf_Server[Server].host, ip_str, + Conf_Server[Server].port); af_dest = ng_ipaddr_af(dest); new_sock = socket(af_dest, SOCK_STREAM, 0); @@ -1931,8 +1935,8 @@ Init_Socket( int Sock ) LogDebug("Setting IP_TOS on socket %d to IPTOS_LOWDELAY.", Sock); if (setsockopt(Sock, IPPROTO_IP, IP_TOS, &value, (socklen_t) sizeof(value))) { - Log(LOG_ERR, "Can't set socket option IP_TOS: %s!", - strerror(errno)); + LogDebug("Can't set socket option IP_TOS: %s!", + strerror(errno)); /* ignore this error */ } #endif @@ -1968,8 +1972,11 @@ cb_Connect_to_Server(int fd, UNUSED short events) /* Read result from pipe */ len = Proc_Read(&Conf_Server[i].res_stat, dest_addrs, sizeof(dest_addrs)); - if (len == 0) + if (len == 0) { + /* Error resolving hostname: reset server structure */ + Conf_Server[i].conn_id = NONE; return; + } assert((len % sizeof(ng_ipaddr_t)) == 0); diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c index df464a7..a4c1d89 100644 --- a/src/ngircd/irc-mode.c +++ b/src/ngircd/irc-mode.c @@ -294,8 +294,17 @@ Channel_Mode_Answer_Request(CLIENT *Origin, CHANNEL *Channel) if (the_args[0]) strlcat(the_modes, the_args, sizeof(the_modes)); - return IRC_WriteStrClient(Origin, RPL_CHANNELMODEIS_MSG, - Client_ID(Origin), Channel_Name(Channel), the_modes); + if (!IRC_WriteStrClient(Origin, RPL_CHANNELMODEIS_MSG, + Client_ID(Origin), Channel_Name(Channel), + the_modes)) + return DISCONNECTED; +#ifndef STRICT_RFC + if (!IRC_WriteStrClient(Origin, RPL_CREATIONTIME_MSG, + Client_ID(Origin), Channel_Name(Channel), + Channel_CreationTime(Channel))) + return DISCONNECTED; +#endif + return CONNECTED; } diff --git a/src/ngircd/log.c b/src/ngircd/log.c index 3710142..0bc53ed 100644 --- a/src/ngircd/log.c +++ b/src/ngircd/log.c @@ -45,10 +45,6 @@ static char Init_Txt[127]; static bool Is_Daemon; -#ifdef DEBUG -static char Error_File[FNAME_LEN]; -#endif - static void Log_Message(int Level, const char *msg) @@ -107,51 +103,14 @@ Log_Init( bool Daemon_Mode ) } #endif if( Init_Txt[0] ) Log( LOG_INFO, "Activating: %s.", Init_Txt ); - -#ifdef DEBUG - Error_File[0] = '\0'; -#endif } /* Log_Init */ -#ifdef DEBUG -GLOBAL void -Log_InitErrorfile( void ) -{ - snprintf( Error_File, sizeof Error_File, "%s/%s-%ld.err", ERROR_DIR, PACKAGE_NAME, (long)getpid( )); - - fflush( stderr ); - if( ! freopen( Error_File, "w", stderr )) - { - Log( LOG_ERR, "Can't reopen stderr (\"%s\"): %s", Error_File, strerror( errno )); - return; - } - - fputs( ctime( &NGIRCd_Start ), stderr ); - fprintf( stderr, "%s started.\n", NGIRCd_Version ); - fprintf( stderr, "Activating: %s\n\n", Init_Txt[0] ? Init_Txt : "-" ); - fflush( stderr ); - - Log(LOG_DEBUG, "Redirected stderr to \"%s\".", Error_File); -} /* Log_InitErrfile */ -#endif - - GLOBAL void Log_Exit( void ) { - /* Good Bye! */ Log(LOG_NOTICE, "%s done%s, served %lu connections.", PACKAGE_NAME, NGIRCd_SignalRestart ? " (restarting)" : "", Conn_CountAccepted()); - -#ifdef DEBUG - if( Error_File[0] ) - { - /* Error-File (stderr) loeschen */ - if( unlink( Error_File ) != 0 ) Log( LOG_ERR, "Can't delete \"%s\": %s", Error_File, strerror( errno )); - } -#endif - #ifdef SYSLOG closelog(); #endif @@ -246,12 +205,6 @@ va_dcl Log_Message(Level, msg); - if (Level <= LOG_CRIT) { - /* log critical messages to stderr */ - fprintf(stderr, "%s\n", msg); - fflush(stderr); - } - if (snotice) { /* Send NOTICE to all local users with mode +s and to the * local &SERVER channel */ diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h index 03ddc36..900d2ff 100644 --- a/src/ngircd/messages.h +++ b/src/ngircd/messages.h @@ -65,6 +65,7 @@ #define RPL_LIST_MSG "322 %s %s %ld :%s" #define RPL_LISTEND_MSG "323 %s :End of LIST" #define RPL_CHANNELMODEIS_MSG "324 %s %s +%s" +#define RPL_CREATIONTIME_MSG "329 %s %s %ld" #define RPL_NOTOPIC_MSG "331 %s %s :No topic is set" #define RPL_TOPIC_MSG "332 %s %s :%s" #define RPL_TOPICSETBY_MSG "333 %s %s %s %u" diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c index d4d4d5f..6dfd206 100644 --- a/src/ngircd/ngircd.c +++ b/src/ngircd/ngircd.c @@ -285,11 +285,6 @@ main( int argc, const char *argv[] ) #endif Conn_Init( ); -#ifdef DEBUG - /* Redirect stderr handle to "error file" for debugging - * when not running in "no daemon" mode: */ - if( ! NGIRCd_NoDaemon ) Log_InitErrorfile( ); -#endif if (!io_library_init(CONNECTION_POOL)) { Log(LOG_ALERT, "Fatal: Cannot initialize IO routines: %s", strerror(errno)); exit(1);