[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Possible exit_client / m_quit modification?
- To: ircd-users@xxxxxxx
- Subject: Possible exit_client / m_quit modification?
- From: wnelson <wnelson@xxxxxxxxxxxxxx>
- Date: Thu, 30 Sep 1999 00:59:17 +0100
- Delivered-to: ircd-users-out@irc.org
- Delivered-to: ircd-users@irc.org
In the current exit_client procedure, there is a section headed as
follows:
/*
** Try to guess from comment if the client is exiting
** normally (KILL or issued QUIT), or if it is splitting
** It requires comment for splitting users to be
** "server.some.where splitting.some.where"
*/
Under the existing implementation, this little sequence is performed
even on remote client's quit comments. As far as I can tell, no fake
quit messages are allowed from clients on even the oldest IRCD versions
on IRCnet, and in any case genuine quits due to netsplits do not invoke
this section of code anyway. Would it not save a little on CPU if this
check was only done on QUIT messages from local clients, rather than
every exiting client on the network?
I've moved (to m_quit) the section which disallows clients to fake a
netsplit, and run some tests on a small network involving normal quits,
squit quits, etc. - and (as far as I can tell) this modification does
not affect nick/channel delay functionality.
Anyways - here's a diff of the modifications I made.
Wull@IRCnet.
diff -rcN irc2.10.3/ircd/s_misc.c irc2.10.3.quitchange/ircd/s_misc.c
*** irc2.10.3/ircd/s_misc.c Wed Jul 21 23:57:40 1999
--- irc2.10.3.quitchange/ircd/s_misc.c Wed Sep 29 23:37:38 1999
***************
*** 542,592 ****
exit_one_client(cptr, acptr, &me, comment1);
}
}
-
- /*
- ** Try to guess from comment if the client is exiting
- ** normally (KILL or issued QUIT), or if it is splitting
- ** It requires comment for splitting users to be
- ** "server.some.where splitting.some.where"
- */
- comment1[0] = '\0';
- if (!IsServer(sptr) && ((sptr->flags & FLAGS_KILLED) == 0))
- {
- char *c = comment;
- int i = 0;
- while (*c && *c != ' ')
- if (*c++ == '.')
- i++;
- if (*c++ && i)
- {
- i = 0;
- while (*c && *c != ' ')
- if (*c++ == '.')
- i++;
- if (!i || *c)
- sptr->flags |= FLAGS_QUIT;
- }
- else
- sptr->flags |= FLAGS_QUIT;
! if (sptr == cptr && !(sptr->flags & FLAGS_QUIT))
! {
! /*
! ** This will avoid nick delay to be abused by
! ** letting local users put a comment looking
! ** like a server split.
! */
! strncpyzt(comment1, comment, HOSTLEN + HOSTLEN);
! strcat(comment1, " ");
! sptr->flags |= FLAGS_QUIT;
! }
! }
!
! if (IsServer(sptr) && (cptr == sptr))
! sendto_flag(SCH_SERVER, "Sending SQUIT %s (%s)",
! cptr->name, comment);
!
! exit_one_client(cptr, sptr, from, (*comment1) ? comment1 : comment);
return cptr == sptr ? FLUSH_BUFFER : 0;
}
--- 542,558 ----
exit_one_client(cptr, acptr, &me, comment1);
}
}
! if (IsServer(sptr))
! {
! if (cptr == sptr)
! sendto_flag(SCH_SERVER, "Sending SQUIT %s (%s)",
! cptr->name, comment);
! }
! else
! sptr->flags |= FLAGS_QUIT;
!
! exit_one_client(cptr, sptr, from, comment);
return cptr == sptr ? FLUSH_BUFFER : 0;
}
***************
*** 605,611 ****
Reg Link *lp;
/*
! ** For a server or user quitting, propagage the information to
** other servers (except to the one where is came from (cptr))
*/
if (IsMe(sptr))
--- 571,577 ----
Reg Link *lp;
/*
! ** For a server or user quitting, propagate the information to
** other servers (except to the one where is came from (cptr))
*/
if (IsMe(sptr))
diff -rcN irc2.10.3/ircd/s_user.c irc2.10.3.quitchange/ircd/s_user.c
*** irc2.10.3/ircd/s_user.c Sat Jul 17 12:47:50 1999
--- irc2.10.3.quitchange/ircd/s_user.c Wed Sep 29 23:53:28 1999
***************
*** 1887,1900 ****
{
static char quitc[] = "I Quit";
register char *comment = (parc > 1 && parv[1]) ? parv[1] : quitc;
if (MyClient(sptr) || MyService(sptr))
if (!strncmp("Local Kill", comment, 10) ||
!strncmp(comment, "Killed", 6))
comment = quitc;
! if (strlen(comment) > (size_t) TOPICLEN)
! comment[TOPICLEN] = '\0';
! return IsServer(sptr) ? 0 : exit_client(cptr, sptr, sptr, comment);
}
/*
--- 1887,1927 ----
{
static char quitc[] = "I Quit";
register char *comment = (parc > 1 && parv[1]) ? parv[1] : quitc;
+ char comment1[HOSTLEN + HOSTLEN + 2];
+ comment1[0] = '\0';
+ if (strlen(comment) > (size_t) TOPICLEN)
+ comment[TOPICLEN] = '\0';
if (MyClient(sptr) || MyService(sptr))
+ {
if (!strncmp("Local Kill", comment, 10) ||
!strncmp(comment, "Killed", 6))
comment = quitc;
! else
! {
! /*
! ** This will avoid nick delay being abused by
! ** local users putting a comment looking
! ** like a server split.
! */
! char *c = comment;
! int i = 0;
! while (*c && *c != ' ')
! if (*c++ == '.')
! i++;
! if (*c++ && i)
! {
! i = 0;
! while (*c && *c != ' ')
! if (*c++ == '.')
! i++;
! if (i && !*c)
! strncpyzt(comment1, comment, HOSTLEN + HOSTLEN);
! strcat(comment1, " ");
! }
! }
! }
! return IsServer(sptr) ? 0 : exit_client(cptr, sptr, sptr, (*comment1) ? comment1 : comment);
}
/*