1 |
adx |
30 |
/* |
2 |
michael |
2820 |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
adx |
30 |
* |
4 |
michael |
2820 |
* Copyright (c) 1997-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_info.c |
23 |
|
|
* \brief Includes required functions for processing the INFO 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 "ircd.h" |
31 |
|
|
#include "numeric.h" |
32 |
michael |
3347 |
#include "misc.h" |
33 |
|
|
#include "server.h" |
34 |
adx |
30 |
#include "send.h" |
35 |
michael |
1309 |
#include "conf.h" |
36 |
adx |
30 |
#include "parse.h" |
37 |
|
|
#include "modules.h" |
38 |
|
|
|
39 |
michael |
1230 |
|
40 |
michael |
3742 |
/* Types for output_type in InfoStruct */ |
41 |
|
|
enum |
42 |
|
|
{ |
43 |
|
|
OUTPUT_STRING = 1 << 0, /* Output option as %s w/ dereference */ |
44 |
|
|
OUTPUT_STRING_PTR = 1 << 1, /* Output option as %s w/out deference */ |
45 |
|
|
OUTPUT_DECIMAL = 1 << 2, /* Output option as decimal (%d) */ |
46 |
|
|
OUTPUT_BOOLEAN = 1 << 3, /* Output option as "ON" or "OFF" */ |
47 |
|
|
OUTPUT_BOOLEAN_YN = 1 << 4, /* Output option as "YES" or "NO" */ |
48 |
|
|
OUTPUT_BOOLEAN2 = 1 << 5 /* Output option as "YES/NO/MASKED" */ |
49 |
|
|
}; |
50 |
|
|
|
51 |
adx |
30 |
/* |
52 |
|
|
* jdc -- Structure for our configuration value table |
53 |
|
|
*/ |
54 |
|
|
struct InfoStruct |
55 |
|
|
{ |
56 |
michael |
3742 |
const char *name; /* Displayed variable name */ |
57 |
|
|
const unsigned int output_type; /* Type of output. See enum above */ |
58 |
|
|
const void *option; /* Pointer reference to the value */ |
59 |
|
|
const char *desc; /* ASCII description of the variable */ |
60 |
adx |
30 |
}; |
61 |
|
|
|
62 |
|
|
static const struct InfoStruct info_table[] = |
63 |
|
|
{ |
64 |
|
|
/* --[ START OF TABLE ]-------------------------------------------- */ |
65 |
michael |
1318 |
|
66 |
adx |
30 |
{ |
67 |
michael |
3236 |
"DPATH", |
68 |
|
|
OUTPUT_STRING, |
69 |
|
|
&ConfigFileEntry.dpath, |
70 |
|
|
"Root directory of installation" |
71 |
|
|
}, |
72 |
|
|
{ |
73 |
michael |
3239 |
"SPATH", |
74 |
|
|
OUTPUT_STRING, |
75 |
|
|
&ConfigFileEntry.spath, |
76 |
|
|
"Path to server executable" |
77 |
|
|
}, |
78 |
|
|
{ |
79 |
|
|
"MPATH", |
80 |
|
|
OUTPUT_STRING, |
81 |
|
|
&ConfigFileEntry.mpath, |
82 |
|
|
"Path to main motd (Message of the Day) file" |
83 |
|
|
}, |
84 |
|
|
{ |
85 |
michael |
1318 |
"CPATH", |
86 |
|
|
OUTPUT_STRING, |
87 |
|
|
&ConfigFileEntry.configfile, |
88 |
michael |
1702 |
"Path to main configuration file" |
89 |
michael |
1318 |
}, |
90 |
|
|
{ |
91 |
|
|
"DLPATH", |
92 |
|
|
OUTPUT_STRING, |
93 |
|
|
&ConfigFileEntry.dlinefile, |
94 |
michael |
1702 |
"Path to D-line database file" |
95 |
michael |
1318 |
}, |
96 |
|
|
{ |
97 |
|
|
"KPATH", |
98 |
|
|
OUTPUT_STRING, |
99 |
|
|
&ConfigFileEntry.klinefile, |
100 |
michael |
1702 |
"Path to K-line database file" |
101 |
michael |
1318 |
}, |
102 |
|
|
{ |
103 |
michael |
1702 |
"GPATH", |
104 |
|
|
OUTPUT_STRING, |
105 |
|
|
&ConfigFileEntry.glinefile, |
106 |
|
|
"Path to G-line database file" |
107 |
|
|
}, |
108 |
|
|
{ |
109 |
|
|
"XPATH", |
110 |
|
|
OUTPUT_STRING, |
111 |
|
|
&ConfigFileEntry.xlinefile, |
112 |
|
|
"Path to X-line database file" |
113 |
|
|
}, |
114 |
|
|
{ |
115 |
|
|
"RESVPATH", |
116 |
|
|
OUTPUT_STRING, |
117 |
michael |
1841 |
&ConfigFileEntry.resvfile, |
118 |
michael |
1702 |
"Path to resv database file" |
119 |
|
|
}, |
120 |
|
|
{ |
121 |
adx |
30 |
"network_name", |
122 |
|
|
OUTPUT_STRING, |
123 |
|
|
&ServerInfo.network_name, |
124 |
|
|
"Network name" |
125 |
|
|
}, |
126 |
|
|
{ |
127 |
|
|
"network_desc", |
128 |
|
|
OUTPUT_STRING, |
129 |
|
|
&ServerInfo.network_desc, |
130 |
|
|
"Network description" |
131 |
|
|
}, |
132 |
|
|
{ |
133 |
|
|
"hub", |
134 |
|
|
OUTPUT_BOOLEAN_YN, |
135 |
|
|
&ServerInfo.hub, |
136 |
|
|
"Server is a hub" |
137 |
|
|
}, |
138 |
|
|
{ |
139 |
michael |
1754 |
"max_clients", |
140 |
|
|
OUTPUT_DECIMAL, |
141 |
|
|
&ServerInfo.max_clients, |
142 |
|
|
"Maximum number of clients permitted simultaneously on this server" |
143 |
|
|
}, |
144 |
|
|
{ |
145 |
|
|
"max_nick_length", |
146 |
|
|
OUTPUT_DECIMAL, |
147 |
|
|
&ServerInfo.max_nick_length, |
148 |
|
|
"Maximum nickname length" |
149 |
|
|
}, |
150 |
|
|
{ |
151 |
|
|
"max_topic_length", |
152 |
|
|
OUTPUT_DECIMAL, |
153 |
|
|
&ServerInfo.max_topic_length, |
154 |
|
|
"Maximum topic length" |
155 |
|
|
}, |
156 |
|
|
{ |
157 |
adx |
30 |
"use_logging", |
158 |
|
|
OUTPUT_BOOLEAN_YN, |
159 |
|
|
&ConfigLoggingEntry.use_logging, |
160 |
|
|
"Enable logging" |
161 |
|
|
}, |
162 |
|
|
{ |
163 |
michael |
1767 |
"disable_fake_channels", |
164 |
|
|
OUTPUT_BOOLEAN_YN, |
165 |
|
|
&ConfigChannel.disable_fake_channels, |
166 |
|
|
"Forbids channels with special ASCII characters in their name" |
167 |
|
|
}, |
168 |
|
|
{ |
169 |
michael |
3860 |
"invite_client_count", |
170 |
michael |
3764 |
OUTPUT_DECIMAL, |
171 |
michael |
3860 |
&ConfigChannel.invite_client_count, |
172 |
|
|
"How many INVITE attempts are permitted in invite_client_time" |
173 |
michael |
3764 |
}, |
174 |
michael |
3860 |
|
175 |
michael |
3764 |
{ |
176 |
michael |
3860 |
"invite_client_time", |
177 |
michael |
3764 |
OUTPUT_DECIMAL, |
178 |
michael |
3860 |
&ConfigChannel.invite_client_time, |
179 |
michael |
3862 |
"How many invite_client_count invites are allowed in this time" |
180 |
michael |
3764 |
}, |
181 |
|
|
{ |
182 |
michael |
3860 |
"knock_client_count", |
183 |
adx |
30 |
OUTPUT_DECIMAL, |
184 |
michael |
3860 |
&ConfigChannel.knock_client_count, |
185 |
michael |
3861 |
"How many KNOCK attempts are permitted in knock_client_time" |
186 |
adx |
30 |
}, |
187 |
|
|
{ |
188 |
michael |
3860 |
"knock_client_time", |
189 |
|
|
OUTPUT_DECIMAL, |
190 |
|
|
&ConfigChannel.knock_client_time, |
191 |
michael |
3862 |
"How many kknock_client_count knocks are allowed in this time" |
192 |
michael |
3860 |
}, |
193 |
|
|
{ |
194 |
adx |
30 |
"knock_delay_channel", |
195 |
|
|
OUTPUT_DECIMAL, |
196 |
|
|
&ConfigChannel.knock_delay_channel, |
197 |
|
|
"Delay between KNOCK attempts to a channel" |
198 |
|
|
}, |
199 |
|
|
{ |
200 |
|
|
"max_chans_per_user", |
201 |
|
|
OUTPUT_DECIMAL, |
202 |
|
|
&ConfigChannel.max_chans_per_user, |
203 |
|
|
"Maximum number of channels a user can join" |
204 |
|
|
}, |
205 |
|
|
{ |
206 |
michael |
1432 |
"max_chans_per_oper", |
207 |
|
|
OUTPUT_DECIMAL, |
208 |
|
|
&ConfigChannel.max_chans_per_oper, |
209 |
|
|
"Maximum number of channels an oper can join" |
210 |
|
|
}, |
211 |
|
|
{ |
212 |
adx |
30 |
"max_bans", |
213 |
|
|
OUTPUT_DECIMAL, |
214 |
|
|
&ConfigChannel.max_bans, |
215 |
|
|
"Total +b/e/I modes allowed in a channel" |
216 |
|
|
}, |
217 |
|
|
{ |
218 |
|
|
"default_split_user_count", |
219 |
|
|
OUTPUT_DECIMAL, |
220 |
|
|
&ConfigChannel.default_split_user_count, |
221 |
|
|
"Startup value of SPLITUSERS" |
222 |
|
|
}, |
223 |
|
|
{ |
224 |
|
|
"default_split_server_count", |
225 |
|
|
OUTPUT_DECIMAL, |
226 |
|
|
&ConfigChannel.default_split_server_count, |
227 |
|
|
"Startup value of SPLITNUM" |
228 |
|
|
}, |
229 |
|
|
{ |
230 |
|
|
"no_create_on_split", |
231 |
|
|
OUTPUT_BOOLEAN_YN, |
232 |
|
|
&ConfigChannel.no_create_on_split, |
233 |
|
|
"Disallow creation of channels when split" |
234 |
|
|
}, |
235 |
|
|
{ |
236 |
|
|
"no_join_on_split", |
237 |
|
|
OUTPUT_BOOLEAN_YN, |
238 |
|
|
&ConfigChannel.no_join_on_split, |
239 |
|
|
"Disallow joining channels when split" |
240 |
|
|
}, |
241 |
|
|
{ |
242 |
|
|
"flatten_links", |
243 |
|
|
OUTPUT_BOOLEAN_YN, |
244 |
|
|
&ConfigServerHide.flatten_links, |
245 |
|
|
"Flatten /links list" |
246 |
|
|
}, |
247 |
|
|
{ |
248 |
|
|
"links_delay", |
249 |
|
|
OUTPUT_DECIMAL, |
250 |
|
|
&ConfigServerHide.links_delay, |
251 |
|
|
"Links rehash delay" |
252 |
|
|
}, |
253 |
|
|
{ |
254 |
|
|
"hidden", |
255 |
|
|
OUTPUT_BOOLEAN_YN, |
256 |
|
|
&ConfigServerHide.hidden, |
257 |
|
|
"Hide this server from a flattened /links on remote servers" |
258 |
|
|
}, |
259 |
|
|
{ |
260 |
|
|
"hide_servers", |
261 |
|
|
OUTPUT_BOOLEAN_YN, |
262 |
|
|
&ConfigServerHide.hide_servers, |
263 |
|
|
"Hide servernames from users" |
264 |
|
|
}, |
265 |
|
|
{ |
266 |
michael |
1854 |
"hide_services", |
267 |
|
|
OUTPUT_BOOLEAN_YN, |
268 |
|
|
&ConfigServerHide.hide_services, |
269 |
|
|
"Hides the location of services server" |
270 |
|
|
}, |
271 |
|
|
{ |
272 |
adx |
30 |
"hidden_name", |
273 |
|
|
OUTPUT_STRING, |
274 |
|
|
&ConfigServerHide.hidden_name, |
275 |
|
|
"Server name users see if hide_servers = yes" |
276 |
|
|
}, |
277 |
|
|
{ |
278 |
|
|
"hide_server_ips", |
279 |
|
|
OUTPUT_BOOLEAN_YN, |
280 |
|
|
&ConfigServerHide.hide_server_ips, |
281 |
michael |
1936 |
"Prevent people from seeing server IP addresses" |
282 |
adx |
30 |
}, |
283 |
|
|
{ |
284 |
|
|
"gline_min_cidr", |
285 |
|
|
OUTPUT_DECIMAL, |
286 |
|
|
&ConfigFileEntry.gline_min_cidr, |
287 |
|
|
"Minimum required length of a CIDR bitmask for IPv4 G-Lines" |
288 |
|
|
}, |
289 |
|
|
{ |
290 |
|
|
"gline_min_cidr6", |
291 |
|
|
OUTPUT_DECIMAL, |
292 |
|
|
&ConfigFileEntry.gline_min_cidr6, |
293 |
|
|
"Minimum required length of a CIDR bitmask for IPv6 G-Lines" |
294 |
|
|
}, |
295 |
|
|
{ |
296 |
|
|
"invisible_on_connect", |
297 |
|
|
OUTPUT_BOOLEAN_YN, |
298 |
|
|
&ConfigFileEntry.invisible_on_connect, |
299 |
|
|
"Automatically set mode +i on connecting users" |
300 |
|
|
}, |
301 |
|
|
{ |
302 |
|
|
"kill_chase_time_limit", |
303 |
|
|
OUTPUT_DECIMAL, |
304 |
|
|
&ConfigFileEntry.kill_chase_time_limit, |
305 |
|
|
"Nick Change Tracker for KILL" |
306 |
|
|
}, |
307 |
|
|
{ |
308 |
|
|
"hide_spoof_ips", |
309 |
|
|
OUTPUT_BOOLEAN_YN, |
310 |
|
|
&ConfigFileEntry.hide_spoof_ips, |
311 |
michael |
1936 |
"Hide spoofed IP addresses" |
312 |
adx |
30 |
}, |
313 |
|
|
{ |
314 |
|
|
"ignore_bogus_ts", |
315 |
|
|
OUTPUT_BOOLEAN_YN, |
316 |
|
|
&ConfigFileEntry.ignore_bogus_ts, |
317 |
|
|
"Ignore bogus timestamps from other servers" |
318 |
|
|
}, |
319 |
|
|
{ |
320 |
michael |
2283 |
"cycle_on_host_change", |
321 |
|
|
OUTPUT_BOOLEAN_YN, |
322 |
|
|
&ConfigFileEntry.cycle_on_host_change, |
323 |
|
|
"Send a fake QUIT/JOIN combination on host change" |
324 |
|
|
}, |
325 |
|
|
{ |
326 |
adx |
30 |
"disable_auth", |
327 |
|
|
OUTPUT_BOOLEAN_YN, |
328 |
|
|
&ConfigFileEntry.disable_auth, |
329 |
|
|
"Completely disable ident lookups" |
330 |
|
|
}, |
331 |
|
|
{ |
332 |
|
|
"disable_remote_commands", |
333 |
|
|
OUTPUT_BOOLEAN_YN, |
334 |
michael |
2196 |
&ConfigServerHide.disable_remote_commands, |
335 |
adx |
30 |
"Prevent users issuing commands on remote servers" |
336 |
|
|
}, |
337 |
|
|
{ |
338 |
|
|
"tkline_expire_notices", |
339 |
|
|
OUTPUT_BOOLEAN_YN, |
340 |
|
|
&ConfigFileEntry.tkline_expire_notices, |
341 |
|
|
"Show temporary kline/xline expire notices" |
342 |
|
|
}, |
343 |
|
|
{ |
344 |
|
|
"default_floodcount", |
345 |
|
|
OUTPUT_DECIMAL, |
346 |
|
|
&ConfigFileEntry.default_floodcount, |
347 |
|
|
"Startup value of FLOODCOUNT" |
348 |
|
|
}, |
349 |
|
|
{ |
350 |
|
|
"failed_oper_notice", |
351 |
michael |
3545 |
OUTPUT_BOOLEAN_YN, |
352 |
adx |
30 |
&ConfigFileEntry.failed_oper_notice, |
353 |
michael |
1702 |
"Inform opers if someone tries to /oper with the wrong password" |
354 |
adx |
30 |
}, |
355 |
|
|
{ |
356 |
|
|
"dots_in_ident", |
357 |
|
|
OUTPUT_DECIMAL, |
358 |
|
|
&ConfigFileEntry.dots_in_ident, |
359 |
|
|
"Number of permissable dots in an ident" |
360 |
|
|
}, |
361 |
|
|
{ |
362 |
|
|
"min_nonwildcard", |
363 |
|
|
OUTPUT_DECIMAL, |
364 |
|
|
&ConfigFileEntry.min_nonwildcard, |
365 |
|
|
"Minimum non-wildcard chars in K/G lines" |
366 |
|
|
}, |
367 |
|
|
{ |
368 |
|
|
"min_nonwildcard_simple", |
369 |
|
|
OUTPUT_DECIMAL, |
370 |
|
|
&ConfigFileEntry.min_nonwildcard_simple, |
371 |
|
|
"Minimum non-wildcards in gecos bans" |
372 |
|
|
}, |
373 |
|
|
{ |
374 |
|
|
"max_accept", |
375 |
|
|
OUTPUT_DECIMAL, |
376 |
|
|
&ConfigFileEntry.max_accept, |
377 |
|
|
"Maximum nicknames on accept list" |
378 |
|
|
}, |
379 |
|
|
{ |
380 |
|
|
"anti_nick_flood", |
381 |
michael |
3545 |
OUTPUT_BOOLEAN_YN, |
382 |
adx |
30 |
&ConfigFileEntry.anti_nick_flood, |
383 |
|
|
"NICK flood protection" |
384 |
|
|
}, |
385 |
|
|
{ |
386 |
|
|
"max_nick_time", |
387 |
|
|
OUTPUT_DECIMAL, |
388 |
|
|
&ConfigFileEntry.max_nick_time, |
389 |
|
|
"NICK flood protection time interval" |
390 |
|
|
}, |
391 |
|
|
{ |
392 |
|
|
"max_nick_changes", |
393 |
|
|
OUTPUT_DECIMAL, |
394 |
|
|
&ConfigFileEntry.max_nick_changes, |
395 |
|
|
"NICK change threshhold setting" |
396 |
|
|
}, |
397 |
|
|
{ |
398 |
|
|
"anti_spam_exit_message_time", |
399 |
|
|
OUTPUT_DECIMAL, |
400 |
|
|
&ConfigFileEntry.anti_spam_exit_message_time, |
401 |
|
|
"Duration a client must be connected for to have an exit message" |
402 |
|
|
}, |
403 |
|
|
{ |
404 |
|
|
"ts_warn_delta", |
405 |
|
|
OUTPUT_DECIMAL, |
406 |
|
|
&ConfigFileEntry.ts_warn_delta, |
407 |
|
|
"Maximum permitted TS delta before displaying a warning" |
408 |
|
|
}, |
409 |
|
|
{ |
410 |
|
|
"ts_max_delta", |
411 |
|
|
OUTPUT_DECIMAL, |
412 |
|
|
&ConfigFileEntry.ts_max_delta, |
413 |
|
|
"Maximum permitted TS delta from another server" |
414 |
|
|
}, |
415 |
|
|
{ |
416 |
michael |
3473 |
"warn_no_connect_block", |
417 |
michael |
3545 |
OUTPUT_BOOLEAN_YN, |
418 |
michael |
3473 |
&ConfigFileEntry.warn_no_connect_block, |
419 |
|
|
"Display warning if connecting server lacks a connect{} block" |
420 |
adx |
30 |
}, |
421 |
|
|
{ |
422 |
michael |
1767 |
"stats_e_disabled", |
423 |
|
|
OUTPUT_BOOLEAN_YN, |
424 |
|
|
&ConfigFileEntry.stats_e_disabled, |
425 |
|
|
"Whether or not STATS e is disabled" |
426 |
|
|
}, |
427 |
|
|
{ |
428 |
adx |
30 |
"stats_o_oper_only", |
429 |
|
|
OUTPUT_BOOLEAN_YN, |
430 |
|
|
&ConfigFileEntry.stats_o_oper_only, |
431 |
|
|
"STATS O output is only shown to operators" |
432 |
|
|
}, |
433 |
|
|
{ |
434 |
|
|
"stats_P_oper_only", |
435 |
|
|
OUTPUT_BOOLEAN_YN, |
436 |
|
|
&ConfigFileEntry.stats_P_oper_only, |
437 |
|
|
"STATS P is only shown to operators" |
438 |
|
|
}, |
439 |
|
|
{ |
440 |
michael |
2269 |
"stats_u_oper_only", |
441 |
|
|
OUTPUT_BOOLEAN_YN, |
442 |
|
|
&ConfigFileEntry.stats_u_oper_only, |
443 |
|
|
"STATS u is only shown to operators" |
444 |
|
|
}, |
445 |
|
|
{ |
446 |
adx |
30 |
"stats_i_oper_only", |
447 |
|
|
OUTPUT_BOOLEAN2, |
448 |
|
|
&ConfigFileEntry.stats_i_oper_only, |
449 |
|
|
"STATS I output is only shown to operators" |
450 |
|
|
}, |
451 |
|
|
{ |
452 |
|
|
"stats_k_oper_only", |
453 |
|
|
OUTPUT_BOOLEAN2, |
454 |
|
|
&ConfigFileEntry.stats_k_oper_only, |
455 |
|
|
"STATS K output is only shown to operators" |
456 |
|
|
}, |
457 |
|
|
{ |
458 |
|
|
"caller_id_wait", |
459 |
|
|
OUTPUT_DECIMAL, |
460 |
|
|
&ConfigFileEntry.caller_id_wait, |
461 |
|
|
"Minimum delay between notifying UMODE +g users of messages" |
462 |
|
|
}, |
463 |
|
|
{ |
464 |
|
|
"opers_bypass_callerid", |
465 |
|
|
OUTPUT_BOOLEAN_YN, |
466 |
|
|
&ConfigFileEntry.opers_bypass_callerid, |
467 |
|
|
"Allows IRC operators to message users who are +g (callerid)" |
468 |
|
|
}, |
469 |
|
|
{ |
470 |
|
|
"pace_wait_simple", |
471 |
|
|
OUTPUT_DECIMAL, |
472 |
|
|
&ConfigFileEntry.pace_wait_simple, |
473 |
|
|
"Minimum delay between less intensive commands" |
474 |
|
|
}, |
475 |
|
|
{ |
476 |
|
|
"pace_wait", |
477 |
|
|
OUTPUT_DECIMAL, |
478 |
|
|
&ConfigFileEntry.pace_wait, |
479 |
|
|
"Minimum delay between uses of certain commands" |
480 |
|
|
}, |
481 |
|
|
{ |
482 |
|
|
"short_motd", |
483 |
|
|
OUTPUT_BOOLEAN_YN, |
484 |
|
|
&ConfigFileEntry.short_motd, |
485 |
|
|
"Do not show MOTD; only tell clients they should read it" |
486 |
|
|
}, |
487 |
|
|
{ |
488 |
|
|
"ping_cookie", |
489 |
michael |
3545 |
OUTPUT_BOOLEAN_YN, |
490 |
adx |
30 |
&ConfigFileEntry.ping_cookie, |
491 |
|
|
"Require ping cookies to connect" |
492 |
|
|
}, |
493 |
|
|
{ |
494 |
|
|
"no_oper_flood", |
495 |
michael |
3545 |
OUTPUT_BOOLEAN_YN, |
496 |
adx |
30 |
&ConfigFileEntry.no_oper_flood, |
497 |
|
|
"Reduce flood control for operators" |
498 |
|
|
}, |
499 |
|
|
{ |
500 |
|
|
"true_no_oper_flood", |
501 |
michael |
3545 |
OUTPUT_BOOLEAN_YN, |
502 |
adx |
30 |
&ConfigFileEntry.true_no_oper_flood, |
503 |
|
|
"Completely disable flood control for operators" |
504 |
|
|
}, |
505 |
|
|
{ |
506 |
|
|
"oper_pass_resv", |
507 |
|
|
OUTPUT_BOOLEAN_YN, |
508 |
|
|
&ConfigFileEntry.oper_pass_resv, |
509 |
|
|
"Opers can over-ride RESVs" |
510 |
|
|
}, |
511 |
|
|
{ |
512 |
|
|
"max_targets", |
513 |
|
|
OUTPUT_DECIMAL, |
514 |
|
|
&ConfigFileEntry.max_targets, |
515 |
|
|
"The maximum number of PRIVMSG/NOTICE targets" |
516 |
|
|
}, |
517 |
|
|
{ |
518 |
|
|
"throttle_time", |
519 |
|
|
OUTPUT_DECIMAL, |
520 |
|
|
&ConfigFileEntry.throttle_time, |
521 |
|
|
"Minimum time between client reconnects" |
522 |
|
|
}, |
523 |
|
|
{ |
524 |
michael |
3545 |
"gline_enable", |
525 |
|
|
OUTPUT_BOOLEAN_YN, |
526 |
adx |
30 |
&ConfigFileEntry.glines, |
527 |
|
|
"G-line (network-wide K-line) support" |
528 |
|
|
}, |
529 |
|
|
{ |
530 |
michael |
1459 |
"gline_duration", |
531 |
adx |
30 |
OUTPUT_DECIMAL, |
532 |
|
|
&ConfigFileEntry.gline_time, |
533 |
|
|
"Expiry time for G-lines" |
534 |
|
|
}, |
535 |
michael |
1459 |
{ |
536 |
|
|
"gline_request_duration", |
537 |
|
|
OUTPUT_DECIMAL, |
538 |
|
|
&ConfigFileEntry.gline_request_time, |
539 |
|
|
"Expiry time for pending G-lines" |
540 |
|
|
}, |
541 |
|
|
|
542 |
adx |
30 |
/* --[ END OF TABLE ]---------------------------------------------- */ |
543 |
|
|
{ |
544 |
|
|
NULL, |
545 |
|
|
0, |
546 |
|
|
NULL, |
547 |
|
|
0 |
548 |
|
|
} |
549 |
|
|
}; |
550 |
|
|
|
551 |
|
|
/* send_birthdate_online_time() |
552 |
|
|
* |
553 |
|
|
* inputs - client pointer to send to |
554 |
|
|
* output - NONE |
555 |
|
|
* side effects - birthdate and online time are sent |
556 |
|
|
*/ |
557 |
|
|
static void |
558 |
|
|
send_birthdate_online_time(struct Client *source_p) |
559 |
|
|
{ |
560 |
michael |
3573 |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
561 |
|
|
":On-line since %s", |
562 |
|
|
myctime(me.localClient->firsttime)); |
563 |
adx |
30 |
} |
564 |
|
|
|
565 |
|
|
/* send_conf_options() |
566 |
|
|
* |
567 |
|
|
* inputs - client pointer to send to |
568 |
|
|
* output - NONE |
569 |
|
|
* side effects - send config options to client |
570 |
|
|
*/ |
571 |
|
|
static void |
572 |
|
|
send_conf_options(struct Client *source_p) |
573 |
|
|
{ |
574 |
|
|
/* |
575 |
|
|
* Parse the info_table[] and do the magic. |
576 |
|
|
*/ |
577 |
michael |
3459 |
for (const struct InfoStruct *iptr = info_table; iptr->name; ++iptr) |
578 |
adx |
30 |
{ |
579 |
|
|
switch (iptr->output_type) |
580 |
|
|
{ |
581 |
|
|
/* For "char *" references */ |
582 |
|
|
case OUTPUT_STRING: |
583 |
|
|
{ |
584 |
michael |
3343 |
const char *option = *((const char *const *)iptr->option); |
585 |
adx |
30 |
|
586 |
michael |
3573 |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
587 |
|
|
":%-30s %-5s [%-30s]", |
588 |
|
|
iptr->name, option ? option : "NONE", |
589 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
590 |
adx |
30 |
break; |
591 |
|
|
} |
592 |
|
|
|
593 |
|
|
/* For "char foo[]" references */ |
594 |
|
|
case OUTPUT_STRING_PTR: |
595 |
|
|
{ |
596 |
|
|
const char *option = iptr->option; |
597 |
|
|
|
598 |
michael |
3573 |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
599 |
|
|
":%-30s %-5s [%-30s]", |
600 |
|
|
iptr->name, option ? option : "NONE", |
601 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
602 |
adx |
30 |
break; |
603 |
|
|
} |
604 |
|
|
|
605 |
|
|
/* Output info_table[i].option as a decimal value. */ |
606 |
|
|
case OUTPUT_DECIMAL: |
607 |
|
|
{ |
608 |
michael |
3343 |
const int option = *((const int *const)iptr->option); |
609 |
adx |
30 |
|
610 |
michael |
3573 |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
611 |
|
|
":%-30s %-5d [%-30s]", |
612 |
|
|
iptr->name, option, iptr->desc ? iptr->desc : "<none>"); |
613 |
adx |
30 |
break; |
614 |
|
|
} |
615 |
|
|
|
616 |
|
|
/* Output info_table[i].option as "ON" or "OFF" */ |
617 |
|
|
case OUTPUT_BOOLEAN: |
618 |
|
|
{ |
619 |
michael |
3343 |
const int option = *((const int *const)iptr->option); |
620 |
adx |
30 |
|
621 |
michael |
3573 |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
622 |
|
|
":%-30s %-5s [%-30s]", |
623 |
|
|
iptr->name, option ? "ON" : "OFF", |
624 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
625 |
adx |
30 |
|
626 |
|
|
break; |
627 |
|
|
} |
628 |
|
|
|
629 |
|
|
/* Output info_table[i].option as "YES" or "NO" */ |
630 |
|
|
case OUTPUT_BOOLEAN_YN: |
631 |
|
|
{ |
632 |
michael |
3343 |
const int option = *((const int *const)iptr->option); |
633 |
adx |
30 |
|
634 |
michael |
3573 |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
635 |
|
|
":%-30s %-5s [%-30s]", |
636 |
|
|
iptr->name, option ? "YES" : "NO", |
637 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
638 |
adx |
30 |
break; |
639 |
|
|
} |
640 |
|
|
|
641 |
|
|
case OUTPUT_BOOLEAN2: |
642 |
|
|
{ |
643 |
michael |
3343 |
const int option = *((const int *const)iptr->option); |
644 |
adx |
30 |
|
645 |
michael |
3573 |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
646 |
|
|
":%-30s %-5s [%-30s]", |
647 |
|
|
iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO", |
648 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
649 |
adx |
30 |
break; |
650 |
|
|
} |
651 |
|
|
} |
652 |
|
|
} |
653 |
|
|
|
654 |
michael |
3109 |
sendto_one_numeric(source_p, &me, RPL_INFO, ""); |
655 |
adx |
30 |
} |
656 |
michael |
1230 |
|
657 |
michael |
1827 |
/* send_info_text() |
658 |
|
|
* |
659 |
|
|
* inputs - client pointer to send info text to |
660 |
|
|
* output - NONE |
661 |
|
|
* side effects - info text is sent to client |
662 |
|
|
*/ |
663 |
michael |
3156 |
static void |
664 |
michael |
1827 |
send_info_text(struct Client *source_p) |
665 |
|
|
{ |
666 |
|
|
const char **text = infotext; |
667 |
|
|
|
668 |
|
|
sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE, |
669 |
|
|
"INFO requested by %s (%s@%s) [%s]", |
670 |
|
|
source_p->name, source_p->username, |
671 |
|
|
source_p->host, source_p->servptr->name); |
672 |
|
|
|
673 |
|
|
while (*text) |
674 |
|
|
{ |
675 |
|
|
const char *line = *text++; |
676 |
|
|
|
677 |
|
|
if (*line == '\0') |
678 |
|
|
line = " "; |
679 |
|
|
|
680 |
michael |
3109 |
sendto_one_numeric(source_p, &me, RPL_INFO, line); |
681 |
michael |
1827 |
} |
682 |
|
|
|
683 |
|
|
if (HasUMode(source_p, UMODE_OPER)) |
684 |
|
|
send_conf_options(source_p); |
685 |
|
|
|
686 |
|
|
send_birthdate_online_time(source_p); |
687 |
|
|
|
688 |
michael |
3109 |
sendto_one_numeric(source_p, &me, RPL_ENDOFINFO); |
689 |
michael |
1827 |
} |
690 |
|
|
|
691 |
michael |
3275 |
/*! \brief INFO command handler |
692 |
|
|
* |
693 |
|
|
* \param source_p Pointer to allocated Client struct from which the message |
694 |
|
|
* originally comes from. This can be a local or remote client. |
695 |
|
|
* \param parc Integer holding the number of supplied arguments. |
696 |
|
|
* \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL |
697 |
|
|
* pointers. |
698 |
|
|
* \note Valid arguments for this command are: |
699 |
|
|
* - parv[0] = command |
700 |
michael |
3300 |
* - parv[1] = nickname/servername |
701 |
michael |
3275 |
*/ |
702 |
michael |
2820 |
static int |
703 |
michael |
3156 |
m_info(struct Client *source_p, int parc, char *parv[]) |
704 |
michael |
1827 |
{ |
705 |
|
|
static time_t last_used = 0; |
706 |
|
|
|
707 |
|
|
if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime) |
708 |
|
|
{ |
709 |
michael |
3109 |
sendto_one_numeric(source_p, &me, RPL_LOAD2HI); |
710 |
michael |
2820 |
return 0; |
711 |
michael |
1827 |
} |
712 |
|
|
|
713 |
|
|
last_used = CurrentTime; |
714 |
|
|
|
715 |
michael |
2196 |
if (!ConfigServerHide.disable_remote_commands) |
716 |
michael |
3156 |
if (hunt_server(source_p, ":%s INFO :%s", 1, |
717 |
michael |
1827 |
parc, parv) != HUNTED_ISME) |
718 |
michael |
2820 |
return 0; |
719 |
michael |
1827 |
|
720 |
michael |
3156 |
send_info_text(source_p); |
721 |
|
|
return 0; |
722 |
michael |
1827 |
} |
723 |
|
|
|
724 |
michael |
3275 |
/*! \brief INFO command handler |
725 |
|
|
* |
726 |
|
|
* \param source_p Pointer to allocated Client struct from which the message |
727 |
|
|
* originally comes from. This can be a local or remote client. |
728 |
|
|
* \param parc Integer holding the number of supplied arguments. |
729 |
|
|
* \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL |
730 |
|
|
* pointers. |
731 |
|
|
* \note Valid arguments for this command are: |
732 |
|
|
* - parv[0] = command |
733 |
michael |
3300 |
* - parv[1] = nickname/servername |
734 |
michael |
3275 |
*/ |
735 |
michael |
2820 |
static int |
736 |
michael |
3156 |
ms_info(struct Client *source_p, int parc, char *parv[]) |
737 |
michael |
1827 |
{ |
738 |
michael |
3156 |
if (hunt_server(source_p, ":%s INFO :%s", 1, |
739 |
michael |
1827 |
parc, parv) != HUNTED_ISME) |
740 |
michael |
2820 |
return 0; |
741 |
michael |
1827 |
|
742 |
michael |
3156 |
send_info_text(source_p); |
743 |
|
|
return 0; |
744 |
michael |
1827 |
} |
745 |
|
|
|
746 |
michael |
2820 |
static struct Message info_msgtab = |
747 |
|
|
{ |
748 |
michael |
1230 |
"INFO", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
749 |
michael |
1827 |
{ m_unregistered, m_info, ms_info, m_ignore, ms_info, m_ignore } |
750 |
michael |
1230 |
}; |
751 |
|
|
|
752 |
|
|
static void |
753 |
|
|
module_init(void) |
754 |
|
|
{ |
755 |
|
|
mod_add_cmd(&info_msgtab); |
756 |
|
|
} |
757 |
|
|
|
758 |
|
|
static void |
759 |
|
|
module_exit(void) |
760 |
|
|
{ |
761 |
|
|
mod_del_cmd(&info_msgtab); |
762 |
|
|
} |
763 |
|
|
|
764 |
michael |
2820 |
struct module module_entry = |
765 |
|
|
{ |
766 |
michael |
1230 |
.node = { NULL, NULL, NULL }, |
767 |
|
|
.name = NULL, |
768 |
|
|
.version = "$Revision$", |
769 |
|
|
.handle = NULL, |
770 |
|
|
.modinit = module_init, |
771 |
|
|
.modexit = module_exit, |
772 |
|
|
.flags = 0 |
773 |
|
|
}; |