]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
1 | /* |
2 | * ircd-ratbox: A slightly useful ircd. | |
3 | * m_unreject.c: Removes an ip from the reject cache | |
4 | * | |
5 | * Copyright (C) 2004 Aaron Sethman <androsyn@ratbox.org> | |
6 | * Copyright (C) 2004-2005 ircd-ratbox development team | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; either version 2 of the License, or | |
11 | * (at your option) any later version. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with this program; if not, write to the Free Software | |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |
21 | * USA | |
212380e3 AC |
22 | */ |
23 | ||
24 | #include "stdinc.h" | |
25 | #include "client.h" | |
26 | #include "s_conf.h" | |
27 | #include "hostmask.h" | |
28 | #include "reject.h" | |
29 | #include "msg.h" | |
30 | #include "modules.h" | |
31 | #include "send.h" | |
32 | ||
4855e957 AW |
33 | static const char unreject_desc[] = |
34 | "Provides the UNREJECT command to remove an IP from the reject cache"; | |
212380e3 | 35 | |
3c7d6fcc EM |
36 | static void mo_unreject(struct MsgBuf *, struct Client *, struct Client *, int, const char **); |
37 | ||
212380e3 | 38 | struct Message unreject_msgtab = { |
7baa37a9 | 39 | "UNREJECT", 0, 0, 0, 0, |
212380e3 AC |
40 | {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_unreject, 2}} |
41 | }; | |
42 | ||
43 | mapi_clist_av1 unreject_clist[] = { &unreject_msgtab, NULL }; | |
3c7d6fcc | 44 | |
4855e957 | 45 | DECLARE_MODULE_AV2(unreject, NULL, NULL, unreject_clist, NULL, NULL, NULL, NULL, unreject_desc); |
212380e3 | 46 | |
54ac8b60 VY |
47 | /* |
48 | * mo_unreject | |
54ac8b60 | 49 | */ |
3c7d6fcc | 50 | static void |
428ca87b | 51 | mo_unreject(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) |
54ac8b60 VY |
52 | { |
53 | if(ConfigFileEntry.reject_after_count == 0 || ConfigFileEntry.reject_ban_time == 0 || | |
54 | ConfigFileEntry.reject_duration == 0) | |
55 | { | |
56 | sendto_one_notice(source_p, ":Reject cache is disabled"); | |
3c7d6fcc | 57 | return; |
54ac8b60 VY |
58 | } |
59 | ||
60 | if(!parse_netmask(parv[1], NULL, NULL)) | |
61 | { | |
62 | sendto_one_notice(source_p, ":Unable to parse netmask %s", parv[1]); | |
3c7d6fcc | 63 | return; |
55abcbb2 KB |
64 | } |
65 | ||
54ac8b60 VY |
66 | if(remove_reject_ip(parv[1])) |
67 | sendto_one_notice(source_p, ":Removed reject for %s", parv[1]); | |
68 | else | |
69 | sendto_one_notice(source_p, ":Unable to remove reject for %s", parv[1]); | |
212380e3 | 70 | } |