ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/branches/newio/src/s_gline.c
Revision: 2407
Committed: Wed Jul 17 20:29:02 2013 UTC (10 years, 9 months ago) by michael
Content type: text/x-csrc
File size: 2808 byte(s)
Log Message:
- ioengine changes as of 17JUL13

File Contents

# Content
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 "list.h"
27 #include "client.h"
28 #include "irc_string.h"
29 #include "ircd.h"
30 #include "conf.h"
31 #include "hostmask.h"
32 #include "s_misc.h"
33 #include "send.h"
34 #include "s_serv.h"
35 #include "ioengine.h"
36 #include "s_gline.h"
37 #include "memory.h"
38
39 dlink_list pending_glines[GLINE_PENDING_ADD_TYPE + 1] = { { NULL, NULL, 0 },
40 { NULL, NULL, 0 } };
41
42
43 struct MaskItem *
44 find_is_glined(const char *host, const char *user)
45 {
46 struct irc_ssaddr iphost, *piphost = NULL;
47 struct MaskItem *conf = NULL;
48 int t = 0;
49 int aftype = 0;
50
51 if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST)
52 {
53 if (t == HM_IPV6)
54 aftype = AF_INET6;
55 else
56 aftype = AF_INET;
57 piphost = &iphost;
58 }
59 else
60 piphost = NULL;
61
62 conf = find_conf_by_address(host, piphost, CONF_GLINE, aftype, user, NULL, 0);
63 return conf;
64 }
65
66 /* expire_pending_glines()
67 *
68 * inputs - NONE
69 * output - NONE
70 * side effects -
71 *
72 * Go through the pending gline list, expire any that haven't had
73 * enough "votes" in the time period allowed
74 */
75 void
76 expire_pending_glines(struct gline_pending *in)
77 {
78 dlink_node *ptr = NULL, *next_ptr = NULL;
79 unsigned int idx = 0;
80
81 for (; idx < GLINE_PENDING_ADD_TYPE + 1; ++idx)
82 {
83 DLINK_FOREACH_SAFE(ptr, next_ptr, pending_glines[idx].head)
84 {
85 struct gline_pending *glp_ptr = ptr->data;
86
87 if ((glp_ptr->last_gline_time + ConfigFileEntry.gline_request_time) <= CurrentTime ||
88 glp_ptr == in)
89 {
90 dlinkDelete(&glp_ptr->node, &pending_glines[idx]);
91 MyFree(glp_ptr);
92 }
93 }
94 }
95 }
96
97 /* cleanup_glines()
98 *
99 * inputs - NONE
100 * output - NONE
101 * side effects - expire gline lists
102 * This is an event started off in ircd.c
103 */
104 void
105 cleanup_glines(struct Event *ev)
106 {
107 expire_pending_glines(NULL);
108 }

Properties

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