X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/9879cd59a64a7801510d3573209fc4949ee62766..af7c236800d8aa369835ff5db6623b9f0a63c6b3:/modules/m_trace.c diff --git a/modules/m_trace.c b/modules/m_trace.c index 8d13159..1c01229 100644 --- a/modules/m_trace.c +++ b/modules/m_trace.c @@ -31,7 +31,7 @@ #include "hash.h" #include "common.h" #include "hash.h" -#include "irc_string.h" +#include "match.h" #include "ircd.h" #include "numeric.h" #include "s_serv.h" @@ -61,7 +61,7 @@ mapi_hlist_av1 trace_hlist[] = { DECLARE_MODULE_AV1(trace, NULL, NULL, trace_clist, trace_hlist, NULL, "$Revision: 3183 $"); static void count_downlinks(struct Client *server_p, int *pservcount, int *pusercount); -static int report_this_status(struct Client *source_p, struct Client *target_p, int dow); +static int report_this_status(struct Client *source_p, struct Client *target_p); /* * m_trace @@ -238,6 +238,11 @@ m_trace(struct Client *client_p, struct Client *source_p, int parc, const char * if(!doall && wilds && !match(tname, target_p->name)) continue; + /* remote opers may not see invisible normal users */ + if(dow && !MyConnect(source_p) && !IsOper(target_p) && + IsInvisible(target_p)) + continue; + cnt = report_this_status(source_p, target_p, dow); } @@ -325,8 +330,7 @@ count_downlinks(struct Client *server_p, int *pservcount, int *pusercount) * side effects - NONE */ static int -report_this_status(struct Client *source_p, struct Client *target_p, - int dow) +report_this_status(struct Client *source_p, struct Client *target_p, int dow) { const char *name; const char *class_name; @@ -341,7 +345,7 @@ report_this_status(struct Client *source_p, struct Client *target_p, class_name = get_client_class(target_p); if(IsAnyServer(target_p)) - name = get_server_name(target_p, HIDE_IP); + name = target_p->name; else name = get_client_name(target_p, HIDE_IP); @@ -374,31 +378,26 @@ report_this_status(struct Client *source_p, struct Client *target_p, break; case STAT_CLIENT: - /* Only opers see users if there is a wildcard - * but anyone can see all the opers. - */ - if((IsOper(source_p) && - (MyClient(source_p) || !(dow && IsInvisible(target_p)))) - || !dow || IsOper(target_p) || (source_p == target_p)) - { - if(IsOper(target_p)) - sendto_one_numeric(source_p, RPL_TRACEOPERATOR, - form_str(RPL_TRACEOPERATOR), - class_name, name, - show_ip(source_p, target_p) ? ip : "255.255.255.255", - rb_current_time() - target_p->localClient->lasttime, - rb_current_time() - target_p->localClient->last); + /* Only opers see users if there is a wildcard + * but anyone can see all the opers. + */ + if((IsOper(source_p) && + (MyClient(source_p) || !(dow && IsInvisible(target_p)))) + || !dow || IsOper(target_p) || (source_p == target_p)) + { + int tnumeric = RPL_TRACEUSER; + if(IsOper(target_p)) + tnumeric = RPL_TRACEOPERATOR; + + sendto_one_numeric(source_p, tnumeric, form_str(tnumeric), + class_name, name, + show_ip(source_p, target_p) ? ip : empty_sockhost, + rb_current_time() - target_p->localClient->lasttime, + rb_current_time() - target_p->localClient->last); + cnt++; + } + break; - else - sendto_one_numeric(source_p, RPL_TRACEUSER, - form_str(RPL_TRACEUSER), - class_name, name, - show_ip(source_p, target_p) ? ip : "255.255.255.255", - rb_current_time() - target_p->localClient->lasttime, - rb_current_time() - target_p->localClient->last); - cnt++; - } - break; case STAT_SERVER: {