1 |
|
/* |
2 |
< |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
2 |
> |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
|
* |
4 |
< |
* Copyright (C) 2002 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 |
33 |
|
#include "send.h" |
34 |
|
#include "parse.h" |
35 |
|
#include "modules.h" |
36 |
– |
#include "irc_string.h" |
36 |
|
|
37 |
|
|
38 |
|
|
43 |
|
static void |
44 |
|
do_admin(struct Client *source_p) |
45 |
|
{ |
46 |
< |
const char *me_name = ID_or_name(&me, source_p->from); |
48 |
< |
const char *nick = ID_or_name(source_p, source_p->from); |
49 |
< |
|
50 |
< |
sendto_realops_flags(UMODE_SPY, L_ALL, |
46 |
> |
sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE, |
47 |
|
"ADMIN requested by %s (%s@%s) [%s]", |
48 |
|
source_p->name, source_p->username, |
49 |
|
source_p->host, source_p->servptr->name); |
50 |
|
|
51 |
< |
sendto_one(source_p, form_str(RPL_ADMINME), |
56 |
< |
me_name, nick, me.name); |
51 |
> |
sendto_one_numeric(source_p, &me, RPL_ADMINME, me.name); |
52 |
|
|
53 |
|
if (AdminInfo.name != NULL) |
54 |
< |
sendto_one(source_p, form_str(RPL_ADMINLOC1), |
60 |
< |
me_name, nick, AdminInfo.name); |
54 |
> |
sendto_one_numeric(source_p, &me, RPL_ADMINLOC1, AdminInfo.name); |
55 |
|
if (AdminInfo.description != NULL) |
56 |
< |
sendto_one(source_p, form_str(RPL_ADMINLOC2), |
63 |
< |
me_name, nick, AdminInfo.description); |
56 |
> |
sendto_one_numeric(source_p, &me, RPL_ADMINLOC2, AdminInfo.description); |
57 |
|
if (AdminInfo.email != NULL) |
58 |
< |
sendto_one(source_p, form_str(RPL_ADMINEMAIL), |
66 |
< |
me_name, nick, AdminInfo.email); |
58 |
> |
sendto_one_numeric(source_p, &me, RPL_ADMINEMAIL, AdminInfo.email); |
59 |
|
} |
60 |
|
|
61 |
< |
/*! \brief NICK command handler (called by already registered, |
61 |
> |
/*! \brief ADMIN command handler (called by already registered, |
62 |
|
* locally connected clients) |
63 |
|
* |
72 |
– |
* \param client_p Pointer to allocated Client struct with physical connection |
73 |
– |
* to this server, i.e. with an open socket connected. |
64 |
|
* \param source_p Pointer to allocated Client struct from which the message |
65 |
|
* originally comes from. This can be a local or remote client. |
66 |
|
* \param parc Integer holding the number of supplied arguments. |
67 |
|
* \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL |
68 |
|
* pointers. |
69 |
|
* \note Valid arguments for this command are: |
70 |
< |
* - parv[0] = sender prefix |
70 |
> |
* - parv[0] = command |
71 |
|
* - parv[1] = nickname/servername |
72 |
|
*/ |
73 |
< |
static void |
74 |
< |
m_admin(struct Client *client_p, struct Client *source_p, |
85 |
< |
int parc, char *parv[]) |
73 |
> |
static int |
74 |
> |
m_admin(struct Client *source_p, int parc, char *parv[]) |
75 |
|
{ |
76 |
|
static time_t last_used = 0; |
77 |
|
|
78 |
|
if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime) |
79 |
|
{ |
80 |
< |
sendto_one(source_p,form_str(RPL_LOAD2HI), |
81 |
< |
me.name, source_p->name); |
93 |
< |
return; |
80 |
> |
sendto_one_numeric(source_p, &me, RPL_LOAD2HI); |
81 |
> |
return 0; |
82 |
|
} |
83 |
|
|
84 |
|
last_used = CurrentTime; |
85 |
|
|
86 |
< |
if (!ConfigFileEntry.disable_remote) |
87 |
< |
if (hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, |
86 |
> |
if (!ConfigServerHide.disable_remote_commands) |
87 |
> |
if (hunt_server(source_p, ":%s ADMIN :%s", 1, |
88 |
|
parc, parv) != HUNTED_ISME) |
89 |
< |
return; |
89 |
> |
return 0; |
90 |
|
|
91 |
|
do_admin(source_p); |
92 |
+ |
return 0; |
93 |
|
} |
94 |
|
|
95 |
|
/*! \brief ADMIN command handler (called by operators and |
96 |
|
* remotely connected clients) |
97 |
|
* |
109 |
– |
* \param client_p Pointer to allocated Client struct with physical connection |
110 |
– |
* to this server, i.e. with an open socket connected. |
98 |
|
* \param source_p Pointer to allocated Client struct from which the message |
99 |
|
* originally comes from. This can be a local or remote client. |
100 |
|
* \param parc Integer holding the number of supplied arguments. |
101 |
|
* \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL |
102 |
|
* pointers. |
103 |
|
* \note Valid arguments for this command are: |
104 |
< |
* - parv[0] = sender prefix |
104 |
> |
* - parv[0] = command |
105 |
|
* - parv[1] = nickname/servername |
106 |
|
*/ |
107 |
< |
static void |
108 |
< |
ms_admin(struct Client *client_p, struct Client *source_p, |
122 |
< |
int parc, char *parv[]) |
107 |
> |
static int |
108 |
> |
ms_admin(struct Client *source_p, int parc, char *parv[]) |
109 |
|
{ |
110 |
< |
if (hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, |
110 |
> |
if (hunt_server(source_p, ":%s ADMIN :%s", 1, |
111 |
|
parc, parv) != HUNTED_ISME) |
112 |
< |
return; |
112 |
> |
return 0; |
113 |
|
|
114 |
< |
if (IsClient(source_p)) |
115 |
< |
do_admin(source_p); |
114 |
> |
do_admin(source_p); |
115 |
> |
return 0; |
116 |
|
} |
117 |
|
|
118 |
< |
static struct Message admin_msgtab = { |
118 |
> |
static struct Message admin_msgtab = |
119 |
> |
{ |
120 |
|
"ADMIN", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
121 |
|
{ m_unregistered, m_admin, ms_admin, m_ignore, ms_admin, m_ignore } |
122 |
|
}; |
133 |
|
mod_del_cmd(&admin_msgtab); |
134 |
|
} |
135 |
|
|
136 |
< |
struct module module_entry = { |
136 |
> |
struct module module_entry = |
137 |
> |
{ |
138 |
|
.node = { NULL, NULL, NULL }, |
139 |
|
.name = NULL, |
140 |
|
.version = "$Revision$", |