ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/s_gline.c
Revision: 957
Committed: Tue Jul 28 18:47:23 2009 UTC (16 years, 1 month ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid-7.2/src/s_gline.c
File size: 2997 byte(s)
Log Message:
- implement proper GUNGLINE support

File Contents

# User Rev Content
1 adx 30 /*
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 knight 31 * $Id$
23 adx 30 */
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 michael 957 dlink_list pending_glines[GLINE_PENDING_ADD_TYPE + 1] = { { NULL, NULL, 0 },
47     { NULL, NULL, 0 } };
48 adx 30
49 michael 957 static void expire_pending_glines(struct gline_pending *);
50 adx 30
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 michael 957 return aconf;
77 adx 30 }
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 michael 957 expire_pending_glines(unused);
90 adx 30 }
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 michael 957 expire_pending_glines(struct gline_pending *in)
103 adx 30 {
104 michael 957 dlink_node *ptr = NULL, *next_ptr = NULL;
105     int idx = 0;
106 adx 30
107 michael 957 for (; idx < GLINE_PENDING_ADD_TYPE + 1; ++idx)
108 adx 30 {
109 michael 957 DLINK_FOREACH_SAFE(ptr, next_ptr, pending_glines[idx].head)
110     {
111     struct gline_pending *glp_ptr = ptr->data;
112 adx 30
113 michael 957 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 adx 30 }
120 michael 957
121     ptr = NULL, next_ptr = NULL;
122 adx 30 }
123     }

Properties

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