ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/modules/m_rehash.c
Revision: 69
Committed: Tue Oct 4 16:09:51 2005 UTC (20 years, 10 months ago) by adx
Content type: text/x-csrc
File size: 4080 byte(s)
Log Message:
- splitted ircd/libio, all headers connected with libio sources have been
  moved for internal use only. To use libio interface, include "libio.h"
  (which is already done in "stdinc.h")


File Contents

# User Rev Content
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 "handlers.h"
27     #include "client.h"
28     #include "common.h"
29     #include "ircd.h"
30     #include "numeric.h"
31     #include "s_conf.h"
32     #include "send.h"
33     #include "msg.h"
34     #include "parse.h"
35     #include "modules.h"
36    
37     static void mo_rehash(struct Client *, struct Client *, int, char **);
38    
39     struct Message rehash_msgtab = {
40     "REHASH", 0, 0, 0, 0, MFLG_SLOW, 0,
41     {m_unregistered, m_not_oper, m_ignore, m_ignore, mo_rehash, m_ignore}
42     };
43    
44     #ifndef STATIC_MODULES
45     void
46     _modinit(void)
47     {
48     mod_add_cmd(&rehash_msgtab);
49     }
50    
51     void
52     _moddeinit(void)
53     {
54     mod_del_cmd(&rehash_msgtab);
55     }
56    
57 knight 31 const char *_version = "$Revision$";
58 adx 30 #endif
59    
60     /*
61     * mo_rehash - REHASH message handler
62     *
63     */
64     static void
65     mo_rehash(struct Client *client_p, struct Client *source_p,
66     int parc, char *parv[])
67     {
68     int found = 0;
69    
70     if (!IsOperRehash(source_p))
71     {
72     sendto_one(source_p, form_str(ERR_NOPRIVS),
73     me.name, source_p->name, "rehash");
74     return;
75     }
76    
77     if (parc > 1)
78     {
79     #ifndef _WIN32
80     if (irccmp(parv[1], "DNS") == 0)
81     {
82     sendto_one(source_p, form_str(RPL_REHASHING), me.name, parv[0], "DNS");
83     sendto_realops_flags(UMODE_ALL, L_ALL, "%s is rehashing DNS",
84     get_oper_name(source_p));
85     restart_resolver(); /* re-read /etc/resolv.conf AGAIN?
86     and close/re-open res socket */
87     found = 1;
88     }
89     else if (irccmp(parv[1], "FDLIMIT") == 0)
90     {
91     sendto_one(source_p, form_str(RPL_REHASHING), me.name,
92     parv[0], "FDLIMIT");
93     sendto_realops_flags(UMODE_ALL, L_ALL, "%s is updating FDLIMIT",
94     get_oper_name(source_p));
95     recalc_fdlimit(NULL);
96     found = 1;
97     }
98     else
99     #endif
100     if (irccmp(parv[1], "MOTD") == 0)
101     {
102     sendto_realops_flags(UMODE_ALL, L_ALL,
103     "%s is forcing re-reading of MOTD file",
104     get_oper_name(source_p));
105     read_message_file(&ConfigFileEntry.motd);
106     found = 1;
107     }
108     else if (irccmp(parv[1], "OMOTD") == 0)
109     {
110     sendto_realops_flags(UMODE_ALL, L_ALL,
111     "%s is forcing re-reading of OPER MOTD file",
112     get_oper_name(source_p));
113     read_message_file(&ConfigFileEntry.opermotd);
114     found = 1;
115     }
116    
117     if (found)
118     {
119     ilog(L_NOTICE, "REHASH %s From %s",
120     parv[1], get_client_name(source_p, HIDE_IP));
121     return;
122     }
123     else
124     {
125     #ifdef _WIN32
126     sendto_one(source_p, ":%s NOTICE %s :rehash one of :MOTD OMOTD",
127     me.name, source_p->name);
128     #else
129     sendto_one(source_p, ":%s NOTICE %s :rehash one of :DNS FDLIMIT "
130     "MOTD OMOTD", me.name, source_p->name);
131     #endif
132     return;
133     }
134     }
135     else
136     {
137     sendto_one(source_p, form_str(RPL_REHASHING),
138     me.name, source_p->name, ConfigFileEntry.configfile);
139     sendto_realops_flags(UMODE_ALL, L_ALL,
140     "%s is rehashing server config file",
141     get_oper_name(source_p));
142     ilog(L_NOTICE, "REHASH From %s[%s]",
143     get_oper_name(source_p), source_p->sockhost);
144     rehash(0);
145     }
146     }
147    

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision