ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_etrace.c
Revision: 2189
Committed: Tue Jun 4 12:45:38 2013 UTC (12 years, 2 months ago) by michael
Content type: text/x-csrc
File size: 4304 byte(s)
Log Message:
- Removed Client::client_host and Client::client_server members

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * m_etrace.c: Traces a path to a client/server.
4 *
5 * Copyright (C) 2002 by the past and present ircd coders, and others.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 * $Id$
23 */
24
25 #include "stdinc.h"
26 #include "list.h"
27 #include "client.h"
28 #include "hash.h"
29 #include "irc_string.h"
30 #include "ircd.h"
31 #include "numeric.h"
32 #include "fdlist.h"
33 #include "s_bsd.h"
34 #include "s_serv.h"
35 #include "send.h"
36 #include "parse.h"
37 #include "modules.h"
38 #include "conf.h"
39 #include "conf_class.h"
40
41
42 static void report_this_status(struct Client *, struct Client *);
43
44 /*
45 * do_etrace()
46 */
47 static void
48 do_etrace(struct Client *source_p, int parc, char *parv[])
49 {
50 const char *tname = NULL;
51 struct Client *target_p = NULL;
52 int wilds = 0;
53 int do_all = 0;
54 dlink_node *ptr;
55
56 sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
57 "ETRACE requested by %s (%s@%s) [%s]",
58 source_p->name, source_p->username,
59 source_p->host, source_p->servptr->name);
60
61 if (parc > 1)
62 {
63 tname = parv[1];
64
65 if (tname != NULL)
66 wilds = has_wildcards(tname);
67 else
68 tname = "*";
69 }
70 else
71 {
72 do_all = 1;
73 tname = "*";
74 }
75
76 if (!wilds && !do_all)
77 {
78 target_p = hash_find_client(tname);
79
80 if (target_p && MyClient(target_p))
81 report_this_status(source_p, target_p);
82
83 sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,
84 source_p->name, tname);
85 return;
86 }
87
88 DLINK_FOREACH(ptr, local_client_list.head)
89 {
90 target_p = ptr->data;
91
92 if (wilds)
93 {
94 if (!match(tname, target_p->name))
95 report_this_status(source_p, target_p);
96 }
97 else
98 report_this_status(source_p, target_p);
99 }
100
101 sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,
102 source_p->name, tname);
103 }
104
105 /* mo_etrace()
106 * parv[0] = sender prefix
107 * parv[1] = servername
108 */
109 static void
110 mo_etrace(struct Client *client_p, struct Client *source_p,
111 int parc, char *parv[])
112 {
113 do_etrace(source_p, parc, parv);
114 }
115
116 /* report_this_status()
117 *
118 * inputs - pointer to client to report to
119 * - pointer to client to report about
120 * - flag full etrace or not
121 * output - NONE
122 * side effects - NONE
123 */
124 static void
125 report_this_status(struct Client *source_p, struct Client *target_p)
126 {
127 if (target_p->status == STAT_CLIENT)
128 {
129 if (ConfigFileEntry.hide_spoof_ips)
130 sendto_one(source_p, form_str(RPL_ETRACE),
131 me.name,
132 source_p->name,
133 HasUMode(target_p, UMODE_OPER) ? "Oper" : "User",
134 get_client_class(&target_p->localClient->confs),
135 target_p->name,
136 target_p->username,
137 target_p->host,
138 IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost,
139 target_p->info);
140 else
141 sendto_one(source_p, form_str(RPL_ETRACE),
142 me.name,
143 source_p->name,
144 HasUMode(target_p, UMODE_OPER) ? "Oper" : "User",
145 get_client_class(&target_p->localClient->confs),
146 target_p->name,
147 target_p->username,
148 target_p->host,
149 target_p->sockhost,
150 target_p->info);
151 }
152 }
153
154 static struct Message etrace_msgtab = {
155 "ETRACE", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
156 {m_unregistered, m_not_oper, m_ignore, m_ignore, mo_etrace, m_ignore}
157 };
158
159 static void
160 module_init(void)
161 {
162 mod_add_cmd(&etrace_msgtab);
163 }
164
165 static void
166 module_exit(void)
167 {
168 mod_del_cmd(&etrace_msgtab);
169 }
170
171 struct module module_entry = {
172 .node = { NULL, NULL, NULL },
173 .name = NULL,
174 .version = "$Revision$",
175 .handle = NULL,
176 .modinit = module_init,
177 .modexit = module_exit,
178 .flags = 0
179 };

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision