Improve the clean-up of outdated IAuth instances on rehash (SF bug #2789656).
[ircu2.10.12-pk.git] / ircd / m_stats.c
index 0ba58c42faeeb5ba30a714f427b525337a11d6e2..a68d0d7f804f527093a313202f54db496048843b 100644 (file)
@@ -119,7 +119,7 @@ int
 m_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   const struct StatDesc *sd;
-  char *param = 0;
+  char *param;
 
   /* If we didn't find a descriptor, send them help */
   if ((parc < 2) || !(sd = stats_find(parv[1])))
@@ -140,13 +140,11 @@ m_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
        ((sd->sd_flags & STAT_FLAG_OPERFEAT) && feature_bool(sd->sd_control))))
     return send_reply(sptr, ERR_NOPRIVILEGES);
 
-  /* Check if they are a local user */
-  if ((sd->sd_flags & STAT_FLAG_LOCONLY) && !MyUser(sptr))
-    return send_reply(sptr, ERR_NOPRIVILEGES);
-
   /* Check for extra parameter */
   if ((sd->sd_flags & STAT_FLAG_VARPARAM) && parc > 3 && !EmptyString(parv[3]))
     param = parv[3];
+  else
+    param = NULL;
 
   /* Ok, track down who's supposed to get this... */
   if (hunt_server_cmd(sptr, CMD_STATS, cptr, feature_int(FEAT_HIS_REMOTE),
@@ -154,6 +152,10 @@ m_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       HUNTED_ISME)
     return 0; /* Someone else--cool :) */
 
+  /* Check if they are a local user */
+  if ((sd->sd_flags & STAT_FLAG_LOCONLY) && !MyUser(sptr))
+    return send_reply(sptr, ERR_NOPRIVILEGES);
+
   assert(sd->sd_func != 0);
 
   /* Ok, dispatch the stats function */