]> jfr.im git - irc/quakenet/snircd-patchqueue.git/commitdiff
add: accountcollision.patch
authorwiebe <redacted>
Fri, 23 Jan 2009 14:15:06 +0000 (15:15 +0100)
committerwiebe <redacted>
Fri, 23 Jan 2009 14:15:06 +0000 (15:15 +0100)
accountcollision.patch [new file with mode: 0644]
series

diff --git a/accountcollision.patch b/accountcollision.patch
new file mode 100644 (file)
index 0000000..f6aa874
--- /dev/null
@@ -0,0 +1,113 @@
+Add account collision kills, controlled by feature ACCOUNT_COLLISION_KILLS
+
+include/ircd_features.h
+ircd/ircd_features.c
+  add new feature
+
+include/numeric.h
+ircd/s_err.c
+  add new numerc 435 ERR_ACCOUNTCOLLISION (mirrored after 436 ERR_NICKCOLLISION)
+
+ircd/m_account.c
+  add the account collision kills
+
+diff -r b193092040a9 include/ircd_features.h
+--- a/include/ircd_features.h  Fri Jan 23 12:53:22 2009 +0100
++++ b/include/ircd_features.h  Fri Jan 23 15:08:41 2009 +0100
+@@ -101,6 +101,7 @@
+   FEAT_IRCD_RES_TIMEOUT,
+   FEAT_AUTH_TIMEOUT,
+   FEAT_ANNOUNCE_INVITES,
++  FEAT_ACCOUNT_COLLISION_KILLS,
+   /* features that affect all operators */
+   FEAT_EXTENDED_CHECKCMD,
+diff -r b193092040a9 include/numeric.h
+--- a/include/numeric.h        Fri Jan 23 12:53:22 2009 +0100
++++ b/include/numeric.h        Fri Jan 23 15:08:41 2009 +0100
+@@ -357,6 +357,7 @@
+ /*    ERR_NORULES          434   unreal */
+ /*      ERR_SERVICECONFUSED  435 ? */
+ /*    ERR_BANONCHAN        435   dalnet */
++#define ERR_ACCOUNTCOLLISION 435        /* QuakeNet extension */
+ #define ERR_NICKCOLLISION    436
+ #define ERR_BANNICKCHANGE    437        /* Undernet extension */
+      /* ERR_UNAVAILRESOURCE  437           IRCnet extension */
+diff -r b193092040a9 ircd/ircd_features.c
+--- a/ircd/ircd_features.c     Fri Jan 23 12:53:22 2009 +0100
++++ b/ircd/ircd_features.c     Fri Jan 23 15:08:41 2009 +0100
+@@ -355,6 +355,7 @@
+   F_I(IRCD_RES_TIMEOUT, 0, 4, 0),
+   F_I(AUTH_TIMEOUT, 0, 9, 0),
+   F_B(ANNOUNCE_INVITES, 0, 0, 0),
++  F_B(ACCOUNT_COLLISION_KILLS, 0, 0, 0),
+   /* features that affect all operators */
+   F_B(EXTENDED_CHECKCMD, 0, 0, 0),
+diff -r b193092040a9 ircd/m_account.c
+--- a/ircd/m_account.c Fri Jan 23 12:53:22 2009 +0100
++++ b/ircd/m_account.c Fri Jan 23 15:08:41 2009 +0100
+@@ -82,10 +82,12 @@
+ #include "client.h"
+ #include "ircd.h"
++#include "ircd_features.h"
+ #include "ircd_log.h"
+ #include "ircd_reply.h"
+ #include "ircd_string.h"
+ #include "msg.h"
++#include "numeric.h"
+ #include "numnicks.h"
+ #include "s_debug.h"
+ #include "s_user.h"
+@@ -138,10 +140,34 @@
+   if (IsAccount(acptr)) {
+     if (strcmp(cli_user(acptr)->account, parv[2]) || 
+         (cli_user(acptr)->acc_create != acc_create) ||
+-        (cli_user(acptr)->acc_id != acc_id))
+-      return protocol_violation(cptr, "ACCOUNT for already registered user %s "
+-                              "(%s -> %s)", cli_name(acptr),
+-                              cli_user(acptr)->account, parv[2]);
++        (cli_user(acptr)->acc_id != acc_id)) {
++
++      /* license to KILL for account collisions */
++      /* TODO: what if just the timestamp differs?
++       * account and ID are the same
++       * could we not resolve the conflict without KILL?
++       */
++      if (feature_bool(FEAT_ACCOUNT_COLLISION_KILLS)) {
++        /* inform ops */
++        sendto_opmask_butone(0, SNO_OLDSNO,
++          "Account collision from %C on %C (%s:%Tu:%lu <- %C %s:%Tu:%lu)", sptr, acptr,
++          cli_user(acptr)->account, cli_user(acptr)->acc_create, cli_user(acptr)->acc_id,
++          cptr, parv[2], acc_create, acc_id);
++        /* tell victim why we kill them */
++        send_reply(acptr, ERR_ACCOUNTCOLLISION, parv[2]);
++        /* Inform the rest of the net... */
++        ServerStats->is_kill++;
++        sendcmdto_serv_butone(&me, CMD_KILL, 0, "%C :%s (account collision)",
++          acptr, cli_name(&me));
++        /* don't go sending off a QUIT message... */
++        SetFlag(acptr, FLAG_KILLED);
++        /* remove them locally. */
++        return exit_client_msg(cptr, acptr, &me, "Killed (%s (account collision))",
++          feature_str(FEAT_HIS_SERVERNAME));
++      } else
++        return protocol_violation(cptr, "ACCOUNT for already registered user %s "
++          "(%s -> %s)", cli_name(acptr), cli_user(acptr)->account, parv[2]);
++       }
+     cli_user(acptr)->acc_flags = acc_flags;
+diff -r b193092040a9 ircd/s_err.c
+--- a/ircd/s_err.c     Fri Jan 23 12:53:22 2009 +0100
++++ b/ircd/s_err.c     Fri Jan 23 15:08:41 2009 +0100
+@@ -902,7 +902,7 @@
+ /* 434 */
+   { 0 },
+ /* 435 */
+-  { 0 },
++  { ERR_ACCOUNTCOLLISION, "%s :Account collision KILL", "435" },
+ /* 436 */
+   { ERR_NICKCOLLISION, "%s :Nickname collision KILL", "436" },
+ /* 437 */
diff --git a/series b/series
index 656c9bda60a509f18b64d7e538fb63fbd0a3eca3..5c1af6082674d0968aeedcf46e194f41286f29de 100644 (file)
--- a/series
+++ b/series
@@ -25,4 +25,5 @@ burstwhotopic.patch
 opernowildbadchan.patch
 operglinenick.patch
 operping.patch
+accountcollision.patch
 split.patch