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