From 4137c21c963affbdc4d26c2e0b28460551b1863e Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sat, 6 Sep 2008 15:13:28 +0200 Subject: [PATCH] Close the link that sends an invalid UID. It does not make sense to send a kill using an invlid identifier to an obviously broken server, as was previously done. --- modules/core/m_nick.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index 7d0996c..292d5ca 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -404,6 +404,7 @@ ms_uid(struct Client *client_p, struct Client *source_p, int parc, const char *p { struct Client *target_p; time_t newts = 0; + char squitreason[120]; newts = atol(parv[3]); @@ -425,6 +426,15 @@ ms_uid(struct Client *client_p, struct Client *source_p, int parc, const char *p return 0; } + if(!clean_uid(parv[8])) + { + rb_snprintf(squitreason, sizeof squitreason, + "Invalid UID %s for nick %s on %s", + parv[8], parv[1], source_p->name); + exit_client(client_p, client_p, client_p, squitreason); + return 0; + } + if(!clean_username(parv[5]) || !clean_host(parv[6])) { ServerStats.is_kill++; @@ -435,16 +445,6 @@ ms_uid(struct Client *client_p, struct Client *source_p, int parc, const char *p return 0; } - if(!clean_uid(parv[8])) - { - ServerStats.is_kill++; - sendto_realops_snomask(SNO_DEBUG, L_ALL, - "Bad UID: %s From: %s(via %s)", - parv[8], source_p->name, client_p->name); - sendto_one(client_p, ":%s KILL %s :%s (Bad UID)", me.id, parv[8], me.name); - return 0; - } - /* check length of clients gecos */ if(strlen(parv[9]) > REALLEN) { @@ -492,6 +492,7 @@ ms_euid(struct Client *client_p, struct Client *source_p, int parc, const char * { struct Client *target_p; time_t newts = 0; + char squitreason[120]; newts = atol(parv[3]); @@ -513,6 +514,15 @@ ms_euid(struct Client *client_p, struct Client *source_p, int parc, const char * return 0; } + if(!clean_uid(parv[8])) + { + rb_snprintf(squitreason, sizeof squitreason, + "Invalid UID %s for nick %s on %s", + parv[8], parv[1], source_p->name); + exit_client(client_p, client_p, client_p, squitreason); + return 0; + } + if(!clean_username(parv[5]) || !clean_host(parv[6])) { ServerStats.is_kill++; @@ -523,16 +533,6 @@ ms_euid(struct Client *client_p, struct Client *source_p, int parc, const char * return 0; } - if(!clean_uid(parv[8])) - { - ServerStats.is_kill++; - sendto_realops_snomask(SNO_DEBUG, L_ALL, - "Bad UID: %s From: %s(via %s)", - parv[8], source_p->name, client_p->name); - sendto_one(client_p, ":%s KILL %s :%s (Bad UID)", me.id, parv[8], me.name); - return 0; - } - if(strcmp(parv[9], "*") && !clean_host(parv[9])) { ServerStats.is_kill++;