#3041 remove the code to skip lines with unreadable characters (this was skipping valid lines); add temporary extra debugging
This commit is contained in:
parent
3d0e329364
commit
12275ccc10
|
@ -264,7 +264,6 @@ _tr_blocklistSetContent( tr_blocklist * b,
|
||||||
|
|
||||||
while( !fggets( &line, in ) )
|
while( !fggets( &line, in ) )
|
||||||
{
|
{
|
||||||
const char * pch;
|
|
||||||
char * rangeBegin;
|
char * rangeBegin;
|
||||||
char * rangeEnd;
|
char * rangeEnd;
|
||||||
char * crpos;
|
char * crpos;
|
||||||
|
@ -273,15 +272,6 @@ _tr_blocklistSetContent( tr_blocklist * b,
|
||||||
|
|
||||||
++inCount;
|
++inCount;
|
||||||
|
|
||||||
for( pch=line; pch && *pch; ++pch )
|
|
||||||
if( !isprint( *pch ) && ( *pch != '\r' ) && ( *pch != '\n' ) )
|
|
||||||
break;
|
|
||||||
if( !pch || *pch ) {
|
|
||||||
tr_err( "skipping line #%d which contains nonprintable characters\n", inCount );
|
|
||||||
free( line );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
rangeBegin = strrchr( line, ':' );
|
rangeBegin = strrchr( line, ':' );
|
||||||
if( !rangeBegin ){ free( line ); continue; }
|
if( !rangeBegin ){ free( line ); continue; }
|
||||||
++rangeBegin;
|
++rangeBegin;
|
||||||
|
@ -293,15 +283,23 @@ _tr_blocklistSetContent( tr_blocklist * b,
|
||||||
*crpos = '\0';
|
*crpos = '\0';
|
||||||
|
|
||||||
if( !tr_pton( rangeBegin, &addr ) )
|
if( !tr_pton( rangeBegin, &addr ) )
|
||||||
tr_err( "blocklist skipped invalid address [%s]\n", rangeBegin );
|
{
|
||||||
|
printf( "error rangeBegin: %s", line );
|
||||||
|
tr_err( _( "blocklist skipped invalid address at line %d" ), inCount );
|
||||||
|
free( line );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
range.begin = ntohl( addr.addr.addr4.s_addr );
|
range.begin = ntohl( addr.addr.addr4.s_addr );
|
||||||
|
|
||||||
if( !tr_pton( rangeEnd, &addr ) )
|
if( !tr_pton( rangeEnd, &addr ) )
|
||||||
tr_err( "blocklist skipped invalid address [%s]\n", rangeEnd );
|
{
|
||||||
|
printf( "error rangeEnd: %s", line );
|
||||||
|
tr_err( _( "blocklist skipped invalid address at line %d" ), inCount );
|
||||||
|
free( line );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
range.end = ntohl( addr.addr.addr4.s_addr );
|
range.end = ntohl( addr.addr.addr4.s_addr );
|
||||||
|
|
||||||
free( line );
|
|
||||||
|
|
||||||
if( fwrite( &range, sizeof( struct tr_ip_range ), 1, out ) != 1 )
|
if( fwrite( &range, sizeof( struct tr_ip_range ), 1, out ) != 1 )
|
||||||
{
|
{
|
||||||
tr_err( _(
|
tr_err( _(
|
||||||
|
@ -319,7 +317,6 @@ _tr_blocklistSetContent( tr_blocklist * b,
|
||||||
tr_free( base );
|
tr_free( base );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fclose( out );
|
fclose( out );
|
||||||
fclose( in );
|
fclose( in );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue