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

Comparing:
ircd-hybrid/modules/m_etrace.c (file contents), Revision 32 by knight, Sun Oct 2 20:41:23 2005 UTC vs.
ircd-hybrid-8/modules/m_etrace.c (file contents), Revision 1156 by michael, Tue Aug 9 20:29:20 2011 UTC

# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 + #include "list.h"
27   #include "handlers.h"
27 #include "tools.h"
28   #include "hook.h"
29   #include "client.h"
30   #include "hash.h"
# Line 40 | Line 40
40   #include "parse.h"
41   #include "modules.h"
42   #include "s_conf.h"
43 #include "irc_getnameinfo.h"
43  
45 #define FORM_STR_RPL_ETRACE     ":%s 709 %s %s %s %s %s %s :%s"
44  
45 < static void do_etrace(struct Client *, int, char **);
45 > static void do_etrace(struct Client *, int, char *[]);
46   static void mo_etrace(struct Client *, struct Client *, int, char *[]);
47  
48   struct Message etrace_msgtab = {
49    "ETRACE", 0, 0, 0, 0, MFLG_SLOW, 0,
50 <  {m_unregistered, m_ignore, m_ignore, m_ignore, mo_etrace, m_ignore}
50 >  {m_unregistered, m_not_oper, m_ignore, m_ignore, mo_etrace, m_ignore}
51   };
52  
55 #ifndef STATIC_MODULES
53   const char *_version = "$Revision$";
57 static struct Callback *etrace_cb;
58
59 static void *
60 va_etrace(va_list args)
61 {
62  struct Client *source_p = va_arg(args, struct Client *);
63  int parc = va_arg(args, int);
64  char **parv = va_arg(args, char **);
65
66  do_etrace(source_p, parc, parv);
67  return NULL;
68 }
54  
55   void
56   _modinit(void)
57   {
73  etrace_cb = register_callback("doing_etrace", va_etrace);
58    mod_add_cmd(&etrace_msgtab);
59   }
60  
# Line 78 | Line 62 | void
62   _moddeinit(void)
63   {
64    mod_del_cmd(&etrace_msgtab);
81  uninstall_hook(etrace_cb, va_etrace);
65   }
83 #endif
66  
67 < static void report_this_status(struct Client *, struct Client *);
67 > static void report_this_status(struct Client *, struct Client *, int);
68  
69   /*
70   * do_etrace()
71   */
72   static void
73 < do_etrace(struct Client *source_p, int parc, char **parv)
73 > do_etrace(struct Client *source_p, int parc, char *parv[])
74   {
75    const char *tname = NULL;
76    struct Client *target_p = NULL;
77    int wilds = 0;
78    int do_all = 0;
79 +  int full_etrace = 0;
80    dlink_node *ptr;
81  
82 <  if (parc > 0)
82 >  sendto_realops_flags(UMODE_SPY, L_ALL,
83 >                       "ETRACE requested by %s (%s@%s) [%s]",
84 >                       source_p->name, source_p->username,
85 >                       source_p->host, source_p->servptr->name);
86 >
87 >  if (parc > 1)
88 >  {
89 >    if (irccmp(parv[1], "-full") == 0)
90 >    {
91 >      parv++;
92 >      parc--;
93 >      full_etrace = 1;
94 >    }
95 >  }
96 >
97 >  if (parc > 1)
98    {
99      tname = parv[1];
100 +
101      if (tname != NULL)
102        wilds = strchr(tname, '*') || strchr(tname, '?');
103      else
# Line 110 | Line 109 | do_etrace(struct Client *source_p, int p
109      tname = "*";
110    }
111  
112 +  if (IsFull(source_p))
113 +    full_etrace = 1;
114 +
115    if (!wilds && !do_all)
116    {
117      target_p = find_client(tname);
118  
119      if (target_p && MyClient(target_p))
120 <      report_this_status(source_p, target_p);
120 >      report_this_status(source_p, target_p, full_etrace);
121        
122      sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,
123 <               source_p->name, tname);
123 >               source_p->name, tname);
124      return;
125    }
126  
# Line 128 | Line 130 | do_etrace(struct Client *source_p, int p
130  
131      if (wilds)
132      {
133 <      if (match(tname, target_p->name) || match(target_p->name, tname))
134 <        report_this_status(source_p, target_p);
133 >      if (match(tname, target_p->name))
134 >        report_this_status(source_p, target_p, full_etrace);
135      }
136      else
137 <      report_this_status(source_p, target_p);
137 >      report_this_status(source_p, target_p, full_etrace);
138    }
139  
140    sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,
141 <             source_p->name, tname);
141 >             source_p->name, tname);
142   }
143  
144   /* mo_etrace()
# Line 145 | Line 147 | do_etrace(struct Client *source_p, int p
147   */
148   static void
149   mo_etrace(struct Client *client_p, struct Client *source_p,
150 <          int parc, char *parv[])
150 >          int parc, char *parv[])
151   {
150 #ifdef STATIC_MODULES
152    do_etrace(source_p, parc, parv);
152 #else
153  execute_callback(etrace_cb, source_p, parc, parv);
154 #endif
153   }
154  
155   /* report_this_status()
156   *
157   * inputs       - pointer to client to report to
158   *              - pointer to client to report about
159 + *              - flag full etrace or not
160   * output       - NONE
161   * side effects - NONE
162   */
163   static void
164 < report_this_status(struct Client *source_p, struct Client *target_p)
164 > report_this_status(struct Client *source_p, struct Client *target_p,
165 >                   int full_etrace)
166   {
167    const char *name;
168    const char *class_name;
169  char ip[HOSTIPLEN];
170
171  /* Should this be sockhost? - stu */
172  irc_getnameinfo((struct sockaddr*)&target_p->localClient->ip,
173        target_p->localClient->ip.ss_len, ip, HOSTIPLEN, NULL, 0,
174        NI_NUMERICHOST);
169  
170    name = get_client_name(target_p, HIDE_IP);
171    class_name = get_client_class(target_p);
# Line 180 | Line 174 | report_this_status(struct Client *source
174  
175    if (target_p->status == STAT_CLIENT)
176    {
177 <    if (ConfigFileEntry.hide_spoof_ips)
178 <      sendto_one(source_p, FORM_STR_RPL_ETRACE,
179 <                 me.name, source_p->name,
180 <                 IsOper(target_p) ? "Oper" : "User",
181 <                 class_name,
182 <                 target_p->name, target_p->username,
183 <                 IsIPSpoof(target_p) ? "255.255.255.255" : ip,
184 <                 target_p->info);
177 >    if (full_etrace)
178 >    {
179 >      if (ConfigFileEntry.hide_spoof_ips)
180 >        sendto_one(source_p, form_str(RPL_ETRACE_FULL),
181 >                   me.name,
182 >                   source_p->name,
183 >                   IsOper(target_p) ? "Oper" : "User",
184 >                   class_name,
185 >                   target_p->name,
186 >                   target_p->username,
187 >                   target_p->host,
188 >                   IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost,
189 >                   IsIPSpoof(target_p) ? "<hidden>" : target_p->localClient->client_host,
190 >                   IsIPSpoof(target_p) ? "<hidden>" : target_p->localClient->client_server,
191 >                   target_p->info);
192 >      else
193 >        sendto_one(source_p, form_str(RPL_ETRACE_FULL),
194 >                   me.name,
195 >                   source_p->name,
196 >                   IsOper(target_p) ? "Oper" : "User",
197 >                   class_name,
198 >                   target_p->name,
199 >                   target_p->username,
200 >                   target_p->host,
201 >                   target_p->sockhost,
202 >                   target_p->localClient->client_host,
203 >                   target_p->localClient->client_server,
204 >                   target_p->info);
205 >    }
206      else
207 <      sendto_one(source_p, FORM_STR_RPL_ETRACE,
208 <                 me.name, source_p->name,
209 <                 IsOper(target_p) ? "Oper" : "User",
210 <                 class_name,
211 <                 target_p->name, target_p->username, ip,
212 <                 target_p->info);
207 >    {
208 >      if (ConfigFileEntry.hide_spoof_ips)
209 >        sendto_one(source_p, form_str(RPL_ETRACE),
210 >                   me.name,
211 >                   source_p->name,
212 >                   IsOper(target_p) ? "Oper" : "User",
213 >                   class_name,
214 >                   target_p->name,
215 >                   target_p->username,
216 >                   target_p->host,
217 >                   IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost,
218 >                   target_p->info);
219 >      else
220 >        sendto_one(source_p, form_str(RPL_ETRACE),
221 >                   me.name,
222 >                   source_p->name,
223 >                   IsOper(target_p) ? "Oper" : "User",
224 >                   class_name,
225 >                   target_p->name,
226 >                   target_p->username,
227 >                   target_p->host,
228 >                   target_p->sockhost,
229 >                   target_p->info);
230 >    }
231    }
232   }

Comparing:
ircd-hybrid/modules/m_etrace.c (property svn:keywords), Revision 32 by knight, Sun Oct 2 20:41:23 2005 UTC vs.
ircd-hybrid-8/modules/m_etrace.c (property svn:keywords), Revision 1156 by michael, Tue Aug 9 20:29:20 2011 UTC

# Line 1 | Line 1
1 < Revision
1 > Id Revision

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines