Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2006-01-07 00:54:20 UTC

Modified files:
  Tag: u2_10_12_branch
     ChangeLog ircd/convert-conf.c ircd/m_join.c

Log message:

Completely wipe out inappropriately resurrected channels.
Fix off-by-one bug in convert-conf.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.57 ircu2.10/ChangeLog:1.710.2.58
--- ircu2.10/ChangeLog:1.710.2.57       Tue Jan  3 18:23:58 2006
+++ ircu2.10/ChangeLog  Fri Jan  6 16:54:09 2006
@@ -1,3 +1,11 @@
+2006-01-06  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/m_join.c (ms_join): Wipe out all modes (not just chanops)
+       when replacing a resurrected channel.
+
+       * ircd/convert-conf.c (dupstring): Fix probable off-by-one size
+       passed to memcpy().
+
 2006-01-03  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/channel.c (modebuf_flush_int): Also send timestamp when &me
Index: ircu2.10/ircd/convert-conf.c
diff -u ircu2.10/ircd/convert-conf.c:1.2.2.5 
ircu2.10/ircd/convert-conf.c:1.2.2.6
--- ircu2.10/ircd/convert-conf.c:1.2.2.5        Fri Dec 30 17:38:24 2005
+++ ircu2.10/ircd/convert-conf.c        Fri Jan  6 16:54:09 2006
@@ -100,7 +100,7 @@
     fputs("};\n", stdout);
 }
 
-#define dupstring(TARGET, SOURCE) do { free(TARGET); if (SOURCE) { size_t len 
= strlen(SOURCE); (TARGET) = malloc(len+1); memcpy((TARGET), (SOURCE), len); } 
else (TARGET) = 0; } while(0)
+#define dupstring(TARGET, SOURCE) do { free(TARGET); if (SOURCE) { size_t len 
= strlen(SOURCE) + 1; (TARGET) = malloc(len); memcpy((TARGET), (SOURCE), len); 
} else (TARGET) = 0; } while(0)
 
 /*** MANAGING LISTS OF STRINGS ***/
 
Index: ircu2.10/ircd/m_join.c
diff -u ircu2.10/ircd/m_join.c:1.34.2.7 ircu2.10/ircd/m_join.c:1.34.2.8
--- ircu2.10/ircd/m_join.c:1.34.2.7     Fri Dec 23 09:12:06 2005
+++ ircu2.10/ircd/m_join.c      Fri Jan  6 16:54:09 2006
@@ -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.34.2.7 2005/12/23 17:12:06 klmitch Exp $
+ * $Id: m_join.c,v 1.34.2.8 2006/01/07 00:54:09 entrope Exp $
  */
 
 #include "config.h"
@@ -364,7 +364,7 @@
          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.
+         clear all modes 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.
@@ -381,17 +381,42 @@
         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);
+        /* Wipe out the current modes on the channel. */
+        modebuf_init(&mbuf, sptr, cptr, chptr, MODEBUF_DEST_CHANNEL | 
MODEBUF_DEST_HACK3);
+
+        modebuf_mode(&mbuf, MODE_DEL | chptr->mode.mode);
+        chptr->mode.mode &= MODE_BURSTADDED | MODE_WASDELJOINS;
+
+        if (chptr->mode.limit) {
+          modebuf_mode_uint(&mbuf, MODE_DEL | MODE_LIMIT, chptr->mode.limit);
+          chptr->mode.limit = 0;
+        }
+
+        if (chptr->mode.key[0]) {
+          modebuf_mode_string(&mbuf, MODE_DEL | MODE_KEY, chptr->mode.key, 0);
+          chptr->mode.key[0] = '\0';
+        }
+
+        if (chptr->mode.upass[0]) {
+          modebuf_mode_string(&mbuf, MODE_DEL | MODE_UPASS, chptr->mode.upass, 
0);
+          chptr->mode.upass[0] = '\0';
+        }
+
+        if (chptr->mode.apass[0]) {
+          modebuf_mode_string(&mbuf, MODE_DEL | MODE_APASS, chptr->mode.apass, 
0);
+          chptr->mode.apass[0] = '\0';
+        }
+
         for (member = chptr->members; member; member = member->next_member)
         {
           if (IsChanOp(member)) {
             modebuf_mode_client(&mbuf, MODE_DEL | MODE_CHANOP, member->user, 
OpLevel(member));
            member->status &= ~CHFL_CHANOP;
          }
+          if (HasVoice(member)) {
+            modebuf_mode_client(&mbuf, MODE_DEL | MODE_VOICE, member->user, 
OpLevel(member));
+           member->status &= ~CHFL_VOICE;
+          }
         }
         modebuf_flush(&mbuf);
       }
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to