m_trace.c fixed

This commit is contained in:
Valery V Yatsko 2008-06-28 18:20:24 +04:00
parent 42706093f1
commit a70bad1d73
1 changed files with 21 additions and 28 deletions

View File

@ -61,7 +61,7 @@ mapi_hlist_av1 trace_hlist[] = {
DECLARE_MODULE_AV1(trace, NULL, NULL, trace_clist, trace_hlist, NULL, "$Revision: 3183 $"); 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 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);
static const char *empty_sockhost = "255.255.255.255"; static const char *empty_sockhost = "255.255.255.255";
@ -174,7 +174,7 @@ m_trace(struct Client *client_p, struct Client *source_p, int parc, const char *
*/ */
if(target_p != NULL) if(target_p != NULL)
{ {
report_this_status(source_p, target_p, 0); report_this_status(source_p, target_p);
tname = target_p->name; tname = target_p->name;
} }
@ -195,7 +195,7 @@ m_trace(struct Client *client_p, struct Client *source_p, int parc, const char *
if(MyClient(source_p)) if(MyClient(source_p))
{ {
if(doall || (wilds && match(tname, source_p->name))) if(doall || (wilds && match(tname, source_p->name)))
report_this_status(source_p, source_p, 0); report_this_status(source_p, source_p);
} }
RB_DLINK_FOREACH(ptr, local_oper_list.head) RB_DLINK_FOREACH(ptr, local_oper_list.head)
@ -205,7 +205,7 @@ m_trace(struct Client *client_p, struct Client *source_p, int parc, const char *
if(!doall && wilds && (match(tname, target_p->name) == 0)) if(!doall && wilds && (match(tname, target_p->name) == 0))
continue; continue;
report_this_status(source_p, target_p, 0); report_this_status(source_p, target_p);
} }
if (IsExemptShide(source_p) || !ConfigServerHide.flatten_links) if (IsExemptShide(source_p) || !ConfigServerHide.flatten_links)
@ -217,7 +217,7 @@ m_trace(struct Client *client_p, struct Client *source_p, int parc, const char *
if(!doall && wilds && !match(tname, target_p->name)) if(!doall && wilds && !match(tname, target_p->name))
continue; continue;
report_this_status(source_p, target_p, 0); report_this_status(source_p, target_p);
} }
} }
@ -245,7 +245,7 @@ m_trace(struct Client *client_p, struct Client *source_p, int parc, const char *
IsInvisible(target_p)) IsInvisible(target_p))
continue; continue;
cnt = report_this_status(source_p, target_p, dow); cnt = report_this_status(source_p, target_p);
} }
RB_DLINK_FOREACH(ptr, serv_list.head) RB_DLINK_FOREACH(ptr, serv_list.head)
@ -255,7 +255,7 @@ m_trace(struct Client *client_p, struct Client *source_p, int parc, const char *
if(!doall && wilds && !match(tname, target_p->name)) if(!doall && wilds && !match(tname, target_p->name))
continue; continue;
cnt = report_this_status(source_p, target_p, dow); cnt = report_this_status(source_p, target_p);
} }
if(MyConnect(source_p)) if(MyConnect(source_p))
@ -267,7 +267,7 @@ m_trace(struct Client *client_p, struct Client *source_p, int parc, const char *
if(!doall && wilds && !match(tname, target_p->name)) if(!doall && wilds && !match(tname, target_p->name))
continue; continue;
cnt = report_this_status(source_p, target_p, dow); cnt = report_this_status(source_p, target_p);
} }
} }
@ -332,7 +332,7 @@ count_downlinks(struct Client *server_p, int *pservcount, int *pusercount)
* side effects - NONE * side effects - NONE
*/ */
static int 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)
{ {
const char *name; const char *name;
const char *class_name; const char *class_name;
@ -380,14 +380,8 @@ report_this_status(struct Client *source_p, struct Client *target_p, int dow)
break; break;
case STAT_CLIENT: 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))
{
int tnumeric = RPL_TRACEUSER; int tnumeric = RPL_TRACEUSER;
if(IsOper(target_p)) if(IsOper(target_p))
tnumeric = RPL_TRACEOPERATOR; tnumeric = RPL_TRACEOPERATOR;
@ -396,10 +390,9 @@ report_this_status(struct Client *source_p, struct Client *target_p, int dow)
show_ip(source_p, target_p) ? ip : empty_sockhost, show_ip(source_p, target_p) ? ip : empty_sockhost,
rb_current_time() - target_p->localClient->lasttime, rb_current_time() - target_p->localClient->lasttime,
rb_current_time() - target_p->localClient->last); rb_current_time() - target_p->localClient->last);
cnt++;
}
break;
cnt++;
break;
case STAT_SERVER: case STAT_SERVER:
{ {