mirror of
https://github.com/bol-van/zapret.git
synced 2025-04-21 06:22:57 +03:00
Compare commits
1 Commits
2426822d78
...
b5dd04640d
Author | SHA1 | Date | |
---|---|---|---|
|
b5dd04640d |
@ -9,7 +9,6 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
int unique_size_t(size_t *pu, int ct)
|
int unique_size_t(size_t *pu, int ct)
|
||||||
{
|
{
|
||||||
@ -314,17 +313,6 @@ bool file_mod_signature(const char *filename, file_mod_sig *ms)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool file_open_test(const char *filename, int flags)
|
|
||||||
{
|
|
||||||
int fd = open(filename,flags);
|
|
||||||
if (fd>=0)
|
|
||||||
{
|
|
||||||
close(fd);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pf_in_range(uint16_t port, const port_filter *pf)
|
bool pf_in_range(uint16_t port, const port_filter *pf)
|
||||||
{
|
{
|
||||||
return port && (((!pf->from && !pf->to) || (port>=pf->from && port<=pf->to)) ^ pf->neg);
|
return port && (((!pf->from && !pf->to) || (port>=pf->from && port<=pf->to)) ^ pf->neg);
|
||||||
|
@ -77,7 +77,6 @@ typedef struct
|
|||||||
#define FILE_MOD_RESET(ms) memset(ms,0,sizeof(file_mod_sig))
|
#define FILE_MOD_RESET(ms) memset(ms,0,sizeof(file_mod_sig))
|
||||||
bool file_mod_signature(const char *filename, file_mod_sig *ms);
|
bool file_mod_signature(const char *filename, file_mod_sig *ms);
|
||||||
time_t file_mod_time(const char *filename);
|
time_t file_mod_time(const char *filename);
|
||||||
bool file_open_test(const char *filename, int flags);
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -126,16 +126,16 @@ static bool test_list_files()
|
|||||||
struct ipset_file *ifile;
|
struct ipset_file *ifile;
|
||||||
|
|
||||||
LIST_FOREACH(hfile, ¶ms.hostlists, next)
|
LIST_FOREACH(hfile, ¶ms.hostlists, next)
|
||||||
if (!file_open_test(hfile->filename, O_RDONLY))
|
if (!file_mod_time(hfile->filename))
|
||||||
{
|
{
|
||||||
DLOG_PERROR("file_open_test");
|
DLOG_PERROR("file_mod_time");
|
||||||
DLOG_ERR("cannot access hostlist file '%s'\n",hfile->filename);
|
DLOG_ERR("cannot access hostlist file '%s'\n",hfile->filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LIST_FOREACH(ifile, ¶ms.ipsets, next)
|
LIST_FOREACH(ifile, ¶ms.ipsets, next)
|
||||||
if (!file_open_test(ifile->filename, O_RDONLY))
|
if (!file_mod_time(ifile->filename))
|
||||||
{
|
{
|
||||||
DLOG_PERROR("file_open_test");
|
DLOG_PERROR("file_mod_time");
|
||||||
DLOG_ERR("cannot access ipset file '%s'\n",ifile->filename);
|
DLOG_ERR("cannot access ipset file '%s'\n",ifile->filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#include "andr/ifaddrs.h"
|
#include "andr/ifaddrs.h"
|
||||||
@ -328,17 +327,6 @@ bool file_mod_signature(const char *filename, file_mod_sig *ms)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool file_open_test(const char *filename, int flags)
|
|
||||||
{
|
|
||||||
int fd = open(filename,flags);
|
|
||||||
if (fd>=0)
|
|
||||||
{
|
|
||||||
close(fd);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pf_in_range(uint16_t port, const port_filter *pf)
|
bool pf_in_range(uint16_t port, const port_filter *pf)
|
||||||
{
|
{
|
||||||
return port && (((!pf->from && !pf->to) || (port >= pf->from && port <= pf->to)) ^ pf->neg);
|
return port && (((!pf->from && !pf->to) || (port >= pf->from && port <= pf->to)) ^ pf->neg);
|
||||||
|
@ -71,7 +71,6 @@ typedef struct
|
|||||||
#define FILE_MOD_RESET(ms) memset(ms,0,sizeof(file_mod_sig))
|
#define FILE_MOD_RESET(ms) memset(ms,0,sizeof(file_mod_sig))
|
||||||
bool file_mod_signature(const char *filename, file_mod_sig *ms);
|
bool file_mod_signature(const char *filename, file_mod_sig *ms);
|
||||||
time_t file_mod_time(const char *filename);
|
time_t file_mod_time(const char *filename);
|
||||||
bool file_open_test(const char *filename, int flags);
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -122,16 +122,16 @@ static bool test_list_files()
|
|||||||
struct ipset_file *ifile;
|
struct ipset_file *ifile;
|
||||||
|
|
||||||
LIST_FOREACH(hfile, ¶ms.hostlists, next)
|
LIST_FOREACH(hfile, ¶ms.hostlists, next)
|
||||||
if (!file_open_test(hfile->filename, O_RDONLY))
|
if (!file_mod_time(hfile->filename))
|
||||||
{
|
{
|
||||||
DLOG_PERROR("file_open_test");
|
DLOG_PERROR("file_mod_time");
|
||||||
DLOG_ERR("cannot access hostlist file '%s'\n",hfile->filename);
|
DLOG_ERR("cannot access hostlist file '%s'\n",hfile->filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LIST_FOREACH(ifile, ¶ms.ipsets, next)
|
LIST_FOREACH(ifile, ¶ms.ipsets, next)
|
||||||
if (!file_open_test(ifile->filename, O_RDONLY))
|
if (!file_mod_time(ifile->filename))
|
||||||
{
|
{
|
||||||
DLOG_PERROR("file_open_test");
|
DLOG_PERROR("file_mod_time");
|
||||||
DLOG_ERR("cannot access ipset file '%s'\n",ifile->filename);
|
DLOG_ERR("cannot access ipset file '%s'\n",ifile->filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user