const struct StatDesc *sd;
char *param = 0;
- /* If we didn't find a descriptor and this is my client, send them help */
+ /* If we didn't find a descriptor, send them help */
if ((parc < 2) || !(sd = stats_find(parv[1])))
parv[1] = "*", sd = stats_find("*");
* not privileged (server or an operator), then the STAT_FLAG_OPERONLY
* flag must not be set, and if the STAT_FLAG_OPERFEAT flag is set,
* then the feature given by sd->sd_control must be off.
+ *
+ * This checks cptr rather than sptr so that a local oper may send
+ * /stats queries to other servers.
*/
if (!IsPrivileged(cptr) &&
((sd->sd_flags & STAT_FLAG_OPERONLY) ||
((sd->sd_flags & STAT_FLAG_OPERFEAT) && feature_bool(sd->sd_control))))
- return send_reply(cptr, ERR_NOPRIVILEGES);
-
- /* Check if they are a local user */
- if ((sd->sd_flags & STAT_FLAG_LOCONLY) && !MyUser(cptr))
- return send_reply(cptr, ERR_NOPRIVILEGES);
-
- /* Check for extra parameter */
- if ((sd->sd_flags & STAT_FLAG_VARPARAM) && parc > 3 && !EmptyString(parv[3]))
- param = parv[3];
+ return send_reply(sptr, ERR_NOPRIVILEGES);
/* Ok, track down who's supposed to get this... */
if (hunt_server_cmd(sptr, CMD_STATS, cptr, feature_int(FEAT_HIS_REMOTE),
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);
+
+ /* Check for extra parameter */
+ if ((sd->sd_flags & STAT_FLAG_VARPARAM) && parc > 3 && !EmptyString(parv[3]))
+ param = parv[3];
+
assert(sd->sd_func != 0);
/* Ok, dispatch the stats function */