]>
Commit | Line | Data |
---|---|---|
212380e3 WP |
1 | /* |
2 | * ircd-ratbox: A slightly useful ircd. | |
3 | * m_info.c: Sends information about the server. | |
4 | * | |
5 | * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center | |
6 | * Copyright (C) 1996-2002 Hybrid Development Team | |
7 | * Copyright (C) 2002-2005 ircd-ratbox development team | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License as published by | |
11 | * the Free Software Foundation; either version 2 of the License, or | |
12 | * (at your option) any later version. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | * GNU General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with this program; if not, write to the Free Software | |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |
22 | * USA | |
212380e3 WP |
23 | */ |
24 | ||
25 | #include "stdinc.h" | |
212380e3 WP |
26 | #include "m_info.h" |
27 | #include "channel.h" | |
28 | #include "client.h" | |
4562c604 | 29 | #include "match.h" |
212380e3 WP |
30 | #include "ircd.h" |
31 | #include "hook.h" | |
32 | #include "numeric.h" | |
33 | #include "s_serv.h" | |
34 | #include "s_user.h" | |
35 | #include "send.h" | |
36 | #include "s_conf.h" | |
37 | #include "msg.h" | |
38 | #include "parse.h" | |
39 | #include "modules.h" | |
d4f7eb4c | 40 | #include "s_newconf.h" |
212380e3 | 41 | |
eeabf33a EM |
42 | static const char info_desc[] = |
43 | "Provides the INFO command for retrieving server copyright, credits, and other info"; | |
44 | ||
212380e3 WP |
45 | static void send_conf_options(struct Client *source_p); |
46 | static void send_birthdate_online_time(struct Client *source_p); | |
47 | static void send_info_text(struct Client *source_p); | |
48 | static void info_spy(struct Client *); | |
49 | ||
3c7d6fcc EM |
50 | static void m_info(struct MsgBuf *, struct Client *, struct Client *, int, const char **); |
51 | static void mo_info(struct MsgBuf *, struct Client *, struct Client *, int, const char **); | |
212380e3 WP |
52 | |
53 | struct Message info_msgtab = { | |
7baa37a9 | 54 | "INFO", 0, 0, 0, 0, |
212380e3 WP |
55 | {mg_unreg, {m_info, 0}, {mo_info, 0}, mg_ignore, mg_ignore, {mo_info, 0}} |
56 | }; | |
57 | ||
58 | int doing_info_hook; | |
59 | ||
60 | mapi_clist_av1 info_clist[] = { &info_msgtab, NULL }; | |
61 | mapi_hlist_av1 info_hlist[] = { | |
62 | { "doing_info", &doing_info_hook }, | |
63 | { NULL, NULL } | |
64 | }; | |
65 | ||
f1156bf0 | 66 | DECLARE_MODULE_AV2(info, NULL, NULL, info_clist, info_hlist, NULL, NULL, NULL, info_desc); |
212380e3 | 67 | |
0ee3f45c EK |
68 | enum info_output_type { |
69 | OUTPUT_STRING, /* Output option as %s w/ dereference */ | |
70 | OUTPUT_STRING_PTR, /* Output option as %s w/out deference */ | |
71 | OUTPUT_DECIMAL, /* Output option as decimal (%d) */ | |
72 | OUTPUT_BOOLEAN, /* Output option as "ON" or "OFF" */ | |
73 | OUTPUT_BOOLEAN_YN, /* Output option as "YES" or "NO" */ | |
74 | OUTPUT_INTBOOL, /* BOOLEAN encoded as an int */ | |
75 | OUTPUT_INTBOOL_YN, /* BOOLEAN_YN encoded as an int */ | |
76 | OUTPUT_YESNOMASK, /* Output option as "YES/NO/MASKED" */ | |
27076304 | 77 | OUTPUT_STATSL, /* Output as "YES/NO/SELF" */ |
0ee3f45c EK |
78 | }; |
79 | ||
80 | #define INFO_STRING(ptr) OUTPUT_STRING, .option.string_p = (ptr) | |
81 | #define INFO_STRING_PTR(ptr) OUTPUT_STRING_PTR, .option.string = (ptr) | |
82 | #define INFO_BOOLEAN(ptr) OUTPUT_BOOLEAN, .option.bool_ = (ptr) | |
83 | #define INFO_BOOLEAN_YN(ptr) OUTPUT_BOOLEAN_YN, .option.bool_ = (ptr) | |
84 | #define INFO_INTBOOL(ptr) OUTPUT_INTBOOL, .option.int_ = (ptr) | |
85 | #define INFO_INTBOOL_YN(ptr) OUTPUT_INTBOOL_YN, .option.int_ = (ptr) | |
86 | #define INFO_YESNOMASK(ptr) OUTPUT_YESNOMASK, .option.int_ = (ptr) | |
87 | #define INFO_DECIMAL(ptr) OUTPUT_DECIMAL, .option.int_ = (ptr) | |
27076304 | 88 | #define INFO_STATSL(ptr) OUTPUT_STATSL, .option.statsl = (ptr) |
0ee3f45c | 89 | |
212380e3 WP |
90 | struct InfoStruct |
91 | { | |
b3701ae2 | 92 | const char *name; |
b3701ae2 | 93 | const char *desc; |
0ee3f45c EK |
94 | enum info_output_type output_type; |
95 | union | |
96 | { | |
97 | const int *int_; | |
98 | const bool *bool_; | |
78744107 EK |
99 | char *const *string_p; |
100 | const char *string; | |
27076304 | 101 | const enum stats_l_oper_only *statsl; |
0ee3f45c | 102 | } option; |
212380e3 | 103 | }; |
b3701ae2 | 104 | |
212380e3 WP |
105 | /* *INDENT-OFF* */ |
106 | static struct InfoStruct info_table[] = { | |
b3701ae2 | 107 | |
212380e3 WP |
108 | { |
109 | "opers_see_all_users", | |
0ee3f45c EK |
110 | "Farconnect notices available or operspy accountability limited", |
111 | INFO_BOOLEAN(&opers_see_all_users) | |
212380e3 | 112 | }, |
8bd5767b JT |
113 | { |
114 | "max_connections", | |
0ee3f45c EK |
115 | "Max number connections", |
116 | INFO_DECIMAL(&maxconnections), | |
d8228627 | 117 | }, |
212380e3 WP |
118 | { |
119 | "anti_nick_flood", | |
0ee3f45c EK |
120 | "NICK flood protection", |
121 | INFO_INTBOOL(&ConfigFileEntry.anti_nick_flood), | |
212380e3 WP |
122 | }, |
123 | { | |
124 | "anti_spam_exit_message_time", | |
0ee3f45c EK |
125 | "Duration a client must be connected for to have an exit message", |
126 | INFO_DECIMAL(&ConfigFileEntry.anti_spam_exit_message_time), | |
212380e3 WP |
127 | }, |
128 | { | |
129 | "caller_id_wait", | |
0ee3f45c EK |
130 | "Minimum delay between notifying UMODE +g users of messages", |
131 | INFO_DECIMAL(&ConfigFileEntry.caller_id_wait), | |
212380e3 WP |
132 | }, |
133 | { | |
134 | "client_exit", | |
0ee3f45c EK |
135 | "Prepend 'Quit:' to user QUIT messages", |
136 | INFO_INTBOOL(&ConfigFileEntry.client_exit), | |
212380e3 WP |
137 | }, |
138 | { | |
e6e54763 | 139 | "client_flood_max_lines", |
212380e3 | 140 | "Number of lines before a client Excess Flood's", |
0ee3f45c | 141 | INFO_DECIMAL(&ConfigFileEntry.client_flood_max_lines), |
212380e3 | 142 | }, |
e6e54763 SB |
143 | { |
144 | "client_flood_burst_rate", | |
a75bf40d | 145 | "Maximum lines per second during flood grace period", |
0ee3f45c | 146 | INFO_DECIMAL(&ConfigFileEntry.client_flood_burst_rate), |
e6e54763 SB |
147 | }, |
148 | { | |
149 | "client_flood_burst_max", | |
a75bf40d | 150 | "Number of lines to process at once before delaying", |
0ee3f45c | 151 | INFO_DECIMAL(&ConfigFileEntry.client_flood_burst_max), |
e6e54763 SB |
152 | }, |
153 | { | |
154 | "client_flood_message_num", | |
e6e54763 | 155 | "Number of messages to allow per client_flood_message_time outside of burst", |
0ee3f45c | 156 | INFO_DECIMAL(&ConfigFileEntry.client_flood_message_num), |
e6e54763 SB |
157 | }, |
158 | { | |
159 | "client_flood_message_time", | |
e6e54763 | 160 | "Time to allow per client_flood_message_num outside of burst", |
0ee3f45c | 161 | INFO_DECIMAL(&ConfigFileEntry.client_flood_message_time), |
e6e54763 | 162 | }, |
2d656284 | 163 | { |
b3a00991 | 164 | "post_registration_delay", |
2d656284 | 165 | "Time to wait before processing commands from a new client", |
0ee3f45c | 166 | INFO_DECIMAL(&ConfigFileEntry.post_registration_delay), |
2d656284 | 167 | }, |
212380e3 WP |
168 | { |
169 | "connect_timeout", | |
0ee3f45c EK |
170 | "Connect timeout for connections to servers", |
171 | INFO_DECIMAL(&ConfigFileEntry.connect_timeout), | |
212380e3 | 172 | }, |
0ffb8106 | 173 | { |
944b0584 | 174 | "default_ident_timeout", |
0ffb8106 | 175 | "Amount of time the server waits for ident responses from clients", |
0ee3f45c | 176 | INFO_DECIMAL(&ConfigFileEntry.default_ident_timeout), |
0ffb8106 | 177 | }, |
212380e3 WP |
178 | { |
179 | "default_floodcount", | |
212380e3 | 180 | "Startup value of FLOODCOUNT", |
0ee3f45c | 181 | INFO_DECIMAL(&ConfigFileEntry.default_floodcount), |
212380e3 WP |
182 | }, |
183 | { | |
184 | "default_adminstring", | |
212380e3 | 185 | "Default adminstring at startup.", |
0ee3f45c | 186 | INFO_STRING(&ConfigFileEntry.default_adminstring), |
212380e3 WP |
187 | }, |
188 | { | |
189 | "default_operstring", | |
212380e3 | 190 | "Default operstring at startup.", |
0ee3f45c | 191 | INFO_STRING(&ConfigFileEntry.default_operstring), |
212380e3 WP |
192 | }, |
193 | { | |
194 | "servicestring", | |
212380e3 | 195 | "String shown in whois for opered services.", |
0ee3f45c | 196 | INFO_STRING(&ConfigFileEntry.servicestring), |
212380e3 | 197 | }, |
27076304 EK |
198 | { |
199 | "drain_reason", | |
200 | "Message to quit users with if this server is draining.", | |
201 | INFO_STRING(&ConfigFileEntry.drain_reason), | |
202 | }, | |
212380e3 WP |
203 | { |
204 | "disable_auth", | |
0ee3f45c EK |
205 | "Controls whether auth checking is disabled or not", |
206 | INFO_INTBOOL_YN(&ConfigFileEntry.disable_auth), | |
212380e3 WP |
207 | }, |
208 | { | |
209 | "disable_fake_channels", | |
0ee3f45c EK |
210 | "Controls whether bold etc are disabled for JOIN", |
211 | INFO_INTBOOL_YN(&ConfigFileEntry.disable_fake_channels), | |
212380e3 | 212 | }, |
212380e3 WP |
213 | { |
214 | "dots_in_ident", | |
0ee3f45c EK |
215 | "Number of permissible dots in an ident", |
216 | INFO_DECIMAL(&ConfigFileEntry.dots_in_ident), | |
212380e3 WP |
217 | }, |
218 | { | |
219 | "failed_oper_notice", | |
0ee3f45c EK |
220 | "Inform opers if someone /oper's with the wrong password", |
221 | INFO_INTBOOL(&ConfigFileEntry.failed_oper_notice), | |
212380e3 WP |
222 | }, |
223 | { | |
224 | "fname_userlog", | |
0ee3f45c EK |
225 | "User log file", |
226 | INFO_STRING(&ConfigFileEntry.fname_userlog), | |
212380e3 WP |
227 | }, |
228 | { | |
229 | "fname_fuserlog", | |
0ee3f45c EK |
230 | "Failed user log file", |
231 | INFO_STRING(&ConfigFileEntry.fname_fuserlog), | |
212380e3 WP |
232 | }, |
233 | ||
234 | { | |
235 | "fname_operlog", | |
0ee3f45c EK |
236 | "Operator log file", |
237 | INFO_STRING(&ConfigFileEntry.fname_operlog), | |
212380e3 WP |
238 | }, |
239 | { | |
240 | "fname_foperlog", | |
0ee3f45c EK |
241 | "Failed operator log file", |
242 | INFO_STRING(&ConfigFileEntry.fname_foperlog), | |
212380e3 WP |
243 | }, |
244 | { | |
245 | "fname_serverlog", | |
0ee3f45c EK |
246 | "Server connect/disconnect log file", |
247 | INFO_STRING(&ConfigFileEntry.fname_serverlog), | |
212380e3 | 248 | }, |
00533129 KB |
249 | { |
250 | "fname_killlog", | |
0ee3f45c EK |
251 | "KILL log file", |
252 | INFO_STRING(&ConfigFileEntry.fname_killlog), | |
00533129 | 253 | }, |
212380e3 WP |
254 | { |
255 | "fname_klinelog", | |
0ee3f45c EK |
256 | "KLINE etc log file", |
257 | INFO_STRING(&ConfigFileEntry.fname_klinelog), | |
212380e3 | 258 | }, |
212380e3 WP |
259 | { |
260 | "fname_operspylog", | |
0ee3f45c EK |
261 | "Oper spy log file", |
262 | INFO_STRING(&ConfigFileEntry.fname_operspylog), | |
212380e3 WP |
263 | }, |
264 | { | |
265 | "fname_ioerrorlog", | |
0ee3f45c EK |
266 | "IO error log file", |
267 | INFO_STRING(&ConfigFileEntry.fname_ioerrorlog), | |
212380e3 | 268 | }, |
212380e3 WP |
269 | { |
270 | "global_snotices", | |
0ee3f45c EK |
271 | "Send out certain server notices globally", |
272 | INFO_INTBOOL_YN(&ConfigFileEntry.global_snotices), | |
212380e3 WP |
273 | }, |
274 | { | |
275 | "hide_error_messages", | |
0ee3f45c EK |
276 | "Hide ERROR messages coming from servers", |
277 | INFO_YESNOMASK(&ConfigFileEntry.hide_error_messages), | |
212380e3 WP |
278 | }, |
279 | { | |
280 | "hide_spoof_ips", | |
0ee3f45c EK |
281 | "Hide IPs of spoofed users", |
282 | INFO_INTBOOL_YN(&ConfigFileEntry.hide_spoof_ips), | |
212380e3 | 283 | }, |
212380e3 WP |
284 | { |
285 | "kline_reason", | |
0ee3f45c EK |
286 | "K-lined clients sign off with this reason", |
287 | INFO_STRING(&ConfigFileEntry.kline_reason), | |
212380e3 WP |
288 | }, |
289 | { | |
290 | "dline_with_reason", | |
0ee3f45c EK |
291 | "Display D-line reason to client on disconnect", |
292 | INFO_INTBOOL_YN(&ConfigFileEntry.dline_with_reason), | |
212380e3 WP |
293 | }, |
294 | { | |
295 | "kline_with_reason", | |
0ee3f45c EK |
296 | "Display K-line reason to client on disconnect", |
297 | INFO_INTBOOL_YN(&ConfigFileEntry.kline_with_reason), | |
212380e3 | 298 | }, |
27076304 EK |
299 | { |
300 | "hide_tkdline_duration", | |
301 | "Hide \"Temporary K-line 123 min.\" from user K/D-lline reasons", | |
302 | INFO_INTBOOL_YN(&ConfigFileEntry.hide_tkdline_duration), | |
303 | }, | |
212380e3 WP |
304 | { |
305 | "max_accept", | |
212380e3 | 306 | "Maximum nicknames on accept list", |
0ee3f45c | 307 | INFO_DECIMAL(&ConfigFileEntry.max_accept), |
212380e3 WP |
308 | }, |
309 | { | |
310 | "max_nick_changes", | |
0ee3f45c EK |
311 | "NICK change threshold setting", |
312 | INFO_DECIMAL(&ConfigFileEntry.max_nick_changes), | |
212380e3 WP |
313 | }, |
314 | { | |
315 | "max_nick_time", | |
0ee3f45c EK |
316 | "NICK flood protection time interval", |
317 | INFO_DECIMAL(&ConfigFileEntry.max_nick_time), | |
212380e3 WP |
318 | }, |
319 | { | |
320 | "max_targets", | |
0ee3f45c EK |
321 | "The maximum number of PRIVMSG/NOTICE targets", |
322 | INFO_DECIMAL(&ConfigFileEntry.max_targets), | |
212380e3 WP |
323 | }, |
324 | { | |
325 | "min_nonwildcard", | |
aae358c0 | 326 | "Minimum non-wildcard chars in K lines", |
0ee3f45c | 327 | INFO_DECIMAL(&ConfigFileEntry.min_nonwildcard), |
212380e3 WP |
328 | }, |
329 | { | |
330 | "min_nonwildcard_simple", | |
212380e3 | 331 | "Minimum non-wildcard chars in xlines/resvs", |
0ee3f45c | 332 | INFO_DECIMAL(&ConfigFileEntry.min_nonwildcard_simple), |
212380e3 WP |
333 | }, |
334 | { | |
335 | "network_name", | |
0ee3f45c EK |
336 | "Network name", |
337 | INFO_STRING(&ServerInfo.network_name), | |
212380e3 | 338 | }, |
212380e3 WP |
339 | { |
340 | "nick_delay", | |
212380e3 | 341 | "Delay nicks are locked for on split", |
0ee3f45c | 342 | INFO_DECIMAL(&ConfigFileEntry.nick_delay), |
212380e3 WP |
343 | }, |
344 | { | |
345 | "no_oper_flood", | |
212380e3 | 346 | "Disable flood control for operators", |
0ee3f45c | 347 | INFO_INTBOOL(&ConfigFileEntry.no_oper_flood), |
212380e3 WP |
348 | }, |
349 | { | |
350 | "non_redundant_klines", | |
0ee3f45c EK |
351 | "Check for and disallow redundant K-lines", |
352 | INFO_INTBOOL(&ConfigFileEntry.non_redundant_klines), | |
212380e3 WP |
353 | }, |
354 | { | |
355 | "operspy_admin_only", | |
0ee3f45c EK |
356 | "Send +Z operspy notices to admins only", |
357 | INFO_INTBOOL(&ConfigFileEntry.operspy_admin_only), | |
212380e3 WP |
358 | }, |
359 | { | |
360 | "operspy_dont_care_user_info", | |
0ee3f45c EK |
361 | "Remove accountability and some '!' requirement from non-channel operspy", |
362 | INFO_INTBOOL(&ConfigFileEntry.operspy_dont_care_user_info), | |
212380e3 WP |
363 | }, |
364 | { | |
365 | "pace_wait", | |
0ee3f45c EK |
366 | "Minimum delay between uses of certain commands", |
367 | INFO_DECIMAL(&ConfigFileEntry.pace_wait), | |
212380e3 WP |
368 | }, |
369 | { | |
370 | "pace_wait_simple", | |
0ee3f45c EK |
371 | "Minimum delay between less intensive commands", |
372 | INFO_DECIMAL(&ConfigFileEntry.pace_wait_simple), | |
212380e3 WP |
373 | }, |
374 | { | |
375 | "ping_cookie", | |
212380e3 | 376 | "Require ping cookies to connect", |
0ee3f45c | 377 | INFO_INTBOOL(&ConfigFileEntry.ping_cookie), |
212380e3 WP |
378 | }, |
379 | { | |
380 | "reject_after_count", | |
212380e3 | 381 | "Client rejection threshold setting", |
0ee3f45c | 382 | INFO_DECIMAL(&ConfigFileEntry.reject_after_count), |
212380e3 WP |
383 | }, |
384 | { | |
385 | "reject_ban_time", | |
212380e3 | 386 | "Client rejection time interval", |
0ee3f45c | 387 | INFO_DECIMAL(&ConfigFileEntry.reject_ban_time), |
212380e3 WP |
388 | }, |
389 | { | |
390 | "reject_duration", | |
212380e3 | 391 | "Client rejection cache duration", |
0ee3f45c | 392 | INFO_DECIMAL(&ConfigFileEntry.reject_duration), |
212380e3 WP |
393 | }, |
394 | { | |
395 | "short_motd", | |
0ee3f45c EK |
396 | "Do not show MOTD; only tell clients they should read it", |
397 | INFO_INTBOOL_YN(&ConfigFileEntry.short_motd), | |
212380e3 WP |
398 | }, |
399 | { | |
400 | "stats_e_disabled", | |
212380e3 | 401 | "STATS e output is disabled", |
0ee3f45c | 402 | INFO_INTBOOL_YN(&ConfigFileEntry.stats_e_disabled), |
212380e3 WP |
403 | }, |
404 | { | |
405 | "stats_c_oper_only", | |
212380e3 | 406 | "STATS C output is only shown to operators", |
0ee3f45c | 407 | INFO_INTBOOL_YN(&ConfigFileEntry.stats_c_oper_only), |
212380e3 | 408 | }, |
212380e3 WP |
409 | { |
410 | "stats_i_oper_only", | |
212380e3 | 411 | "STATS I output is only shown to operators", |
0ee3f45c | 412 | INFO_YESNOMASK(&ConfigFileEntry.stats_i_oper_only), |
212380e3 WP |
413 | }, |
414 | { | |
415 | "stats_k_oper_only", | |
212380e3 | 416 | "STATS K output is only shown to operators", |
0ee3f45c | 417 | INFO_YESNOMASK(&ConfigFileEntry.stats_k_oper_only), |
212380e3 | 418 | }, |
27076304 EK |
419 | { |
420 | "stats_l_oper_only", | |
421 | "STATS l/L output is only shown to operators", | |
422 | INFO_STATSL(&ConfigFileEntry.stats_l_oper_only), | |
423 | }, | |
212380e3 WP |
424 | { |
425 | "stats_o_oper_only", | |
212380e3 | 426 | "STATS O output is only shown to operators", |
0ee3f45c | 427 | INFO_INTBOOL_YN(&ConfigFileEntry.stats_o_oper_only), |
212380e3 WP |
428 | }, |
429 | { | |
430 | "stats_P_oper_only", | |
212380e3 | 431 | "STATS P is only shown to operators", |
0ee3f45c | 432 | INFO_INTBOOL_YN(&ConfigFileEntry.stats_P_oper_only), |
212380e3 WP |
433 | }, |
434 | { | |
435 | "stats_y_oper_only", | |
212380e3 | 436 | "STATS Y is only shown to operators", |
0ee3f45c | 437 | INFO_INTBOOL_YN(&ConfigFileEntry.stats_y_oper_only), |
212380e3 | 438 | }, |
43946961 JT |
439 | { |
440 | "throttle_count", | |
43946961 | 441 | "Connection throttle threshold", |
0ee3f45c | 442 | INFO_DECIMAL(&ConfigFileEntry.throttle_count), |
43946961 JT |
443 | }, |
444 | { | |
445 | "throttle_duration", | |
43946961 | 446 | "Connection throttle duration", |
0ee3f45c | 447 | INFO_DECIMAL(&ConfigFileEntry.throttle_duration), |
43946961 | 448 | }, |
212380e3 WP |
449 | { |
450 | "tkline_expire_notices", | |
0ee3f45c EK |
451 | "Notices given to opers when tklines expire", |
452 | INFO_INTBOOL(&ConfigFileEntry.tkline_expire_notices), | |
212380e3 WP |
453 | }, |
454 | { | |
455 | "ts_max_delta", | |
0ee3f45c EK |
456 | "Maximum permitted TS delta from another server", |
457 | INFO_DECIMAL(&ConfigFileEntry.ts_max_delta), | |
212380e3 WP |
458 | }, |
459 | { | |
460 | "ts_warn_delta", | |
0ee3f45c EK |
461 | "Maximum permitted TS delta before displaying a warning", |
462 | INFO_DECIMAL(&ConfigFileEntry.ts_warn_delta), | |
212380e3 WP |
463 | }, |
464 | { | |
465 | "warn_no_nline", | |
0ee3f45c EK |
466 | "Display warning if connecting server lacks connect block", |
467 | INFO_INTBOOL(&ConfigFileEntry.warn_no_nline), | |
212380e3 | 468 | }, |
1702b694 JT |
469 | { |
470 | "use_propagated_bans", | |
0ee3f45c EK |
471 | "KLINE sets fully propagated bans", |
472 | INFO_INTBOOL(&ConfigFileEntry.use_propagated_bans), | |
1702b694 | 473 | }, |
e88a1f1b KB |
474 | { |
475 | "max_ratelimit_tokens", | |
e88a1f1b | 476 | "The maximum number of tokens that can be accumulated for executing rate-limited commands", |
0ee3f45c | 477 | INFO_DECIMAL(&ConfigFileEntry.max_ratelimit_tokens), |
e88a1f1b | 478 | }, |
d42e6915 JT |
479 | { |
480 | "away_interval", | |
d42e6915 | 481 | "The minimum time between aways", |
0ee3f45c | 482 | INFO_DECIMAL(&ConfigFileEntry.away_interval), |
d42e6915 | 483 | }, |
fff4f763 EK |
484 | { |
485 | "tls_ciphers_oper_only", | |
fff4f763 | 486 | "TLS cipher strings are hidden in whois for non-opers", |
0ee3f45c | 487 | INFO_INTBOOL_YN(&ConfigFileEntry.tls_ciphers_oper_only), |
fff4f763 | 488 | }, |
212380e3 WP |
489 | { |
490 | "default_split_server_count", | |
212380e3 | 491 | "Startup value of SPLITNUM", |
0ee3f45c | 492 | INFO_DECIMAL(&ConfigChannel.default_split_server_count), |
212380e3 WP |
493 | }, |
494 | { | |
495 | "default_split_user_count", | |
212380e3 | 496 | "Startup value of SPLITUSERS", |
0ee3f45c | 497 | INFO_DECIMAL(&ConfigChannel.default_split_user_count), |
212380e3 WP |
498 | }, |
499 | { | |
500 | "knock_delay", | |
0ee3f45c EK |
501 | "Delay between a users KNOCK attempts", |
502 | INFO_DECIMAL(&ConfigChannel.knock_delay), | |
212380e3 WP |
503 | }, |
504 | { | |
505 | "knock_delay_channel", | |
212380e3 | 506 | "Delay between KNOCK attempts to a channel", |
0ee3f45c | 507 | INFO_DECIMAL(&ConfigChannel.knock_delay_channel), |
212380e3 | 508 | }, |
212380e3 WP |
509 | { |
510 | "kick_on_split_riding", | |
0ee3f45c EK |
511 | "Kick users riding splits to join +i or +k channels", |
512 | INFO_INTBOOL_YN(&ConfigChannel.kick_on_split_riding), | |
212380e3 | 513 | }, |
341f971e SB |
514 | { |
515 | "disable_local_channels", | |
0ee3f45c EK |
516 | "Disable local channels (&channels)", |
517 | INFO_INTBOOL_YN(&ConfigChannel.disable_local_channels), | |
341f971e | 518 | }, |
212380e3 WP |
519 | { |
520 | "max_bans", | |
212380e3 | 521 | "Total +b/e/I/q modes allowed in a channel", |
0ee3f45c | 522 | INFO_DECIMAL(&ConfigChannel.max_bans), |
212380e3 WP |
523 | }, |
524 | { | |
525 | "max_bans_large", | |
212380e3 | 526 | "Total +b/e/I/q modes allowed in a +L channel", |
0ee3f45c | 527 | INFO_DECIMAL(&ConfigChannel.max_bans_large), |
212380e3 WP |
528 | }, |
529 | { | |
530 | "max_chans_per_user", | |
212380e3 | 531 | "Maximum number of channels a user can join", |
0ee3f45c | 532 | INFO_DECIMAL(&ConfigChannel.max_chans_per_user), |
212380e3 | 533 | }, |
a4721f5e WP |
534 | { |
535 | "max_chans_per_user_large", | |
a4721f5e | 536 | "Maximum extended number of channels a user can join", |
0ee3f45c | 537 | INFO_DECIMAL(&ConfigChannel.max_chans_per_user_large), |
a4721f5e | 538 | }, |
212380e3 WP |
539 | { |
540 | "no_create_on_split", | |
212380e3 | 541 | "Disallow creation of channels when split", |
0ee3f45c | 542 | INFO_INTBOOL_YN(&ConfigChannel.no_create_on_split), |
212380e3 WP |
543 | }, |
544 | { | |
545 | "no_join_on_split", | |
212380e3 | 546 | "Disallow joining channels when split", |
0ee3f45c | 547 | INFO_INTBOOL_YN(&ConfigChannel.no_join_on_split), |
212380e3 | 548 | }, |
6865c0b0 JT |
549 | { |
550 | "only_ascii_channels", | |
0ee3f45c EK |
551 | "Controls whether non-ASCII is disabled for JOIN", |
552 | INFO_INTBOOL_YN(&ConfigChannel.only_ascii_channels), | |
6865c0b0 | 553 | }, |
212380e3 WP |
554 | { |
555 | "use_except", | |
212380e3 | 556 | "Enable chanmode +e (ban exceptions)", |
0ee3f45c | 557 | INFO_INTBOOL_YN(&ConfigChannel.use_except), |
212380e3 WP |
558 | }, |
559 | { | |
560 | "use_invex", | |
212380e3 | 561 | "Enable chanmode +I (invite exceptions)", |
0ee3f45c | 562 | INFO_INTBOOL_YN(&ConfigChannel.use_invex), |
212380e3 | 563 | }, |
2da6f6eb JT |
564 | { |
565 | "use_forward", | |
2da6f6eb | 566 | "Enable chanmode +f (channel forwarding)", |
0ee3f45c | 567 | INFO_INTBOOL_YN(&ConfigChannel.use_forward), |
2da6f6eb | 568 | }, |
212380e3 WP |
569 | { |
570 | "use_knock", | |
212380e3 | 571 | "Enable /KNOCK", |
0ee3f45c | 572 | INFO_INTBOOL_YN(&ConfigChannel.use_knock), |
212380e3 | 573 | }, |
c2c25552 JT |
574 | { |
575 | "resv_forcepart", | |
0ee3f45c EK |
576 | "Force-part local users on channel RESV", |
577 | INFO_INTBOOL_YN(&ConfigChannel.resv_forcepart), | |
c2c25552 | 578 | }, |
04e5ed6c JK |
579 | { |
580 | "opmod_send_statusmsg", | |
0ee3f45c EK |
581 | "Send messages to @#channel if affected by +z", |
582 | INFO_INTBOOL_YN(&ConfigChannel.opmod_send_statusmsg), | |
04e5ed6c | 583 | }, |
27076304 EK |
584 | { |
585 | "hide_opers", | |
586 | "Hide all opers from unprivileged users", | |
587 | INFO_INTBOOL_YN(&ConfigFileEntry.hide_opers), | |
588 | }, | |
589 | { | |
590 | "hide_opers_in_whois", | |
591 | "Don't send RPL_WHOISOPERATOR to non-opers", | |
592 | INFO_INTBOOL_YN(&ConfigFileEntry.hide_opers_in_whois), | |
593 | }, | |
212380e3 WP |
594 | { |
595 | "disable_hidden", | |
212380e3 | 596 | "Prevent servers from hiding themselves from a flattened /links", |
0ee3f45c | 597 | INFO_INTBOOL_YN(&ConfigServerHide.disable_hidden), |
212380e3 WP |
598 | }, |
599 | { | |
600 | "flatten_links", | |
212380e3 | 601 | "Flatten /links list", |
0ee3f45c | 602 | INFO_INTBOOL_YN(&ConfigServerHide.flatten_links), |
212380e3 WP |
603 | }, |
604 | { | |
605 | "hidden", | |
212380e3 | 606 | "Hide this server from a flattened /links on remote servers", |
0ee3f45c | 607 | INFO_INTBOOL_YN(&ConfigServerHide.hidden), |
212380e3 WP |
608 | }, |
609 | { | |
610 | "links_delay", | |
0ee3f45c EK |
611 | "Links rehash delay", |
612 | INFO_DECIMAL(&ConfigServerHide.links_delay), | |
212380e3 | 613 | }, |
b3701ae2 | 614 | |
0ee3f45c | 615 | { NULL, NULL, 0, { NULL } }, |
212380e3 WP |
616 | }; |
617 | /* *INDENT-ON* */ | |
618 | ||
619 | /* | |
e6e54763 SB |
620 | ** m_info |
621 | ** parv[1] = servername | |
622 | */ | |
3c7d6fcc | 623 | static void |
428ca87b | 624 | m_info(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) |
212380e3 WP |
625 | { |
626 | static time_t last_used = 0L; | |
627 | ||
e3354945 | 628 | if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) |
212380e3 WP |
629 | { |
630 | /* safe enough to give this on a local connect only */ | |
631 | sendto_one(source_p, form_str(RPL_LOAD2HI), | |
e6e54763 | 632 | me.name, source_p->name, "INFO"); |
212380e3 | 633 | sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO)); |
3c7d6fcc | 634 | return; |
212380e3 WP |
635 | } |
636 | else | |
e3354945 | 637 | last_used = rb_current_time(); |
212380e3 WP |
638 | |
639 | if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) != HUNTED_ISME) | |
3c7d6fcc | 640 | return; |
212380e3 WP |
641 | |
642 | info_spy(source_p); | |
643 | ||
644 | send_info_text(source_p); | |
645 | send_birthdate_online_time(source_p); | |
646 | ||
647 | sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO)); | |
212380e3 WP |
648 | } |
649 | ||
650 | /* | |
e6e54763 SB |
651 | ** mo_info |
652 | ** parv[1] = servername | |
653 | */ | |
3c7d6fcc | 654 | static void |
428ca87b | 655 | mo_info(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) |
212380e3 WP |
656 | { |
657 | if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) == HUNTED_ISME) | |
658 | { | |
659 | info_spy(source_p); | |
212380e3 WP |
660 | send_info_text(source_p); |
661 | ||
d4f7eb4c | 662 | if(IsOperGeneral(source_p)) |
8ee12f0c | 663 | { |
212380e3 | 664 | send_conf_options(source_p); |
8ee12f0c JT |
665 | sendto_one_numeric(source_p, RPL_INFO, ":%s", |
666 | rb_lib_version()); | |
667 | } | |
212380e3 WP |
668 | |
669 | send_birthdate_online_time(source_p); | |
670 | ||
671 | sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO)); | |
672 | } | |
212380e3 WP |
673 | } |
674 | ||
675 | /* | |
676 | * send_info_text | |
677 | * | |
678 | * inputs - client pointer to send info text to | |
679 | * output - none | |
680 | * side effects - info text is sent to client | |
681 | */ | |
682 | static void | |
683 | send_info_text(struct Client *source_p) | |
684 | { | |
685 | const char **text = infotext; | |
686 | ||
687 | while (*text) | |
688 | { | |
689 | sendto_one_numeric(source_p, RPL_INFO, form_str(RPL_INFO), *text++); | |
690 | } | |
691 | ||
692 | sendto_one_numeric(source_p, RPL_INFO, form_str(RPL_INFO), ""); | |
693 | } | |
694 | ||
695 | /* | |
696 | * send_birthdate_online_time | |
697 | * | |
698 | * inputs - client pointer to send to | |
699 | * output - none | |
700 | * side effects - birthdate and online time are sent | |
701 | */ | |
702 | static void | |
703 | send_birthdate_online_time(struct Client *source_p) | |
704 | { | |
08d75d97 | 705 | char tbuf[26]; /* this needs to be 26 - see ctime_r manpage */ |
212380e3 | 706 | sendto_one(source_p, ":%s %d %s :Birth Date: %s, compile # %s", |
55abcbb2 | 707 | get_id(&me, source_p), RPL_INFO, |
e6e54763 | 708 | get_id(source_p, source_p), creation, generation); |
212380e3 WP |
709 | |
710 | sendto_one(source_p, ":%s %d %s :On-line since %s", | |
55abcbb2 | 711 | get_id(&me, source_p), RPL_INFO, |
e6e54763 | 712 | get_id(source_p, source_p), rb_ctime(startup_time, tbuf, sizeof(tbuf))); |
212380e3 WP |
713 | } |
714 | ||
715 | /* | |
716 | * send_conf_options | |
717 | * | |
718 | * inputs - client pointer to send to | |
719 | * output - none | |
720 | * side effects - send config options to client | |
721 | */ | |
722 | static void | |
723 | send_conf_options(struct Client *source_p) | |
724 | { | |
725 | Info *infoptr; | |
726 | int i = 0; | |
727 | ||
728 | /* | |
729 | * Now send them a list of all our configuration options | |
9b8e9eb3 | 730 | * (mostly from defaults.h) |
212380e3 WP |
731 | */ |
732 | for (infoptr = MyInformation; infoptr->name; infoptr++) | |
733 | { | |
734 | if(infoptr->intvalue) | |
735 | { | |
cf3b1525 | 736 | sendto_one(source_p, ":%s %d %s :%-30s %-16d [%s]", |
e6e54763 SB |
737 | get_id(&me, source_p), RPL_INFO, |
738 | get_id(source_p, source_p), | |
55abcbb2 | 739 | infoptr->name, infoptr->intvalue, |
e6e54763 | 740 | infoptr->desc); |
212380e3 WP |
741 | } |
742 | else | |
743 | { | |
cf3b1525 | 744 | sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]", |
e6e54763 SB |
745 | get_id(&me, source_p), RPL_INFO, |
746 | get_id(source_p, source_p), | |
55abcbb2 | 747 | infoptr->name, infoptr->strvalue, |
e6e54763 | 748 | infoptr->desc); |
212380e3 WP |
749 | } |
750 | } | |
751 | ||
752 | /* | |
753 | * Parse the info_table[] and do the magic. | |
754 | */ | |
755 | for (i = 0; info_table[i].name; i++) | |
756 | { | |
dce5f18f | 757 | static char opt_buf[BUFSIZE]; |
78744107 | 758 | const char *opt_value = opt_buf; |
dce5f18f EK |
759 | |
760 | ||
212380e3 WP |
761 | switch (info_table[i].output_type) |
762 | { | |
0ee3f45c EK |
763 | case OUTPUT_STRING: |
764 | { | |
78744107 | 765 | const char *option = *info_table[i].option.string_p; |
dce5f18f | 766 | opt_value = option != NULL ? option : "NONE"; |
0ee3f45c EK |
767 | break; |
768 | } | |
769 | case OUTPUT_STRING_PTR: | |
770 | { | |
78744107 | 771 | const char *option = info_table[i].option.string; |
dce5f18f | 772 | opt_value = option != NULL ? option : "NONE"; |
0ee3f45c EK |
773 | break; |
774 | } | |
775 | case OUTPUT_DECIMAL: | |
776 | { | |
777 | int option = *info_table[i].option.int_; | |
dce5f18f | 778 | snprintf(opt_buf, sizeof opt_buf, "%d", option); |
0ee3f45c EK |
779 | break; |
780 | } | |
781 | case OUTPUT_BOOLEAN: | |
782 | { | |
783 | bool option = *info_table[i].option.bool_; | |
dce5f18f | 784 | opt_value = option ? "ON" : "OFF"; |
0ee3f45c EK |
785 | break; |
786 | } | |
787 | case OUTPUT_BOOLEAN_YN: | |
788 | { | |
789 | bool option = *info_table[i].option.bool_; | |
dce5f18f | 790 | opt_value = option ? "YES" : "NO"; |
0ee3f45c EK |
791 | break; |
792 | } | |
793 | case OUTPUT_YESNOMASK: | |
794 | { | |
795 | int option = *info_table[i].option.int_; | |
dce5f18f EK |
796 | opt_value = option == 0 ? "NO" : |
797 | option == 1 ? "MASK" : | |
798 | "YES"; | |
799 | break; | |
0ee3f45c EK |
800 | } |
801 | case OUTPUT_INTBOOL: | |
802 | { | |
803 | bool option = *info_table[i].option.int_; | |
dce5f18f | 804 | opt_value = option ? "ON" : "OFF"; |
0ee3f45c EK |
805 | break; |
806 | } | |
807 | case OUTPUT_INTBOOL_YN: | |
808 | { | |
809 | bool option = *info_table[i].option.int_; | |
dce5f18f | 810 | opt_value = option ? "YES" : "NO"; |
0ee3f45c EK |
811 | break; |
812 | } | |
27076304 EK |
813 | case OUTPUT_STATSL: |
814 | { | |
815 | enum stats_l_oper_only option = *info_table[i].option.statsl; | |
816 | opt_value = option == STATS_L_OPER_ONLY_NO ? "NO" : | |
817 | option == STATS_L_OPER_ONLY_SELF ? "SELF" : | |
818 | "YES"; | |
819 | break; | |
820 | } | |
212380e3 | 821 | } |
dce5f18f EK |
822 | |
823 | sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]", | |
824 | get_id(&me, source_p), RPL_INFO, | |
825 | get_id(source_p, source_p), | |
826 | info_table[i].name, | |
827 | opt_value, | |
828 | info_table[i].desc ? info_table[i].desc : "<none>"); | |
b3701ae2 | 829 | } |
212380e3 WP |
830 | |
831 | ||
832 | /* Don't send oper_only_umodes...it's a bit mask, we will have to decode it | |
833 | ** in order for it to show up properly to opers who issue INFO | |
834 | */ | |
835 | ||
836 | sendto_one_numeric(source_p, RPL_INFO, form_str(RPL_INFO), ""); | |
837 | } | |
838 | ||
839 | /* info_spy() | |
55abcbb2 | 840 | * |
212380e3 WP |
841 | * input - pointer to client |
842 | * output - none | |
843 | * side effects - hook doing_info is called | |
844 | */ | |
845 | static void | |
846 | info_spy(struct Client *source_p) | |
847 | { | |
848 | hook_data hd; | |
849 | ||
850 | hd.client = source_p; | |
851 | hd.arg1 = hd.arg2 = NULL; | |
852 | ||
853 | call_hook(doing_info_hook, &hd); | |
854 | } |