1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

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 );