diff options
Diffstat (limited to 'ot_accesslist.c')
| -rw-r--r-- | ot_accesslist.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ot_accesslist.c b/ot_accesslist.c index 4b88c40..8e9afdc 100644 --- a/ot_accesslist.c +++ b/ot_accesslist.c | |||
| @@ -129,8 +129,8 @@ static void accesslist_readfile(void) { | |||
| 129 | 129 | ||
| 130 | /* We do ignore anything that is not of the form "^[:xdigit:]{40}[^:xdigit:].*" */ | 130 | /* We do ignore anything that is not of the form "^[:xdigit:]{40}[^:xdigit:].*" */ |
| 131 | while (read_offs <= map_end) { | 131 | while (read_offs <= map_end) { |
| 132 | int i; | 132 | size_t i; |
| 133 | for (i = 0; i < (int)sizeof(ot_hash); ++i) { | 133 | for (i = 0; i < sizeof(ot_hash); ++i) { |
| 134 | int eger1 = scan_fromhex((unsigned char)read_offs[2 * i]); | 134 | int eger1 = scan_fromhex((unsigned char)read_offs[2 * i]); |
| 135 | int eger2 = scan_fromhex((unsigned char)read_offs[1 + 2 * i]); | 135 | int eger2 = scan_fromhex((unsigned char)read_offs[1 + 2 * i]); |
| 136 | if (eger1 < 0 || eger2 < 0) | 136 | if (eger1 < 0 || eger2 < 0) |
| @@ -197,7 +197,7 @@ int accesslist_hashisvalid(ot_hash hash) { | |||
| 197 | 197 | ||
| 198 | /* If we found a matching hash on the main list, scan the list of dynamically deleted hashes */ | 198 | /* If we found a matching hash on the main list, scan the list of dynamically deleted hashes */ |
| 199 | accesslist_delete = g_accesslist_delete; | 199 | accesslist_delete = g_accesslist_delete; |
| 200 | if ((exactmatch != NULL) && accesslist_delete && bsearch(hash, accesslist_add->list, accesslist_add->size, OT_HASH_COMPARE_SIZE, vector_compare_hash)) | 200 | if ((exactmatch != NULL) && accesslist_delete && bsearch(hash, accesslist_delete->list, accesslist_delete->size, OT_HASH_COMPARE_SIZE, vector_compare_hash)) |
| 201 | exactmatch = NULL; | 201 | exactmatch = NULL; |
| 202 | #endif | 202 | #endif |
| 203 | 203 | ||
| @@ -262,7 +262,7 @@ static void *accesslist_adddel_worker(char *fifoname, ot_accesslist *_Atomic | |||
| 262 | 262 | ||
| 263 | while ((linelen = getline(&line, &linecap, fifo)) > 0) { | 263 | while ((linelen = getline(&line, &linecap, fifo)) > 0) { |
| 264 | ot_hash info_hash; | 264 | ot_hash info_hash; |
| 265 | int i; | 265 | size_t i; |
| 266 | 266 | ||
| 267 | printf("Got line %*s", (int)linelen, line); | 267 | printf("Got line %*s", (int)linelen, line); |
| 268 | /* We do ignore anything that is not of the form "^[:xdigit:]{40}[^:xdigit:].*" | 268 | /* We do ignore anything that is not of the form "^[:xdigit:]{40}[^:xdigit:].*" |
| @@ -270,7 +270,7 @@ static void *accesslist_adddel_worker(char *fifoname, ot_accesslist *_Atomic | |||
| 270 | if (linelen < 41) | 270 | if (linelen < 41) |
| 271 | continue; | 271 | continue; |
| 272 | 272 | ||
| 273 | for (i = 0; i < (int)sizeof(ot_hash); ++i) { | 273 | for (i = 0; i < sizeof(ot_hash); ++i) { |
| 274 | int eger1 = scan_fromhex((unsigned char)line[2 * i]); | 274 | int eger1 = scan_fromhex((unsigned char)line[2 * i]); |
| 275 | int eger2 = scan_fromhex((unsigned char)line[1 + 2 * i]); | 275 | int eger2 = scan_fromhex((unsigned char)line[1 + 2 * i]); |
| 276 | if (eger1 < 0 || eger2 < 0) | 276 | if (eger1 < 0 || eger2 < 0) |
| @@ -342,7 +342,7 @@ static void *accesslist_deleter_worker(void *args) { | |||
| 342 | #endif | 342 | #endif |
| 343 | 343 | ||
| 344 | static pthread_t thread_id; | 344 | static pthread_t thread_id; |
| 345 | void accesslist_init() { | 345 | void accesslist_init(void) { |
| 346 | pthread_mutex_init(&g_accesslist_mutex, NULL); | 346 | pthread_mutex_init(&g_accesslist_mutex, NULL); |
| 347 | pthread_create(&thread_id, NULL, accesslist_worker, NULL); | 347 | pthread_create(&thread_id, NULL, accesslist_worker, NULL); |
| 348 | #ifdef WANT_DYNAMIC_ACCESSLIST | 348 | #ifdef WANT_DYNAMIC_ACCESSLIST |
| @@ -444,7 +444,7 @@ void loglist_add_network(const ot_net *net) { | |||
| 444 | pthread_mutex_unlock(&g_lognets_list_mutex); | 444 | pthread_mutex_unlock(&g_lognets_list_mutex); |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | void loglist_reset() { | 447 | void loglist_reset(void) { |
| 448 | pthread_mutex_lock(&g_lognets_list_mutex); | 448 | pthread_mutex_lock(&g_lognets_list_mutex); |
| 449 | free(g_lognets_list.data); | 449 | free(g_lognets_list.data); |
| 450 | g_lognets_list.data = 0; | 450 | g_lognets_list.data = 0; |
| @@ -511,7 +511,7 @@ int proxylist_check_proxy(const ot_ip6 proxy, const ot_ip6 address) { | |||
| 511 | 511 | ||
| 512 | static ot_net g_admin_nets[OT_ADMINIP_MAX]; | 512 | static ot_net g_admin_nets[OT_ADMINIP_MAX]; |
| 513 | static ot_permissions g_admin_nets_permissions[OT_ADMINIP_MAX]; | 513 | static ot_permissions g_admin_nets_permissions[OT_ADMINIP_MAX]; |
| 514 | static unsigned int g_admin_nets_count = 0; | 514 | static size_t g_admin_nets_count = 0; |
| 515 | 515 | ||
| 516 | int accesslist_bless_net(ot_net *net, ot_permissions permissions) { | 516 | int accesslist_bless_net(ot_net *net, ot_permissions permissions) { |
| 517 | if (g_admin_nets_count >= OT_ADMINIP_MAX) | 517 | if (g_admin_nets_count >= OT_ADMINIP_MAX) |
| @@ -553,7 +553,7 @@ int accesslist_bless_net(ot_net *net, ot_permissions permissions) { | |||
| 553 | } | 553 | } |
| 554 | 554 | ||
| 555 | int accesslist_is_blessed(ot_ip6 ip, ot_permissions permissions) { | 555 | int accesslist_is_blessed(ot_ip6 ip, ot_permissions permissions) { |
| 556 | unsigned int i; | 556 | size_t i; |
| 557 | for (i = 0; i < g_admin_nets_count; ++i) | 557 | for (i = 0; i < g_admin_nets_count; ++i) |
| 558 | if (address_in_net(ip, g_admin_nets + i) && (g_admin_nets_permissions[i] & permissions)) | 558 | if (address_in_net(ip, g_admin_nets + i) && (g_admin_nets_permissions[i] & permissions)) |
| 559 | return 1; | 559 | return 1; |
