]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - minoplevel.patch
Update patchset for latest ircu changes
[irc/quakenet/snircd-patchqueue.git] / minoplevel.patch
1 Fix for enforcing the min oplevel we added to snircd.
2
3 Previously, only oplevels between 0 and MINOPLEVEL (value 100) were accepted from
4 services server (+s flag) or from a service client (umode +k) on them.
5
6 1. Servers bouncing modes with such an oplevel would be set back to MINOPLEVEL,
7 instead of the original level, leading to desynch. Locally the server that bounces the mode
8 would keep the original oplevel, and bounce it back upstream, were the servers would correct
9 it with MINOPLEVEL.
10
11 2. If we would ever dicide to change this hardcoded value for MINOPLEVEL, there would be
12 desynchs for the oplevels chanops would have between old and new servers.
13
14 3. The original oplevel received (either by client or over a server link)
15 was propagated (further) and not the oplevel the ircd set locally
16 (and which may have been changed for the MINOPLEVEL value).
17
18 All of these issues are fixed in this patch.
19
20 1. MINOPLEVEL is only enforced on local clients, that is, local clients
21 using /MODE (for more detail, see comment in code).
22 2. if we ever change the value, there would be no desynch, just different local
23 enforcement of the value between old and new servers.
24 3. in case the oplevel is corrected for MINOPLEVEL, the correct oplevel goes upstream.
25
26 NOTE: previously MINOPLEVEL was also enforced on /OPMODE - it is no longer in this patch (should it?)
27
28 diff -r 041543097dfa ircd/channel.c
29 --- a/ircd/channel.c Sun Feb 15 16:28:56 2009 +0100
30 +++ b/ircd/channel.c Sun Feb 15 16:36:34 2009 +0100
31 @@ -3355,18 +3355,34 @@
32 * Otherwise, get state->member's oplevel+1.
33 */
34 if (state->cli_change[i].oplevel <= MAXOPLEVEL) {
35 - if ((IsChannelService(state->sptr) && IsService(cli_user(state->sptr)->server)) || (IsService(state->sptr))) {
36 - SetOpLevel(member, state->cli_change[i].oplevel);
37 - } else {
38 - SetOpLevel(member, state->cli_change[i].oplevel > MINOPLEVEL ? state->cli_change[i].oplevel : MINOPLEVEL);
39 - }
40 + /* MINOPLEVEL - snircd
41 + * accept oplevels as given when forced - modes are forced when:
42 + * MODE &chan by oper with MODE_LCHAN PRIV
43 + * OPMODE, MODE with server as source, MODE from remote user
44 + *
45 + * we need to change state->cli_change[i].oplevel so that
46 + * the oplevel we set goes upstream (including any change we make to it),
47 + * and not the oplevel specified by the client
48 + * we do not want to set one thing locally, and send upstream another
49 + */
50 + if (!(state->flags & MODE_PARSE_FORCE) && state->cli_change[i].oplevel < MINOPLEVEL)
51 + state->cli_change[i].oplevel = MINOPLEVEL;
52 + SetOpLevel(member, state->cli_change[i].oplevel);
53 }
54 else if (!state->member)
55 SetOpLevel(member, MAXOPLEVEL);
56 else if (OpLevel(state->member) >= MAXOPLEVEL)
57 SetOpLevel(member, OpLevel(state->member));
58 - else
59 - SetOpLevel(member, OpLevel(state->member) >= MINOPLEVEL ? OpLevel(state->member) + 1 : MINOPLEVEL);
60 + else {
61 + /* MINOPLEVEL - snircd
62 + * change state->cli_change[i].oplevel - see above.
63 + */
64 + if (!(state->flags & MODE_PARSE_FORCE) && OpLevel(state->member) < MINOPLEVEL)
65 + state->cli_change[i].oplevel = MINOPLEVEL;
66 + else
67 + state->cli_change[i].oplevel = OpLevel(state->member) + 1;
68 + SetOpLevel(member, state->cli_change[i].oplevel);
69 + }
70 }
71
72 /* actually effect the change */