1 |
/* |
2 |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
* m_die.c: Kills off this server. |
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 |
* $Id$ |
23 |
*/ |
24 |
|
25 |
#include "stdinc.h" |
26 |
#include "list.h" |
27 |
#include "handlers.h" |
28 |
#include "client.h" |
29 |
#include "ircd.h" |
30 |
#include "irc_string.h" |
31 |
#include "numeric.h" |
32 |
#include "fdlist.h" |
33 |
#include "s_bsd.h" |
34 |
#include "s_log.h" |
35 |
#include "s_conf.h" |
36 |
#include "send.h" |
37 |
#include "msg.h" |
38 |
#include "parse.h" |
39 |
#include "modules.h" |
40 |
#include "restart.h" |
41 |
#include "sprintf_irc.h" |
42 |
|
43 |
|
44 |
static void mo_die(struct Client *, struct Client *, int, char *[]); |
45 |
|
46 |
struct Message die_msgtab = { |
47 |
"DIE", 0, 0, 1, 0, MFLG_SLOW, 0, |
48 |
{m_unregistered, m_not_oper, m_ignore, m_ignore, mo_die, m_ignore} |
49 |
}; |
50 |
|
51 |
#ifndef STATIC_MODULES |
52 |
void |
53 |
_modinit(void) |
54 |
{ |
55 |
mod_add_cmd(&die_msgtab); |
56 |
} |
57 |
|
58 |
void |
59 |
_moddeinit(void) |
60 |
{ |
61 |
mod_del_cmd(&die_msgtab); |
62 |
} |
63 |
|
64 |
const char *_version = "$Revision$"; |
65 |
#endif |
66 |
|
67 |
/* |
68 |
* mo_die - DIE command handler |
69 |
*/ |
70 |
static void |
71 |
mo_die(struct Client *client_p, struct Client *source_p, |
72 |
int parc, char *parv[]) |
73 |
{ |
74 |
char buf[IRCD_BUFSIZE]; |
75 |
|
76 |
if (!IsOperDie(source_p)) |
77 |
{ |
78 |
sendto_one(source_p, form_str(ERR_NOPRIVS), |
79 |
me.name, source_p->name, "die"); |
80 |
return; |
81 |
} |
82 |
|
83 |
if (parc < 2 || EmptyString(parv[1])) |
84 |
{ |
85 |
sendto_one(source_p, ":%s NOTICE %s :Need server name /die %s", |
86 |
me.name, source_p->name, me.name); |
87 |
return; |
88 |
} |
89 |
|
90 |
if (irccmp(parv[1], me.name)) |
91 |
{ |
92 |
sendto_one(source_p, ":%s NOTICE %s :Mismatch on /die %s", |
93 |
me.name, source_p->name, me.name); |
94 |
return; |
95 |
} |
96 |
|
97 |
ircsprintf(buf, "received DIE command from %s", |
98 |
get_oper_name(source_p)); |
99 |
server_die(buf, 0); |
100 |
} |