Browse Source

Enabled debug output, fixed blessed ip permissions

dynamic-accesslists
erdgeist 16 years ago
parent
commit
01c9c3695c
  1. 10
      ot_accesslist.c
  2. 12
      ot_accesslist.h

10
ot_accesslist.c

@ -95,7 +95,6 @@ void accesslist_init( ) {
signal( SIGHUP, accesslist_readfile ); signal( SIGHUP, accesslist_readfile );
} }
} }
#endif #endif
static uint32_t g_adminip_addresses[OT_ADMINIP_MAX]; static uint32_t g_adminip_addresses[OT_ADMINIP_MAX];
@ -107,7 +106,14 @@ int accesslist_blessip( char *ip, ot_permissions permissions ) {
return -1; return -1;
memmove( g_adminip_addresses + g_adminip_count, ip, 4 ); memmove( g_adminip_addresses + g_adminip_count, ip, 4 );
g_adminip_permissions[ g_adminip_count++ ] = permissions; 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; return 0;
} }

12
ot_accesslist.h

@ -23,13 +23,13 @@ extern char *g_accesslist_filename;
#endif #endif
typedef enum { typedef enum {
OT_PERMISSION_MAY_FULLSCRAPE, OT_PERMISSION_MAY_FULLSCRAPE = 0x1,
OT_PERMISSION_MAY_SYNC, OT_PERMISSION_MAY_SYNC = 0x2,
OT_PERMISSION_MAY_STAT, OT_PERMISSION_MAY_STAT = 0x4,
OT_PERMISSION_MAY_LIVESYNC OT_PERMISSION_MAY_LIVESYNC = 0x8
} ot_permissions; } ot_permissions;
int accesslist_blessip( char * ip, ot_permissions permissions ); int accesslist_blessip( char * ip, ot_permissions permissions );
int accesslist_isblessed( char * ip, ot_permissions permissions ); int accesslist_isblessed( char * ip, ot_permissions permissions );
#endif #endif

Loading…
Cancel
Save