Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2006-03-19 04:04:05 UTC

Modified files:
  Tag: u2_10_12_branch
     ircd/channel.c ChangeLog

Log message:

Fix bug #1444405 by allowing other servers to overwrite keys and Upass.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.80 ircu2.10/ChangeLog:1.710.2.81
--- ircu2.10/ChangeLog:1.710.2.80       Sat Mar 18 07:52:57 2006
+++ ircu2.10/ChangeLog  Sat Mar 18 20:03:55 2006
@@ -1,5 +1,14 @@
 2006-06-18  Michael Poole <[EMAIL PROTECTED]>
 
+       * ircd/channel.c (mode_parse_key): Outside of burst, allow
+       overwriting of keys by a service when a key is already set.
+       (mode_parse_upass): Likewise.  Instead, ignore new Upass during
+       burst if it is lexicographically greater than the current one.
+       (mode_parse_apas): Likewise for Apass, but only allow overwiting
+       an existing Apass in a BURST.
+
+2006-06-18  Michael Poole <[EMAIL PROTECTED]>
+
        * ircd/channel.c (modebuf_flush_int): Fix typo about changing
        oplevels.  Send correct channel TS for modes to other servers.
        (mode_parse): Accept timestamps on modes from users on other
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.155.2.13 ircu2.10/ircd/channel.c:1.155.2.14
--- ircu2.10/ircd/channel.c:1.155.2.13  Sat Mar 18 07:52:58 2006
+++ ircu2.10/ircd/channel.c     Sat Mar 18 20:03:55 2006
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Channel management and maintenance
- * @version $Id: channel.c,v 1.155.2.13 2006/03/18 15:52:58 entrope Exp $
+ * @version $Id: channel.c,v 1.155.2.14 2006/03/19 04:03:55 entrope Exp $
  */
 #include "config.h"
 
@@ -2390,8 +2390,7 @@
   if (state->flags & MODE_PARSE_SET) {
     if (state->dir == MODE_DEL) /* remove the old key */
       *state->chptr->mode.key = '\0';
-    else if (!state->chptr->mode.key[0]
-             || ircd_strcmp(t_str, state->chptr->mode.key) < 0)
+    else
       ircd_strncpy(state->chptr->mode.key, t_str, KEYLEN);
   }
 }
@@ -2485,6 +2484,13 @@
       !ircd_strcmp(state->chptr->mode.upass, t_str))
     return; /* no upass change */
 
+  /* Skip if this is a burst, we have a Upass already and the new Upass is
+   * after the old one alphabetically */
+  if ((state->flags & MODE_PARSE_BURST) &&
+      *(state->chptr->mode.upass) &&
+      ircd_strcmp(state->chptr->mode.upass, t_str) <= 0)
+    return;
+
   if (state->flags & MODE_PARSE_BOUNCE) {
     if (*state->chptr->mode.upass) /* reset old upass */
       modebuf_mode_string(state->mbuf, MODE_DEL | flag_p[0],
@@ -2497,8 +2503,7 @@
   if (state->flags & MODE_PARSE_SET) {
     if (state->dir == MODE_DEL) /* remove the old upass */
       *state->chptr->mode.upass = '\0';
-    else if (state->chptr->mode.upass[0] == '\0'
-             || ircd_strcmp(t_str, state->chptr->mode.upass) < 0)
+    else
       ircd_strncpy(state->chptr->mode.upass, t_str, KEYLEN);
   }
 }
@@ -2596,6 +2601,13 @@
       !ircd_strcmp(state->chptr->mode.apass, t_str))
     return; /* no apass change */
 
+  /* Skip if this is a burst, we have an Apass already and the new Apass is
+   * after the old one alphabetically */
+  if ((state->flags & MODE_PARSE_BURST) &&
+      *(state->chptr->mode.apass) &&
+      ircd_strcmp(state->chptr->mode.apass, t_str) <= 0)
+    return;
+
   if (state->flags & MODE_PARSE_BOUNCE) {
     if (*state->chptr->mode.apass) /* reset old apass */
       modebuf_mode_string(state->mbuf, MODE_DEL | flag_p[0],
@@ -2607,12 +2619,10 @@
 
   if (state->flags & MODE_PARSE_SET) {
     if (state->dir == MODE_ADD) { /* set the new apass */
-      /* Only accept the new apass if there is no current apass
-       * (e.g. when a user sets it) or the new one is "less" than the
-       * old (for resolving conflicts during burst).
-       */
-      if (state->chptr->mode.apass[0] == '\0'
-          || ircd_strcmp(t_str, state->chptr->mode.apass) < 0)
+      /* Only accept the new apass if there is no current apass or
+       * this is a BURST. */
+      if (state->chptr->mode.apass[0] == '\0' ||
+          (state->flags & MODE_PARSE_BURST))
         ircd_strncpy(state->chptr->mode.apass, t_str, KEYLEN);
       /* Make it VERY clear to the user that this is a one-time password */
       if (MyUser(state->sptr)) {
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to