mirror of https://github.com/jrbrtsn/ban2fail
Dropped dependency on libanl
This commit is contained in:
parent
aee76d1c4a
commit
b27b6e40f8
|
@ -17,7 +17,6 @@ src := \
|
|||
cntry.c \
|
||||
es.c \
|
||||
ez_es.c \
|
||||
ez_libanl.c \
|
||||
ez_libc.c \
|
||||
ez_libz.c \
|
||||
iptables.c \
|
||||
|
@ -32,7 +31,7 @@ src := \
|
|||
str.c \
|
||||
util.c \
|
||||
|
||||
libs := anl z crypto GeoIP pthread
|
||||
libs := z crypto GeoIP pthread
|
||||
endif
|
||||
|
||||
########################################
|
||||
|
|
34
ban2fail.c
34
ban2fail.c
|
@ -64,7 +64,6 @@ struct initInfo {
|
|||
|
||||
static int cntryStat_count_qsort(const void *p1, const void *p2);
|
||||
static int configure(CFGMAP *h_cfgmap, const char *pfix);
|
||||
static const char* reverse_dns_lookup(const char *addr);
|
||||
static int logentry_count_qsort(const void *p1, const void *p2);
|
||||
static int map_byCountries(LOGENTRY *e, MAP *h_map);
|
||||
static int stub_init(CFGMAP *map, char *symStr);
|
||||
|
@ -88,7 +87,7 @@ struct Global G= {
|
|||
.version= {
|
||||
.major= 0,
|
||||
.minor= 12,
|
||||
.patch= 3
|
||||
.patch= 4
|
||||
},
|
||||
|
||||
.bitTuples.flags= GlobalFlagBitTuples
|
||||
|
@ -690,34 +689,3 @@ map_byCountries(LOGENTRY *e, MAP *h_map)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char*
|
||||
reverse_dns_lookup(const char *addr)
|
||||
/**************************************************************
|
||||
* Do a getaddrinfo() reverse lookup on addr
|
||||
*/
|
||||
{
|
||||
const char *rtn= NULL;
|
||||
static char hostBuf[PATH_MAX];
|
||||
static struct addrinfo hints,
|
||||
*res;
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
res= NULL;
|
||||
|
||||
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
|
||||
hints.ai_flags = AI_NUMERICHOST; /* Only doing reverse lookups */
|
||||
|
||||
int rc= ez_getaddrinfo(addr, NULL, &hints, &res);
|
||||
assert(0 == rc);
|
||||
|
||||
assert(res && res->ai_addr && res->ai_addrlen);
|
||||
|
||||
rc= ez_getnameinfo(res->ai_addr, res->ai_addrlen, hostBuf, sizeof(hostBuf)-1, NULL, 0, NI_NAMEREQD);
|
||||
if(rc) return NULL;
|
||||
|
||||
rtn= hostBuf;
|
||||
|
||||
abort:
|
||||
if(res) freeaddrinfo(res);
|
||||
return rtn;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue