>>>>> "Me" == Andrew Snare <ajs@xxxxxxxxxxx> writes:
Me> I've often had requests like this from people who wish to run
Me> internal-only IRC servers. My initial idea was to modify the
Me> semantics of JOIN so that a new channel is only created if the
Me> client is opered. The only inconvenience would be having an
Me> opered client "initialise" the channels with each restart.
Me> I think it would make the ircd a lot more attractive for
Me> single-server corporate (or otherwise) use.
Here's a quick patch that will do exactly this (against my irc2.10a3,
will apply to irc2.9.x with a little tender loving care). It's
configurable, and turned off by default (as it should be:). It touches
up a few other things in m_join() as well (mainly cosmetic).
Briefly tested and seems to work fine.
- Andrew
--
#!/usr/bin/env python
print(lambda s:s+"("+`s`+")")\
('#!/usr/bin/env python\012print(lambda s:s+"("+`s`+")")\\\012')
print(lambda x:x%`x`)('print(lambda x:x%%`x`)(%s)')
diff -urN irc2.10a3/ircd/channel.c irc2.10a3-ep/ircd/channel.c
--- irc2.10a3/ircd/channel.c Wed May 6 09:30:16 1998
+++ irc2.10a3-ep/ircd/channel.c Sat May 23 01:15:22 1998
@@ -1859,7 +1859,7 @@
parv[0]), name);
continue;
}
- if (*name == '-' && *(name+1) == '#')
+ if (*(name+1) == '#')
{
if (get_channel(sptr, name+2, 0))
{
@@ -1877,7 +1877,7 @@
* rightfully ceases to exist, it
* can still be *locked* for up to
* 2*CHIDNB^3 seconds (~24h)
- * Is it a reasonnable price to pay to
+ * Is it a reasonable price to pay to
* ensure shortname uniqueness? -kalt
*/
sendto_one(sptr,
@@ -1889,6 +1889,10 @@
name+2);
name = buf;
}
+ /*
+ ** Note that `name' could be mutated here due to
+ ** above sprintf() - Earthpig
+ */
else if (!get_channel(sptr, name, 0) &&
!(chptr = get_channel(sptr, name+1, 0)))
{
@@ -1902,7 +1906,7 @@
name = chptr->chname;
}
if (!IsChannelName(name) ||
- (*name == '-' && IsChannelName(name+1)))
+ (*name == '-') && IsChannelName(name+1))
{
if (MyClient(sptr))
sendto_one(sptr, err_str(ERR_NOSUCHCHANNEL,
@@ -1960,10 +1964,22 @@
return 2;
}
+#ifdef IRCOPCHANNELCREATE
+ if (MyConnect(sptr) && !find_channel(name, (aChannel *)NULL) &&
+ !IsAnOper(sptr))
+ {
+ sendto_one(sptr, err_str(ERR_NOPRIVILEGES, parv[0]));
+ return 2;
+ }
+#endif
+
chptr = get_channel(sptr, name, CREATE);
if (IsMember(sptr, chptr))
continue;
+ /*
+ ** i is undefined here for sendto_one if !chptr ?
+ */
if (!chptr ||
(MyConnect(sptr) && (i = can_join(sptr, chptr, key))))
{
diff -urN irc2.10a3/support/config.h.dist irc2.10a3-ep/support/config.h.dist
--- irc2.10a3/support/config.h.dist Wed May 6 09:30:29 1998
+++ irc2.10a3-ep/support/config.h.dist Sat May 23 00:17:08 1998
@@ -497,13 +497,22 @@
* DELAYCHASETIMELIMIT is the default,
* LDELAYCHASETIMELIMIT applies to -channels and should be really long.
*/
#define DELAYCHASETIMELIMIT 900 /* Recommended value: 900 */
#define LDELAYCHASETIMELIMIT 3600 /* Recommended value: 3600 */
/*
* Max number of channels a user is allowed to join.
*/
#define MAXCHANNELSPERUSER 10 /* Recommended value: 10 */
+
+/*
+ * If set, only IRC operators can create new channels. This
+ * can be used on small, customised IRC servers where you want to
+ * restrict what channels people can join.
+ * NOTE: Do NOT enable it on reasonably-sized IRC networks if you are
+ * sane.
+ */
+#undef IRCOPCHANNELCREATE
/*
* SendQ-Always causes the server to put all outbound data into the sendq and
Attachment:
pgp00004.pgp
Description: PGP signature