1 Add account collision kills, controlled by feature ACCOUNT_COLLISION_KILLS
3 include/ircd_features.h
9 add new numerc 435 ERR_ACCOUNTCOLLISION (mirrored after 436 ERR_NICKCOLLISION)
12 add the account collision kills
14 diff -r aa908af5cc1f include/ircd_features.h
15 --- a/include/ircd_features.h Wed Jan 28 19:53:55 2009 +0100
16 +++ b/include/ircd_features.h Wed Jan 28 20:14:05 2009 +0100
19 FEAT_ANNOUNCE_INVITES,
21 + FEAT_ACCOUNT_COLLISION_KILLS,
23 /* features that affect all operators */
24 FEAT_EXTENDED_CHECKCMD,
25 diff -r aa908af5cc1f include/numeric.h
26 --- a/include/numeric.h Wed Jan 28 19:53:55 2009 +0100
27 +++ b/include/numeric.h Wed Jan 28 20:14:05 2009 +0100
29 /* ERR_NORULES 434 unreal */
30 /* ERR_SERVICECONFUSED 435 ? */
31 /* ERR_BANONCHAN 435 dalnet */
32 +#define ERR_ACCOUNTCOLLISION 435 /* QuakeNet extension */
33 #define ERR_NICKCOLLISION 436
34 #define ERR_BANNICKCHANGE 437 /* Undernet extension */
35 /* ERR_UNAVAILRESOURCE 437 IRCnet extension */
36 diff -r aa908af5cc1f ircd/ircd_features.c
37 --- a/ircd/ircd_features.c Wed Jan 28 19:53:55 2009 +0100
38 +++ b/ircd/ircd_features.c Wed Jan 28 20:14:05 2009 +0100
40 F_I(AUTH_TIMEOUT, 0, 9, 0),
41 F_B(ANNOUNCE_INVITES, 0, 0, 0),
42 F_B(WELCOME, 0, 1, 0),
43 + F_B(ACCOUNT_COLLISION_KILLS, 0, 0, 0),
45 /* features that affect all operators */
46 F_B(EXTENDED_CHECKCMD, 0, 0, 0),
47 diff -r aa908af5cc1f ircd/m_account.c
48 --- a/ircd/m_account.c Wed Jan 28 19:53:55 2009 +0100
49 +++ b/ircd/m_account.c Wed Jan 28 20:14:05 2009 +0100
54 +#include "ircd_features.h"
56 #include "ircd_reply.h"
57 #include "ircd_string.h"
66 unsigned long long acc_flags;
70 return need_more_params(sptr, "ACCOUNT");
72 * all other elements match
74 if (IsAccount(acptr)) {
75 - if (strcmp(cli_user(acptr)->account, parv[2]) ||
76 + if ((diff_acc = strcmp(cli_user(acptr)->account, parv[2])) ||
77 (cli_user(acptr)->acc_create != acc_create) ||
78 - (cli_user(acptr)->acc_id != acc_id))
79 - return protocol_violation(cptr, "ACCOUNT for already registered user %s "
80 - "(%s -> %s)", cli_name(acptr),
81 - cli_user(acptr)->account, parv[2]);
82 + (cli_user(acptr)->acc_id != acc_id)) {
84 + /* license to KILL for account collisions */
85 + /* TODO: what if just the timestamp differs?
86 + * account and ID are the same
87 + * could we not resolve the conflict without KILL?
88 + * ie. oldest timestamp overrules?
90 + if (feature_bool(FEAT_ACCOUNT_COLLISION_KILLS)) {
92 + /* accounts differ */
94 + sendto_opmask_butone(0, SNO_OLDSNO,
95 + "Account collision from %C on %C (%s <- %C %s (Different account))",
96 + sptr, acptr, cli_user(acptr)->account, cptr, parv[2]);
98 + /* account IDs differ */
99 + else if (cli_user(acptr)->acc_id != acc_id)
100 + sendto_opmask_butone(0, SNO_OLDSNO,
101 + "Account collision from %C on %C (%lu <- %C %lu (Different ID))",
102 + sptr, acptr,cli_user(acptr)->acc_id, cptr, acc_id);
104 + /* timestamps differ */
106 + sendto_opmask_butone(0, SNO_OLDSNO,
107 + "Account collision from %C on %C (%Tu <- %C %Tu (Different timestamp))",
108 + sptr, acptr, cli_user(acptr)->acc_create, cptr, acc_create);
110 + /* tell victim why we kill them */
111 + /* TODO: send the account we got here (parv[2]) or just a *? */
112 + send_reply(acptr, ERR_ACCOUNTCOLLISION, "*");
114 + /* Inform the rest of the net... */
115 + ServerStats->is_kill++;
116 + sendcmdto_serv_butone(&me, CMD_KILL, 0, "%C :%s (account collision)",
117 + acptr, cli_name(&me));
119 + /* don't go sending off a QUIT message... */
120 + SetFlag(acptr, FLAG_KILLED);
122 + /* remove them locally. */
123 + return exit_client_msg(cptr, acptr, &me, "Killed (%s (account collision))",
124 + feature_str(FEAT_HIS_SERVERNAME));
126 + return protocol_violation(cptr, "ACCOUNT for already registered user %s "
127 + "(%s -> %s)", cli_name(acptr), cli_user(acptr)->account, parv[2]);
130 cli_user(acptr)->acc_flags = acc_flags;
132 diff -r aa908af5cc1f ircd/s_err.c
133 --- a/ircd/s_err.c Wed Jan 28 19:53:55 2009 +0100
134 +++ b/ircd/s_err.c Wed Jan 28 20:14:05 2009 +0100
140 + { ERR_ACCOUNTCOLLISION, "%s :Account collision KILL", "435" },
142 { ERR_NICKCOLLISION, "%s :Nickname collision KILL", "436" },