mirror of
https://github.com/bol-van/zapret.git
synced 2024-12-28 04:10:34 +05:00
tpws: fixed list fixes
This commit is contained in:
parent
422faaa29c
commit
f00b45a28e
10
tpws/ipset.c
10
tpws/ipset.c
@ -242,12 +242,22 @@ bool IpsetCheck(const struct desync_profile *dp, const struct in_addr *ipv4, con
|
|||||||
static struct ipset_file *RegisterIpset_(struct ipset_files_head *ipsets, struct ipset_collection_head *ips_collection, const char *filename)
|
static struct ipset_file *RegisterIpset_(struct ipset_files_head *ipsets, struct ipset_collection_head *ips_collection, const char *filename)
|
||||||
{
|
{
|
||||||
struct ipset_file *hfile;
|
struct ipset_file *hfile;
|
||||||
|
if (filename)
|
||||||
|
{
|
||||||
if (!(hfile=ipset_files_search(ipsets, filename)))
|
if (!(hfile=ipset_files_search(ipsets, filename)))
|
||||||
if (!(hfile=ipset_files_add(ipsets, filename)))
|
if (!(hfile=ipset_files_add(ipsets, filename)))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!ipset_collection_search(ips_collection, filename))
|
if (!ipset_collection_search(ips_collection, filename))
|
||||||
if (!ipset_collection_add(ips_collection, hfile))
|
if (!ipset_collection_add(ips_collection, hfile))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!(hfile=ipset_files_add(ipsets, NULL)))
|
||||||
|
return NULL;
|
||||||
|
if (!ipset_collection_add(ips_collection, hfile))
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return hfile;
|
return hfile;
|
||||||
}
|
}
|
||||||
struct ipset_file *RegisterIpset(struct desync_profile *dp, bool bExclude, const char *filename)
|
struct ipset_file *RegisterIpset(struct desync_profile *dp, bool bExclude, const char *filename)
|
||||||
|
15
tpws/pools.c
15
tpws/pools.c
@ -154,17 +154,21 @@ void strlist_destroy(struct str_list_head *head)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct hostlist_file *hostlist_files_add(struct hostlist_files_head *head, const char *filename)
|
struct hostlist_file *hostlist_files_add(struct hostlist_files_head *head, const char *filename)
|
||||||
{
|
{
|
||||||
struct hostlist_file *entry = malloc(sizeof(struct hostlist_file));
|
struct hostlist_file *entry = malloc(sizeof(struct hostlist_file));
|
||||||
if (entry)
|
if (entry)
|
||||||
{
|
{
|
||||||
if (filename && !(entry->filename = strdup(filename)))
|
if (filename)
|
||||||
|
{
|
||||||
|
if (!(entry->filename = strdup(filename)))
|
||||||
{
|
{
|
||||||
free(entry);
|
free(entry);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
entry->filename = NULL;
|
||||||
entry->mod_time = 0;
|
entry->mod_time = 0;
|
||||||
entry->hostlist = NULL;
|
entry->hostlist = NULL;
|
||||||
LIST_INSERT_HEAD(head, entry, next);
|
LIST_INSERT_HEAD(head, entry, next);
|
||||||
@ -369,11 +373,16 @@ struct ipset_file *ipset_files_add(struct ipset_files_head *head, const char *fi
|
|||||||
struct ipset_file *entry = malloc(sizeof(struct ipset_file));
|
struct ipset_file *entry = malloc(sizeof(struct ipset_file));
|
||||||
if (entry)
|
if (entry)
|
||||||
{
|
{
|
||||||
if (filename && !(entry->filename = strdup(filename)))
|
if (filename)
|
||||||
|
{
|
||||||
|
if (!(entry->filename = strdup(filename)))
|
||||||
{
|
{
|
||||||
free(entry);
|
free(entry);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
entry->filename = NULL;
|
||||||
entry->mod_time = 0;
|
entry->mod_time = 0;
|
||||||
memset(&entry->ipset,0,sizeof(entry->ipset));
|
memset(&entry->ipset,0,sizeof(entry->ipset));
|
||||||
LIST_INSERT_HEAD(head, entry, next);
|
LIST_INSERT_HEAD(head, entry, next);
|
||||||
|
Loading…
Reference in New Issue
Block a user