ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_etrace.c
Revision: 3787
Committed: Mon Jun 2 23:27:50 2014 UTC (12 years, 1 month ago) by michael
Content type: text/x-csrc
File size: 4298 byte(s)
Log Message:
- m_etrace.c: whitespace commit

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 adx 30
39    
40 michael 2968 /* report_this_status()
41     *
42     * inputs - pointer to client to report to
43     * - pointer to client to report about
44     * - flag full etrace or not
45     * output - NONE
46     * side effects - NONE
47     */
48     static void
49 michael 3578 report_this_status(struct Client *source_p, const struct Client *target_p)
50 michael 2968 {
51 michael 3578 if (target_p->status != STAT_CLIENT)
52 michael 3787 return;
53 michael 3578
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 michael 2968 }
73 adx 30
74     /*
75     * do_etrace()
76     */
77     static void
78 michael 3580 do_etrace(struct Client *source_p, const char *arg)
79 adx 30 {
80     const char *tname = NULL;
81 michael 3578 unsigned int wilds = 0, do_all = 0;
82     const dlink_node *ptr = NULL;
83 adx 30
84 michael 1618 sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
85 michael 1144 "ETRACE requested by %s (%s@%s) [%s]",
86     source_p->name, source_p->username,
87     source_p->host, source_p->servptr->name);
88    
89 michael 3580 if (!EmptyString(arg))
90 adx 30 {
91 michael 3580 tname = arg;
92 michael 3647 wilds = has_wildcards(tname);
93 adx 30 }
94     else
95     {
96     do_all = 1;
97     tname = "*";
98     }
99    
100     if (!wilds && !do_all)
101     {
102 michael 3578 const struct Client *target_p = hash_find_client(tname);
103 adx 30
104     if (target_p && MyClient(target_p))
105 michael 2189 report_this_status(source_p, target_p);
106 michael 2820
107 michael 3109 sendto_one_numeric(source_p, &me, RPL_ENDOFTRACE, tname);
108 adx 30 return;
109     }
110    
111     DLINK_FOREACH(ptr, local_client_list.head)
112     {
113 michael 3578 const struct Client *target_p = ptr->data;
114 adx 30
115     if (wilds)
116     {
117 michael 1652 if (!match(tname, target_p->name))
118 michael 2189 report_this_status(source_p, target_p);
119 adx 30 }
120     else
121 michael 2189 report_this_status(source_p, target_p);
122 adx 30 }
123    
124 michael 3109 sendto_one_numeric(source_p, &me, RPL_ENDOFTRACE, tname);
125 adx 30 }
126    
127     /* mo_etrace()
128 michael 3096 * parv[0] = command
129 adx 30 * parv[1] = servername
130     */
131 michael 2820 static int
132 michael 3156 mo_etrace(struct Client *source_p, int parc, char *parv[])
133 adx 30 {
134 michael 3580 do_etrace(source_p, parv[1]);
135 michael 2820 return 0;
136 adx 30 }
137    
138 michael 2820 static struct Message etrace_msgtab =
139     {
140 michael 1230 "ETRACE", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
141 michael 2820 { m_unregistered, m_not_oper, m_ignore, m_ignore, mo_etrace, m_ignore }
142 michael 1230 };
143    
144     static void
145     module_init(void)
146     {
147     mod_add_cmd(&etrace_msgtab);
148     }
149    
150     static void
151     module_exit(void)
152     {
153     mod_del_cmd(&etrace_msgtab);
154     }
155    
156 michael 2820 struct module module_entry =
157     {
158 michael 1230 .node = { NULL, NULL, NULL },
159     .name = NULL,
160     .version = "$Revision$",
161     .handle = NULL,
162     .modinit = module_init,
163     .modexit = module_exit,
164     .flags = 0
165     };

Properties

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