ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/modules/m_info.c
Revision: 8962
Committed: Sat May 11 21:04:34 2019 UTC (6 years, 3 months ago) by michael
Content type: text/x-csrc
File size: 21943 byte(s)
Log Message:
- Removed general::tkline_expire_notices configuration directive and added user mode +X (sees *LINE expiration notices) instead

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 8751 * Copyright (c) 1997-2019 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 michael 4564 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * 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 michael 7707 #include "tls.h"
39 adx 30
40 michael 1230
41 adx 30 /*
42     * jdc -- Structure for our configuration value table
43     */
44     struct InfoStruct
45     {
46 michael 3743 const char *name; /* Displayed variable name */
47 michael 8846 enum
48     {
49 michael 8806 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 michael 8846
57 michael 3743 const void *option; /* Pointer reference to the value */
58     const char *desc; /* ASCII description of the variable */
59 adx 30 };
60    
61     static const struct InfoStruct info_table[] =
62     {
63     /* --[ START OF TABLE ]-------------------------------------------- */
64 michael 1318
65 adx 30 {
66 michael 3236 "DPATH",
67     OUTPUT_STRING,
68 michael 4341 &ConfigGeneral.dpath,
69 michael 3236 "Root directory of installation"
70     },
71     {
72 michael 3239 "SPATH",
73     OUTPUT_STRING,
74 michael 4341 &ConfigGeneral.spath,
75 michael 3239 "Path to server executable"
76     },
77     {
78     "MPATH",
79     OUTPUT_STRING,
80 michael 4341 &ConfigGeneral.mpath,
81 michael 3239 "Path to main motd (Message of the Day) file"
82     },
83     {
84 michael 1318 "CPATH",
85     OUTPUT_STRING,
86 michael 4341 &ConfigGeneral.configfile,
87 michael 1702 "Path to main configuration file"
88 michael 1318 },
89     {
90     "DLPATH",
91     OUTPUT_STRING,
92 michael 4341 &ConfigGeneral.dlinefile,
93 michael 1702 "Path to D-line database file"
94 michael 1318 },
95     {
96     "KPATH",
97     OUTPUT_STRING,
98 michael 4341 &ConfigGeneral.klinefile,
99 michael 1702 "Path to K-line database file"
100 michael 1318 },
101     {
102 michael 1702 "XPATH",
103     OUTPUT_STRING,
104 michael 4341 &ConfigGeneral.xlinefile,
105 michael 1702 "Path to X-line database file"
106     },
107     {
108     "RESVPATH",
109     OUTPUT_STRING,
110 michael 4341 &ConfigGeneral.resvfile,
111 michael 1702 "Path to resv database file"
112     },
113     {
114 adx 30 "network_name",
115     OUTPUT_STRING,
116 michael 4341 &ConfigServerInfo.network_name,
117 adx 30 "Network name"
118     },
119     {
120     "network_desc",
121     OUTPUT_STRING,
122 michael 4341 &ConfigServerInfo.network_desc,
123 adx 30 "Network description"
124     },
125     {
126     "hub",
127     OUTPUT_BOOLEAN_YN,
128 michael 4341 &ConfigServerInfo.hub,
129 adx 30 "Server is a hub"
130     },
131     {
132 michael 5488 "default_max_clients",
133 michael 1754 OUTPUT_DECIMAL,
134 michael 5488 &ConfigServerInfo.default_max_clients,
135     "The default maximum number of clients permitted simultaneously on this server"
136 michael 1754 },
137     {
138     "max_nick_length",
139     OUTPUT_DECIMAL,
140 michael 4341 &ConfigServerInfo.max_nick_length,
141 michael 1754 "Maximum nickname length"
142     },
143     {
144     "max_topic_length",
145     OUTPUT_DECIMAL,
146 michael 4341 &ConfigServerInfo.max_topic_length,
147 michael 1754 "Maximum topic length"
148     },
149     {
150 adx 30 "use_logging",
151     OUTPUT_BOOLEAN_YN,
152 michael 4341 &ConfigLog.use_logging,
153 adx 30 "Enable logging"
154     },
155     {
156 michael 1767 "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 michael 3863 "invite_client_count",
163 michael 3765 OUTPUT_DECIMAL,
164 michael 3863 &ConfigChannel.invite_client_count,
165     "How many INVITE attempts are permitted in invite_client_time"
166 michael 3765 },
167     {
168 michael 3863 "invite_client_time",
169 michael 3765 OUTPUT_DECIMAL,
170 michael 3863 &ConfigChannel.invite_client_time,
171     "How many invite_client_count invites are allowed in this time"
172 michael 3765 },
173     {
174 michael 6794 "invite_delay_channel",
175     OUTPUT_DECIMAL,
176     &ConfigChannel.invite_delay_channel,
177     "Delay between INVITE attempts to a channel"
178     },
179     {
180 michael 7792 "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 michael 3863 "knock_client_count",
187 adx 30 OUTPUT_DECIMAL,
188 michael 3863 &ConfigChannel.knock_client_count,
189     "How many KNOCK attempts are permitted in knock_client_time"
190 adx 30 },
191     {
192 michael 3863 "knock_client_time",
193     OUTPUT_DECIMAL,
194     &ConfigChannel.knock_client_time,
195 michael 4314 "How many knock_client_count knocks are allowed in this time"
196 michael 3863 },
197     {
198 adx 30 "knock_delay_channel",
199     OUTPUT_DECIMAL,
200     &ConfigChannel.knock_delay_channel,
201     "Delay between KNOCK attempts to a channel"
202     },
203     {
204 michael 3934 "max_channels",
205 adx 30 OUTPUT_DECIMAL,
206 michael 3934 &ConfigChannel.max_channels,
207 adx 30 "Maximum number of channels a user can join"
208     },
209     {
210 michael 7765 "max_invites",
211     OUTPUT_DECIMAL,
212     &ConfigChannel.max_invites,
213     "Maximum number of channels a user can be invited to"
214     },
215     {
216 adx 30 "max_bans",
217     OUTPUT_DECIMAL,
218     &ConfigChannel.max_bans,
219     "Total +b/e/I modes allowed in a channel"
220     },
221     {
222 michael 8045 "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 adx 30 "flatten_links",
229     OUTPUT_BOOLEAN_YN,
230     &ConfigServerHide.flatten_links,
231     "Flatten /links list"
232     },
233     {
234 michael 6598 "flatten_links_delay",
235 adx 30 OUTPUT_DECIMAL,
236 michael 6598 &ConfigServerHide.flatten_links_delay,
237 adx 30 "Links rehash delay"
238     },
239     {
240 michael 6600 "flatten_links_file",
241     OUTPUT_STRING,
242     &ConfigServerHide.flatten_links_file,
243     "Path to the flatten links cache file"
244     },
245     {
246 adx 30 "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 michael 1854 "hide_services",
259     OUTPUT_BOOLEAN_YN,
260     &ConfigServerHide.hide_services,
261     "Hides the location of services server"
262     },
263     {
264 adx 30 "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 michael 1936 "Prevent people from seeing server IP addresses"
274 adx 30 },
275     {
276 michael 4314 "away_count",
277     OUTPUT_DECIMAL,
278 michael 4341 &ConfigGeneral.away_count,
279 michael 4314 "How many AWAY attempts are permitted in away_time"
280     },
281     {
282     "away_time",
283     OUTPUT_DECIMAL,
284 michael 4341 &ConfigGeneral.away_time,
285 michael 4314 "How many away_count aways are allowed in this time"
286     },
287     {
288 michael 5810 "dline_min_cidr",
289 adx 30 OUTPUT_DECIMAL,
290 michael 5810 &ConfigGeneral.dline_min_cidr,
291     "Minimum required length of a CIDR bitmask for IPv4 D-Lines"
292 adx 30 },
293     {
294 michael 5810 "dline_min_cidr6",
295 adx 30 OUTPUT_DECIMAL,
296 michael 5810 &ConfigGeneral.dline_min_cidr6,
297     "Minimum required length of a CIDR bitmask for IPv6 D-Lines"
298 adx 30 },
299     {
300 michael 5810 "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 adx 30 "invisible_on_connect",
313     OUTPUT_BOOLEAN_YN,
314 michael 4341 &ConfigGeneral.invisible_on_connect,
315 adx 30 "Automatically set mode +i on connecting users"
316     },
317     {
318     "kill_chase_time_limit",
319     OUTPUT_DECIMAL,
320 michael 4341 &ConfigGeneral.kill_chase_time_limit,
321 adx 30 "Nick Change Tracker for KILL"
322     },
323     {
324 michael 2283 "cycle_on_host_change",
325     OUTPUT_BOOLEAN_YN,
326 michael 4341 &ConfigGeneral.cycle_on_host_change,
327 michael 2283 "Send a fake QUIT/JOIN combination on host change"
328     },
329     {
330 adx 30 "disable_auth",
331     OUTPUT_BOOLEAN_YN,
332 michael 4341 &ConfigGeneral.disable_auth,
333 adx 30 "Completely disable ident lookups"
334     },
335     {
336     "disable_remote_commands",
337     OUTPUT_BOOLEAN_YN,
338 michael 2196 &ConfigServerHide.disable_remote_commands,
339 adx 30 "Prevent users issuing commands on remote servers"
340     },
341     {
342     "default_floodcount",
343     OUTPUT_DECIMAL,
344 michael 4341 &ConfigGeneral.default_floodcount,
345 adx 30 "Startup value of FLOODCOUNT"
346     },
347     {
348 michael 7859 "default_floodtime",
349     OUTPUT_DECIMAL,
350     &ConfigGeneral.default_floodtime,
351     "Startup value of FLOODTIME"
352     },
353     {
354 adx 30 "failed_oper_notice",
355 michael 3546 OUTPUT_BOOLEAN_YN,
356 michael 4341 &ConfigGeneral.failed_oper_notice,
357 michael 8056 "Inform opers if someone tries to /oper with the wrong credentials"
358 adx 30 },
359     {
360     "dots_in_ident",
361     OUTPUT_DECIMAL,
362 michael 4341 &ConfigGeneral.dots_in_ident,
363 adx 30 "Number of permissable dots in an ident"
364     },
365     {
366     "min_nonwildcard",
367     OUTPUT_DECIMAL,
368 michael 4341 &ConfigGeneral.min_nonwildcard,
369 michael 5895 "Minimum non-wildcard chars in K/D lines"
370 adx 30 },
371     {
372     "min_nonwildcard_simple",
373     OUTPUT_DECIMAL,
374 michael 4341 &ConfigGeneral.min_nonwildcard_simple,
375 adx 30 "Minimum non-wildcards in gecos bans"
376     },
377     {
378 michael 5619 "max_watch",
379     OUTPUT_DECIMAL,
380     &ConfigGeneral.max_watch,
381     "Maximum nicknames on watch list"
382     },
383     {
384 adx 30 "max_accept",
385     OUTPUT_DECIMAL,
386 michael 4341 &ConfigGeneral.max_accept,
387 adx 30 "Maximum nicknames on accept list"
388     },
389     {
390 michael 7436 "whowas_history_length",
391     OUTPUT_DECIMAL,
392     &ConfigGeneral.whowas_history_length,
393     "Length of the WHOWAS nick name history list"
394     },
395     {
396 adx 30 "anti_nick_flood",
397 michael 3546 OUTPUT_BOOLEAN_YN,
398 michael 4341 &ConfigGeneral.anti_nick_flood,
399 adx 30 "NICK flood protection"
400     },
401     {
402     "max_nick_time",
403     OUTPUT_DECIMAL,
404 michael 4341 &ConfigGeneral.max_nick_time,
405 adx 30 "NICK flood protection time interval"
406     },
407     {
408     "max_nick_changes",
409     OUTPUT_DECIMAL,
410 michael 4341 &ConfigGeneral.max_nick_changes,
411 adx 30 "NICK change threshhold setting"
412     },
413     {
414     "anti_spam_exit_message_time",
415     OUTPUT_DECIMAL,
416 michael 4341 &ConfigGeneral.anti_spam_exit_message_time,
417 adx 30 "Duration a client must be connected for to have an exit message"
418     },
419     {
420     "ts_warn_delta",
421     OUTPUT_DECIMAL,
422 michael 4341 &ConfigGeneral.ts_warn_delta,
423 adx 30 "Maximum permitted TS delta before displaying a warning"
424     },
425     {
426     "ts_max_delta",
427     OUTPUT_DECIMAL,
428 michael 4341 &ConfigGeneral.ts_max_delta,
429 adx 30 "Maximum permitted TS delta from another server"
430     },
431     {
432 michael 3474 "warn_no_connect_block",
433 michael 3546 OUTPUT_BOOLEAN_YN,
434 michael 4341 &ConfigGeneral.warn_no_connect_block,
435 michael 3474 "Display warning if connecting server lacks a connect{} block"
436 adx 30 },
437     {
438 michael 1767 "stats_e_disabled",
439     OUTPUT_BOOLEAN_YN,
440 michael 4341 &ConfigGeneral.stats_e_disabled,
441 michael 1767 "Whether or not STATS e is disabled"
442     },
443     {
444 michael 5619 "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 adx 30 "stats_o_oper_only",
451     OUTPUT_BOOLEAN_YN,
452 michael 4341 &ConfigGeneral.stats_o_oper_only,
453 adx 30 "STATS O output is only shown to operators"
454     },
455     {
456     "stats_P_oper_only",
457     OUTPUT_BOOLEAN_YN,
458 michael 4341 &ConfigGeneral.stats_P_oper_only,
459 michael 6532 "STATS P output is only shown to operators"
460 adx 30 },
461     {
462 michael 2269 "stats_u_oper_only",
463     OUTPUT_BOOLEAN_YN,
464 michael 4341 &ConfigGeneral.stats_u_oper_only,
465 michael 6532 "STATS u output is only shown to operators"
466 michael 2269 },
467     {
468 adx 30 "stats_i_oper_only",
469     OUTPUT_BOOLEAN2,
470 michael 4341 &ConfigGeneral.stats_i_oper_only,
471 adx 30 "STATS I output is only shown to operators"
472     },
473     {
474     "stats_k_oper_only",
475     OUTPUT_BOOLEAN2,
476 michael 4341 &ConfigGeneral.stats_k_oper_only,
477 adx 30 "STATS K output is only shown to operators"
478     },
479     {
480     "caller_id_wait",
481     OUTPUT_DECIMAL,
482 michael 4341 &ConfigGeneral.caller_id_wait,
483 adx 30 "Minimum delay between notifying UMODE +g users of messages"
484     },
485     {
486     "opers_bypass_callerid",
487     OUTPUT_BOOLEAN_YN,
488 michael 4341 &ConfigGeneral.opers_bypass_callerid,
489 adx 30 "Allows IRC operators to message users who are +g (callerid)"
490     },
491     {
492     "pace_wait_simple",
493     OUTPUT_DECIMAL,
494 michael 4341 &ConfigGeneral.pace_wait_simple,
495 adx 30 "Minimum delay between less intensive commands"
496     },
497     {
498     "pace_wait",
499     OUTPUT_DECIMAL,
500 michael 4341 &ConfigGeneral.pace_wait,
501 adx 30 "Minimum delay between uses of certain commands"
502     },
503     {
504     "short_motd",
505     OUTPUT_BOOLEAN_YN,
506 michael 4341 &ConfigGeneral.short_motd,
507 adx 30 "Do not show MOTD; only tell clients they should read it"
508     },
509     {
510     "ping_cookie",
511 michael 3546 OUTPUT_BOOLEAN_YN,
512 michael 4341 &ConfigGeneral.ping_cookie,
513 adx 30 "Require ping cookies to connect"
514     },
515     {
516     "no_oper_flood",
517 michael 3546 OUTPUT_BOOLEAN_YN,
518 michael 4341 &ConfigGeneral.no_oper_flood,
519 adx 30 "Reduce flood control for operators"
520     },
521     {
522     "max_targets",
523     OUTPUT_DECIMAL,
524 michael 4341 &ConfigGeneral.max_targets,
525 adx 30 "The maximum number of PRIVMSG/NOTICE targets"
526     },
527     {
528 michael 3876 "throttle_count",
529     OUTPUT_DECIMAL,
530 michael 4341 &ConfigGeneral.throttle_count,
531 michael 3876 "Number of connects in throttle_time before connections are blocked"
532     },
533     {
534 adx 30 "throttle_time",
535     OUTPUT_DECIMAL,
536 michael 4341 &ConfigGeneral.throttle_time,
537 adx 30 "Minimum time between client reconnects"
538     },
539 michael 1459
540 adx 30 /* --[ END OF TABLE ]---------------------------------------------- */
541     {
542     NULL,
543     0,
544     NULL,
545 michael 5023 NULL
546 adx 30 }
547     };
548    
549 michael 8728 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 michael 8751 "Copyright (c) 1997-2019 ircd-hybrid development team",
555 michael 8728 "",
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 adx 30 /* 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 michael 5582 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
623 michael 3574 ":On-line since %s",
624 michael 8918 date(me.connection->created_real));
625 adx 30 }
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 michael 3460 for (const struct InfoStruct *iptr = info_table; iptr->name; ++iptr)
640 adx 30 {
641     switch (iptr->output_type)
642     {
643     /* For "char *" references */
644     case OUTPUT_STRING:
645     {
646 michael 3343 const char *option = *((const char *const *)iptr->option);
647 adx 30
648 michael 5582 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
649 michael 4434 ":%-30s %-5s [%s]",
650 michael 3574 iptr->name, option ? option : "NONE",
651     iptr->desc ? iptr->desc : "<none>");
652 adx 30 break;
653     }
654    
655     /* For "char foo[]" references */
656     case OUTPUT_STRING_PTR:
657     {
658     const char *option = iptr->option;
659    
660 michael 5582 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
661 michael 4434 ":%-30s %-5s [%s]",
662 michael 3574 iptr->name, option ? option : "NONE",
663     iptr->desc ? iptr->desc : "<none>");
664 adx 30 break;
665     }
666    
667     /* Output info_table[i].option as a decimal value. */
668     case OUTPUT_DECIMAL:
669     {
670 michael 5890 const unsigned int option = *((const unsigned int *const)iptr->option);
671 adx 30
672 michael 5582 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
673 michael 5890 ":%-30s %-5u [%s]",
674 michael 3574 iptr->name, option, iptr->desc ? iptr->desc : "<none>");
675 adx 30 break;
676     }
677    
678     /* Output info_table[i].option as "ON" or "OFF" */
679     case OUTPUT_BOOLEAN:
680     {
681 michael 5890 const unsigned int option = *((const unsigned int *const)iptr->option);
682 adx 30
683 michael 5582 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
684 michael 4434 ":%-30s %-5s [%s]",
685 michael 3574 iptr->name, option ? "ON" : "OFF",
686     iptr->desc ? iptr->desc : "<none>");
687 adx 30
688     break;
689     }
690    
691     /* Output info_table[i].option as "YES" or "NO" */
692     case OUTPUT_BOOLEAN_YN:
693     {
694 michael 5890 const unsigned int option = *((const unsigned int *const)iptr->option);
695 adx 30
696 michael 5582 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
697 michael 4434 ":%-30s %-5s [%s]",
698 michael 3574 iptr->name, option ? "YES" : "NO",
699     iptr->desc ? iptr->desc : "<none>");
700 adx 30 break;
701     }
702    
703     case OUTPUT_BOOLEAN2:
704     {
705 michael 5890 const unsigned int option = *((const unsigned int *const)iptr->option);
706 adx 30
707 michael 5582 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
708 michael 4434 ":%-30s %-5s [%s]",
709 michael 3574 iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO",
710     iptr->desc ? iptr->desc : "<none>");
711 adx 30 break;
712     }
713     }
714     }
715    
716 michael 3109 sendto_one_numeric(source_p, &me, RPL_INFO, "");
717 adx 30 }
718 michael 1230
719 michael 1827 /* 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 michael 3156 static void
726 michael 1827 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 michael 3894 for (const char **text = infotext; *text; ++text)
734 michael 1827 {
735 michael 3879 const char *line = *text;
736 michael 1827
737     if (*line == '\0')
738     line = " ";
739    
740 michael 3109 sendto_one_numeric(source_p, &me, RPL_INFO, line);
741 michael 1827 }
742    
743     if (HasUMode(source_p, UMODE_OPER))
744 michael 7707 {
745 michael 1827 send_conf_options(source_p);
746    
747 michael 7707 if (tls_is_initialized())
748     sendto_one_numeric(source_p, &me, RPL_INFO, tls_get_version());
749     }
750    
751 michael 1827 send_birthdate_online_time(source_p);
752    
753 michael 3109 sendto_one_numeric(source_p, &me, RPL_ENDOFINFO);
754 michael 1827 }
755    
756 michael 3275 /*! \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 michael 3300 * - parv[1] = nickname/servername
766 michael 3275 */
767 michael 2820 static int
768 michael 3156 m_info(struct Client *source_p, int parc, char *parv[])
769 michael 1827 {
770 michael 7329 static uintmax_t last_used = 0;
771 michael 1827
772 michael 8902 if ((last_used + ConfigGeneral.pace_wait) > event_base->time.sec_monotonic)
773 michael 1827 {
774 michael 4758 sendto_one_numeric(source_p, &me, RPL_LOAD2HI, "INFO");
775 michael 2820 return 0;
776 michael 1827 }
777    
778 michael 8902 last_used = event_base->time.sec_monotonic;
779 michael 1827
780 michael 8604 if (ConfigServerHide.disable_remote_commands == 0)
781 michael 7970 if (server_hunt(source_p, ":%s INFO :%s", 1, parc, parv)->ret != HUNTED_ISME)
782 michael 2820 return 0;
783 michael 1827
784 michael 3156 send_info_text(source_p);
785     return 0;
786 michael 1827 }
787    
788 michael 3275 /*! \brief INFO command handler
789     *
790     * \param source_p Pointer to allocated Client struct from which the message
791     * originally comes from. This can be a local or remote client.
792     * \param parc Integer holding the number of supplied arguments.
793     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
794     * pointers.
795     * \note Valid arguments for this command are:
796     * - parv[0] = command
797 michael 3300 * - parv[1] = nickname/servername
798 michael 3275 */
799 michael 2820 static int
800 michael 3156 ms_info(struct Client *source_p, int parc, char *parv[])
801 michael 1827 {
802 michael 7970 if (server_hunt(source_p, ":%s INFO :%s", 1, parc, parv)->ret != HUNTED_ISME)
803 michael 2820 return 0;
804 michael 1827
805 michael 3156 send_info_text(source_p);
806     return 0;
807 michael 1827 }
808    
809 michael 2820 static struct Message info_msgtab =
810     {
811 michael 5880 .cmd = "INFO",
812     .args_max = MAXPARA,
813     .handlers[UNREGISTERED_HANDLER] = m_unregistered,
814     .handlers[CLIENT_HANDLER] = m_info,
815     .handlers[SERVER_HANDLER] = ms_info,
816     .handlers[ENCAP_HANDLER] = m_ignore,
817     .handlers[OPER_HANDLER] = ms_info
818 michael 1230 };
819    
820     static void
821     module_init(void)
822     {
823     mod_add_cmd(&info_msgtab);
824     }
825    
826     static void
827     module_exit(void)
828     {
829     mod_del_cmd(&info_msgtab);
830     }
831    
832 michael 2820 struct module module_entry =
833     {
834 michael 1230 .version = "$Revision$",
835     .modinit = module_init,
836     .modexit = module_exit,
837     };

Properties

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