From b67d77c107ea751a42265134e3491422abff1137 Mon Sep 17 00:00:00 2001 From: Bleep Date: Thu, 20 Jan 2000 04:51:31 +0000 Subject: [PATCH] Author: David M Run Log message: - Fixes a bug making all of the patch's functionality restricted to global opers, whereas it was intended to be for both local and global opers, since it only affects the local server. - Now requires opers who want to join a local channel where they normally couldnt to use a /join &channel OVERRIDE to force the join. This generates a HACK(4) server notice. Previous patch was silent on forced joins. Update URL in readme.www git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@16 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 5 ++++- doc/readme.www | 2 +- include/channel.h | 11 ++++++++++- ircd/channel.c | 44 ++++++++++++++++++++++++++++++++++---------- ircd/numnicks.c | 12 ++++-------- 5 files changed, 53 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 469ce0f..7f3ca5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,15 @@ # # ChangeLog for Undernet ircu Servers # -# $Id: ChangeLog,v 1.6 2000-01-01 00:00:32 bleep Exp $ +# $Id: ChangeLog,v 1.7 2000-01-20 04:51:29 bleep Exp $ # # Please insert new entries on the top of the list, a one or two line comment # is sufficient. Please include your name on the entries we know who to blame. # Please keep lines < 80 chars. #------------------------------------------------------------------------------- +* doc/readme.www: add Runs link update patch for linux info. --Bleep +* channel.c, channel.h: add David M's fixup for local channel oper overrides. + --Bleep * s_misc.c (date): add Runs Y2K patch --Bleep * hash.c (hChangeClient): bug fix. If the client pointer matched the first pointer in the bucket, the change was ignored (returned 0), leaving stale diff --git a/doc/readme.www b/doc/readme.www index f3c25e7..b6508a0 100644 --- a/doc/readme.www +++ b/doc/readme.www @@ -20,4 +20,4 @@ world wide web pages: http://routing-com.undernet.org/ * Information about large number of file descriptors per process: - linux: ftp://ftp.linux.org.za/linux/local/kernel/ + linux: http://www.linux.org.za/oskar/patches/kernel/filehandle/ diff --git a/include/channel.h b/include/channel.h index 167e9cf..abe7e1e 100644 --- a/include/channel.h +++ b/include/channel.h @@ -101,7 +101,16 @@ /* Check if a sptr is an oper, and chptr is a local channel. */ -#define IsOperOnLocalChannel(sptr,chname) ((IsOper(sptr)) && (IsLocalChannel(chname))) +#define IsOperOnLocalChannel(sptr,chname) ((IsAnOper(sptr)) \ + && (IsLocalChannel(chname))) + + +#ifdef OPER_WALK_THROUGH_LMODES + /* used in can_join to determine if an oper forced a join on a channel */ + #define MAGIC_OPER_OVERRIDE 1000 +#endif + + /* used in SetMode() in channel.c and m_umode() in s_msg.c */ diff --git a/ircd/channel.c b/ircd/channel.c index 27b6e95..651cdd6 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -850,7 +850,7 @@ int m_mode(aClient *cptr, aClient *sptr, int parc, char *parv[]) me.name, chptr->chname, modebuf, parabuf); sendto_op_mask(SNO_HACK4, "OPER MODE: %s MODE %s %s %s", - me.name,chptr->chname,modebuf,parabuf); + sptr->name,chptr->chname,modebuf,parabuf); } else #endif @@ -1987,10 +1987,15 @@ top: static int can_join(aClient *sptr, aChannel *chptr, char *key) { Reg1 Link *lp; - + int overrideJoin = 0; + #ifdef OPER_WALK_THROUGH_LMODES - if (IsOperOnLocalChannel(sptr, chptr->chname)) - return 0; + /* An oper can force a join on a local channel using "OVERRIDE" as the key. + a HACK(4) notice will be sent if he would not have been supposed + to join normally. */ + if (IsOperOnLocalChannel(sptr,chptr->chname) && !BadPtr(key) && + compall("OVERRIDE",key) == 0) + overrideJoin = MAGIC_OPER_OVERRIDE; #endif /* * Now a banned user CAN join if invited -- Nemesi @@ -2005,20 +2010,20 @@ static int can_join(aClient *sptr, aChannel *chptr, char *key) if (!lp) { if (chptr->mode.limit && chptr->users >= chptr->mode.limit) - return (ERR_CHANNELISFULL); + return (overrideJoin + ERR_CHANNELISFULL); /* * This can return an "Invite only" msg instead of the "You are banned" * if _both_ conditions are true, but who can say what is more * appropriate ? checking again IsBanned would be _SO_ cpu-xpensive ! */ - return ((chptr->mode.mode & MODE_INVITEONLY) ? + return overrideJoin + ((chptr->mode.mode & MODE_INVITEONLY) ? ERR_INVITEONLYCHAN : ERR_BANNEDFROMCHAN); } } /* now using compall (above) to test against a whole key ring -Kev */ if (*chptr->mode.key && (BadPtr(key) || compall(chptr->mode.key, key))) - return (ERR_BADCHANNELKEY); + return overrideJoin + (ERR_BADCHANNELKEY); return 0; } @@ -2367,7 +2372,7 @@ int m_join(aClient *cptr, aClient *sptr, int parc, char *parv[]) /* * Opers are allowed to join any number of channels */ - if (sptr->user->joined >= MAXCHANNELSPERUSER && !IsOper(sptr)) + if (sptr->user->joined >= MAXCHANNELSPERUSER && !IsAnOper(sptr)) #else if (sptr->user->joined >= MAXCHANNELSPERUSER) #endif @@ -2421,8 +2426,27 @@ int m_join(aClient *cptr, aClient *sptr, int parc, char *parv[]) } if ((i = can_join(sptr, chptr, keysOrTS))) { - sendto_one(sptr, err_str(i), me.name, parv[0], chptr->chname); - continue; +#ifdef OPER_WALK_THROUGH_LMODES + if (i > MAGIC_OPER_OVERRIDE) + { + switch(i - MAGIC_OPER_OVERRIDE) + { + case ERR_CHANNELISFULL: i = 'l'; break; + case ERR_INVITEONLYCHAN: i = 'i'; break; + case ERR_BANNEDFROMCHAN: i = 'b'; break; + case ERR_BADCHANNELKEY: i = 'k'; break; + } + sendto_op_mask(SNO_HACK4,"OPER JOIN: %s JOIN %s (overriding +%c)",sptr->name,chptr->chname,i); + } + else + { + sendto_one(sptr, err_str(i), me.name, parv[0], chptr->chname); + continue; + } +#else + sendto_one(sptr, err_str(i), me.name, parv[0], chptr->chname); + continue; +#endif } } /* diff --git a/ircd/numnicks.c b/ircd/numnicks.c index 09b904c..f5d3e76 100644 --- a/ircd/numnicks.c +++ b/ircd/numnicks.c @@ -217,14 +217,10 @@ void SetServerYXX(struct Client *cptr, struct Client *server, const char *yxx) const char *name; unsigned int numeric; } server_table[] = { - { - "Uworld.undernet.org", 22}, - { - "Uworld2.undernet.org", 23}, - { - "channels.undernet.org", 30}, - { - "channels2.undernet.org", 31}, + { "Uworld.undernet.org", 22}, + { "Uworld2.undernet.org", 23}, + { "channels.undernet.org", 30}, + { "channels2.undernet.org", 31}, { 0, 0} }; -- 2.20.1