Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2004-12-17 22:41:13 UTC

Modified files:
     ChangeLog ircd/channel.c ircd/ircd_parser.y ircd/m_server.c
     ircd/s_conf.c

Log message:

Make UWorld servers work when not directly connected to them.  Fix a
channel destruction error that would lead to opless channels.  Fix an
attempted free() of an uninitialized pointer.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.517 ircu2.10/ChangeLog:1.518
--- ircu2.10/ChangeLog:1.517    Wed Dec 15 20:37:13 2004
+++ ircu2.10/ChangeLog  Fri Dec 17 14:41:02 2004
@@ -1,3 +1,21 @@
+2004-12-17  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/channel.c (sub1_from_channel): Immediately destroy
+       non-Apass channels when oplevels are enabled; otherwise, they can
+       stay opless for a considerable period.
+       (mode_parse_ban): Initialize banstr to NULL so that set_ban_mask()
+       does not try to free() an invalid pointer.
+
+       * ircd/ircd_parser.y (uworldblock): Put UWorld server name into
+       aconf->host, not aconf->name.
+
+       * ircd/m_server.c (mr_server, ms_server): Attach CONF_UWORLD items
+       by host here..
+
+       * ircd/s_conf.c (conf_check_server): .. rather than by name here.
+       (attach_conf_uworld): New function to attach CONF_UWORLD items.
+       (rehash): Use attach_conf_uworld() instead of attaching by name.
+
 2004-12-15  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/m_topic.c (do_settopic): Allow +k services to set topics on
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.111 ircu2.10/ircd/channel.c:1.112
--- ircu2.10/ircd/channel.c:1.111       Fri Dec 10 21:13:43 2004
+++ ircu2.10/ircd/channel.c     Fri Dec 17 14:41:03 2004
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Channel management and maintanance
- * @version $Id: channel.c,v 1.111 2004/12/11 05:13:43 klmitch Exp $
+ * @version $Id: channel.c,v 1.112 2004/12/17 22:41:03 entrope Exp $
  */
 #include "config.h"
 
@@ -259,13 +259,12 @@
    * who then will educate them on the use of Apass/upass.
    */
 
-   if (feature_bool(FEAT_OPLEVELS)) {
-  if (TStime() - chptr->creationtime < 172800) /* Channel younger than 48 
hours? */
+  if (!(chptr->mode.mode & MODE_APASS))         /* If no Apass, destroy now. */
+    destruct_channel(chptr);
+  else if (TStime() - chptr->creationtime < 172800)    /* Channel younger than 
48 hours? */
     schedule_destruct_event_1m(chptr);         /* Get rid of it in 
approximately 4-5 minutes */
   else
     schedule_destruct_event_48h(chptr);                /* Get rid of it in 
approximately 48 hours */
-   } else
-       destruct_channel(chptr);
 
   return 0;
 }
@@ -2791,6 +2790,7 @@
   newban->next = 0;
   newban->flags = ((state->dir == MODE_ADD) ? BAN_ADD : BAN_DEL)
       | (*flag_p == 'b' ? 0 : BAN_EXCEPTION);
+  newban->banstr = NULL;
   set_ban_mask(newban, collapse(pretty_mask(t_str)));
   newban->who = cli_name(state->sptr);
   newban->when = TStime();
Index: ircu2.10/ircd/ircd_parser.y
diff -u ircu2.10/ircd/ircd_parser.y:1.32 ircu2.10/ircd/ircd_parser.y:1.33
--- ircu2.10/ircd/ircd_parser.y:1.32    Mon Dec 13 19:00:57 2004
+++ ircu2.10/ircd/ircd_parser.y Fri Dec 17 14:41:03 2004
@@ -17,7 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  *  USA.
- * $Id: ircd_parser.y,v 1.32 2004/12/14 03:00:57 entrope Exp $
+ * $Id: ircd_parser.y,v 1.33 2004/12/17 22:41:03 entrope Exp $
  */
 %{
 
@@ -477,7 +477,7 @@
  if (name)
  {
   struct ConfItem *aconf = make_conf(CONF_UWORLD);
-  aconf->name = name;
+  aconf->host = name;
  }
  else
  {
Index: ircu2.10/ircd/m_server.c
diff -u ircu2.10/ircd/m_server.c:1.36 ircu2.10/ircd/m_server.c:1.37
--- ircu2.10/ircd/m_server.c:1.36       Wed Dec 15 19:33:57 2004
+++ ircu2.10/ircd/m_server.c    Fri Dec 17 14:41:03 2004
@@ -22,7 +22,7 @@
  */
 /** @file
  * @brief Handlers for the SERVER command.
- * @version $Id: m_server.c,v 1.36 2004/12/16 03:33:57 entrope Exp $
+ * @version $Id: m_server.c,v 1.37 2004/12/17 22:41:03 entrope Exp $
  */
 
 #include "config.h"
@@ -612,6 +612,9 @@
   cli_serv(cptr)->ghost = ghost;
   SetServerYXX(cptr, cptr, parv[6]);
 
+  /* Attach any necessary UWorld config items. */
+  attach_confs_byhost(cptr, host, CONF_UWORLD);
+
   if (*parv[7] == '+') {
     for (ch = parv[7] + 1; *ch; ch++)
       switch (*ch) {
@@ -733,6 +736,9 @@
      for numeric nicks ! */
   SetServerYXX(cptr, acptr, parv[6]);
 
+  /* Attach any necessary UWorld config items. */
+  attach_confs_byhost(cptr, host, CONF_UWORLD);
+
   if (*parv[7] == '+') {
     for (ch = parv[7] + 1; *ch; ch++)
       switch (*ch) {
Index: ircu2.10/ircd/s_conf.c
diff -u ircu2.10/ircd/s_conf.c:1.69 ircu2.10/ircd/s_conf.c:1.70
--- ircu2.10/ircd/s_conf.c:1.69 Mon Dec 13 16:21:54 2004
+++ ircu2.10/ircd/s_conf.c      Fri Dec 17 14:41:03 2004
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief ircd configuration file driver
- * @version $Id: s_conf.c,v 1.69 2004/12/14 00:21:54 entrope Exp $
+ * @version $Id: s_conf.c,v 1.70 2004/12/17 22:41:03 entrope Exp $
  */
 #include "config.h"
 
@@ -734,6 +734,17 @@
  conf_error = 1;
 }
 
+/** Attach CONF_UWORLD items to a server and everything attached to it. */
+static void
+attach_conf_uworld(struct Client *cptr)
+{
+  struct DLink *lp;
+
+  attach_confs_byhost(cptr, cli_name(cptr), CONF_UWORLD);
+  for (lp = cli_serv(cptr)->down; lp; lp = lp->next)
+    attach_conf_uworld(lp->value.cptr);
+}
+
 /** Reload the configuration file.
  * @param cptr Client that requested rehash (if a signal, &me).
  * @param sig Type of rehash (0 = oper-requested, 1 = signal, 2 =
@@ -818,10 +829,8 @@
   for (i = 0; i <= HighestFd; i++) {
     if ((acptr = LocalClientArray[i])) {
       assert(!IsMe(acptr));
-      if (IsServer(acptr)) {
+      if (IsServer(acptr))
         det_confs_butmask(acptr, ~(CONF_UWORLD | CONF_ILLEGAL));
-        attach_confs_byname(acptr, cli_name(acptr), CONF_UWORLD);
-      }
       /* Because admin's are getting so uppity about people managing to
        * get past K/G's etc, we'll "fix" the bug by actually explaining
        * whats going on.
@@ -839,6 +848,8 @@
     }
   }
 
+  attach_conf_uworld(&me);
+
   return ret;
 }
 
@@ -1049,7 +1060,6 @@
    * attach the Connect block to the client structure for later use.
    */
   attach_conf(cptr, c_conf);
-  attach_confs_byname(cptr, cli_name(cptr), CONF_UWORLD);
 
   if (!irc_in_addr_valid(&c_conf->address.addr))
     memcpy(&c_conf->address.addr, &cli_ip(cptr), sizeof(c_conf->address.addr));
----------------------- End of diff -----------------------

Reply via email to