/[svn]/ircd-hybrid-7.2/contrib/m_ctrace.c
ViewVC logotype

Diff of /ircd-hybrid-7.2/contrib/m_ctrace.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 890 by adx, Fri Dec 9 11:25:44 2005 UTC revision 891 by michael, Thu Nov 1 13:44:50 2007 UTC
# Line 40  Line 40 
40  #include "msg.h"  #include "msg.h"
41  #include "parse.h"  #include "parse.h"
42  #include "modules.h"  #include "modules.h"
 #include "irc_getnameinfo.h"  
43    
44  static void do_ctrace(struct Client *, int, char **);  static void do_ctrace(struct Client *, int, char *[]);
45  static void mo_ctrace(struct Client *, struct Client *, int, char *[]);  static void mo_ctrace(struct Client *, struct Client *, int, char *[]);
46    
47  struct Message ctrace_msgtab = {  struct Message ctrace_msgtab = {
# Line 80  _moddeinit(void) Line 79  _moddeinit(void)
79  }  }
80  #endif  #endif
81    
82  static int report_this_status(struct Client *, struct Client *);  static void report_this_status(struct Client *, struct Client *);
83    
84  /*  /*
85  ** mo_ctrace  ** mo_ctrace
# Line 109  mo_ctrace(struct Client *client_p, struc Line 108  mo_ctrace(struct Client *client_p, struc
108   * do_ctrace   * do_ctrace
109   */   */
110  static void  static void
111  do_ctrace(struct Client *source_p, int parc, char **parv)  do_ctrace(struct Client *source_p, int parc, char *parv[])
112  {  {
113    struct Client *target_p = NULL;    struct Client *target_p = NULL;
114    char *class_looking_for;    char *class_looking_for;
# Line 146  report_this_status(struct Client *source Line 145  report_this_status(struct Client *source
145  {  {
146    const char *name = NULL;    const char *name = NULL;
147    const char *class_name = NULL;    const char *class_name = NULL;
   char ip[HOSTIPLEN];  
   int cnt = 0;  
148    
   /* Should this be sockhost? - stu */  
   irc_getnameinfo((struct sockaddr*)&target_p->localClient->ip,  
         target_p->localClient->ip.ss_len, ip, HOSTIPLEN, NULL, 0,  
         NI_NUMERICHOST);  
149    name = get_client_name(target_p, HIDE_IP);    name = get_client_name(target_p, HIDE_IP);
150    class_name = get_client_class(target_p);    class_name = get_client_class(target_p);
151    
# Line 167  report_this_status(struct Client *source Line 160  report_this_status(struct Client *source
160          if (IsAdmin(target_p) && !ConfigFileEntry.hide_spoof_ips)          if (IsAdmin(target_p) && !ConfigFileEntry.hide_spoof_ips)
161            sendto_one(source_p, form_str(RPL_TRACEOPERATOR),            sendto_one(source_p, form_str(RPL_TRACEOPERATOR),
162                         me.name, source_p->name, class_name, name,                         me.name, source_p->name, class_name, name,
163                         IsAdmin(source_p) ? ip : "255.255.255.255",                         IsAdmin(source_p) ? target_p->sockhost : "255.255.255.255",
164                         CurrentTime - target_p->lasttime,                         CurrentTime - target_p->lasttime,
165                         CurrentTime - target_p->localClient->last);                         CurrentTime - target_p->localClient->last);
166            else if (IsOper(target_p))            else if (IsOper(target_p))
# Line 175  report_this_status(struct Client *source Line 168  report_this_status(struct Client *source
168              if (ConfigFileEntry.hide_spoof_ips)              if (ConfigFileEntry.hide_spoof_ips)
169                sendto_one(source_p, form_str(RPL_TRACEOPERATOR),                sendto_one(source_p, form_str(RPL_TRACEOPERATOR),
170                           me.name, source_p->name, class_name, name,                           me.name, source_p->name, class_name, name,
171                           IsIPSpoof(target_p) ? "255.255.255.255" : ip,                           IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost,
172                           CurrentTime - target_p->lasttime,                           CurrentTime - target_p->lasttime,
173                           CurrentTime - target_p->localClient->last);                           CurrentTime - target_p->localClient->last);
174              else                else  
175                sendto_one(source_p, form_str(RPL_TRACEOPERATOR),                sendto_one(source_p, form_str(RPL_TRACEOPERATOR),
176                           me.name, source_p->name, class_name, name,                           me.name, source_p->name, class_name, name,
177                           (IsIPSpoof(target_p) ? "255.255.255.255" : ip),                           (IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost),
178                           CurrentTime - target_p->lasttime,                           CurrentTime - target_p->lasttime,
179                           CurrentTime - target_p->localClient->last);                           CurrentTime - target_p->localClient->last);
180            }            }
# Line 190  report_this_status(struct Client *source Line 183  report_this_status(struct Client *source
183              if (ConfigFileEntry.hide_spoof_ips)              if (ConfigFileEntry.hide_spoof_ips)
184                sendto_one(source_p, form_str(RPL_TRACEUSER),                sendto_one(source_p, form_str(RPL_TRACEUSER),
185                           me.name, source_p->name, class_name, name,                           me.name, source_p->name, class_name, name,
186                           IsIPSpoof(target_p) ? "255.255.255.255" : ip,                           IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost,
187                           CurrentTime - target_p->lasttime,                           CurrentTime - target_p->lasttime,
188                           CurrentTime - target_p->localClient->last);                           CurrentTime - target_p->localClient->last);
189              else              else
190                sendto_one(source_p, form_str(RPL_TRACEUSER),                sendto_one(source_p, form_str(RPL_TRACEUSER),
191                           me.name, source_p->name, class_name, name,                           me.name, source_p->name, class_name, name,
192                           (IsIPSpoof(target_p) ? "255.255.255.255" : ip),                           (IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost),
193                           CurrentTime - target_p->lasttime,                           CurrentTime - target_p->lasttime,
194                           CurrentTime - target_p->localClient->last);                           CurrentTime - target_p->localClient->last);
195            }            }
           cnt++;  
196          }          }
197        break;        break;
198      case STAT_SERVER:      case STAT_SERVER:
199        if(!IsAdmin(source_p))        if (!IsAdmin(source_p))
200          name = get_client_name(target_p, MASK_IP);          name = get_client_name(target_p, MASK_IP);
201    
202        sendto_one(source_p, form_str(RPL_TRACESERVER),        sendto_one(source_p, form_str(RPL_TRACESERVER),
# Line 212  report_this_status(struct Client *source Line 204  report_this_status(struct Client *source
204                   0, name, *(target_p->serv->by) ?                   0, name, *(target_p->serv->by) ?
205                   target_p->serv->by : "*", "*",                   target_p->serv->by : "*", "*",
206                   me.name, CurrentTime - target_p->lasttime);                   me.name, CurrentTime - target_p->lasttime);
       cnt++;  
207        break;        break;
208                
209      default: /* ...we actually shouldn't come here... --msa */      default: /* ...we actually shouldn't come here... --msa */
210        sendto_one(source_p, form_str(RPL_TRACENEWTYPE), me.name,        sendto_one(source_p, form_str(RPL_TRACENEWTYPE), me.name,
211                   source_p->name, name);                   source_p->name, name);
       cnt++;  
212        break;        break;
213      }    }
   
   return cnt;  
214  }  }

Legend:
Removed from v.890  
changed lines
  Added in v.891

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.26