1 |
/* |
2 |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
* |
4 |
* Copyright (c) 1997-2020 ircd-hybrid development team |
5 |
* |
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
19 |
* USA |
20 |
*/ |
21 |
|
22 |
/*! \file m_info.c |
23 |
* \brief Includes required functions for processing the INFO command. |
24 |
* \version $Id$ |
25 |
*/ |
26 |
|
27 |
#include "stdinc.h" |
28 |
#include "list.h" |
29 |
#include "client.h" |
30 |
#include "ircd.h" |
31 |
#include "numeric.h" |
32 |
#include "misc.h" |
33 |
#include "server.h" |
34 |
#include "send.h" |
35 |
#include "conf.h" |
36 |
#include "parse.h" |
37 |
#include "modules.h" |
38 |
#include "tls.h" |
39 |
|
40 |
|
41 |
/* |
42 |
* jdc -- Structure for our configuration value table |
43 |
*/ |
44 |
struct InfoStruct |
45 |
{ |
46 |
const char *name; /* Displayed variable name */ |
47 |
enum |
48 |
{ |
49 |
OUTPUT_STRING = 1, /* Output option as %s w/ dereference */ |
50 |
OUTPUT_STRING_PTR, /* Output option as %s w/out deference */ |
51 |
OUTPUT_DECIMAL, /* Output option as decimal (%d) */ |
52 |
OUTPUT_BOOLEAN, /* Output option as "ON" or "OFF" */ |
53 |
OUTPUT_BOOLEAN_YN, /* Output option as "YES" or "NO" */ |
54 |
OUTPUT_BOOLEAN2 /* Output option as "YES/NO/MASKED" */ |
55 |
} output_type; /* Type of output. See enum above */ |
56 |
|
57 |
const void *option; /* Pointer reference to the value */ |
58 |
const char *desc; /* ASCII description of the variable */ |
59 |
}; |
60 |
|
61 |
static const struct InfoStruct info_table[] = |
62 |
{ |
63 |
/* --[ START OF TABLE ]-------------------------------------------- */ |
64 |
|
65 |
{ |
66 |
"DPATH", |
67 |
OUTPUT_STRING, |
68 |
&ConfigGeneral.dpath, |
69 |
"Root directory of installation" |
70 |
}, |
71 |
{ |
72 |
"SPATH", |
73 |
OUTPUT_STRING, |
74 |
&ConfigGeneral.spath, |
75 |
"Path to server executable" |
76 |
}, |
77 |
{ |
78 |
"MPATH", |
79 |
OUTPUT_STRING, |
80 |
&ConfigGeneral.mpath, |
81 |
"Path to main motd (Message of the Day) file" |
82 |
}, |
83 |
{ |
84 |
"CPATH", |
85 |
OUTPUT_STRING, |
86 |
&ConfigGeneral.configfile, |
87 |
"Path to main configuration file" |
88 |
}, |
89 |
{ |
90 |
"DLPATH", |
91 |
OUTPUT_STRING, |
92 |
&ConfigGeneral.dlinefile, |
93 |
"Path to D-line database file" |
94 |
}, |
95 |
{ |
96 |
"KPATH", |
97 |
OUTPUT_STRING, |
98 |
&ConfigGeneral.klinefile, |
99 |
"Path to K-line database file" |
100 |
}, |
101 |
{ |
102 |
"XPATH", |
103 |
OUTPUT_STRING, |
104 |
&ConfigGeneral.xlinefile, |
105 |
"Path to X-line database file" |
106 |
}, |
107 |
{ |
108 |
"RESVPATH", |
109 |
OUTPUT_STRING, |
110 |
&ConfigGeneral.resvfile, |
111 |
"Path to resv database file" |
112 |
}, |
113 |
{ |
114 |
"network_name", |
115 |
OUTPUT_STRING, |
116 |
&ConfigServerInfo.network_name, |
117 |
"Network name" |
118 |
}, |
119 |
{ |
120 |
"network_desc", |
121 |
OUTPUT_STRING, |
122 |
&ConfigServerInfo.network_desc, |
123 |
"Network description" |
124 |
}, |
125 |
{ |
126 |
"hub", |
127 |
OUTPUT_BOOLEAN_YN, |
128 |
&ConfigServerInfo.hub, |
129 |
"Server is a hub" |
130 |
}, |
131 |
{ |
132 |
"default_max_clients", |
133 |
OUTPUT_DECIMAL, |
134 |
&ConfigServerInfo.default_max_clients, |
135 |
"The default maximum number of clients permitted simultaneously on this server" |
136 |
}, |
137 |
{ |
138 |
"max_nick_length", |
139 |
OUTPUT_DECIMAL, |
140 |
&ConfigServerInfo.max_nick_length, |
141 |
"Maximum nickname length" |
142 |
}, |
143 |
{ |
144 |
"max_topic_length", |
145 |
OUTPUT_DECIMAL, |
146 |
&ConfigServerInfo.max_topic_length, |
147 |
"Maximum topic length" |
148 |
}, |
149 |
{ |
150 |
"use_logging", |
151 |
OUTPUT_BOOLEAN_YN, |
152 |
&ConfigLog.use_logging, |
153 |
"Enable logging" |
154 |
}, |
155 |
{ |
156 |
"disable_fake_channels", |
157 |
OUTPUT_BOOLEAN_YN, |
158 |
&ConfigChannel.disable_fake_channels, |
159 |
"Forbids channels with special ASCII characters in their name" |
160 |
}, |
161 |
{ |
162 |
"invite_client_count", |
163 |
OUTPUT_DECIMAL, |
164 |
&ConfigChannel.invite_client_count, |
165 |
"How many INVITE attempts are permitted in invite_client_time" |
166 |
}, |
167 |
{ |
168 |
"invite_client_time", |
169 |
OUTPUT_DECIMAL, |
170 |
&ConfigChannel.invite_client_time, |
171 |
"How many invite_client_count invites are allowed in this time" |
172 |
}, |
173 |
{ |
174 |
"invite_delay_channel", |
175 |
OUTPUT_DECIMAL, |
176 |
&ConfigChannel.invite_delay_channel, |
177 |
"Delay between INVITE attempts to a channel" |
178 |
}, |
179 |
{ |
180 |
"invite_expire_time", |
181 |
OUTPUT_DECIMAL, |
182 |
&ConfigChannel.invite_expire_time, |
183 |
"Amount of time an INVITE will be active until it expires" |
184 |
}, |
185 |
{ |
186 |
"knock_client_count", |
187 |
OUTPUT_DECIMAL, |
188 |
&ConfigChannel.knock_client_count, |
189 |
"How many KNOCK attempts are permitted in knock_client_time" |
190 |
}, |
191 |
{ |
192 |
"knock_client_time", |
193 |
OUTPUT_DECIMAL, |
194 |
&ConfigChannel.knock_client_time, |
195 |
"How many knock_client_count knocks are allowed in this time" |
196 |
}, |
197 |
{ |
198 |
"knock_delay_channel", |
199 |
OUTPUT_DECIMAL, |
200 |
&ConfigChannel.knock_delay_channel, |
201 |
"Delay between KNOCK attempts to a channel" |
202 |
}, |
203 |
{ |
204 |
"max_channels", |
205 |
OUTPUT_DECIMAL, |
206 |
&ConfigChannel.max_channels, |
207 |
"Maximum number of channels a user can join" |
208 |
}, |
209 |
{ |
210 |
"max_invites", |
211 |
OUTPUT_DECIMAL, |
212 |
&ConfigChannel.max_invites, |
213 |
"Maximum number of channels a user can be invited to" |
214 |
}, |
215 |
{ |
216 |
"max_bans", |
217 |
OUTPUT_DECIMAL, |
218 |
&ConfigChannel.max_bans, |
219 |
"Total +b/e/I modes allowed in a channel" |
220 |
}, |
221 |
{ |
222 |
"max_bans_large", |
223 |
OUTPUT_DECIMAL, |
224 |
&ConfigChannel.max_bans_large, |
225 |
"Total +b/e/I modes allowed in a +L channel" |
226 |
}, |
227 |
{ |
228 |
"flatten_links", |
229 |
OUTPUT_BOOLEAN_YN, |
230 |
&ConfigServerHide.flatten_links, |
231 |
"Flatten /links list" |
232 |
}, |
233 |
{ |
234 |
"flatten_links_delay", |
235 |
OUTPUT_DECIMAL, |
236 |
&ConfigServerHide.flatten_links_delay, |
237 |
"Links rehash delay" |
238 |
}, |
239 |
{ |
240 |
"flatten_links_file", |
241 |
OUTPUT_STRING, |
242 |
&ConfigServerHide.flatten_links_file, |
243 |
"Path to the flatten links cache file" |
244 |
}, |
245 |
{ |
246 |
"hidden", |
247 |
OUTPUT_BOOLEAN_YN, |
248 |
&ConfigServerHide.hidden, |
249 |
"Hide this server from a flattened /links on remote servers" |
250 |
}, |
251 |
{ |
252 |
"hide_servers", |
253 |
OUTPUT_BOOLEAN_YN, |
254 |
&ConfigServerHide.hide_servers, |
255 |
"Hide servernames from users" |
256 |
}, |
257 |
{ |
258 |
"hide_services", |
259 |
OUTPUT_BOOLEAN_YN, |
260 |
&ConfigServerHide.hide_services, |
261 |
"Hides the location of services server" |
262 |
}, |
263 |
{ |
264 |
"hidden_name", |
265 |
OUTPUT_STRING, |
266 |
&ConfigServerHide.hidden_name, |
267 |
"Server name users see if hide_servers = yes" |
268 |
}, |
269 |
{ |
270 |
"hide_server_ips", |
271 |
OUTPUT_BOOLEAN_YN, |
272 |
&ConfigServerHide.hide_server_ips, |
273 |
"Prevent people from seeing server IP addresses" |
274 |
}, |
275 |
{ |
276 |
"away_count", |
277 |
OUTPUT_DECIMAL, |
278 |
&ConfigGeneral.away_count, |
279 |
"How many AWAY attempts are permitted in away_time" |
280 |
}, |
281 |
{ |
282 |
"away_time", |
283 |
OUTPUT_DECIMAL, |
284 |
&ConfigGeneral.away_time, |
285 |
"How many away_count aways are allowed in this time" |
286 |
}, |
287 |
{ |
288 |
"dline_min_cidr", |
289 |
OUTPUT_DECIMAL, |
290 |
&ConfigGeneral.dline_min_cidr, |
291 |
"Minimum required length of a CIDR bitmask for IPv4 D-Lines" |
292 |
}, |
293 |
{ |
294 |
"dline_min_cidr6", |
295 |
OUTPUT_DECIMAL, |
296 |
&ConfigGeneral.dline_min_cidr6, |
297 |
"Minimum required length of a CIDR bitmask for IPv6 D-Lines" |
298 |
}, |
299 |
{ |
300 |
"kline_min_cidr", |
301 |
OUTPUT_DECIMAL, |
302 |
&ConfigGeneral.kline_min_cidr, |
303 |
"Minimum required length of a CIDR bitmask for IPv4 K-Lines" |
304 |
}, |
305 |
{ |
306 |
"kline_min_cidr6", |
307 |
OUTPUT_DECIMAL, |
308 |
&ConfigGeneral.kline_min_cidr6, |
309 |
"Minimum required length of a CIDR bitmask for IPv6 K-Lines" |
310 |
}, |
311 |
{ |
312 |
"invisible_on_connect", |
313 |
OUTPUT_BOOLEAN_YN, |
314 |
&ConfigGeneral.invisible_on_connect, |
315 |
"Automatically set mode +i on connecting users" |
316 |
}, |
317 |
{ |
318 |
"kill_chase_time_limit", |
319 |
OUTPUT_DECIMAL, |
320 |
&ConfigGeneral.kill_chase_time_limit, |
321 |
"Nick Change Tracker for KILL" |
322 |
}, |
323 |
{ |
324 |
"cycle_on_host_change", |
325 |
OUTPUT_BOOLEAN_YN, |
326 |
&ConfigGeneral.cycle_on_host_change, |
327 |
"Send a fake QUIT/JOIN combination on host change" |
328 |
}, |
329 |
{ |
330 |
"disable_auth", |
331 |
OUTPUT_BOOLEAN_YN, |
332 |
&ConfigGeneral.disable_auth, |
333 |
"Completely disable ident lookups" |
334 |
}, |
335 |
{ |
336 |
"disable_remote_commands", |
337 |
OUTPUT_BOOLEAN_YN, |
338 |
&ConfigServerHide.disable_remote_commands, |
339 |
"Prevent users issuing commands on remote servers" |
340 |
}, |
341 |
{ |
342 |
"default_floodcount", |
343 |
OUTPUT_DECIMAL, |
344 |
&ConfigGeneral.default_floodcount, |
345 |
"Startup value of FLOODCOUNT" |
346 |
}, |
347 |
{ |
348 |
"default_floodtime", |
349 |
OUTPUT_DECIMAL, |
350 |
&ConfigGeneral.default_floodtime, |
351 |
"Startup value of FLOODTIME" |
352 |
}, |
353 |
{ |
354 |
"failed_oper_notice", |
355 |
OUTPUT_BOOLEAN_YN, |
356 |
&ConfigGeneral.failed_oper_notice, |
357 |
"Inform opers if someone tries to /oper with the wrong credentials" |
358 |
}, |
359 |
{ |
360 |
"dots_in_ident", |
361 |
OUTPUT_DECIMAL, |
362 |
&ConfigGeneral.dots_in_ident, |
363 |
"Number of permissable dots in an ident" |
364 |
}, |
365 |
{ |
366 |
"min_nonwildcard", |
367 |
OUTPUT_DECIMAL, |
368 |
&ConfigGeneral.min_nonwildcard, |
369 |
"Minimum non-wildcard chars in K/D lines" |
370 |
}, |
371 |
{ |
372 |
"min_nonwildcard_simple", |
373 |
OUTPUT_DECIMAL, |
374 |
&ConfigGeneral.min_nonwildcard_simple, |
375 |
"Minimum non-wildcards in gecos bans" |
376 |
}, |
377 |
{ |
378 |
"max_watch", |
379 |
OUTPUT_DECIMAL, |
380 |
&ConfigGeneral.max_watch, |
381 |
"Maximum nicknames on watch list" |
382 |
}, |
383 |
{ |
384 |
"max_accept", |
385 |
OUTPUT_DECIMAL, |
386 |
&ConfigGeneral.max_accept, |
387 |
"Maximum nicknames on accept list" |
388 |
}, |
389 |
{ |
390 |
"whowas_history_length", |
391 |
OUTPUT_DECIMAL, |
392 |
&ConfigGeneral.whowas_history_length, |
393 |
"Length of the WHOWAS nick name history list" |
394 |
}, |
395 |
{ |
396 |
"anti_nick_flood", |
397 |
OUTPUT_BOOLEAN_YN, |
398 |
&ConfigGeneral.anti_nick_flood, |
399 |
"NICK flood protection" |
400 |
}, |
401 |
{ |
402 |
"max_nick_time", |
403 |
OUTPUT_DECIMAL, |
404 |
&ConfigGeneral.max_nick_time, |
405 |
"NICK flood protection time interval" |
406 |
}, |
407 |
{ |
408 |
"max_nick_changes", |
409 |
OUTPUT_DECIMAL, |
410 |
&ConfigGeneral.max_nick_changes, |
411 |
"NICK change threshhold setting" |
412 |
}, |
413 |
{ |
414 |
"anti_spam_exit_message_time", |
415 |
OUTPUT_DECIMAL, |
416 |
&ConfigGeneral.anti_spam_exit_message_time, |
417 |
"Duration a client must be connected for to have an exit message" |
418 |
}, |
419 |
{ |
420 |
"ts_warn_delta", |
421 |
OUTPUT_DECIMAL, |
422 |
&ConfigGeneral.ts_warn_delta, |
423 |
"Maximum permitted TS delta before displaying a warning" |
424 |
}, |
425 |
{ |
426 |
"ts_max_delta", |
427 |
OUTPUT_DECIMAL, |
428 |
&ConfigGeneral.ts_max_delta, |
429 |
"Maximum permitted TS delta from another server" |
430 |
}, |
431 |
{ |
432 |
"warn_no_connect_block", |
433 |
OUTPUT_BOOLEAN_YN, |
434 |
&ConfigGeneral.warn_no_connect_block, |
435 |
"Display warning if connecting server lacks a connect{} block" |
436 |
}, |
437 |
{ |
438 |
"stats_e_disabled", |
439 |
OUTPUT_BOOLEAN_YN, |
440 |
&ConfigGeneral.stats_e_disabled, |
441 |
"Whether or not STATS e is disabled" |
442 |
}, |
443 |
{ |
444 |
"stats_m_oper_only", |
445 |
OUTPUT_BOOLEAN_YN, |
446 |
&ConfigGeneral.stats_m_oper_only, |
447 |
"STATS m output is only shown to operators" |
448 |
}, |
449 |
{ |
450 |
"stats_o_oper_only", |
451 |
OUTPUT_BOOLEAN_YN, |
452 |
&ConfigGeneral.stats_o_oper_only, |
453 |
"STATS O output is only shown to operators" |
454 |
}, |
455 |
{ |
456 |
"stats_P_oper_only", |
457 |
OUTPUT_BOOLEAN_YN, |
458 |
&ConfigGeneral.stats_P_oper_only, |
459 |
"STATS P output is only shown to operators" |
460 |
}, |
461 |
{ |
462 |
"stats_u_oper_only", |
463 |
OUTPUT_BOOLEAN_YN, |
464 |
&ConfigGeneral.stats_u_oper_only, |
465 |
"STATS u output is only shown to operators" |
466 |
}, |
467 |
{ |
468 |
"stats_i_oper_only", |
469 |
OUTPUT_BOOLEAN2, |
470 |
&ConfigGeneral.stats_i_oper_only, |
471 |
"STATS I output is only shown to operators" |
472 |
}, |
473 |
{ |
474 |
"stats_k_oper_only", |
475 |
OUTPUT_BOOLEAN2, |
476 |
&ConfigGeneral.stats_k_oper_only, |
477 |
"STATS K output is only shown to operators" |
478 |
}, |
479 |
{ |
480 |
"caller_id_wait", |
481 |
OUTPUT_DECIMAL, |
482 |
&ConfigGeneral.caller_id_wait, |
483 |
"Minimum delay between notifying UMODE +g users of messages" |
484 |
}, |
485 |
{ |
486 |
"opers_bypass_callerid", |
487 |
OUTPUT_BOOLEAN_YN, |
488 |
&ConfigGeneral.opers_bypass_callerid, |
489 |
"Allows IRC operators to message users who are +g (callerid)" |
490 |
}, |
491 |
{ |
492 |
"pace_wait_simple", |
493 |
OUTPUT_DECIMAL, |
494 |
&ConfigGeneral.pace_wait_simple, |
495 |
"Minimum delay between less intensive commands" |
496 |
}, |
497 |
{ |
498 |
"pace_wait", |
499 |
OUTPUT_DECIMAL, |
500 |
&ConfigGeneral.pace_wait, |
501 |
"Minimum delay between uses of certain commands" |
502 |
}, |
503 |
{ |
504 |
"short_motd", |
505 |
OUTPUT_BOOLEAN_YN, |
506 |
&ConfigGeneral.short_motd, |
507 |
"Do not show MOTD; only tell clients they should read it" |
508 |
}, |
509 |
{ |
510 |
"ping_cookie", |
511 |
OUTPUT_BOOLEAN_YN, |
512 |
&ConfigGeneral.ping_cookie, |
513 |
"Require ping cookies to connect" |
514 |
}, |
515 |
{ |
516 |
"no_oper_flood", |
517 |
OUTPUT_BOOLEAN_YN, |
518 |
&ConfigGeneral.no_oper_flood, |
519 |
"Reduce flood control for operators" |
520 |
}, |
521 |
{ |
522 |
"max_targets", |
523 |
OUTPUT_DECIMAL, |
524 |
&ConfigGeneral.max_targets, |
525 |
"The maximum number of PRIVMSG/NOTICE targets" |
526 |
}, |
527 |
{ |
528 |
"throttle_count", |
529 |
OUTPUT_DECIMAL, |
530 |
&ConfigGeneral.throttle_count, |
531 |
"Number of connects in throttle_time before connections are blocked" |
532 |
}, |
533 |
{ |
534 |
"throttle_time", |
535 |
OUTPUT_DECIMAL, |
536 |
&ConfigGeneral.throttle_time, |
537 |
"Minimum time between client reconnects" |
538 |
}, |
539 |
|
540 |
/* --[ END OF TABLE ]---------------------------------------------- */ |
541 |
{ |
542 |
NULL, |
543 |
0, |
544 |
NULL, |
545 |
NULL |
546 |
} |
547 |
}; |
548 |
|
549 |
static const char *infotext[] = |
550 |
{ |
551 |
"ircd-hybrid --", |
552 |
"Based on the original code written by Jarkko Oikarinen", |
553 |
"Copyright (c) 1988-1991 University of Oulu, Computing Center", |
554 |
"Copyright (c) 1997-2020 ircd-hybrid development team", |
555 |
"", |
556 |
"This program is free software; you can redistribute it and/or", |
557 |
"modify it under the terms of the GNU General Public License as", |
558 |
"published by the Free Software Foundation; either version 2, or", |
559 |
"(at your option) any later version.", |
560 |
"", |
561 |
"", |
562 |
"The core team as of this major release:", |
563 |
"", |
564 |
"Dianora, Diane Bruce <db@db.net>", |
565 |
"Michael, Michael Wobst <michael@wobst.fr>", |
566 |
"Rodder, Jon Lusky <lusky@blown.net>", |
567 |
"Wohali, Joan Touzet <joant@ieee.org>", |
568 |
"", |
569 |
"The following people have contributed blood, sweat, and/or code to", |
570 |
"recent releases of ircd-hybrid, in nick alphabetical order:", |
571 |
"", |
572 |
"A1kmm, Andrew Miller <a1kmm@mware.virtualave.net>", |
573 |
"Adam, Adam <Adam@anope.org>", |
574 |
"Adrian Chadd <adrian@creative.net.au>", |
575 |
"adx, Piotr Nizynski <nizynski@sysplex.pl>", |
576 |
"AndroSyn, Aaron Sethman <androsyn@ratbox.org>", |
577 |
"bane, Dragan Dosen <bane@idolnet.org>", |
578 |
"billy-jon, William Bierman III <bill@thebiermans.org>", |
579 |
"bysin, Ben Kittridge <bkittridge@cfl.rr.com>", |
580 |
"cosine, Patrick Alken <wnder@uwns.underworld.net>", |
581 |
"cryogen, Stuart Walsh <stu@ipng.org.uk>", |
582 |
"David-T, David Taylor <davidt@yadt.co.uk>", |
583 |
"Dom, Dominic Hargreaves <dom@earth.li>", |
584 |
"Fawkes, Christoph Ostermeier <fawkes@phat-net.de>", |
585 |
"fgeek, Henri Salo <henri@nerv.fi>", |
586 |
"fl, Lee Hardy <lee@leeh.co.uk>", |
587 |
"Garion, Joost Vunderink <garion@efnet.nl>", |
588 |
"Habeeb, David Supuran <habeeb@cfl.rr.com>", |
589 |
"Hwy101, W. Campbell <wcampbel@botbay.net>", |
590 |
"jmallett, Juli Mallett <jmallett@FreeBSD.org>", |
591 |
"joshk, Joshua Kwan <joshk@triplehelix.org>", |
592 |
"jv, Jakub Vlasek <jv@pilsedu.cz>", |
593 |
"k9, Jeremy Chadwick <ircd@jdc.parodius.com>", |
594 |
"kire, Erik Small <smalle@hawaii.edu>", |
595 |
"knight, Alan LeVee <alan.levee@prometheus-designs.net>", |
596 |
"kre, Dinko Korunic <kreator@fly.srk.fer.hr>", |
597 |
"madmax, Paul Lomax <madmax@efnet.org>", |
598 |
"metalrock, Jack Low <xxjack12xx@gmail.com>", |
599 |
"r0d3nt, Andrew Strutt <andrew.strutt@gmail.com>", |
600 |
"Riedel, Dennis Vink <dennis@drvink.com>", |
601 |
"scuzzy, David Todd <scuzzy@aniverse.net>", |
602 |
"spookey, David Colburn <spookey@spookey.org>", |
603 |
"TimeMr14C, Yusuf Iskenderoglu <uhc0@stud.uni-karlsruhe.de>", |
604 |
"toot, Toby Verrall <to7@antipope.fsnet.co.uk>", |
605 |
"vx0, Mark Miller <mark@oc768.net>", |
606 |
"wiz, Jason Dambrosio <jason@wiz.cx>", |
607 |
"Xride, S\xC3\xB8ren Straarup <xride@x12.dk>", |
608 |
"zb^3, Alfred Perlstein <alfred@freebsd.org>", |
609 |
"", |
610 |
NULL |
611 |
}; |
612 |
|
613 |
/* send_birthdate_online_time() |
614 |
* |
615 |
* inputs - client pointer to send to |
616 |
* output - NONE |
617 |
* side effects - birthdate and online time are sent |
618 |
*/ |
619 |
static void |
620 |
send_birthdate_online_time(struct Client *source_p) |
621 |
{ |
622 |
sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT, |
623 |
":On-line since %s", |
624 |
date(me.connection->created_real)); |
625 |
} |
626 |
|
627 |
/* send_conf_options() |
628 |
* |
629 |
* inputs - client pointer to send to |
630 |
* output - NONE |
631 |
* side effects - send config options to client |
632 |
*/ |
633 |
static void |
634 |
send_conf_options(struct Client *source_p) |
635 |
{ |
636 |
/* |
637 |
* Parse the info_table[] and do the magic. |
638 |
*/ |
639 |
for (const struct InfoStruct *iptr = info_table; iptr->name; ++iptr) |
640 |
{ |
641 |
switch (iptr->output_type) |
642 |
{ |
643 |
/* For "char *" references */ |
644 |
case OUTPUT_STRING: |
645 |
{ |
646 |
const char *option = *((const char *const *)iptr->option); |
647 |
|
648 |
sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT, |
649 |
":%-30s %-5s [%s]", |
650 |
iptr->name, option ? option : "NONE", |
651 |
iptr->desc ? iptr->desc : "<none>"); |
652 |
break; |
653 |
} |
654 |
|
655 |
/* For "char foo[]" references */ |
656 |
case OUTPUT_STRING_PTR: |
657 |
{ |
658 |
const char *option = iptr->option; |
659 |
|
660 |
sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT, |
661 |
":%-30s %-5s [%s]", |
662 |
iptr->name, option ? option : "NONE", |
663 |
iptr->desc ? iptr->desc : "<none>"); |
664 |
break; |
665 |
} |
666 |
|
667 |
/* Output info_table[i].option as a decimal value. */ |
668 |
case OUTPUT_DECIMAL: |
669 |
{ |
670 |
const unsigned int option = *((const unsigned int *const)iptr->option); |
671 |
|
672 |
sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT, |
673 |
":%-30s %-5u [%s]", |
674 |
iptr->name, option, iptr->desc ? iptr->desc : "<none>"); |
675 |
break; |
676 |
} |
677 |
|
678 |
/* Output info_table[i].option as "ON" or "OFF" */ |
679 |
case OUTPUT_BOOLEAN: |
680 |
{ |
681 |
const unsigned int option = *((const unsigned int *const)iptr->option); |
682 |
|
683 |
sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT, |
684 |
":%-30s %-5s [%s]", |
685 |
iptr->name, option ? "ON" : "OFF", |
686 |
iptr->desc ? iptr->desc : "<none>"); |
687 |
|
688 |
break; |
689 |
} |
690 |
|
691 |
/* Output info_table[i].option as "YES" or "NO" */ |
692 |
case OUTPUT_BOOLEAN_YN: |
693 |
{ |
694 |
const unsigned int option = *((const unsigned int *const)iptr->option); |
695 |
|
696 |
sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT, |
697 |
":%-30s %-5s [%s]", |
698 |
iptr->name, option ? "YES" : "NO", |
699 |
iptr->desc ? iptr->desc : "<none>"); |
700 |
break; |
701 |
} |
702 |
|
703 |
case OUTPUT_BOOLEAN2: |
704 |
{ |
705 |
const unsigned int option = *((const unsigned int *const)iptr->option); |
706 |
|
707 |
sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT, |
708 |
":%-30s %-5s [%s]", |
709 |
iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO", |
710 |
iptr->desc ? iptr->desc : "<none>"); |
711 |
break; |
712 |
} |
713 |
} |
714 |
} |
715 |
|
716 |
sendto_one_numeric(source_p, &me, RPL_INFO, ""); |
717 |
} |
718 |
|
719 |
/* send_info_text() |
720 |
* |
721 |
* inputs - client pointer to send info text to |
722 |
* output - NONE |
723 |
* side effects - info text is sent to client |
724 |
*/ |
725 |
static void |
726 |
send_info_text(struct Client *source_p) |
727 |
{ |
728 |
sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE, |
729 |
"INFO requested by %s (%s@%s) [%s]", |
730 |
source_p->name, source_p->username, |
731 |
source_p->host, source_p->servptr->name); |
732 |
|
733 |
for (const char **text = infotext; *text; ++text) |
734 |
{ |
735 |
const char *line = *text; |
736 |
|
737 |
if (*line == '\0') |
738 |
line = " "; |
739 |
|
740 |
sendto_one_numeric(source_p, &me, RPL_INFO, line); |
741 |
} |
742 |
|
743 |
if (HasUMode(source_p, UMODE_OPER)) |
744 |
{ |
745 |
send_conf_options(source_p); |
746 |
|
747 |
if (tls_is_initialized()) |
748 |
sendto_one_numeric(source_p, &me, RPL_INFO, tls_get_version()); |
749 |
} |
750 |
|
751 |
send_birthdate_online_time(source_p); |
752 |
|
753 |
sendto_one_numeric(source_p, &me, RPL_ENDOFINFO); |
754 |
} |
755 |
|
756 |
/*! \brief INFO command handler |
757 |
* |
758 |
* \param source_p Pointer to allocated Client struct from which the message |
759 |
* originally comes from. This can be a local or remote client. |
760 |
* \param parc Integer holding the number of supplied arguments. |
761 |
* \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL |
762 |
* pointers. |
763 |
* \note Valid arguments for this command are: |
764 |
* - parv[0] = command |
765 |
* - parv[1] = nickname/servername |
766 |
*/ |
767 |
static void |
768 |
m_info(struct Client *source_p, int parc, char *parv[]) |
769 |
{ |
770 |
static uintmax_t last_used = 0; |
771 |
|
772 |
if ((last_used + ConfigGeneral.pace_wait) > event_base->time.sec_monotonic) |
773 |
{ |
774 |
sendto_one_numeric(source_p, &me, RPL_LOAD2HI, "INFO"); |
775 |
return; |
776 |
} |
777 |
|
778 |
last_used = event_base->time.sec_monotonic; |
779 |
|
780 |
if (ConfigServerHide.disable_remote_commands == 0) |
781 |
if (server_hunt(source_p, ":%s INFO :%s", 1, parc, parv)->ret != HUNTED_ISME) |
782 |
return; |
783 |
|
784 |
send_info_text(source_p); |
785 |
} |
786 |
|
787 |
/*! \brief INFO command handler |
788 |
* |
789 |
* \param source_p Pointer to allocated Client struct from which the message |
790 |
* originally comes from. This can be a local or remote client. |
791 |
* \param parc Integer holding the number of supplied arguments. |
792 |
* \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL |
793 |
* pointers. |
794 |
* \note Valid arguments for this command are: |
795 |
* - parv[0] = command |
796 |
* - parv[1] = nickname/servername |
797 |
*/ |
798 |
static void |
799 |
ms_info(struct Client *source_p, int parc, char *parv[]) |
800 |
{ |
801 |
if (server_hunt(source_p, ":%s INFO :%s", 1, parc, parv)->ret != HUNTED_ISME) |
802 |
return; |
803 |
|
804 |
send_info_text(source_p); |
805 |
} |
806 |
|
807 |
static struct Message info_msgtab = |
808 |
{ |
809 |
.cmd = "INFO", |
810 |
.args_max = MAXPARA, |
811 |
.handlers[UNREGISTERED_HANDLER] = m_unregistered, |
812 |
.handlers[CLIENT_HANDLER] = m_info, |
813 |
.handlers[SERVER_HANDLER] = ms_info, |
814 |
.handlers[ENCAP_HANDLER] = m_ignore, |
815 |
.handlers[OPER_HANDLER] = ms_info |
816 |
}; |
817 |
|
818 |
static void |
819 |
module_init(void) |
820 |
{ |
821 |
mod_add_cmd(&info_msgtab); |
822 |
} |
823 |
|
824 |
static void |
825 |
module_exit(void) |
826 |
{ |
827 |
mod_del_cmd(&info_msgtab); |
828 |
} |
829 |
|
830 |
struct module module_entry = |
831 |
{ |
832 |
.version = "$Revision$", |
833 |
.modinit = module_init, |
834 |
.modexit = module_exit, |
835 |
}; |