Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-07-15 01:53:23 UTC

Modified files:
     ChangeLog doc/example.conf ircd/channel.c ircd/ircd_parser.y

Log message:

Make ircd.conf accept "*" as vhost like .11 did.  Fix comment in channel.c.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.661 ircu2.10/ChangeLog:1.662
--- ircu2.10/ChangeLog:1.661    Mon Jul 11 20:10:56 2005
+++ ircu2.10/ChangeLog  Thu Jul 14 18:53:11 2005
@@ -1,3 +1,15 @@
+2005-07-14  Michael Poole <[EMAIL PROTECTED]>
+
+       * doc/example.conf (General): Update comment about vhost to match
+       the code change below.
+
+       * ircd/ircd_parser.y (generalvhost): Accept vhost="*"; as a
+       synonym for the default behavior (for backwards compatibility).
+       Spotted by Kev.
+
+       * ircd/channel.c (sub1_from_channel): Remove stale code and
+       comment, replacing with an up-to-date comment.  Spotted by skx.
+
 2005-07-11  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/engine_select.c: Remove outdated comment about USE_POLL.
Index: ircu2.10/doc/example.conf
diff -u ircu2.10/doc/example.conf:1.58 ircu2.10/doc/example.conf:1.59
--- ircu2.10/doc/example.conf:1.58      Mon Jul 11 19:47:07 2005
+++ ircu2.10/doc/example.conf   Thu Jul 14 18:53:12 2005
@@ -63,7 +63,7 @@
 # be the address of a physical interface on the host.  This address is
 # used for outgoing connections if the Connect{} block does not
 # override it.  See Port{} for listener virtual hosting.  If in doubt,
-# leave it out.
+# leave it out -- or use "*", which has the same meaning as no vhost.
 #
 # You may specify both an IPv4 virtual host and an IPv6 virtual host,
 # to indicate which address should be used for outbound connections
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.134 ircu2.10/ircd/channel.c:1.135
--- ircu2.10/ircd/channel.c:1.134       Mon Jul 11 19:47:07 2005
+++ ircu2.10/ircd/channel.c     Thu Jul 14 18:53:12 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Channel management and maintenance
- * @version $Id: channel.c,v 1.134 2005/07/12 02:47:07 entrope Exp $
+ * @version $Id: channel.c,v 1.135 2005/07/15 01:53:12 entrope Exp $
  */
 #include "config.h"
 
@@ -258,24 +258,15 @@
 
   chptr->users = 0;
 
-  /*
-   * Also channels without Apass set need to be kept alive,
-   * otherwise Bad Guys(tm) would be able to takeover
-   * existing channels too easily, and then set an Apass!
-   * However, if a channel without Apass becomes empty
-   * then we try to be kind to them and remove possible
-   * limiting modes.
-   */
-  chptr->mode.mode &= ~MODE_INVITEONLY;
-  chptr->mode.limit = 0;
-  /*
-   * We do NOT reset a possible key or bans because when
-   * the 'channel owners' can't get in because of a key
-   * or ban then apparently there was a fight/takeover
-   * on the channel and we want them to contact IRC opers
-   * who then will educate them on the use of Apass/upass.
+  /* There is a semantics problem here: Assuming no fragments across a
+   * split, a channel without Apass could be maliciously destroyed and
+   * recreated, and someone could set apass on the new instance.
+   *
+   * This could be fixed by preserving the empty non-Apass channel for
+   * the same time as if it had an Apass (but removing +i and +l), and
+   * reopping the first user to rejoin.  However, preventing net rides
+   * requires a backwards-incompatible protocol change..
    */
-
   if (!chptr->mode.apass[0])         /* If no Apass, destroy now. */
     destruct_channel(chptr);
   else if (TStime() - chptr->creationtime < 172800)    /* Channel younger than 
48 hours? */
Index: ircu2.10/ircd/ircd_parser.y
diff -u ircu2.10/ircd/ircd_parser.y:1.54 ircu2.10/ircd/ircd_parser.y:1.55
--- ircu2.10/ircd/ircd_parser.y:1.54    Mon May  9 20:43:08 2005
+++ ircu2.10/ircd/ircd_parser.y Thu Jul 14 18:53:13 2005
@@ -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.54 2005/05/10 03:43:08 entrope Exp $
+ * $Id: ircd_parser.y,v 1.55 2005/07/15 01:53:13 entrope Exp $
  */
 %{
 
@@ -263,8 +263,12 @@
   MyFree($3);
 };
 
-generalblock: GENERAL '{' generalitems '}' ';'
+generalblock: GENERAL
 {
+    /* Zero out the vhost addresses, in case they were removed. */
+    memset(&VirtualHost_v4.addr, 0, sizeof(VirtualHost_v4.addr));
+    memset(&VirtualHost_v6.addr, 0, sizeof(VirtualHost_v6.addr));
+} '{' generalitems '}' ';' {
   if (localConf.name == NULL)
     parse_error("Your General block must contain a name.");
   if (localConf.numeric == 0)
@@ -303,8 +307,11 @@
 generalvhost: VHOST '=' QSTRING ';'
 {
   struct irc_in_addr addr;
-  if (!ircd_aton(&addr, $3))
-      parse_error("Invalid virtual host '%s'.", $3);
+  if (!strcmp($3, "*")) {
+    /* This traditionally meant bind to all interfaces and connect
+     * from the default. */
+  } else if (!ircd_aton(&addr, $3))
+    parse_error("Invalid virtual host '%s'.", $3);
   else if (irc_in_addr_is_ipv4(&addr))
     memcpy(&VirtualHost_v4.addr, &addr, sizeof(addr));
   else
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to