]> jfr.im git - irc/quakenet/newserv.git/commitdiff
CHANSERV: add walls to AUTHHISTORY.
authorChris Porter <redacted>
Thu, 15 Oct 2009 15:27:32 +0000 (16:27 +0100)
committerChris Porter <redacted>
Thu, 15 Oct 2009 15:27:32 +0000 (16:27 +0100)
chanserv/authcmds/authhistory.c

index 3621657d3a5935f7d4f8639f3022c912024ddf42..ac3f8fd9b459b81392ae99331f932c978e8d1458 100644 (file)
@@ -114,15 +114,28 @@ int csa_doauthhistory(void *source, int cargc, char **cargv) {
     if (!(trup=findreguser(sender, cargv[0])))
       return CMD_ERROR;
 
-    /* don't allow non-opers to view oper auth history, but allow helpers to view non-oper history */
-    if ((trup != rup) && ((UHasOperPriv(trup) && !UHasOperPriv(rup)) || !UHasHelperPriv(rup))) {
-      chanservstdmessage(sender, QM_NOACCESSONUSER, "authhistory", cargv[0]);
-      return CMD_ERROR;
+    /* if target != command issuer */
+    if (trup != rup) {
+      /* only opers and helpers can view authhistory of other users */
+      if (!UHasHelperPriv(rup)) {
+        chanservstdmessage(sender, QM_NOACCESSONUSER, "authhistory", cargv[0]);
+        return CMD_ERROR;
+      }
+
+      /* and only opers can view opers history */
+      if (UHasOperPriv(trup) && !UHasOperPriv(rup)) {
+        chanservwallmessage("%s (%s) just FAILED using AUTHHISTORY on %s", sender->nick, rup->username, trup->username);
+        chanservstdmessage(sender, QM_NOACCESSONUSER, "authhistory", cargv[0]);
+        return CMD_ERROR;
+      }
+
+      /* checks passed */
+
+      chanservwallmessage("%s (%s) used AUTHHISTORY on %s", sender->nick, rup->username, trup->username);
     }
   } else {
     trup=rup;
   }
-  
   csdb_retreiveauthhistory(sender, trup, 10);
 
   return CMD_OK;