/[svn]/ircd-hybrid-7.2/src/s_gline.c
ViewVC logotype

Contents of /ircd-hybrid-7.2/src/s_gline.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 957 - (show annotations)
Tue Jul 28 18:47:23 2009 UTC (10 years, 2 months ago) by michael
File MIME type: text/x-chdr
File size: 2997 byte(s)
- implement proper GUNGLINE support

1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * s_gline.c: GLine global ban functions.
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 "tools.h"
27 #include "handlers.h"
28 #include "client.h"
29 #include "common.h"
30 #include "irc_string.h"
31 #include "ircd.h"
32 #include "hostmask.h"
33 #include "fdlist.h"
34 #include "s_bsd.h"
35 #include "s_conf.h"
36 #include "s_misc.h"
37 #include "send.h"
38 #include "msg.h"
39 #include "fileio.h"
40 #include "s_serv.h"
41 #include "s_gline.h"
42 #include "event.h"
43 #include "list.h"
44 #include "memory.h"
45
46 dlink_list pending_glines[GLINE_PENDING_ADD_TYPE + 1] = { { NULL, NULL, 0 },
47 { NULL, NULL, 0 } };
48
49 static void expire_pending_glines(struct gline_pending *);
50
51
52 struct AccessItem *
53 find_is_glined(const char *host, const char *user)
54 {
55 struct irc_ssaddr iphost, *piphost;
56 struct AccessItem *aconf;
57 int t;
58
59 if ((t = parse_netmask(host, &iphost, &t)) != HM_HOST)
60 {
61 #ifdef IPV6
62 if (t == HM_IPV6)
63 t = AF_INET6;
64 else
65 #endif
66 t = AF_INET;
67 piphost = &iphost;
68 }
69 else
70 {
71 t = 0;
72 piphost = NULL;
73 }
74
75 aconf = find_conf_by_address(host, piphost, CONF_GLINE, t, user, NULL);
76 return aconf;
77 }
78
79 /* cleanup_glines()
80 *
81 * inputs - NONE
82 * output - NONE
83 * side effects - expire gline lists
84 * This is an event started off in ircd.c
85 */
86 void
87 cleanup_glines(void *unused)
88 {
89 expire_pending_glines(unused);
90 }
91
92 /* expire_pending_glines()
93 *
94 * inputs - NONE
95 * output - NONE
96 * side effects -
97 *
98 * Go through the pending gline list, expire any that haven't had
99 * enough "votes" in the time period allowed
100 */
101 static void
102 expire_pending_glines(struct gline_pending *in)
103 {
104 dlink_node *ptr = NULL, *next_ptr = NULL;
105 int idx = 0;
106
107 for (; idx < GLINE_PENDING_ADD_TYPE + 1; ++idx)
108 {
109 DLINK_FOREACH_SAFE(ptr, next_ptr, pending_glines[idx].head)
110 {
111 struct gline_pending *glp_ptr = ptr->data;
112
113 if ((glp_ptr->last_gline_time + GLINE_PENDING_EXPIRE) <= CurrentTime ||
114 glp_ptr == in)
115 {
116 dlinkDelete(&glp_ptr->node, &pending_glines[idx]);
117 MyFree(glp_ptr);
118 }
119 }
120
121 ptr = NULL, next_ptr = NULL;
122 }
123 }

Properties

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

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.26