reject: reorder to avoid leaks
This commit is contained in:
parent
b9c43bc08a
commit
6cd12661af
1 changed files with 39 additions and 39 deletions
|
@ -233,51 +233,51 @@ check_reject(rb_fde_t *F, struct sockaddr *addr)
|
||||||
rb_patricia_node_t *pnode;
|
rb_patricia_node_t *pnode;
|
||||||
reject_t *rdata;
|
reject_t *rdata;
|
||||||
delay_t *ddata;
|
delay_t *ddata;
|
||||||
|
|
||||||
/* Reject is disabled */
|
/* Reject is disabled */
|
||||||
if(ConfigFileEntry.reject_after_count == 0 || ConfigFileEntry.reject_duration == 0)
|
if (ConfigFileEntry.reject_after_count == 0 || ConfigFileEntry.reject_duration == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pnode = rb_match_ip(reject_tree, addr);
|
pnode = rb_match_ip(reject_tree, addr);
|
||||||
if(pnode != NULL)
|
if (pnode == NULL)
|
||||||
{
|
return 0;
|
||||||
rdata = pnode->data;
|
|
||||||
|
|
||||||
rdata->time = rb_current_time();
|
rdata = pnode->data;
|
||||||
if(rdata->count > (unsigned long)ConfigFileEntry.reject_after_count)
|
rdata->time = rb_current_time();
|
||||||
{
|
|
||||||
ddata = rb_malloc(sizeof(delay_t));
|
if (rdata->count <= (unsigned long)ConfigFileEntry.reject_after_count)
|
||||||
ServerStats.is_rej++;
|
return 0;
|
||||||
rb_setselect(F, RB_SELECT_WRITE | RB_SELECT_READ, NULL, NULL);
|
|
||||||
if(rdata->aconf)
|
if (rdata->aconf != NULL && rdata->aconf->status & CONF_ILLEGAL)
|
||||||
{
|
{
|
||||||
if(rdata->aconf->status & CONF_ILLEGAL)
|
rb_dlinkDelete(&rdata->rnode, &reject_list);
|
||||||
{
|
reject_free(rdata);
|
||||||
rb_dlinkDelete(&rdata->rnode, &reject_list);
|
rb_patricia_remove(reject_tree, pnode);
|
||||||
reject_free(rdata);
|
return 0;
|
||||||
rb_patricia_remove(reject_tree, pnode);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
ddata->aconf = rdata->aconf;
|
|
||||||
ddata->aconf->clients++;
|
|
||||||
ddata->reason = NULL;
|
|
||||||
}
|
|
||||||
else if(rdata->reason)
|
|
||||||
{
|
|
||||||
ddata->reason = rdata->reason;
|
|
||||||
ddata->aconf = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ddata->aconf = NULL;
|
|
||||||
ddata->reason = NULL;
|
|
||||||
}
|
|
||||||
ddata->F = F;
|
|
||||||
rb_dlinkAdd(ddata, &ddata->node, &delay_exit);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Caller does what it wants */
|
|
||||||
return 0;
|
ddata = rb_malloc(sizeof(delay_t));
|
||||||
|
ServerStats.is_rej++;
|
||||||
|
rb_setselect(F, RB_SELECT_WRITE | RB_SELECT_READ, NULL, NULL);
|
||||||
|
if (rdata->aconf)
|
||||||
|
{
|
||||||
|
ddata->aconf = rdata->aconf;
|
||||||
|
ddata->aconf->clients++;
|
||||||
|
ddata->reason = NULL;
|
||||||
|
}
|
||||||
|
else if (rdata->reason)
|
||||||
|
{
|
||||||
|
ddata->reason = rdata->reason;
|
||||||
|
ddata->aconf = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ddata->aconf = NULL;
|
||||||
|
ddata->reason = NULL;
|
||||||
|
}
|
||||||
|
ddata->F = F;
|
||||||
|
rb_dlinkAdd(ddata, &ddata->node, &delay_exit);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in a new issue