ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/contrib/m_ctrace.c
(Generate patch)

Comparing ircd-hybrid/contrib/m_ctrace.c (file contents):
Revision 612 by adx, Sun Feb 12 00:15:24 2006 UTC vs.
Revision 613 by michael, Fri May 19 09:23:10 2006 UTC

# Line 39 | Line 39
39  
40   static void *do_ctrace(va_list);
41   static void mo_ctrace(struct Client *, struct Client *, int, char *[]);
42 + static void report_this_status(struct Client *, struct Client *);
43  
44   struct Message ctrace_msgtab = {
45    "CTRACE", 0, 0, 2, 0, MFLG_SLOW, 0,
46 <  {m_unregistered, m_not_oper, m_ignore, m_ignore, mo_ctrace, m_ignore}
46 >  { m_unregistered, m_not_oper, m_ignore, m_ignore, mo_ctrace, m_ignore }
47   };
48  
49   static struct Callback *ctrace_cb;
# Line 59 | Line 60 | CLEANUP_MODULE
60    uninstall_hook(ctrace_cb, do_ctrace);
61   }
62  
62 static int report_this_status(struct Client *, struct Client *);
63  
64   /*
65   ** mo_ctrace
# Line 73 | Line 73 | mo_ctrace(struct Client *client_p, struc
73    if (EmptyString(parv[1]))
74    {
75      sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
76 <               me.name, parv[0], "CTRACE");
76 >               me.name, source_p->name, "CTRACE");
77      return;
78    }
79  
# Line 98 | Line 98 | do_ctrace(va_list args)
98    class_looking_for = parv[1];
99  
100    /* report all direct connections */
101
101    DLINK_FOREACH(ptr, local_client_list.head)
102    {
103      target_p = ptr->data;
104  
105 <    class_name = ((struct ConfItem *)target_p->localClient->class->conf_ptr)->name;
105 >    class_name = get_client_className(target_p);
106      if ((class_name != NULL) && match(class_looking_for, class_name))
107        report_this_status(source_p, target_p);
108    }
109  
110    sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,
111 <             parv[0], class_looking_for);
111 >             source_p->name, class_looking_for);
112    return NULL;
113   }
114  
# Line 121 | Line 120 | do_ctrace(va_list args)
120   * output       - counter of number of hits
121   * side effects - NONE
122   */
123 < static int
123 > static void
124   report_this_status(struct Client *source_p, struct Client *target_p)
125   {
126    const char *name = NULL;
127    const char *class_name = NULL;
129  char ip[HOSTIPLEN];
130  int cnt = 0;
128  
132  /* Should this be sockhost? - stu */
133  irc_getnameinfo((struct sockaddr*)&target_p->localClient->ip,
134        target_p->localClient->ip.ss_len, ip, HOSTIPLEN, NULL, 0,
135        NI_NUMERICHOST);
129    name = get_client_name(target_p, HIDE_IP);
130 <  class_name  = ((struct ConfItem *)target_p->localClient->class->conf_ptr)->name;
130 >  class_name  = get_client_className(target_p);
131  
132    switch (target_p->status)
133    {
134      case STAT_CLIENT:
135 <
143 <      if ((IsOper(source_p) &&
144 <          (MyClient(source_p) || !IsInvisible(target_p)))
135 >      if ((IsOper(source_p) && (MyClient(source_p) || !IsInvisible(target_p)))
136            || IsOper(target_p))
137        {
138          if (IsAdmin(target_p) && !ConfigFileEntry.hide_spoof_ips)
139            sendto_one(source_p, form_str(RPL_TRACEOPERATOR),
140                         me.name, source_p->name, class_name, name,
141 <                       IsAdmin(source_p) ? ip : "255.255.255.255",
141 >                       IsAdmin(source_p) ? target_p->sockhost : "255.255.255.255",
142                         CurrentTime - target_p->lasttime,
143                         CurrentTime - target_p->localClient->last);
144            else if (IsOper(target_p))
# Line 155 | Line 146 | report_this_status(struct Client *source
146              if (ConfigFileEntry.hide_spoof_ips)
147                sendto_one(source_p, form_str(RPL_TRACEOPERATOR),
148                           me.name, source_p->name, class_name, name,
149 <                         IsIPSpoof(target_p) ? "255.255.255.255" : ip,
149 >                         IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost,
150                           CurrentTime - target_p->lasttime,
151                           CurrentTime - target_p->localClient->last);
152              else  
153                sendto_one(source_p, form_str(RPL_TRACEOPERATOR),
154                           me.name, source_p->name, class_name, name,
155 <                         (IsIPSpoof(target_p) ? "255.255.255.255" : ip),
155 >                         (IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost),
156                           CurrentTime - target_p->lasttime,
157                           CurrentTime - target_p->localClient->last);
158            }
# Line 170 | Line 161 | report_this_status(struct Client *source
161              if (ConfigFileEntry.hide_spoof_ips)
162                sendto_one(source_p, form_str(RPL_TRACEUSER),
163                           me.name, source_p->name, class_name, name,
164 <                         IsIPSpoof(target_p) ? "255.255.255.255" : ip,
164 >                         IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost,
165                           CurrentTime - target_p->lasttime,
166                           CurrentTime - target_p->localClient->last);
167              else
168                sendto_one(source_p, form_str(RPL_TRACEUSER),
169                           me.name, source_p->name, class_name, name,
170 <                         (IsIPSpoof(target_p) ? "255.255.255.255" : ip),
170 >                         (IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost),
171                           CurrentTime - target_p->lasttime,
172                           CurrentTime - target_p->localClient->last);
173            }
183          cnt++;
174          }
175        break;
176      case STAT_SERVER:
# Line 192 | Line 182 | report_this_status(struct Client *source
182                   0, name, *(target_p->serv->by) ?
183                   target_p->serv->by : "*", "*",
184                   me.name, CurrentTime - target_p->lasttime);
195      cnt++;
185        break;
186        
187      default: /* ...we actually shouldn't come here... --msa */
188        sendto_one(source_p, form_str(RPL_TRACENEWTYPE), me.name,
189                   source_p->name, name);
201      cnt++;
190        break;
191 <    }
204 <
205 <  return cnt;
191 >  }
192   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines