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-2014 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 |
17 |
|
* along with this program; if not, write to the Free Software |
18 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
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_misc.h" |
33 |
|
#include "s_serv.h" |
33 |
– |
#include "s_user.h" |
34 |
|
#include "send.h" |
35 |
|
#include "conf.h" |
36 |
|
#include "parse.h" |
61 |
|
/* --[ START OF TABLE ]-------------------------------------------- */ |
62 |
|
|
63 |
|
{ |
64 |
– |
"CPATH", |
65 |
– |
OUTPUT_STRING, |
66 |
– |
&ConfigFileEntry.configfile, |
67 |
– |
"Path to main configuration file" |
68 |
– |
}, |
69 |
– |
{ |
64 |
|
"DPATH", |
65 |
|
OUTPUT_STRING, |
66 |
|
&ConfigFileEntry.dpath, |
67 |
|
"Root directory of installation" |
68 |
|
}, |
69 |
|
{ |
70 |
+ |
"CPATH", |
71 |
+ |
OUTPUT_STRING, |
72 |
+ |
&ConfigFileEntry.configfile, |
73 |
+ |
"Path to main configuration file" |
74 |
+ |
}, |
75 |
+ |
{ |
76 |
|
"DLPATH", |
77 |
|
OUTPUT_STRING, |
78 |
|
&ConfigFileEntry.dlinefile, |
175 |
|
"Maximum number of channels an oper can join" |
176 |
|
}, |
177 |
|
{ |
178 |
– |
"quiet_on_ban", |
179 |
– |
OUTPUT_BOOLEAN_YN, |
180 |
– |
&ConfigChannel.quiet_on_ban, |
181 |
– |
"Banned users may not send text to a channel" |
182 |
– |
}, |
183 |
– |
{ |
178 |
|
"max_bans", |
179 |
|
OUTPUT_DECIMAL, |
180 |
|
&ConfigChannel.max_bans, |
244 |
|
"hide_server_ips", |
245 |
|
OUTPUT_BOOLEAN_YN, |
246 |
|
&ConfigServerHide.hide_server_ips, |
247 |
< |
"Prevent people from seeing server IPs" |
247 |
> |
"Prevent people from seeing server IP addresses" |
248 |
|
}, |
249 |
|
{ |
250 |
|
"gline_min_cidr", |
274 |
|
"hide_spoof_ips", |
275 |
|
OUTPUT_BOOLEAN_YN, |
276 |
|
&ConfigFileEntry.hide_spoof_ips, |
277 |
< |
"Hide spoofed IP's" |
277 |
> |
"Hide spoofed IP addresses" |
278 |
|
}, |
279 |
|
{ |
280 |
|
"ignore_bogus_ts", |
283 |
|
"Ignore bogus timestamps from other servers" |
284 |
|
}, |
285 |
|
{ |
286 |
+ |
"cycle_on_host_change", |
287 |
+ |
OUTPUT_BOOLEAN_YN, |
288 |
+ |
&ConfigFileEntry.cycle_on_host_change, |
289 |
+ |
"Send a fake QUIT/JOIN combination on host change" |
290 |
+ |
}, |
291 |
+ |
{ |
292 |
|
"disable_auth", |
293 |
|
OUTPUT_BOOLEAN_YN, |
294 |
|
&ConfigFileEntry.disable_auth, |
297 |
|
{ |
298 |
|
"disable_remote_commands", |
299 |
|
OUTPUT_BOOLEAN_YN, |
300 |
< |
&ConfigFileEntry.disable_remote, |
300 |
> |
&ConfigServerHide.disable_remote_commands, |
301 |
|
"Prevent users issuing commands on remote servers" |
302 |
|
}, |
303 |
|
{ |
403 |
|
"STATS P is only shown to operators" |
404 |
|
}, |
405 |
|
{ |
406 |
+ |
"stats_u_oper_only", |
407 |
+ |
OUTPUT_BOOLEAN_YN, |
408 |
+ |
&ConfigFileEntry.stats_u_oper_only, |
409 |
+ |
"STATS u is only shown to operators" |
410 |
+ |
}, |
411 |
+ |
{ |
412 |
|
"stats_i_oper_only", |
413 |
|
OUTPUT_BOOLEAN2, |
414 |
|
&ConfigFileEntry.stats_i_oper_only, |
523 |
|
static void |
524 |
|
send_birthdate_online_time(struct Client *source_p) |
525 |
|
{ |
526 |
< |
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p)) |
527 |
< |
sendto_one(source_p, ":%s %d %s :On-line since %s", |
528 |
< |
me.id, RPL_INFO, source_p->id, |
529 |
< |
myctime(me.localClient->firsttime)); |
524 |
< |
else |
525 |
< |
sendto_one(source_p, ":%s %d %s :On-line since %s", |
526 |
< |
me.name, RPL_INFO, source_p->name, |
527 |
< |
myctime(me.localClient->firsttime)); |
526 |
> |
sendto_one(source_p, ":%s %d %s :On-line since %s", |
527 |
> |
ID_or_name(&me, source_p), RPL_INFO, |
528 |
> |
ID_or_name(source_p, source_p), |
529 |
> |
myctime(me.localClient->firsttime)); |
530 |
|
} |
531 |
|
|
532 |
|
/* send_conf_options() |
538 |
|
static void |
539 |
|
send_conf_options(struct Client *source_p) |
540 |
|
{ |
539 |
– |
const char *from, *to; |
541 |
|
const struct InfoStruct *iptr = NULL; |
542 |
|
|
542 |
– |
/* Now send them a list of all our configuration options |
543 |
– |
* (mostly from defaults.h and config.h) |
544 |
– |
*/ |
545 |
– |
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p)) |
546 |
– |
{ |
547 |
– |
from = me.id; |
548 |
– |
to = source_p->id; |
549 |
– |
} |
550 |
– |
else |
551 |
– |
{ |
552 |
– |
from = me.name; |
553 |
– |
to = source_p->name; |
554 |
– |
} |
555 |
– |
|
543 |
|
/* |
544 |
|
* Parse the info_table[] and do the magic. |
545 |
|
*/ |
553 |
|
const char *option = *((char **)iptr->option); |
554 |
|
|
555 |
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
556 |
< |
from, RPL_INFO, to, |
556 |
> |
ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p), |
557 |
|
iptr->name, option ? option : "NONE", |
558 |
|
iptr->desc ? iptr->desc : "<none>"); |
559 |
|
break; |
565 |
|
const char *option = iptr->option; |
566 |
|
|
567 |
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
568 |
< |
from, RPL_INFO, to, |
568 |
> |
ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p), |
569 |
|
iptr->name, option ? option : "NONE", |
570 |
|
iptr->desc ? iptr->desc : "<none>"); |
571 |
|
break; |
577 |
|
const int option = *((int *)iptr->option); |
578 |
|
|
579 |
|
sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]", |
580 |
< |
from, RPL_INFO, to, iptr->name, |
581 |
< |
option, iptr->desc ? iptr->desc : "<none>"); |
580 |
> |
ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p), |
581 |
> |
iptr->name, option, iptr->desc ? iptr->desc : "<none>"); |
582 |
|
break; |
583 |
|
} |
584 |
|
|
588 |
|
const int option = *((int *)iptr->option); |
589 |
|
|
590 |
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
591 |
< |
from, RPL_INFO, to, |
591 |
> |
ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p), |
592 |
|
iptr->name, option ? "ON" : "OFF", |
593 |
|
iptr->desc ? iptr->desc : "<none>"); |
594 |
|
|
601 |
|
const int option = *((int *)iptr->option); |
602 |
|
|
603 |
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
604 |
< |
from, RPL_INFO, to, |
604 |
> |
ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p), |
605 |
|
iptr->name, option ? "YES" : "NO", |
606 |
|
iptr->desc ? iptr->desc : "<none>"); |
607 |
|
break; |
612 |
|
const int option = *((int *)iptr->option); |
613 |
|
|
614 |
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
615 |
< |
from, RPL_INFO, to, |
615 |
> |
ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p), |
616 |
|
iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO", |
617 |
|
iptr->desc ? iptr->desc : "<none>"); |
618 |
|
break; |
620 |
|
} |
621 |
|
} |
622 |
|
|
623 |
< |
sendto_one(source_p, form_str(RPL_INFO), |
637 |
< |
from, to, ""); |
623 |
> |
sendto_one_numeric(source_p, &me, RPL_INFO, ""); |
624 |
|
} |
625 |
|
|
626 |
|
/* send_info_text() |
633 |
|
send_info_text(struct Client *source_p) |
634 |
|
{ |
635 |
|
const char **text = infotext; |
650 |
– |
char *source, *target; |
636 |
|
|
637 |
|
sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE, |
638 |
|
"INFO requested by %s (%s@%s) [%s]", |
639 |
|
source_p->name, source_p->username, |
640 |
|
source_p->host, source_p->servptr->name); |
641 |
|
|
657 |
– |
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && |
658 |
– |
HasID(source_p)) |
659 |
– |
source = me.id, target = source_p->id; |
660 |
– |
else |
661 |
– |
source = me.name, target = source_p->name; |
662 |
– |
|
642 |
|
while (*text) |
643 |
|
{ |
644 |
|
const char *line = *text++; |
646 |
|
if (*line == '\0') |
647 |
|
line = " "; |
648 |
|
|
649 |
< |
sendto_one(source_p, form_str(RPL_INFO), |
671 |
< |
source, target, line); |
649 |
> |
sendto_one_numeric(source_p, &me, RPL_INFO, line); |
650 |
|
} |
651 |
|
|
652 |
|
if (HasUMode(source_p, UMODE_OPER)) |
654 |
|
|
655 |
|
send_birthdate_online_time(source_p); |
656 |
|
|
657 |
< |
sendto_one(source_p, form_str(RPL_ENDOFINFO), |
680 |
< |
me.name, source_p->name); |
657 |
> |
sendto_one_numeric(source_p, &me, RPL_ENDOFINFO); |
658 |
|
} |
659 |
|
|
660 |
|
/* |
661 |
|
** m_info() |
662 |
< |
** parv[0] = sender prefix |
662 |
> |
** parv[0] = command |
663 |
|
** parv[1] = servername |
664 |
|
*/ |
665 |
< |
static void |
666 |
< |
m_info(struct Client *client_p, struct Client *source_p, |
690 |
< |
int parc, char *parv[]) |
665 |
> |
static int |
666 |
> |
m_info(struct Client *source_p, int parc, char *parv[]) |
667 |
|
{ |
668 |
|
static time_t last_used = 0; |
669 |
|
|
670 |
|
if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime) |
671 |
|
{ |
672 |
|
/* safe enough to give this on a local connect only */ |
673 |
< |
sendto_one(source_p, form_str(RPL_LOAD2HI), |
674 |
< |
me.name, source_p->name); |
699 |
< |
return; |
673 |
> |
sendto_one_numeric(source_p, &me, RPL_LOAD2HI); |
674 |
> |
return 0; |
675 |
|
} |
676 |
|
|
677 |
|
last_used = CurrentTime; |
678 |
|
|
679 |
< |
if (!ConfigFileEntry.disable_remote) |
680 |
< |
if (hunt_server(client_p,source_p, ":%s INFO :%s", 1, |
679 |
> |
if (!ConfigServerHide.disable_remote_commands) |
680 |
> |
if (hunt_server(source_p, ":%s INFO :%s", 1, |
681 |
|
parc, parv) != HUNTED_ISME) |
682 |
< |
return; |
682 |
> |
return 0; |
683 |
|
|
684 |
|
send_info_text(source_p); |
685 |
+ |
return 0; |
686 |
|
} |
687 |
|
|
688 |
|
/* |
689 |
|
** ms_info() |
690 |
< |
** parv[0] = sender prefix |
690 |
> |
** parv[0] = command |
691 |
|
** parv[1] = servername |
692 |
|
*/ |
693 |
< |
static void |
694 |
< |
ms_info(struct Client *client_p, struct Client *source_p, |
719 |
< |
int parc, char *parv[]) |
693 |
> |
static int |
694 |
> |
ms_info(struct Client *source_p, int parc, char *parv[]) |
695 |
|
{ |
696 |
< |
if (!IsClient(source_p)) |
722 |
< |
return; |
723 |
< |
|
724 |
< |
if (hunt_server(client_p, source_p, ":%s INFO :%s", 1, |
696 |
> |
if (hunt_server(source_p, ":%s INFO :%s", 1, |
697 |
|
parc, parv) != HUNTED_ISME) |
698 |
< |
return; |
698 |
> |
return 0; |
699 |
|
|
700 |
|
send_info_text(source_p); |
701 |
+ |
return 0; |
702 |
|
} |
703 |
|
|
704 |
< |
static struct Message info_msgtab = { |
704 |
> |
static struct Message info_msgtab = |
705 |
> |
{ |
706 |
|
"INFO", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
707 |
|
{ m_unregistered, m_info, ms_info, m_ignore, ms_info, m_ignore } |
708 |
|
}; |
719 |
|
mod_del_cmd(&info_msgtab); |
720 |
|
} |
721 |
|
|
722 |
< |
struct module module_entry = { |
722 |
> |
struct module module_entry = |
723 |
> |
{ |
724 |
|
.node = { NULL, NULL, NULL }, |
725 |
|
.name = NULL, |
726 |
|
.version = "$Revision$", |