From bdaf53e799541bef5911f7793b901b2a5d56330a Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sat, 28 Feb 2004 02:18:16 +0000 Subject: [PATCH] Fixed TRACE: don't output "Serv" lines for ourself; display more info. --- ChangeLog | 3 ++- src/ngircd/irc.c | 12 ++++++------ src/ngircd/messages.h | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 940dce24..ab898ecd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ ngIRCd CVSHEAD + - Fixed TRACE: don't output "Serv" lines for ourself; display more info. - Results of the resolver (hostnames and IDENT names) are discarded after the client is successfully registered with the server. - Better logging while establishing and shutting down connections. @@ -504,4 +505,4 @@ ngIRCd 0.0.1, 31.12.2001 -- -$Id: ChangeLog,v 1.227 2004/02/28 02:01:01 alex Exp $ +$Id: ChangeLog,v 1.228 2004/02/28 02:18:16 alex Exp $ diff --git a/src/ngircd/irc.c b/src/ngircd/irc.c index a4355dd4..8d7f6d37 100644 --- a/src/ngircd/irc.c +++ b/src/ngircd/irc.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) + * Copyright (c)2001-2004 Alexander Barton * * 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 @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc.c,v 1.123 2003/12/26 15:55:07 alex Exp $"; +static char UNUSED id[] = "$Id: irc.c,v 1.124 2004/02/28 02:18:16 alex Exp $"; #include "imp.h" #include @@ -210,6 +210,7 @@ IRC_TRACE( CLIENT *Client, REQUEST *Req ) { CLIENT *from, *target, *c; CONN_ID idx, idx2; + CHAR user[CLIENT_USER_LEN]; assert( Client != NULL ); assert( Req != NULL ); @@ -251,7 +252,9 @@ IRC_TRACE( CLIENT *Client, REQUEST *Req ) if( Client_Type( c ) == CLIENT_SERVER ) { /* Server link */ - if( ! IRC_WriteStrClient( from, RPL_TRACESERVER_MSG, Client_ID( from ), Client_ID( c ), Client_Mask( c ), Option_String( Client_Conn( c )))) return DISCONNECTED; + strlcpy( user, Client_User( c ), sizeof( user )); + if( user[0] == '~' ) strlcpy( user, "unknown", sizeof( user )); + if( ! IRC_WriteStrClient( from, RPL_TRACESERVER_MSG, Client_ID( from ), Client_ID( c ), user, Client_Hostname( c ), Client_Mask( Client_ThisServer( )), Option_String( Client_Conn( c )))) return DISCONNECTED; } if(( Client_Type( c ) == CLIENT_USER ) && ( strchr( Client_Modes( c ), 'o' ))) { @@ -262,9 +265,6 @@ IRC_TRACE( CLIENT *Client, REQUEST *Req ) c = Client_Next( c ); } - /* Some information about us */ - if( ! IRC_WriteStrClient( from, RPL_TRACESERVER_MSG, Client_ID( from ), Conf_ServerName, Client_Mask( Client_ThisServer( )), Option_String( Client_Conn( Client )))) return DISCONNECTED; - IRC_SetPenalty( Client, 3 ); return IRC_WriteStrClient( from, RPL_TRACEEND_MSG, Client_ID( from ), Conf_ServerName, PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel ); } /* IRC_TRACE */ diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h index 3ac479e8..c6847cf4 100644 --- a/src/ngircd/messages.h +++ b/src/ngircd/messages.h @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) + * Copyright (c)2001-2004 Alexander Barton * * 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 @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: messages.h,v 1.65 2003/12/26 15:55:07 alex Exp $ + * $Id: messages.h,v 1.66 2004/02/28 02:18:16 alex Exp $ * * IRC numerics (Header) */ @@ -26,7 +26,7 @@ #define RPL_TRACELINK_MSG "200 %s Link %s-%s %s %s V%s %ld %d %d" #define RPL_TRACEOPERATOR_MSG "204 %s Oper 2 :%s" -#define RPL_TRACESERVER_MSG "206 %s Serv 1 0S 0C %s *!*@%s :V%s" +#define RPL_TRACESERVER_MSG "206 %s Serv 1 0S 0C %s[%s@%s] *!*@%s :V%s" #define RPL_STATSLINKINFO_MSG "211 %s %s %d %ld %ld %ld %ld :%ld" #define RPL_STATSCOMMANDS_MSG "212 %s %s %ld %ld %ld" #define RPL_ENDOFSTATS_MSG "219 %s %c :End of STATS report"