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