1 |
adx |
30 |
/* |
2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
|
|
* m_rehash.c: Re-reads the configuration file. |
4 |
|
|
* |
5 |
|
|
* Copyright (C) 2002 by the past and present ircd coders, and others. |
6 |
|
|
* |
7 |
|
|
* This program is free software; you can redistribute it and/or modify |
8 |
|
|
* it under the terms of the GNU General Public License as published by |
9 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
10 |
|
|
* (at your option) any later version. |
11 |
|
|
* |
12 |
|
|
* This program is distributed in the hope that it will be useful, |
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
* GNU General Public License for more details. |
16 |
|
|
* |
17 |
|
|
* You should have received a copy of the GNU General Public License |
18 |
|
|
* along with this program; if not, write to the Free Software |
19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
20 |
|
|
* USA |
21 |
|
|
* |
22 |
knight |
31 |
* $Id$ |
23 |
adx |
30 |
*/ |
24 |
|
|
|
25 |
|
|
#include "stdinc.h" |
26 |
|
|
#include "client.h" |
27 |
|
|
#include "irc_string.h" |
28 |
|
|
#include "ircd.h" |
29 |
|
|
#include "list.h" |
30 |
|
|
#include "numeric.h" |
31 |
|
|
#include "irc_res.h" |
32 |
michael |
1309 |
#include "conf.h" |
33 |
|
|
#include "log.h" |
34 |
adx |
30 |
#include "send.h" |
35 |
|
|
#include "parse.h" |
36 |
|
|
#include "modules.h" |
37 |
|
|
|
38 |
|
|
|
39 |
|
|
/* |
40 |
|
|
* mo_rehash - REHASH message handler |
41 |
|
|
* |
42 |
|
|
*/ |
43 |
|
|
static void |
44 |
|
|
mo_rehash(struct Client *client_p, struct Client *source_p, |
45 |
|
|
int parc, char *parv[]) |
46 |
|
|
{ |
47 |
|
|
int found = 0; |
48 |
|
|
|
49 |
michael |
1219 |
if (!HasOFlag(source_p, OPER_FLAG_REHASH)) |
50 |
adx |
30 |
{ |
51 |
|
|
sendto_one(source_p, form_str(ERR_NOPRIVS), |
52 |
|
|
me.name, source_p->name, "rehash"); |
53 |
|
|
return; |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
if (parc > 1) |
57 |
|
|
{ |
58 |
|
|
if (irccmp(parv[1], "DNS") == 0) |
59 |
|
|
{ |
60 |
michael |
1234 |
sendto_one(source_p, form_str(RPL_REHASHING), me.name, source_p->name, "DNS"); |
61 |
adx |
30 |
sendto_realops_flags(UMODE_ALL, L_ALL, "%s is rehashing DNS", |
62 |
|
|
get_oper_name(source_p)); |
63 |
|
|
restart_resolver(); /* re-read /etc/resolv.conf AGAIN? |
64 |
|
|
and close/re-open res socket */ |
65 |
|
|
found = 1; |
66 |
|
|
} |
67 |
|
|
else if (irccmp(parv[1], "FDLIMIT") == 0) |
68 |
|
|
{ |
69 |
|
|
sendto_one(source_p, form_str(RPL_REHASHING), me.name, |
70 |
michael |
1234 |
source_p->name, "FDLIMIT"); |
71 |
adx |
30 |
sendto_realops_flags(UMODE_ALL, L_ALL, "%s is updating FDLIMIT", |
72 |
|
|
get_oper_name(source_p)); |
73 |
|
|
recalc_fdlimit(NULL); |
74 |
|
|
found = 1; |
75 |
|
|
} |
76 |
michael |
1001 |
else if (irccmp(parv[1], "MOTD") == 0) |
77 |
adx |
30 |
{ |
78 |
|
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
79 |
|
|
"%s is forcing re-reading of MOTD file", |
80 |
|
|
get_oper_name(source_p)); |
81 |
|
|
read_message_file(&ConfigFileEntry.motd); |
82 |
|
|
found = 1; |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
if (found) |
86 |
|
|
{ |
87 |
michael |
1247 |
ilog(LOG_TYPE_IRCD, "REHASH %s From %s", |
88 |
adx |
30 |
parv[1], get_client_name(source_p, HIDE_IP)); |
89 |
|
|
return; |
90 |
|
|
} |
91 |
|
|
else |
92 |
|
|
{ |
93 |
|
|
sendto_one(source_p, ":%s NOTICE %s :rehash one of :DNS FDLIMIT " |
94 |
michael |
1446 |
"MOTD", me.name, source_p->name); |
95 |
adx |
30 |
return; |
96 |
|
|
} |
97 |
|
|
} |
98 |
|
|
else |
99 |
|
|
{ |
100 |
|
|
sendto_one(source_p, form_str(RPL_REHASHING), |
101 |
|
|
me.name, source_p->name, ConfigFileEntry.configfile); |
102 |
|
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
103 |
|
|
"%s is rehashing server config file", |
104 |
|
|
get_oper_name(source_p)); |
105 |
michael |
1247 |
ilog(LOG_TYPE_IRCD, "REHASH From %s[%s]", |
106 |
adx |
30 |
get_oper_name(source_p), source_p->sockhost); |
107 |
|
|
rehash(0); |
108 |
|
|
} |
109 |
|
|
} |
110 |
michael |
1230 |
|
111 |
|
|
static struct Message rehash_msgtab = { |
112 |
|
|
"REHASH", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
113 |
|
|
{m_unregistered, m_not_oper, m_ignore, m_ignore, mo_rehash, m_ignore} |
114 |
|
|
}; |
115 |
|
|
|
116 |
|
|
static void |
117 |
|
|
module_init(void) |
118 |
|
|
{ |
119 |
|
|
mod_add_cmd(&rehash_msgtab); |
120 |
|
|
} |
121 |
|
|
|
122 |
|
|
static void |
123 |
|
|
module_exit(void) |
124 |
|
|
{ |
125 |
|
|
mod_del_cmd(&rehash_msgtab); |
126 |
|
|
} |
127 |
|
|
|
128 |
|
|
struct module module_entry = { |
129 |
|
|
.node = { NULL, NULL, NULL }, |
130 |
|
|
.name = NULL, |
131 |
|
|
.version = "$Revision$", |
132 |
|
|
.handle = NULL, |
133 |
|
|
.modinit = module_init, |
134 |
|
|
.modexit = module_exit, |
135 |
|
|
.flags = 0 |
136 |
|
|
}; |