ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_etrace.c
Revision: 2968
Committed: Thu Jan 30 18:19:18 2014 UTC (12 years, 5 months ago) by michael
Content type: text/x-csrc
File size: 4495 byte(s)
Log Message:
- m_etrace.c: removed unused header includes

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2820 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 2820 * Copyright (c) 2004-2014 ircd-hybrid development team
5 adx 30 *
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 michael 2820 /*! \file m_etrace.c
23     * \brief Includes required functions for processing the ETRACE command.
24     * \version $Id$
25     */
26    
27 adx 30 #include "stdinc.h"
28 michael 1011 #include "list.h"
29 adx 30 #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 michael 1309 #include "conf.h"
38 michael 1632 #include "conf_class.h"
39 adx 30
40    
41 michael 2968 /* 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(source_p, form_str(RPL_ETRACE),
56     me.name,
57     source_p->name,
58     HasUMode(target_p, UMODE_OPER) ? "Oper" : "User",
59     get_client_class(&target_p->localClient->confs),
60     target_p->name,
61     target_p->username,
62     target_p->host,
63     IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost,
64     target_p->info);
65     else
66     sendto_one(source_p, form_str(RPL_ETRACE),
67     me.name,
68     source_p->name,
69     HasUMode(target_p, UMODE_OPER) ? "Oper" : "User",
70     get_client_class(&target_p->localClient->confs),
71     target_p->name,
72     target_p->username,
73     target_p->host,
74     target_p->sockhost,
75     target_p->info);
76     }
77     }
78 adx 30
79     /*
80     * do_etrace()
81     */
82     static void
83 michael 1144 do_etrace(struct Client *source_p, int parc, char *parv[])
84 adx 30 {
85     const char *tname = NULL;
86     struct Client *target_p = NULL;
87     int wilds = 0;
88     int do_all = 0;
89     dlink_node *ptr;
90    
91 michael 1618 sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
92 michael 1144 "ETRACE requested by %s (%s@%s) [%s]",
93     source_p->name, source_p->username,
94     source_p->host, source_p->servptr->name);
95    
96 db 849 if (parc > 1)
97 adx 30 {
98     tname = parv[1];
99 db 849
100 adx 30 if (tname != NULL)
101 michael 1400 wilds = has_wildcards(tname);
102 adx 30 else
103     tname = "*";
104     }
105     else
106     {
107     do_all = 1;
108     tname = "*";
109     }
110    
111     if (!wilds && !do_all)
112     {
113 michael 1169 target_p = hash_find_client(tname);
114 adx 30
115     if (target_p && MyClient(target_p))
116 michael 2189 report_this_status(source_p, target_p);
117 michael 2820
118     sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,
119 michael 891 source_p->name, tname);
120 adx 30 return;
121     }
122    
123     DLINK_FOREACH(ptr, local_client_list.head)
124     {
125     target_p = ptr->data;
126    
127     if (wilds)
128     {
129 michael 1652 if (!match(tname, target_p->name))
130 michael 2189 report_this_status(source_p, target_p);
131 adx 30 }
132     else
133 michael 2189 report_this_status(source_p, target_p);
134 adx 30 }
135    
136 michael 1834 sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,
137 michael 891 source_p->name, tname);
138 adx 30 }
139    
140     /* mo_etrace()
141     * parv[0] = sender prefix
142     * parv[1] = servername
143     */
144 michael 2820 static int
145 adx 30 mo_etrace(struct Client *client_p, struct Client *source_p,
146 michael 1114 int parc, char *parv[])
147 adx 30 {
148 michael 1144 do_etrace(source_p, parc, parv);
149 michael 2820 return 0;
150 adx 30 }
151    
152 michael 2820 static struct Message etrace_msgtab =
153     {
154 michael 1230 "ETRACE", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
155 michael 2820 { m_unregistered, m_not_oper, m_ignore, m_ignore, mo_etrace, m_ignore }
156 michael 1230 };
157    
158     static void
159     module_init(void)
160     {
161     mod_add_cmd(&etrace_msgtab);
162     }
163    
164     static void
165     module_exit(void)
166     {
167     mod_del_cmd(&etrace_msgtab);
168     }
169    
170 michael 2820 struct module module_entry =
171     {
172 michael 1230 .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