Browse Source

Enabled debug output, fixed blessed ip permissions

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

10
ot_accesslist.c

@ -95,7 +95,6 @@ void accesslist_init( ) { @@ -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 ) { @@ -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;
}

8
ot_accesslist.h

@ -23,10 +23,10 @@ extern char *g_accesslist_filename; @@ -23,10 +23,10 @@ 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 );

Loading…
Cancel
Save