ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/modules/m_version.c
Revision: 2196
Committed: Tue Jun 4 18:30:12 2013 UTC (10 years, 10 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid/trunk/modules/m_version.c
File size: 3750 byte(s)
Log Message:
- Moved disable_remote_command configuration directive from
  general{} block to serverhide{] block

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * m_version.c: Shows ircd version information.
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 "client.h"
27 #include "ircd.h"
28 #include "numeric.h"
29 #include "conf.h"
30 #include "s_serv.h"
31 #include "s_user.h"
32 #include "send.h"
33 #include "parse.h"
34 #include "modules.h"
35
36
37 /* Option string. */
38 static const char serveropts[] = {
39 'T',
40 'S',
41 #ifdef TS_CURRENT
42 '0' + TS_CURRENT,
43 #endif
44 /* ONLY do TS */
45 /* ALWAYS do TS_WARNINGS */
46 'o',
47 'w',
48 '\0'
49 };
50
51 /*
52 * m_version - VERSION command handler
53 * parv[0] = sender prefix
54 * parv[1] = remote server
55 */
56 static void
57 m_version(struct Client *client_p, struct Client *source_p,
58 int parc, char *parv[])
59 {
60 static time_t last_used = 0;
61
62 if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
63 {
64 /* safe enough to give this on a local connect only */
65 sendto_one(source_p, form_str(RPL_LOAD2HI),
66 me.name, source_p->name);
67 return;
68 }
69
70 last_used = CurrentTime;
71
72 if (!ConfigServerHide.disable_remote_commands)
73 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
74 1, parc, parv) != HUNTED_ISME)
75 return;
76
77 sendto_one(source_p, form_str(RPL_VERSION), me.name,
78 source_p->name, ircd_version, serno,
79 me.name, serveropts);
80 show_isupport(source_p);
81 }
82
83 /*
84 * mo_version - VERSION command handler
85 * parv[0] = sender prefix
86 * parv[1] = remote server
87 */
88 static void
89 mo_version(struct Client *client_p, struct Client *source_p,
90 int parc, char *parv[])
91 {
92
93 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
94 1, parc, parv) != HUNTED_ISME)
95 return;
96
97 sendto_one(source_p, form_str(RPL_VERSION), me.name,
98 source_p->name, ircd_version, serno,
99 me.name, serveropts);
100 show_isupport(source_p);
101 }
102
103 /*
104 * ms_version - VERSION command handler
105 * parv[0] = sender prefix
106 * parv[1] = remote server
107 */
108 static void
109 ms_version(struct Client *client_p, struct Client *source_p,
110 int parc, char *parv[])
111 {
112 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
113 1, parc, parv) != HUNTED_ISME)
114 return;
115
116 sendto_one(source_p, form_str(RPL_VERSION),
117 ID_or_name(&me, client_p),
118 ID_or_name(source_p, client_p),
119 ircd_version, serno,
120 me.name, serveropts);
121 show_isupport(source_p);
122 }
123
124 static struct Message version_msgtab = {
125 "VERSION", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
126 { m_unregistered, m_version, ms_version, m_ignore, mo_version, m_ignore }
127 };
128
129 static void
130 module_init(void)
131 {
132 mod_add_cmd(&version_msgtab);
133 }
134
135 static void
136 module_exit(void)
137 {
138 mod_del_cmd(&version_msgtab);
139 }
140
141 struct module module_entry = {
142 .node = { NULL, NULL, NULL },
143 .name = NULL,
144 .version = "$Revision$",
145 .handle = NULL,
146 .modinit = module_init,
147 .modexit = module_exit,
148 .flags = 0
149 };

Properties

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