Make ircd.conf accept "*" as vhost like .11 did. Fix comment in channel.c.
authorMichael Poole <mdpoole@troilus.org>
Fri, 15 Jul 2005 01:53:13 +0000 (01:53 +0000)
committerMichael Poole <mdpoole@troilus.org>
Fri, 15 Jul 2005 01:53:13 +0000 (01:53 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1446 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
doc/example.conf
ircd/channel.c
ircd/ircd_parser.y

index 9271ac1ec131f1fcc9bfacc62529dd8655a5224f..34f80d685aa0403a07fb5a0a7bb6346a757b9e13 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-07-14  Michael Poole <mdpoole@troilus.org>
+
+       * 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 <mdpoole@troilus.org>
 
        * ircd/engine_select.c: Remove outdated comment about USE_POLL.
index da47f13aa134556d3bcb612ff8741126ce9a9e91..85f4ec96cec90739de7ddb25415134a87bb62daa 100644 (file)
@@ -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 36f87272873b3c26fa39a68f16342dec5caa7c54..81be0d993346796f09e823b4b51ce458a5b1c4bc 100644 (file)
@@ -258,24 +258,15 @@ int sub1_from_channel(struct Channel* chptr)
 
   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 d6aec44d8d3fb4715db82f89727319c100f75d25..2ce1b6c79cf129c07cfdc7551b6965bdbaafbba6 100644 (file)
@@ -263,8 +263,12 @@ jupenick: NICK '=' QSTRING ';'
   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 @@ generaldesc: DESCRIPTION '=' QSTRING ';'
 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