From: wiebe Date: Tue, 20 Apr 2010 13:21:59 +0000 (+0200) Subject: opernotify: do check user was indeed a local oper when -o or -O is set, use cli_sockh... X-Git-Url: https://jfr.im/git/irc/quakenet/snircd-patchqueue.git/commitdiff_plain/bc999d0f4cc04bc17a1424403c43b19b3b71255a opernotify: do check user was indeed a local oper when -o or -O is set, use cli_sockhost() on local users --- diff --git a/opernotify.patch b/opernotify.patch new file mode 100644 index 0000000..4d89608 --- /dev/null +++ b/opernotify.patch @@ -0,0 +1,66 @@ +do check user was indeed a local oper when -o or -O is set +if it is my user, use cli_sockhost() instead of cli_user()->realhost + +diff -r 14467ecfea35 ircd/s_user.c +--- a/ircd/s_user.c ++++ b/ircd/s_user.c +@@ -1317,13 +1317,7 @@ + if (MyConnect(sptr)) + { + tmpmask = cli_snomask(sptr) & ~SNO_OPER; +- cli_handler(sptr) = CLIENT_HANDLER; +- +- /* notify my operators a local operator has deOPERed - wiebe */ +- sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (o) as %s", +- cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, +- cli_user(sptr)->opername); +- ++ cli_handler(sptr) = CLIENT_HANDLER; + } + } + break; +@@ -1521,7 +1515,7 @@ + ++UserStats.opers; + client_set_privs(sptr, NULL); /* may set propagate privilege */ + +- /* notify my operators a user has OPERed on a remote server - wiebe */ ++ /* notify my operators a user has OPERed on a remote server */ + if (!MyConnect(sptr)) { + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (O) as %s on %s", + cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, +@@ -1533,20 +1527,30 @@ + if (HasPriv(sptr, PRIV_PROPAGATE)) { + prop = 1; + } ++ ++ /* user was a local operator */ ++ if (FlagHas(&setflags, FLAG_LOCOP) && !IsLocOp(sptr)) { ++ ++ /* notify my operators a local operator has deOPERed */ ++ sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (o) as %s", ++ cli_name(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr), ++ cli_user(sptr)->opername); ++ } ++ + if (FlagHas(&setflags, FLAG_OPER) && !IsOper(sptr)) { + /* user no longer oper */ + assert(UserStats.opers > 0); + --UserStats.opers; + +- /* notify my operators an operator has deOPERed on the network - wiebe */ ++ /* notify my operators an operator has deOPERed on the network */ + if (MyConnect(sptr)) { + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) as %s", +- cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, +- cli_user(sptr)->opername ? cli_user(sptr)->opername : ""); ++ cli_name(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr), ++ cli_user(sptr)->opername ? cli_user(sptr)->opername : ""); + } else { + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) as %s on %s", +- cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, +- cli_user(sptr)->opername ? cli_user(sptr)->opername : "", cli_name(cli_user(sptr)->server)); ++ cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, ++ cli_user(sptr)->opername ? cli_user(sptr)->opername : "", cli_name(cli_user(sptr)->server)); + } + + client_set_privs(sptr, NULL); /* will clear propagate privilege */ diff --git a/series b/series index 9e33824..a1905d3 100644 --- a/series +++ b/series @@ -10,6 +10,7 @@ nserverflag.patch enforceinvisible.patch snircdumodescheckisanoper.patch noopername.patch +opernotify.patch minoplevel.patch ischannelservice.patch invalidatebanssethost.patch