]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blobdiff - accountcollision.patch
oplevelforward.patch - revert to earlier fix + comments
[irc/quakenet/snircd-patchqueue.git] / accountcollision.patch
index f6aa8745f2a7e364e3e9b998070233466021588c..88c224d4ce1a871a9a631a2af7a99cee9469b363 100644 (file)
@@ -11,21 +11,21 @@ ircd/s_err.c
 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,
+diff -r aa908af5cc1f include/ircd_features.h
+--- a/include/ircd_features.h  Wed Jan 28 19:53:55 2009 +0100
++++ b/include/ircd_features.h  Wed Jan 28 20:14:05 2009 +0100
+@@ -102,6 +102,7 @@
    FEAT_AUTH_TIMEOUT,
    FEAT_ANNOUNCE_INVITES,
+   FEAT_WELCOME,
 +  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 @@
+diff -r aa908af5cc1f include/numeric.h
+--- a/include/numeric.h        Wed Jan 28 19:53:55 2009 +0100
++++ b/include/numeric.h        Wed Jan 28 20:14:05 2009 +0100
+@@ -362,6 +362,7 @@
  /*    ERR_NORULES          434   unreal */
  /*      ERR_SERVICECONFUSED  435 ? */
  /*    ERR_BANONCHAN        435   dalnet */
@@ -33,20 +33,20 @@ diff -r b193092040a9 include/numeric.h
  #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),
+diff -r aa908af5cc1f ircd/ircd_features.c
+--- a/ircd/ircd_features.c     Wed Jan 28 19:53:55 2009 +0100
++++ b/ircd/ircd_features.c     Wed Jan 28 20:14:05 2009 +0100
+@@ -356,6 +356,7 @@
    F_I(AUTH_TIMEOUT, 0, 9, 0),
    F_B(ANNOUNCE_INVITES, 0, 0, 0),
+   F_B(WELCOME, 0, 1, 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
+diff -r aa908af5cc1f ircd/m_account.c
+--- a/ircd/m_account.c Wed Jan 28 19:53:55 2009 +0100
++++ b/ircd/m_account.c Wed Jan 28 20:14:05 2009 +0100
 @@ -82,10 +82,12 @@
  
  #include "client.h"
@@ -60,9 +60,20 @@ diff -r b193092040a9 ircd/m_account.c
  #include "numnicks.h"
  #include "s_debug.h"
  #include "s_user.h"
-@@ -138,10 +140,34 @@
+@@ -113,6 +115,7 @@
+   time_t acc_create;
+   unsigned long acc_id;
+   unsigned long long acc_flags;
++  int diff_acc;
+   if (parc < 5)
+     return need_more_params(sptr, "ACCOUNT");
+@@ -136,12 +139,55 @@
+    * all other elements match
+    */
    if (IsAccount(acptr)) {
-     if (strcmp(cli_user(acptr)->account, parv[2]) || 
+-    if (strcmp(cli_user(acptr)->account, parv[2]) || 
++    if ((diff_acc = 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 "
@@ -72,23 +83,42 @@ diff -r b193092040a9 ircd/m_account.c
 +
 +      /* 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?
++       *       account and ID are the same
++       *       could we not resolve the conflict without KILL?
++       *       ie. oldest timestamp overrules?
 +       */
 +      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);
++        /* accounts differ */
++        if (diff_acc)
++          sendto_opmask_butone(0, SNO_OLDSNO,
++            "Account collision from %C on %C (%s <- %C %s (Different account))",
++            sptr, acptr, cli_user(acptr)->account, cptr, parv[2]);
++
++        /* account IDs differ */
++        else if (cli_user(acptr)->acc_id != acc_id)
++          sendto_opmask_butone(0, SNO_OLDSNO,
++            "Account collision from %C on %C (%lu <- %C %lu (Different ID))",
++            sptr, acptr,cli_user(acptr)->acc_id, cptr, acc_id);
++
++        /* timestamps differ */
++        else
++          sendto_opmask_butone(0, SNO_OLDSNO,
++            "Account collision from %C on %C (%Tu <- %C %Tu (Different timestamp))",
++            sptr, acptr, cli_user(acptr)->acc_create, cptr, acc_create);
++
 +        /* tell victim why we kill them */
-+        send_reply(acptr, ERR_ACCOUNTCOLLISION, parv[2]);
++        /* TODO: send the account we got here (parv[2]) or just a *? */
++        send_reply(acptr, ERR_ACCOUNTCOLLISION, "*");
++
 +        /* 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));
@@ -99,9 +129,9 @@ diff -r b193092040a9 ircd/m_account.c
  
      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
+diff -r aa908af5cc1f ircd/s_err.c
+--- a/ircd/s_err.c     Wed Jan 28 19:53:55 2009 +0100
++++ b/ircd/s_err.c     Wed Jan 28 20:14:05 2009 +0100
 @@ -902,7 +902,7 @@
  /* 434 */
    { 0 },