ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/modules/m_info.c
(Generate patch)

Comparing:
ircd-hybrid-8/modules/m_info.c (file contents), Revision 1549 by michael, Mon Oct 1 18:11:11 2012 UTC vs.
ircd-hybrid/branches/8.2.x/modules/m_info.c (file contents), Revision 8045 by michael, Sat Mar 18 18:05:41 2017 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)