ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_etrace.c
Revision: 2820
Committed: Wed Jan 15 23:10:26 2014 UTC (12 years, 6 months ago) by michael
Content type: text/x-csrc
File size: 4586 byte(s)
Log Message:
- Clean up all files in modules/ (fixed indentation, removed whitespaces/tabs)
- Fixed copyright years
- Made module handlers int type for later use

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 "fdlist.h"
35     #include "s_bsd.h"
36     #include "s_serv.h"
37     #include "send.h"
38     #include "parse.h"
39     #include "modules.h"
40 michael 1309 #include "conf.h"
41 michael 1632 #include "conf_class.h"
42 adx 30
43    
44 michael 2189 static void report_this_status(struct Client *, struct Client *);
45 adx 30
46     /*
47     * do_etrace()
48     */
49     static void
50 michael 1144 do_etrace(struct Client *source_p, int parc, char *parv[])
51 adx 30 {
52     const char *tname = NULL;
53     struct Client *target_p = NULL;
54     int wilds = 0;
55     int do_all = 0;
56     dlink_node *ptr;
57    
58 michael 1618 sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
59 michael 1144 "ETRACE requested by %s (%s@%s) [%s]",
60     source_p->name, source_p->username,
61     source_p->host, source_p->servptr->name);
62    
63 db 849 if (parc > 1)
64 adx 30 {
65     tname = parv[1];
66 db 849
67 adx 30 if (tname != NULL)
68 michael 1400 wilds = has_wildcards(tname);
69 adx 30 else
70     tname = "*";
71     }
72     else
73     {
74     do_all = 1;
75     tname = "*";
76     }
77    
78     if (!wilds && !do_all)
79     {
80 michael 1169 target_p = hash_find_client(tname);
81 adx 30
82     if (target_p && MyClient(target_p))
83 michael 2189 report_this_status(source_p, target_p);
84 michael 2820
85     sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,
86 michael 891 source_p->name, tname);
87 adx 30 return;
88     }
89    
90     DLINK_FOREACH(ptr, local_client_list.head)
91     {
92     target_p = ptr->data;
93    
94     if (wilds)
95     {
96 michael 1652 if (!match(tname, target_p->name))
97 michael 2189 report_this_status(source_p, target_p);
98 adx 30 }
99     else
100 michael 2189 report_this_status(source_p, target_p);
101 adx 30 }
102    
103 michael 1834 sendto_one(source_p, form_str(RPL_ENDOFTRACE), me.name,
104 michael 891 source_p->name, tname);
105 adx 30 }
106    
107     /* mo_etrace()
108     * parv[0] = sender prefix
109     * parv[1] = servername
110     */
111 michael 2820 static int
112 adx 30 mo_etrace(struct Client *client_p, struct Client *source_p,
113 michael 1114 int parc, char *parv[])
114 adx 30 {
115 michael 1144 do_etrace(source_p, parc, parv);
116 michael 2820 return 0;
117 adx 30 }
118    
119     /* report_this_status()
120     *
121     * inputs - pointer to client to report to
122     * - pointer to client to report about
123 db 849 * - flag full etrace or not
124 adx 30 * output - NONE
125     * side effects - NONE
126     */
127     static void
128 michael 2189 report_this_status(struct Client *source_p, struct Client *target_p)
129 adx 30 {
130     if (target_p->status == STAT_CLIENT)
131     {
132 michael 2189 if (ConfigFileEntry.hide_spoof_ips)
133 michael 2820 sendto_one(source_p, form_str(RPL_ETRACE),
134     me.name,
135     source_p->name,
136     HasUMode(target_p, UMODE_OPER) ? "Oper" : "User",
137     get_client_class(&target_p->localClient->confs),
138     target_p->name,
139     target_p->username,
140     target_p->host,
141     IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost,
142     target_p->info);
143 adx 30 else
144 michael 2820 sendto_one(source_p, form_str(RPL_ETRACE),
145     me.name,
146     source_p->name,
147     HasUMode(target_p, UMODE_OPER) ? "Oper" : "User",
148     get_client_class(&target_p->localClient->confs),
149     target_p->name,
150     target_p->username,
151     target_p->host,
152     target_p->sockhost,
153     target_p->info);
154 adx 30 }
155     }
156 michael 1230
157 michael 2820 static struct Message etrace_msgtab =
158     {
159 michael 1230 "ETRACE", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
160 michael 2820 { m_unregistered, m_not_oper, m_ignore, m_ignore, mo_etrace, m_ignore }
161 michael 1230 };
162    
163     static void
164     module_init(void)
165     {
166     mod_add_cmd(&etrace_msgtab);
167     }
168    
169     static void
170     module_exit(void)
171     {
172     mod_del_cmd(&etrace_msgtab);
173     }
174    
175 michael 2820 struct module module_entry =
176     {
177 michael 1230 .node = { NULL, NULL, NULL },
178     .name = NULL,
179     .version = "$Revision$",
180     .handle = NULL,
181     .modinit = module_init,
182     .modexit = module_exit,
183     .flags = 0
184     };

Properties

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