From 46b0968143b5bd9ac8cbe9e850db94338bcd16f7 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Fri, 15 Jul 2005 01:53:13 +0000 Subject: [PATCH] Make ircd.conf accept "*" as vhost like .11 did. Fix comment in channel.c. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1446 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 12 ++++++++++++ doc/example.conf | 2 +- ircd/channel.c | 25 ++++++++----------------- ircd/ircd_parser.y | 13 ++++++++++--- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9271ac1..34f80d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-07-14 Michael Poole + + * 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 * ircd/engine_select.c: Remove outdated comment about USE_POLL. diff --git a/doc/example.conf b/doc/example.conf index da47f13..85f4ec9 100644 --- a/doc/example.conf +++ b/doc/example.conf @@ -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 diff --git a/ircd/channel.c b/ircd/channel.c index 36f8727..81be0d9 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -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? */ diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y index d6aec44..2ce1b6c 100644 --- a/ircd/ircd_parser.y +++ b/ircd/ircd_parser.y @@ -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 -- 2.20.1