fix ACL parsing error introduced by the shttpd auth code change.

This commit is contained in:
Charles Kerr 2008-06-11 15:17:59 +00:00
parent 51aa583d60
commit d2459fa2af
2 changed files with 5 additions and 5 deletions

View File

@ -310,8 +310,8 @@ cidrize( const char * acl )
evbuffer_add_printf( out, "," );
}
/* the -2 is to eat the final ", " */
ret = tr_strndup( (char*) EVBUFFER_DATA(out), EVBUFFER_LENGTH(out)-2 );
/* the -1 is to eat the final ", " */
ret = tr_strndup( (char*) EVBUFFER_DATA(out), EVBUFFER_LENGTH(out)-1 );
evbuffer_free( out );
return ret;
}

View File

@ -30,7 +30,7 @@ testWildcard( const char * in, const char * expected )
{
int ok;
char * str = cidrize( in );
/*fprintf( stderr, "in [%s] out [%s] should be [%s]\n", in, str, expected );*/
fprintf( stderr, "in [%s] out [%s] should be [%s]\n", in, str, expected );
ok = expected ? !strcmp( expected, str ) : !str;
tr_free( str );
return ok;
@ -46,7 +46,7 @@ test_acl( void )
check( testWildcard( "192.64.*.*", "192.64.0.0/16" ) );
check( testWildcard( "192.64.0.*", "192.64.0.0/24" ) );
check( testWildcard( "192.64.0.1", "192.64.0.1/32" ) );
check( testWildcard( "+192.*.*.*, -192.64.*.*", "+192.0.0.0/8, -192.64.0.0/16" ) );
check( testWildcard( "+192.*.*.*,-192.64.*.*", "+192.0.0.0/8,-192.64.0.0/16" ) );
err = tr_rpcTestACL( NULL, "+192.*.*.*", &errmsg );
check( !err );
@ -56,7 +56,7 @@ test_acl( void )
check( errmsg );
tr_free( errmsg );
errmsg = NULL;
err = tr_rpcTestACL( NULL, "+192.*.*.*, -192.168.*.*", &errmsg );
err = tr_rpcTestACL( NULL, "+192.*.*.*,-192.168.*.*", &errmsg );
check( !err );
check( !errmsg );