libunbound.c (266114) | libunbound.c (276605) |
---|---|
1/* 2 * unbound.c - unbound validating resolver public API implementation 3 * 4 * Copyright (c) 2007, NLnet Labs. All rights reserved. 5 * 6 * This software is open source. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 349 unchanged lines hidden (view full) --- 358 lock_basic_unlock(&ctx->cfglock); 359 free(dup); 360 return UB_NOMEM; 361 } 362 lock_basic_unlock(&ctx->cfglock); 363 return UB_NOERROR; 364} 365 | 1/* 2 * unbound.c - unbound validating resolver public API implementation 3 * 4 * Copyright (c) 2007, NLnet Labs. All rights reserved. 5 * 6 * This software is open source. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 349 unchanged lines hidden (view full) --- 358 lock_basic_unlock(&ctx->cfglock); 359 free(dup); 360 return UB_NOMEM; 361 } 362 lock_basic_unlock(&ctx->cfglock); 363 return UB_NOERROR; 364} 365 |
366int ub_ctx_add_ta_autr(struct ub_ctx* ctx, const char* fname) 367{ 368 char* dup = strdup(fname); 369 if(!dup) return UB_NOMEM; 370 lock_basic_lock(&ctx->cfglock); 371 if(ctx->finalized) { 372 lock_basic_unlock(&ctx->cfglock); 373 free(dup); 374 return UB_AFTERFINAL; 375 } 376 if(!cfg_strlist_insert(&ctx->env->cfg->auto_trust_anchor_file_list, 377 dup)) { 378 lock_basic_unlock(&ctx->cfglock); 379 free(dup); 380 return UB_NOMEM; 381 } 382 lock_basic_unlock(&ctx->cfglock); 383 return UB_NOERROR; 384} 385 |
|
366int 367ub_ctx_trustedkeys(struct ub_ctx* ctx, const char* fname) 368{ 369 char* dup = strdup(fname); 370 if(!dup) return UB_NOMEM; 371 lock_basic_lock(&ctx->cfglock); 372 if(ctx->finalized) { 373 lock_basic_unlock(&ctx->cfglock); --- 580 unchanged lines hidden (view full) --- 954 if(strncmp(parse, "nameserver", 10) == 0) { 955 numserv++; 956 parse += 10; /* skip 'nameserver' */ 957 /* skip whitespace */ 958 while(*parse == ' ' || *parse == '\t') 959 parse++; 960 addr = parse; 961 /* skip [0-9a-fA-F.:]*, i.e. IP4 and IP6 address */ | 386int 387ub_ctx_trustedkeys(struct ub_ctx* ctx, const char* fname) 388{ 389 char* dup = strdup(fname); 390 if(!dup) return UB_NOMEM; 391 lock_basic_lock(&ctx->cfglock); 392 if(ctx->finalized) { 393 lock_basic_unlock(&ctx->cfglock); --- 580 unchanged lines hidden (view full) --- 974 if(strncmp(parse, "nameserver", 10) == 0) { 975 numserv++; 976 parse += 10; /* skip 'nameserver' */ 977 /* skip whitespace */ 978 while(*parse == ' ' || *parse == '\t') 979 parse++; 980 addr = parse; 981 /* skip [0-9a-fA-F.:]*, i.e. IP4 and IP6 address */ |
962 while(isxdigit(*parse) || *parse=='.' || *parse==':') | 982 while(isxdigit((unsigned char)*parse) || *parse=='.' || *parse==':') |
963 parse++; 964 /* terminate after the address, remove newline */ 965 *parse = 0; 966 967 if((r = ub_ctx_set_fwd(ctx, addr)) != UB_NOERROR) { 968 fclose(in); 969 return r; 970 } --- 55 unchanged lines hidden (view full) --- 1026 parse=buf; 1027 while(*parse == ' ' || *parse == '\t') 1028 parse++; 1029 if(*parse == '#') 1030 continue; /* skip comment */ 1031 /* format: <addr> spaces <name> spaces <name> ... */ 1032 addr = parse; 1033 /* skip addr */ | 983 parse++; 984 /* terminate after the address, remove newline */ 985 *parse = 0; 986 987 if((r = ub_ctx_set_fwd(ctx, addr)) != UB_NOERROR) { 988 fclose(in); 989 return r; 990 } --- 55 unchanged lines hidden (view full) --- 1046 parse=buf; 1047 while(*parse == ' ' || *parse == '\t') 1048 parse++; 1049 if(*parse == '#') 1050 continue; /* skip comment */ 1051 /* format: <addr> spaces <name> spaces <name> ... */ 1052 addr = parse; 1053 /* skip addr */ |
1034 while(isxdigit(*parse) || *parse == '.' || *parse == ':') | 1054 while(isxdigit((unsigned char)*parse) || *parse == '.' || *parse == ':') |
1035 parse++; 1036 if(*parse == '\n' || *parse == 0) 1037 continue; 1038 if(*parse == '%') 1039 continue; /* ignore macOSX fe80::1%lo0 localhost */ 1040 if(*parse != ' ' && *parse != '\t') { 1041 /* must have whitespace after address */ 1042 fclose(in); --- 185 unchanged lines hidden --- | 1055 parse++; 1056 if(*parse == '\n' || *parse == 0) 1057 continue; 1058 if(*parse == '%') 1059 continue; /* ignore macOSX fe80::1%lo0 localhost */ 1060 if(*parse != ' ' && *parse != '\t') { 1061 /* must have whitespace after address */ 1062 fclose(in); --- 185 unchanged lines hidden --- |