summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2008-10-05 12:28:57 +0000
committererdgeist <>2008-10-05 12:28:57 +0000
commit01c9c3695ccc098384422545ac1c11568a416871 (patch)
tree67a63c230ac57ebc44a620850ae52d6b06a3be47
parenteac898afd82b6400cefd0466073c31a734ee1fdb (diff)
Enabled debug output, fixed blessed ip permissions
-rw-r--r--ot_accesslist.c10
-rw-r--r--ot_accesslist.h12
2 files changed, 14 insertions, 8 deletions
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( ) {
95 signal( SIGHUP, accesslist_readfile ); 95 signal( SIGHUP, accesslist_readfile );
96 } 96 }
97} 97}
98
99#endif 98#endif
100 99
101static uint32_t g_adminip_addresses[OT_ADMINIP_MAX]; 100static uint32_t g_adminip_addresses[OT_ADMINIP_MAX];
@@ -107,7 +106,14 @@ int accesslist_blessip( char *ip, ot_permissions permissions ) {
107 return -1; 106 return -1;
108 memmove( g_adminip_addresses + g_adminip_count, ip, 4 ); 107 memmove( g_adminip_addresses + g_adminip_count, ip, 4 );
109 g_adminip_permissions[ g_adminip_count++ ] = permissions; 108 g_adminip_permissions[ g_adminip_count++ ] = permissions;
110// 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 ); 109#ifdef _DEBUG
110 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]);
111 if( permissions & OT_PERMISSION_MAY_STAT ) fputs( " may_fetch_stats", stderr );
112 if( permissions & OT_PERMISSION_MAY_SYNC ) fputs( " may_sync_batch", stderr );
113 if( permissions & OT_PERMISSION_MAY_LIVESYNC ) fputs( " may_sync_live", stderr );
114 if( permissions & OT_PERMISSION_MAY_FULLSCRAPE ) fputs( " may_fetch_fullscrapes", stderr );
115 if( !permissions ) fputs(" nothing.\n", stderr); else fputs(".\n", stderr );
116#endif
111 return 0; 117 return 0;
112} 118}
113 119
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;
23#endif 23#endif
24 24
25typedef enum { 25typedef enum {
26 OT_PERMISSION_MAY_FULLSCRAPE, 26 OT_PERMISSION_MAY_FULLSCRAPE = 0x1,
27 OT_PERMISSION_MAY_SYNC, 27 OT_PERMISSION_MAY_SYNC = 0x2,
28 OT_PERMISSION_MAY_STAT, 28 OT_PERMISSION_MAY_STAT = 0x4,
29 OT_PERMISSION_MAY_LIVESYNC 29 OT_PERMISSION_MAY_LIVESYNC = 0x8
30} ot_permissions; 30} ot_permissions;
31 31
32int accesslist_blessip( char * ip, ot_permissions permissions ); 32int accesslist_blessip( char * ip, ot_permissions permissions );
33int accesslist_isblessed( char * ip, ot_permissions permissions ); 33int accesslist_isblessed( char * ip, ot_permissions permissions );
34 34
35#endif 35#endif