ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/gline.c
Revision: 2916
Committed: Sat Jan 25 21:09:18 2014 UTC (11 years, 7 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid/trunk/src/s_gline.c
File size: 2805 byte(s)
Log Message:
- Clean up all files in include/ (fixed indentation, removed whitespaces/tabs)
- Fixed copyright years

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2014 ircd-hybrid development team
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 * USA
20 */
21
22 /*! \file s_gline.c
23 * \brief GLine global ban functions.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "list.h"
29 #include "client.h"
30 #include "irc_string.h"
31 #include "ircd.h"
32 #include "conf.h"
33 #include "hostmask.h"
34 #include "s_misc.h"
35 #include "send.h"
36 #include "s_serv.h"
37 #include "s_gline.h"
38 #include "event.h"
39 #include "memory.h"
40
41 dlink_list pending_glines[GLINE_PENDING_ADD_TYPE + 1] = { { NULL, NULL, 0 },
42 { NULL, NULL, 0 } };
43
44
45 struct MaskItem *
46 find_is_glined(const char *host, const char *user)
47 {
48 struct irc_ssaddr iphost, *piphost = NULL;
49 int t = 0;
50 int aftype = 0;
51
52 if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST)
53 {
54 #ifdef IPV6
55 if (t == HM_IPV6)
56 aftype = AF_INET6;
57 else
58 #endif
59 aftype = AF_INET;
60 piphost = &iphost;
61 }
62 else
63 piphost = NULL;
64
65 return find_conf_by_address(host, piphost, CONF_GLINE, aftype, user, NULL, 0);
66 }
67
68 /* expire_pending_glines()
69 *
70 * inputs - NONE
71 * output - NONE
72 * side effects -
73 *
74 * Go through the pending gline list, expire any that haven't had
75 * enough "votes" in the time period allowed
76 */
77 static void
78 expire_pending_glines(struct gline_pending *in)
79 {
80 dlink_node *ptr = NULL, *next_ptr = NULL;
81 unsigned int idx = 0;
82
83 for (; idx < GLINE_PENDING_ADD_TYPE + 1; ++idx)
84 {
85 DLINK_FOREACH_SAFE(ptr, next_ptr, pending_glines[idx].head)
86 {
87 struct gline_pending *glp_ptr = ptr->data;
88
89 if ((glp_ptr->last_gline_time + ConfigFileEntry.gline_request_time) <= CurrentTime ||
90 glp_ptr == in)
91 {
92 dlinkDelete(&glp_ptr->node, &pending_glines[idx]);
93 MyFree(glp_ptr);
94 }
95 }
96 }
97 }
98
99 /* cleanup_glines()
100 *
101 * inputs - NONE
102 * output - NONE
103 * side effects - expire gline lists
104 * This is an event started off in ircd.c
105 */
106 void
107 cleanup_glines(void *unused)
108 {
109 expire_pending_glines(unused);
110 }

Properties

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