From 5486e65c14636f775bc5d746c977177f652c8084 Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Mon, 20 Nov 2000 21:05:43 +0000 Subject: [PATCH] Author: Kev Log message: Apply a bandaid to Iso's m_motd change; rewrite protocol_violation so that it actually works Testing done: Tested BURST with too few arguments--produced correct behavior. Am able to connect to the server as a user without coring it :) Status: Stable git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@310 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 10 ++++++++++ ircd/ircd_reply.c | 24 +++++++++++++----------- ircd/m_motd.c | 2 +- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0af5a67..22a6ab6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2000-11-20 Kevin L. Mitchell + + * ircd/ircd_reply.c (protocol_violation): rewrite + protocol_violation so it'll actually work + + * ircd/m_motd.c (m_motd): Iso's addition of get_client_class(sptr) + resulted in core dumps if NODEFAULTMOTD is defined, because m_motd + gets called from register_user with a NULL sptr. This is probably + a design problem, but this bandaid will do for now... + 2000-11-19 Isomer * ircd/ircd_reply.c: added 'protocol_violation', thus alerting us to problems in the server<->server protocol. diff --git a/ircd/ircd_reply.c b/ircd/ircd_reply.c index 5e33b1b..6e8cc6b 100644 --- a/ircd/ircd_reply.c +++ b/ircd/ircd_reply.c @@ -41,17 +41,19 @@ int protocol_violation(struct Client* cptr, const char* pattern, ...) { - va_list vl; - char buffer[512]; - assert(pattern); - assert(cptr); - va_start(vl,pattern); - ircd_snprintf(0,buffer,sizeof(buffer)-2, - "Protocol Violation from %C: %v",vl); - sendcmdto_flag_butone(&me, CMD_DESYNCH, NULL, FLAGS_DEBUG, - ":%s", cptr, buffer); - va_end(vl); - return 0; + struct VarData vd; + + assert(pattern); + assert(cptr); + + vd.vd_format = pattern; + va_start(vd.vd_args, pattern); + + sendcmdto_flag_butone(&me, CMD_DESYNCH, NULL, FLAGS_DEBUG, + ":Protocol Violation from %C: %v", cptr, &vd); + + va_end(vd.vd_args); + return 0; } int need_more_params(struct Client* cptr, const char* cmd) diff --git a/ircd/m_motd.c b/ircd/m_motd.c index 966a8b6..0eb2034 100644 --- a/ircd/m_motd.c +++ b/ircd/m_motd.c @@ -125,7 +125,7 @@ int m_motd(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) struct TRecord *ptr; int count; struct MotdItem *temp; - int class = get_client_class(sptr); + int class = get_client_class(cptr); #ifdef NODEFAULTMOTD int no_motd; -- 2.20.1