ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_info.c
Revision: 7708
Committed: Fri Sep 23 16:46:01 2016 UTC (9 years, 10 months ago) by michael
Content type: text/x-csrc
File size: 19406 byte(s)
Log Message:
- Show GnuTLS/OpenSSL library/header versions in /INFO as suggested by Adam

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

Properties

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