]>
Commit | Line | Data |
---|---|---|
1 | Add account collision kills, controlled by feature ACCOUNT_COLLISION_KILLS | |
2 | ||
3 | include/ircd_features.h | |
4 | ircd/ircd_features.c | |
5 | add new feature | |
6 | ||
7 | include/numeric.h | |
8 | ircd/s_err.c | |
9 | add new numerc 435 ERR_ACCOUNTCOLLISION (mirrored after 436 ERR_NICKCOLLISION) | |
10 | ||
11 | ircd/m_account.c | |
12 | add the account collision kills | |
13 | ||
14 | diff -r 4599c781548c include/ircd_features.h | |
15 | --- a/include/ircd_features.h Tue Jan 27 18:15:32 2009 +0100 | |
16 | +++ b/include/ircd_features.h Tue Jan 27 18:19:05 2009 +0100 | |
17 | @@ -102,6 +102,7 @@ | |
18 | FEAT_AUTH_TIMEOUT, | |
19 | FEAT_ANNOUNCE_INVITES, | |
20 | FEAT_WELCOME, | |
21 | + FEAT_ACCOUNT_COLLISION_KILLS, | |
22 | ||
23 | /* features that affect all operators */ | |
24 | FEAT_EXTENDED_CHECKCMD, | |
25 | diff -r 4599c781548c include/numeric.h | |
26 | --- a/include/numeric.h Tue Jan 27 18:15:32 2009 +0100 | |
27 | +++ b/include/numeric.h Tue Jan 27 18:19:05 2009 +0100 | |
28 | @@ -358,6 +358,7 @@ | |
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 4599c781548c ircd/ircd_features.c | |
37 | --- a/ircd/ircd_features.c Tue Jan 27 18:15:32 2009 +0100 | |
38 | +++ b/ircd/ircd_features.c Tue Jan 27 18:19:05 2009 +0100 | |
39 | @@ -356,6 +356,7 @@ | |
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), | |
44 | ||
45 | /* features that affect all operators */ | |
46 | F_B(EXTENDED_CHECKCMD, 0, 0, 0), | |
47 | diff -r 4599c781548c ircd/m_account.c | |
48 | --- a/ircd/m_account.c Tue Jan 27 18:15:32 2009 +0100 | |
49 | +++ b/ircd/m_account.c Tue Jan 27 18:19:05 2009 +0100 | |
50 | @@ -82,10 +82,12 @@ | |
51 | ||
52 | #include "client.h" | |
53 | #include "ircd.h" | |
54 | +#include "ircd_features.h" | |
55 | #include "ircd_log.h" | |
56 | #include "ircd_reply.h" | |
57 | #include "ircd_string.h" | |
58 | #include "msg.h" | |
59 | +#include "numeric.h" | |
60 | #include "numnicks.h" | |
61 | #include "s_debug.h" | |
62 | #include "s_user.h" | |
63 | @@ -138,10 +140,45 @@ | |
64 | if (IsAccount(acptr)) { | |
65 | if (strcmp(cli_user(acptr)->account, parv[2]) || | |
66 | (cli_user(acptr)->acc_create != acc_create) || | |
67 | - (cli_user(acptr)->acc_id != acc_id)) | |
68 | - return protocol_violation(cptr, "ACCOUNT for already registered user %s " | |
69 | - "(%s -> %s)", cli_name(acptr), | |
70 | - cli_user(acptr)->account, parv[2]); | |
71 | + (cli_user(acptr)->acc_id != acc_id)) { | |
72 | + | |
73 | + /* license to KILL for account collisions */ | |
74 | + /* TODO: what if just the timestamp differs? | |
75 | + * account and ID are the same | |
76 | + * could we not resolve the conflict without KILL? | |
77 | + * ie. oldest timestamp overrules? | |
78 | + */ | |
79 | + if (feature_bool(FEAT_ACCOUNT_COLLISION_KILLS)) { | |
80 | + /* inform ops */ | |
81 | + if (strcmp(cli_user(acptr)->account, parv[2])) | |
82 | + sendto_opmask_butone(0, SNO_OLDSNO, | |
83 | + "Account collision from %C on %C (%s <- %C %s (Different account))", | |
84 | + sptr, acptr, cli_user(acptr)->account, cptr, parv[2]); | |
85 | + else if (cli_user(acptr)->acc_id != acc_id) | |
86 | + sendto_opmask_butone(0, SNO_OLDSNO, | |
87 | + "Account collision from %C on %C (%lu <- %C %lu (Different ID))", | |
88 | + sptr, acptr,cli_user(acptr)->acc_id, cptr, acc_id); | |
89 | + else | |
90 | + sendto_opmask_butone(0, SNO_OLDSNO, | |
91 | + "Account collision from %C on %C (%Tu <- %C %Tu (Different timestamp))", | |
92 | + sptr, acptr, cli_user(acptr)->acc_create, cptr, acc_create); | |
93 | + | |
94 | + /* tell victim why we kill them */ | |
95 | + /* TODO: send the account we got here (parv[2]) or just a *? */ | |
96 | + send_reply(acptr, ERR_ACCOUNTCOLLISION, "*"); | |
97 | + /* Inform the rest of the net... */ | |
98 | + ServerStats->is_kill++; | |
99 | + sendcmdto_serv_butone(&me, CMD_KILL, 0, "%C :%s (account collision)", | |
100 | + acptr, cli_name(&me)); | |
101 | + /* don't go sending off a QUIT message... */ | |
102 | + SetFlag(acptr, FLAG_KILLED); | |
103 | + /* remove them locally. */ | |
104 | + return exit_client_msg(cptr, acptr, &me, "Killed (%s (account collision))", | |
105 | + feature_str(FEAT_HIS_SERVERNAME)); | |
106 | + } else | |
107 | + return protocol_violation(cptr, "ACCOUNT for already registered user %s " | |
108 | + "(%s -> %s)", cli_name(acptr), cli_user(acptr)->account, parv[2]); | |
109 | + } | |
110 | ||
111 | cli_user(acptr)->acc_flags = acc_flags; | |
112 | ||
113 | diff -r 4599c781548c ircd/s_err.c | |
114 | --- a/ircd/s_err.c Tue Jan 27 18:15:32 2009 +0100 | |
115 | +++ b/ircd/s_err.c Tue Jan 27 18:19:05 2009 +0100 | |
116 | @@ -902,7 +902,7 @@ | |
117 | /* 434 */ | |
118 | { 0 }, | |
119 | /* 435 */ | |
120 | - { 0 }, | |
121 | + { ERR_ACCOUNTCOLLISION, "%s :Account collision KILL", "435" }, | |
122 | /* 436 */ | |
123 | { ERR_NICKCOLLISION, "%s :Nickname collision KILL", "436" }, | |
124 | /* 437 */ |