| 43 |
|
#include "list.h" |
| 44 |
|
#include "memory.h" |
| 45 |
|
|
| 46 |
< |
dlink_list pending_glines = { NULL, NULL, 0 }; |
| 46 |
> |
dlink_list pending_glines[GLINE_PENDING_ADD_TYPE + 1] = { { NULL, NULL, 0 }, |
| 47 |
> |
{ NULL, NULL, 0 } }; |
| 48 |
|
|
| 49 |
< |
static void expire_pending_glines(void); |
| 49 |
> |
static void expire_pending_glines(struct gline_pending *); |
| 50 |
|
|
| 51 |
|
|
| 52 |
|
struct AccessItem * |
| 73 |
|
} |
| 74 |
|
|
| 75 |
|
aconf = find_conf_by_address(host, piphost, CONF_GLINE, t, user, NULL); |
| 76 |
< |
return(aconf); |
| 76 |
> |
return aconf; |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
/* cleanup_glines() |
| 86 |
|
void |
| 87 |
|
cleanup_glines(void *unused) |
| 88 |
|
{ |
| 89 |
< |
expire_pending_glines(); |
| 89 |
> |
expire_pending_glines(unused); |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
/* expire_pending_glines() |
| 99 |
|
* enough "votes" in the time period allowed |
| 100 |
|
*/ |
| 101 |
|
static void |
| 102 |
< |
expire_pending_glines(void) |
| 102 |
> |
expire_pending_glines(struct gline_pending *in) |
| 103 |
|
{ |
| 104 |
< |
dlink_node *ptr; |
| 105 |
< |
dlink_node *next_ptr; |
| 105 |
< |
struct gline_pending *glp_ptr; |
| 104 |
> |
dlink_node *ptr = NULL, *next_ptr = NULL; |
| 105 |
> |
int idx = 0; |
| 106 |
|
|
| 107 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, pending_glines.head) |
| 107 |
> |
for (; idx < GLINE_PENDING_ADD_TYPE + 1; ++idx) |
| 108 |
|
{ |
| 109 |
< |
glp_ptr = ptr->data; |
| 110 |
< |
|
| 111 |
< |
if (((glp_ptr->last_gline_time + GLINE_PENDING_EXPIRE) <= CurrentTime) || |
| 112 |
< |
find_is_glined(glp_ptr->host, glp_ptr->user)) |
| 109 |
> |
DLINK_FOREACH_SAFE(ptr, next_ptr, pending_glines[idx].head) |
| 110 |
|
{ |
| 111 |
< |
dlinkDelete(&glp_ptr->node, &pending_glines); |
| 112 |
< |
MyFree(glp_ptr); |
| 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 |
|
} |