Browse Source

Enabled debug output, fixed blessed ip permissions

master
Dirk Engling 13 years ago
parent
commit
3abbbe9d78
  1. 12
      ot_accesslist.c
  2. 12
      ot_accesslist.h

12
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;
}
@ -119,4 +125,4 @@ int accesslist_isblessed( char *ip, ot_permissions permissions ) {
return 0;
}
const char *g_version_accesslist_c = "$Source: /home/cvsroot/opentracker/ot_accesslist.c,v $: $Revision: 1.6 $\n";
const char *g_version_accesslist_c = "$Source: /home/cvsroot/opentracker/ot_accesslist.c,v $: $Revision: 1.7 $\n";

12
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
Loading…
Cancel
Save