diff --git a/ot_accesslist.c b/ot_accesslist.c index cebb064..412c539 100644 --- a/ot_accesslist.c +++ b/ot_accesslist.c @@ -95,7 +95,6 @@ void accesslist_init( ) { signal( SIGHUP, accesslist_readfile ); } } - #endif static uint32_t g_adminip_addresses[OT_ADMINIP_MAX]; @@ -107,7 +106,14 @@ int accesslist_blessip( char *ip, ot_permissions permissions ) { return -1; memmove( g_adminip_addresses + g_adminip_count, ip, 4 ); g_adminip_permissions[ g_adminip_count++ ] = permissions; -// fprintf( stderr, "Blessing ip address %d.%d.%d.%d with %02x\n", (uint8_t)ip[0], (uint8_t)ip[1], (uint8_t)ip[2], (uint8_t)ip[3], permissions ); +#ifdef _DEBUG + fprintf( stderr, "Blessing ip address %d.%d.%d.%d with:", (uint8_t)ip[0], (uint8_t)ip[1], (uint8_t)ip[2], (uint8_t)ip[3]); + if( permissions & OT_PERMISSION_MAY_STAT ) fputs( " may_fetch_stats", stderr ); + if( permissions & OT_PERMISSION_MAY_SYNC ) fputs( " may_sync_batch", stderr ); + if( permissions & OT_PERMISSION_MAY_LIVESYNC ) fputs( " may_sync_live", stderr ); + if( permissions & OT_PERMISSION_MAY_FULLSCRAPE ) fputs( " may_fetch_fullscrapes", stderr ); + if( !permissions ) fputs(" nothing.\n", stderr); else fputs(".\n", stderr ); +#endif return 0; } diff --git a/ot_accesslist.h b/ot_accesslist.h index 2783b3c..5d163c2 100644 --- a/ot_accesslist.h +++ b/ot_accesslist.h @@ -23,13 +23,13 @@ extern char *g_accesslist_filename; #endif typedef enum { - OT_PERMISSION_MAY_FULLSCRAPE, - OT_PERMISSION_MAY_SYNC, - OT_PERMISSION_MAY_STAT, - OT_PERMISSION_MAY_LIVESYNC + OT_PERMISSION_MAY_FULLSCRAPE = 0x1, + OT_PERMISSION_MAY_SYNC = 0x2, + OT_PERMISSION_MAY_STAT = 0x4, + OT_PERMISSION_MAY_LIVESYNC = 0x8 } ot_permissions; -int accesslist_blessip( char * ip, ot_permissions permissions ); -int accesslist_isblessed( char * ip, ot_permissions permissions ); +int accesslist_blessip( char * ip, ot_permissions permissions ); +int accesslist_isblessed( char * ip, ot_permissions permissions ); #endif