Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-12-13 23:51:35 UTC

Modified files:
     ChangeLog ircd/m_join.c

Log message:

Fix a possible net ride.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.752 ircu2.10/ChangeLog:1.753
--- ircu2.10/ChangeLog:1.752    Tue Dec 13 15:38:39 2005
+++ ircu2.10/ChangeLog  Tue Dec 13 15:51:25 2005
@@ -1,5 +1,11 @@
 2005-12-13  Michael Poole <[EMAIL PROTECTED]>
 
+       * ircd/m_join.c (ms_join): Prevent net rides allowed by moving the
+       channel timestamp backwards in time without deopping current ops.
+       (Reported by Wouter Coekaerts.)
+
+2005-12-13  Michael Poole <[EMAIL PROTECTED]>
+
        * doc/example.conf: Remove extraneous "Other" Client block.
 
        * ircd/convert-conf.c (finish_operators): Fix operator precedence
Index: ircu2.10/ircd/m_join.c
diff -u ircu2.10/ircd/m_join.c:1.40 ircu2.10/ircd/m_join.c:1.41
--- ircu2.10/ircd/m_join.c:1.40 Sun Nov 27 18:17:29 2005
+++ ircu2.10/ircd/m_join.c      Tue Dec 13 15:51:25 2005
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_join.c,v 1.40 2005/11/28 02:17:29 entrope Exp $
+ * $Id: m_join.c,v 1.41 2005/12/13 23:51:25 entrope Exp $
  */
 
 #include "config.h"
@@ -363,9 +363,37 @@
          by one when someone joins an existing, but empty, channel.
          However, this is only necessary when the channel is still
          empty (also here) and when this channel doesn't have +A set.
+
+         To prevent this from allowing net-rides on the channel, we
+         clear all ops from the channel.
+
+         (Scenario for a net ride: c1 - s1 - s2 - c2, with c1 the only
+         user in the channel; c1 parts and rejoins, gaining ops.
+         Before s2 sees c1's part, c2 joins the channel and parts
+         immediately.  s1 sees c1 part, c1 create, c2 join, c2 part;
+         c2's join resets the timestamp.  s2 sees c2 join, c2 part, c1
+         part, c1 create; but since s2 sees the channel as a zannel or
+         non-existent, it does not bounce the create with the newer
+         timestamp.)
       */
       if (creation && creation - ((!chptr->mode.apass[0] && chptr->users == 0) 
? 1 : 0) <= chptr->creationtime)
+      {
+        struct Membership *member;
+        struct ModeBuf mbuf;
+
        chptr->creationtime = creation;
+        /* Deop the current ops.  (This will go in both directions on
+         * the network, and revise the channel timestamp as it goes,
+         * avoiding further traffic due to the JOIN.)
+         */
+        modebuf_init(&mbuf, sptr, cptr, chptr, MODEBUF_DEST_CHANNEL | 
MODEBUF_DEST_HACK3 | MODEBUF_DEST_SERVER);
+        for (member = chptr->members; member; member = member->next_member)
+        {
+          if (IsChanOp(member))
+            modebuf_mode_client(&mbuf, MODE_DEL | MODE_CHANOP, member->user, 
OpLevel(member));
+        }
+        modebuf_flush(&mbuf);
+      }
     }
 
     joinbuf_join(&join, chptr, flags);
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to