From 92b26e74a99f74832ffc8aa0f750f91b668bb61e Mon Sep 17 00:00:00 2001 From: "B.Greenham" Date: Wed, 31 Mar 2010 11:22:32 -0400 Subject: [PATCH 1/5] Make chm_staff (staff only modes) only settable if you have ops in the channel in question. If operators need to set such modes in a channel where they don't have ops, that's what override/omode are for. --- src/chmode.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/chmode.c b/src/chmode.c index 3161b64..5aa618f 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -660,6 +660,8 @@ chm_staff(struct Client *source_p, struct Channel *chptr, int alevel, int parc, int *parn, const char **parv, int *errors, int dir, char c, long mode_type) { + int override = 0; + if(!IsOper(source_p) && !IsServer(source_p)) { if(!(*errors & SM_ERR_NOPRIVS)) @@ -676,6 +678,20 @@ chm_staff(struct Client *source_p, struct Channel *chptr, return; } + if(alevel != CHFL_CHANOP && alevel != CHFL_ADMIN && alevel != CHFL_HALFOP) + { + if (IsOverride(source_p)) + override = 1; + else + { + if(!(*errors & SM_ERR_NOOPS)) + sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), + me.name, source_p->name, chptr->chname); + *errors |= SM_ERR_NOOPS; + return; + } + } + if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE)) return; @@ -690,7 +706,7 @@ chm_staff(struct Client *source_p, struct Channel *chptr, mode_changes[mode_count].nocaps = 0; mode_changes[mode_count].id = NULL; mode_changes[mode_count].mems = ALL_MEMBERS; - mode_changes[mode_count].override = 0; + mode_changes[mode_count].override = override; mode_changes[mode_count++].arg = NULL; } else if((dir == MODE_DEL) && (chptr->mode.mode & mode_type)) @@ -702,7 +718,7 @@ chm_staff(struct Client *source_p, struct Channel *chptr, mode_changes[mode_count].caps = 0; mode_changes[mode_count].nocaps = 0; mode_changes[mode_count].mems = ALL_MEMBERS; - mode_changes[mode_count].override = 0; + mode_changes[mode_count].override = override; mode_changes[mode_count].id = NULL; mode_changes[mode_count++].arg = NULL; } From 2d8ae01fa4630c6eaa18e730e17d81db9585a4b7 Mon Sep 17 00:00:00 2001 From: "B.Greenham" Date: Sun, 4 Apr 2010 14:39:57 -0400 Subject: [PATCH 2/5] Update help snomask with snomasks provided by extensions. --- help/opers/snomask | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/help/opers/snomask b/help/opers/snomask index fda4fe0..a09ed7b 100644 --- a/help/opers/snomask +++ b/help/opers/snomask @@ -1,6 +1,8 @@ MODE +s <+|-> -Server notice masks: +Server notice masks: (? designates that the snomask is provided + by an extension and may not be present on + this server) SNOMASK DESCRIPTION ----------------------------------------------------------------- @@ -9,11 +11,13 @@ Server notice masks: +C - Extended local client connections and exits +d - Server debug messages +f - Clients refused due to limits + ? +F - Global client connections and exits +k - Server and service kill messages +n - Local client nick changes +r - Invalid usernames and dumb HTTP proxies +s - Generic server messages and oper kills +u - Client connections without auth{} block + ? +W - Shows whenever someone does a local whois on you +x - New server introduction and split messages +y - Juped channel join attempts, etc +Z - Operspy usage From 46a30dbe861f133bebde28328db91cf376026d5c Mon Sep 17 00:00:00 2001 From: "B.Greenham" Date: Sun, 4 Apr 2010 15:32:34 -0400 Subject: [PATCH 3/5] Update omode so that it can set +ah. --- extensions/m_omode.c | 61 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/extensions/m_omode.c b/extensions/m_omode.c index f80e262..451b627 100644 --- a/extensions/m_omode.c +++ b/extensions/m_omode.c @@ -124,7 +124,24 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char set_channel_mode(client_p, source_p->servptr, chptr, msptr, parc - 2, parv + 2); #else - if (parc == 4 && !strcmp(parv[2], "+o") && !irccmp(parv[3], source_p->name)) + if (parc == 4 && !strcmp(parv[2], "+a") && !irccmp(parv[3], source_p->name)) + { + /* Admining themselves */ + if (!wasonchannel) + { + sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, + form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname); + return 0; + } + sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s", + me.name, parv[1], source_p->name); + sendto_server(NULL, chptr, CAP_TS6, NOCAPS, + ":%s TMODE %ld %s +a %s", + me.id, (long) chptr->channelts, parv[1], + source_p->id); + msptr->flags |= CHFL_ADMIN; + } + else if (parc == 4 && !strcmp(parv[2], "+o") && !irccmp(parv[3], source_p->name)) { /* Opping themselves */ if (!wasonchannel) @@ -141,11 +158,28 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char source_p->id); msptr->flags |= CHFL_CHANOP; } - else + else if (parc == 4 && !strcmp(parv[2], "+h") && !irccmp(parv[3], source_p->name)) + { + /* Halfopping themselves */ + if (!wasonchannel) + { + sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, + form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname); + return 0; + } + sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +h %s", + me.name, parv[1], source_p->name); + sendto_server(NULL, chptr, CAP_TS6, NOCAPS, + ":%s TMODE %ld %s +h %s", + me.id, (long) chptr->channelts, parv[1], + source_p->id); + msptr->flags |= CHFL_HALFOP; + } + else if (ConfigChannel.use_admin) { /* Hack it so set_channel_mode() will accept */ if (wasonchannel) - msptr->flags |= CHFL_CHANOP; + msptr->flags |= CHFL_ADMIN; else { add_user_to_channel(chptr, source_p, CHFL_CHANOP); @@ -156,6 +190,27 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char /* We know they were not opped before and they can't have opped * themselves as set_channel_mode() does not allow that * -- jilles */ + if (wasonchannel) + msptr->flags &= ~CHFL_ADMIN; + else + remove_user_from_channel(msptr); + } + else + { + /* CHFL_ADMIN is only useful if admin is enabled + * so hack it with op if it is not. */ + if (wasonchannel) + msptr->flags |= CHFL_CHANOP; + else + { + add_user_to_channel(chptr, source_p, CHFL_CHANOP); + msptr = find_channel_membership(chptr, source_p); + } + set_channel_mode(client_p, source_p, chptr, msptr, + parc - 2, parv + 2); + /* We know they were not opped before and they can't have opped + * themselves as set_channel_mode() does not allow that + * -- jilles */ if (wasonchannel) msptr->flags &= ~CHFL_CHANOP; else From 8097430a810ac1535fe5304f74991b16ff58b064 Mon Sep 17 00:00:00 2001 From: "B.Greenham" Date: Sun, 4 Apr 2010 15:58:07 -0400 Subject: [PATCH 4/5] Allow /ojoin !#channel/%#channel, if admin/halfop are enabled. --- TODO-SHADOW | 1 - extensions/README | 2 +- extensions/m_ojoin.c | 29 +++++++++++++++++++++++++++-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/TODO-SHADOW b/TODO-SHADOW index 4ef2bfb..447dc22 100644 --- a/TODO-SHADOW +++ b/TODO-SHADOW @@ -1,6 +1,5 @@ Todo list for ShadowIRCd 6.1 ----------------------------- -* update ojoin/omode/etc to use +ah * notice/message !#channel and %#channel * Add a disable_oper option to auth {} to not allow users in that auth block to use OPER. diff --git a/extensions/README b/extensions/README index 9ba97b1..877f026 100644 --- a/extensions/README +++ b/extensions/README @@ -36,7 +36,7 @@ m_oaccept.c - OACCEPT - Add metadata to a user that will allow you to Syntax: OACCEPT m_ojoin.c - OJOIN - Join a channel through any modes or limits with - an optional status (@+) + an optional status (!@%+) Syntax: OJOIN [status] m_olist.c - OLIST - Lists channels like LIST, but shows hidden diff --git a/extensions/m_ojoin.c b/extensions/m_ojoin.c index 239cd44..8c29f6d 100644 --- a/extensions/m_ojoin.c +++ b/extensions/m_ojoin.c @@ -65,7 +65,7 @@ mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char return 0; } - if(*parv[1] == '@' || *parv[1] == '%' || *parv[1] == '+') + if(*parv[1] == '@' || *parv[1] == '%' || *parv[1] == '+' || *parv[1] == '!') { parv[1]++; move_me = 1; @@ -98,7 +98,20 @@ mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char me.name, parv[1], source_p->name, source_p->username, source_p->host); - if(*parv[1] == '@') + if(*parv[1] == '!' && ConfigChannel.use_admin) + { + add_user_to_channel(chptr, source_p, CHFL_ADMIN); + sendto_server(client_p, chptr, CAP_TS6, NOCAPS, + ":%s SJOIN %ld %s + :!%s", + me.id, (long) chptr->channelts, chptr->chname, source_p->id); + sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s", + source_p->name, + source_p->username, source_p->host, chptr->chname); + sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s", + me.name, chptr->chname, source_p->name); + + } + else if(*parv[1] == '@') { add_user_to_channel(chptr, source_p, CHFL_CHANOP); sendto_server(client_p, chptr, CAP_TS6, NOCAPS, @@ -111,6 +124,18 @@ mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char me.name, chptr->chname, source_p->name); } + else if(*parv[1] == '%' && ConfigChannel.use_halfop) + { + add_user_to_channel(chptr, source_p, CHFL_HALFOP); + sendto_server(client_p, chptr, CAP_TS6, NOCAPS, + ":%s SJOIN %ld %s + :%s%s", + me.id, (long) chptr->channelts, chptr->chname, "%", source_p->id); + sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s", + source_p->name, + source_p->username, source_p->host, chptr->chname); + sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +h %s", + me.name, chptr->chname, source_p->name); + } else if(*parv[1] == '+') { add_user_to_channel(chptr, source_p, CHFL_VOICE); From d6a51668b7caf8889b143793ce7d23c5b9c7649a Mon Sep 17 00:00:00 2001 From: "B.Greenham" Date: Sun, 4 Apr 2010 16:13:48 -0400 Subject: [PATCH 5/5] Update NEWS. --- NEWS | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 10a85a4..9543e57 100644 --- a/NEWS +++ b/NEWS @@ -17,7 +17,9 @@ new configuration options will just get the help index and that's it on /quote help. new commands -- /CYCLE - server-side /CYCLE, also called /HOP in some clients/servers. +- CYCLE #channel - server-side CYCLE, also called HOP in some clients/servers. + Parts the user from the given channel, then joins them to it immediately after. + Enabled by loading extensions/m_cycle. opers - Override no longer alows overriding opers to talk through +q, +m, etc. @@ -30,14 +32,22 @@ opers - All module management commands (MODLOAD, MODLIST, MODUNLOAD, MODRELOAD and MODRESTART) can be executed remotely. See the appropriate helpfile for details. +- OMODE can now set and unset +ah. +- OJOIN now works with !#channel and %#channel. +- Staff channelmodes (+AO) now require chanops to set. other - Added a strip_unprintable function to make evasion of cmodes +G and +K less trivial. - Massive helpfile updates. +- Added SVSJOIN s2s command. This allows things like atheme's ns_ajoin + to work on shadowircd. - Added BAN stuff (propogated bans on burst) from charybdis trunk. This can be disabled and the old behavior can be used by setting the general::use_propogated_bans option to no. +- The --enable-small-net configure option is now enabled by default. + If you wish to disable small net mode, pass --disable-small-net to + configure. -- shadowircd-6.0.0