mirror of
https://github.com/jrbrtsn/ban2fail
synced 2024-06-16 11:58:01 +00:00
Fixed minor reporting bug
This commit is contained in:
parent
b6d4d8df3f
commit
36b3295df7
20
ban2fail.c
20
ban2fail.c
@ -89,7 +89,7 @@ struct Global G= {
|
|||||||
.version= {
|
.version= {
|
||||||
.major= 0,
|
.major= 0,
|
||||||
.minor= 13,
|
.minor= 13,
|
||||||
.patch= 1
|
.patch= 2
|
||||||
},
|
},
|
||||||
|
|
||||||
.bitTuples.flags= GlobalFlagBitTuples
|
.bitTuples.flags= GlobalFlagBitTuples
|
||||||
@ -186,7 +186,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
int c, option_ndx= 0;
|
int c, option_ndx= 0;
|
||||||
|
|
||||||
c= getopt_long(argc, argv, ":a::cst:v", long_options, &option_ndx);
|
c= getopt_long(argc, argv, ":a::cFst:v", long_options, &option_ndx);
|
||||||
|
|
||||||
if(-1 == c) break;
|
if(-1 == c) break;
|
||||||
|
|
||||||
@ -197,10 +197,6 @@ main(int argc, char **argv)
|
|||||||
++errflg;
|
++errflg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
|
||||||
G.flags |= GLB_LIST_CNTRY_FLG;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
G.flags |= GLB_LIST_ADDR_FLG;
|
G.flags |= GLB_LIST_ADDR_FLG;
|
||||||
if(optarg) {
|
if(optarg) {
|
||||||
@ -213,6 +209,14 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'c':
|
||||||
|
G.flags |= GLB_LIST_CNTRY_FLG;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'F':
|
||||||
|
G.flags |= GLB_FLUSH_CACHE_FLG;
|
||||||
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
G.flags |= GLB_LIST_SUMMARY_FLG;
|
G.flags |= GLB_LIST_SUMMARY_FLG;
|
||||||
break;
|
break;
|
||||||
@ -251,6 +255,7 @@ main(int argc, char **argv)
|
|||||||
" --help\tprint this usage message.\n"
|
" --help\tprint this usage message.\n"
|
||||||
" -a[+]\t\tList results by Address. '+' to perform DNS reverse lookups.\n"
|
" -a[+]\t\tList results by Address. '+' to perform DNS reverse lookups.\n"
|
||||||
" -c\t\tlist results by Country\n"
|
" -c\t\tlist results by Country\n"
|
||||||
|
" -F\t\tFlush the cache\n"
|
||||||
" -s\t\tlist Summary results only\n"
|
" -s\t\tlist Summary results only\n"
|
||||||
" -t confFile\tTest confFile, do not apply iptables rules\n"
|
" -t confFile\tTest confFile, do not apply iptables rules\n"
|
||||||
" -v\t\tVerbose information about unrecognized configuration info\n"
|
" -v\t\tVerbose information about unrecognized configuration info\n"
|
||||||
@ -335,6 +340,9 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
/* Open our cache, instance file-specific LOGTYPE objects */
|
/* Open our cache, instance file-specific LOGTYPE objects */
|
||||||
{ /*=============================================================*/
|
{ /*=============================================================*/
|
||||||
|
if(G.flags & GLB_FLUSH_CACHE_FLG && !access(G.cacheDir, F_OK)) {
|
||||||
|
ez_rmdir_recursive(G.cacheDir);
|
||||||
|
}
|
||||||
|
|
||||||
/* Make the directory if needed */
|
/* Make the directory if needed */
|
||||||
if(access(G.cacheDir, F_OK)) {
|
if(access(G.cacheDir, F_OK)) {
|
||||||
|
@ -69,6 +69,7 @@ enum GlobalFlg_enum {
|
|||||||
GLB_PRINT_LOGFILE_NAMES_FLG=1<<5,
|
GLB_PRINT_LOGFILE_NAMES_FLG=1<<5,
|
||||||
GLB_DNS_LOOKUP_FLG =1<<6,
|
GLB_DNS_LOOKUP_FLG =1<<6,
|
||||||
GLB_DNS_FILTER_BAD_FLG =1<<7,
|
GLB_DNS_FILTER_BAD_FLG =1<<7,
|
||||||
|
GLB_FLUSH_CACHE_FLG =1<<8,
|
||||||
GLB_LONG_LISTING_MASK = GLB_LIST_CNTRY_FLG|GLB_LIST_ADDR_FLG
|
GLB_LONG_LISTING_MASK = GLB_LIST_CNTRY_FLG|GLB_LIST_ADDR_FLG
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -190,6 +190,9 @@ obsv_load_AddrRPT(struct obsv *self, struct infoTuple *it)
|
|||||||
assert(self->len < sizeof(lbuf));
|
assert(self->len < sizeof(lbuf));
|
||||||
unsigned len= MIN(self->len, sizeof(lbuf)-1);
|
unsigned len= MIN(self->len, sizeof(lbuf)-1);
|
||||||
|
|
||||||
|
/* Put null terminator in place */
|
||||||
|
lbuf[len]= '\0';
|
||||||
|
|
||||||
ez_gzseek(it->fh, self->pos, SEEK_SET);
|
ez_gzseek(it->fh, self->pos, SEEK_SET);
|
||||||
ez_gzread(it->fh, lbuf, len);
|
ez_gzread(it->fh, lbuf, len);
|
||||||
AddrRPT_addLine(it->ar, it->lf, lbuf);
|
AddrRPT_addLine(it->ar, it->lf, lbuf);
|
||||||
|
Loading…
Reference in New Issue
Block a user