ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/src/s_gline.c
Revision: 69
Committed: Tue Oct 4 16:09:51 2005 UTC (20 years, 10 months ago) by adx
Content type: text/x-csrc
File size: 2572 byte(s)
Log Message:
- splitted ircd/libio, all headers connected with libio sources have been
  moved for internal use only. To use libio interface, include "libio.h"
  (which is already done in "stdinc.h")


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

Properties

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