]> jfr.im git - irc/quakenet/snircd-patchqueue.git/commitdiff
opernotify: do check user was indeed a local oper when -o or -O is set, use cli_sockh...
authorwiebe <redacted>
Tue, 20 Apr 2010 13:21:59 +0000 (15:21 +0200)
committerwiebe <redacted>
Tue, 20 Apr 2010 13:21:59 +0000 (15:21 +0200)
opernotify.patch [new file with mode: 0644]
series

diff --git a/opernotify.patch b/opernotify.patch
new file mode 100644 (file)
index 0000000..4d89608
--- /dev/null
@@ -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 : "<unknown>");
++          cli_name(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr),
++          cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>");
+       } 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 : "<unknown>", 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 : "<unknown>", cli_name(cli_user(sptr)->server));
+       }
+       
+       client_set_privs(sptr, NULL); /* will clear propagate privilege */
diff --git a/series b/series
index 9e338240687d75b50ef8012fc07582b4c4f2a6bd..a1905d3b424cce4163e969d54265eb9376e9ac87 100644 (file)
--- a/series
+++ b/series
@@ -10,6 +10,7 @@ nserverflag.patch
 enforceinvisible.patch
 snircdumodescheckisanoper.patch
 noopername.patch
+opernotify.patch
 minoplevel.patch
 ischannelservice.patch
 invalidatebanssethost.patch