/[svn]/ircd-hybrid-7.2/modules/m_etrace.c
ViewVC logotype

Diff of /ircd-hybrid-7.2/modules/m_etrace.c

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

revision 848 by michael, Fri Oct 21 22:04:25 2005 UTC revision 849 by db, Mon Feb 19 19:41:59 2007 UTC
# Line 42  Line 42 
42  #include "s_conf.h"  #include "s_conf.h"
43  #include "irc_getnameinfo.h"  #include "irc_getnameinfo.h"
44    
45  #define FORM_STR_RPL_ETRACE     ":%s 709 %s %s %s %s %s %s :%s"  #define FORM_STR_RPL_ETRACE      ":%s 709 %s %s %s %s %s %s :%s"
46    #define FORM_STR_RPL_ETRACE_FULL ":%s 708 %s %s %s %s %s %s %s %s :%s"
47    
48  static void do_etrace(struct Client *, int, char **);  static void do_etrace(struct Client *, int, char **);
49  static void mo_etrace(struct Client *, struct Client *, int, char *[]);  static void mo_etrace(struct Client *, struct Client *, int, char *[]);
# Line 82  _moddeinit(void) Line 83  _moddeinit(void)
83  }  }
84  #endif  #endif
85    
86  static void report_this_status(struct Client *, struct Client *);  static void report_this_status(struct Client *, struct Client *, int);
87    
88  /*  /*
89   * do_etrace()   * do_etrace()
# Line 94  do_etrace(struct Client *source_p, int p Line 95  do_etrace(struct Client *source_p, int p
95    struct Client *target_p = NULL;    struct Client *target_p = NULL;
96    int wilds = 0;    int wilds = 0;
97    int do_all = 0;    int do_all = 0;
98      int full_etrace = 0;
99    dlink_node *ptr;    dlink_node *ptr;
100    
101    if (parc > 0)    if (parc > 1)
102      {
103        if (irccmp(parv[1], "-full") == 0)
104        {
105          parv++;
106          parc--;
107          full_etrace = 1;
108        }
109      }
110    
111      if (parc > 1)
112    {    {
113      tname = parv[1];      tname = parv[1];
114    
115      if (tname != NULL)      if (tname != NULL)
116        wilds = strchr(tname, '*') || strchr(tname, '?');        wilds = strchr(tname, '*') || strchr(tname, '?');
117      else      else
# Line 115  do_etrace(struct Client *source_p, int p Line 128  do_etrace(struct Client *source_p, int p
128      target_p = find_client(tname);      target_p = find_client(tname);
129    
130      if (target_p && MyClient(target_p))      if (target_p && MyClient(target_p))
131        report_this_status(source_p, target_p);        report_this_status(source_p, target_p, full_etrace);
132                
133      sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,      sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,
134                 source_p->name, tname);                 source_p->name, tname);
# Line 129  do_etrace(struct Client *source_p, int p Line 142  do_etrace(struct Client *source_p, int p
142      if (wilds)      if (wilds)
143      {      {
144        if (match(tname, target_p->name) || match(target_p->name, tname))        if (match(tname, target_p->name) || match(target_p->name, tname))
145          report_this_status(source_p, target_p);          report_this_status(source_p, target_p, full_etrace);
146      }      }
147      else      else
148        report_this_status(source_p, target_p);        report_this_status(source_p, target_p, full_etrace);
149    }    }
150    
151    sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,    sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,
# Line 158  mo_etrace(struct Client *client_p, struc Line 171  mo_etrace(struct Client *client_p, struc
171   *   *
172   * inputs       - pointer to client to report to   * inputs       - pointer to client to report to
173   *              - pointer to client to report about   *              - pointer to client to report about
174     *              - flag full etrace or not
175   * output       - NONE   * output       - NONE
176   * side effects - NONE   * side effects - NONE
177   */   */
178  static void  static void
179  report_this_status(struct Client *source_p, struct Client *target_p)  report_this_status(struct Client *source_p, struct Client *target_p,
180                       int full_etrace)
181  {  {
182    const char *name;    const char *name;
183    const char *class_name;    const char *class_name;
# Line 180  report_this_status(struct Client *source Line 195  report_this_status(struct Client *source
195    
196    if (target_p->status == STAT_CLIENT)    if (target_p->status == STAT_CLIENT)
197    {    {
198      if (ConfigFileEntry.hide_spoof_ips)      if (full_etrace)
199        sendto_one(source_p, FORM_STR_RPL_ETRACE,      {
200                   me.name, source_p->name,        if (ConfigFileEntry.hide_spoof_ips)
201                   IsOper(target_p) ? "Oper" : "User",          sendto_one(source_p, FORM_STR_RPL_ETRACE_FULL,
202                   class_name,                     me.name,
203                   target_p->name, target_p->username,                     source_p->name,
204                   IsIPSpoof(target_p) ? "255.255.255.255" : ip,                     IsOper(target_p) ? "Oper" : "User",
205                   target_p->info);                     class_name,
206                       target_p->name,
207                       target_p->username,
208                       IsIPSpoof(target_p) ? "255.255.255.255" : ip,
209                       IsIPSpoof(target_p) ? "<hidden>" : target_p->client_host,
210                       IsIPSpoof(target_p) ? "<hidden>" : target_p->client_server,
211                       target_p->info);
212          else
213            sendto_one(source_p, FORM_STR_RPL_ETRACE_FULL,
214                       me.name,
215                       source_p->name,
216                       IsOper(target_p) ? "Oper" : "User",
217                       class_name,
218                       target_p->name,
219                       target_p->username,
220                       ip,
221                       target_p->client_host,
222                       target_p->client_server,
223                       target_p->info);
224        }
225      else      else
226        sendto_one(source_p, FORM_STR_RPL_ETRACE,      {
227                   me.name, source_p->name,        if (ConfigFileEntry.hide_spoof_ips)
228                   IsOper(target_p) ? "Oper" : "User",          sendto_one(source_p, FORM_STR_RPL_ETRACE,
229                   class_name,                     me.name,
230                   target_p->name, target_p->username, ip,                     source_p->name,
231                   target_p->info);                     IsOper(target_p) ? "Oper" : "User",
232                       class_name,
233                       target_p->name,
234                       target_p->username,
235                       IsIPSpoof(target_p) ? "255.255.255.255" : ip,
236                       target_p->info);
237          else
238            sendto_one(source_p, FORM_STR_RPL_ETRACE,
239                       me.name,
240                       source_p->name,
241                       IsOper(target_p) ? "Oper" : "User",
242                       class_name,
243                       target_p->name,
244                       target_p->username,
245                       ip,
246                       target_p->info);
247        }
248    }    }
249  }  }

Legend:
Removed from v.848  
changed lines
  Added in v.849

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