ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_etrace.c
Revision: 3156
Committed: Fri Mar 14 19:57:38 2014 UTC (11 years, 5 months ago) by michael
Content type: text/x-csrc
File size: 4270 byte(s)
Log Message:
- Removed client_p pointers from everywhere

File Contents

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

Properties

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