unbound-host.c (266114) | unbound-host.c (276605) |
---|---|
1/* 2 * checkconf/unbound-host.c - replacement for host that supports validation. 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 --- 71 unchanged lines hidden (view full) --- 80 printf(" Queries the DNS for information.\n"); 81 printf(" The hostname is looked up for IP4, IP6 and mail.\n"); 82 printf(" If an ip-address is given a reverse lookup is done.\n"); 83 printf(" Use the -v option to see DNSSEC security information.\n"); 84 printf(" -t type what type to look for.\n"); 85 printf(" -c class what class to look for, if not class IN.\n"); 86 printf(" -y 'keystring' specify trust anchor, DS or DNSKEY, like\n"); 87 printf(" -y 'example.com DS 31560 5 1 1CFED8478...'\n"); | 1/* 2 * checkconf/unbound-host.c - replacement for host that supports validation. 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 --- 71 unchanged lines hidden (view full) --- 80 printf(" Queries the DNS for information.\n"); 81 printf(" The hostname is looked up for IP4, IP6 and mail.\n"); 82 printf(" If an ip-address is given a reverse lookup is done.\n"); 83 printf(" Use the -v option to see DNSSEC security information.\n"); 84 printf(" -t type what type to look for.\n"); 85 printf(" -c class what class to look for, if not class IN.\n"); 86 printf(" -y 'keystring' specify trust anchor, DS or DNSKEY, like\n"); 87 printf(" -y 'example.com DS 31560 5 1 1CFED8478...'\n"); |
88 printf(" -D DNSSEC enable with default root anchor\n"); 89 printf(" from %s\n", ROOT_ANCHOR_FILE); |
|
88 printf(" -f keyfile read trust anchors from file, with lines as -y.\n"); 89 printf(" -F keyfile read named.conf-style trust anchors.\n"); 90 printf(" -C config use the specified unbound.conf (none read by default)\n"); 91 printf(" -r read forwarder information from /etc/resolv.conf\n"); 92 printf(" breaks validation if the fwder does not do DNSSEC.\n"); 93 printf(" -v be more verbose, shows nodata and security.\n"); 94 printf(" -d debug, traces the action, -d -d shows more.\n"); 95 printf(" -4 use ipv4 network, avoid ipv6.\n"); --- 306 unchanged lines hidden (view full) --- 402 } 403} 404 405/** getopt global, in case header files fail to declare it. */ 406extern int optind; 407/** getopt global, in case header files fail to declare it. */ 408extern char* optarg; 409 | 90 printf(" -f keyfile read trust anchors from file, with lines as -y.\n"); 91 printf(" -F keyfile read named.conf-style trust anchors.\n"); 92 printf(" -C config use the specified unbound.conf (none read by default)\n"); 93 printf(" -r read forwarder information from /etc/resolv.conf\n"); 94 printf(" breaks validation if the fwder does not do DNSSEC.\n"); 95 printf(" -v be more verbose, shows nodata and security.\n"); 96 printf(" -d debug, traces the action, -d -d shows more.\n"); 97 printf(" -4 use ipv4 network, avoid ipv6.\n"); --- 306 unchanged lines hidden (view full) --- 404 } 405} 406 407/** getopt global, in case header files fail to declare it. */ 408extern int optind; 409/** getopt global, in case header files fail to declare it. */ 410extern char* optarg; 411 |
410/** Main routine for checkconf */ | 412/** Main routine for unbound-host */ |
411int main(int argc, char* argv[]) 412{ 413 int c; 414 char* qclass = NULL; 415 char* qtype = NULL; 416 struct ub_ctx* ctx = NULL; 417 int debuglevel = 0; 418 419 ctx = ub_ctx_create(); 420 if(!ctx) { 421 fprintf(stderr, "error: out of memory\n"); 422 exit(1); 423 } | 413int main(int argc, char* argv[]) 414{ 415 int c; 416 char* qclass = NULL; 417 char* qtype = NULL; 418 struct ub_ctx* ctx = NULL; 419 int debuglevel = 0; 420 421 ctx = ub_ctx_create(); 422 if(!ctx) { 423 fprintf(stderr, "error: out of memory\n"); 424 exit(1); 425 } |
426 /* no need to fetch additional targets, we only do few lookups */ 427 check_ub_res(ub_ctx_set_option(ctx, "target-fetch-policy:", "0 0 0 0 0")); |
|
424 425 /* parse the options */ | 428 429 /* parse the options */ |
426 while( (c=getopt(argc, argv, "46F:c:df:hrt:vy:C:")) != -1) { | 430 while( (c=getopt(argc, argv, "46DF:c:df:hrt:vy:C:")) != -1) { |
427 switch(c) { 428 case '4': 429 check_ub_res(ub_ctx_set_option(ctx, "do-ip6:", "no")); 430 break; 431 case '6': 432 check_ub_res(ub_ctx_set_option(ctx, "do-ip4:", "no")); 433 break; 434 case 'c': 435 qclass = optarg; 436 break; 437 case 'C': 438 check_ub_res(ub_ctx_config(ctx, optarg)); 439 break; | 431 switch(c) { 432 case '4': 433 check_ub_res(ub_ctx_set_option(ctx, "do-ip6:", "no")); 434 break; 435 case '6': 436 check_ub_res(ub_ctx_set_option(ctx, "do-ip4:", "no")); 437 break; 438 case 'c': 439 qclass = optarg; 440 break; 441 case 'C': 442 check_ub_res(ub_ctx_config(ctx, optarg)); 443 break; |
444 case 'D': 445 check_ub_res(ub_ctx_add_ta_file(ctx, ROOT_ANCHOR_FILE)); 446 break; |
|
440 case 'd': 441 debuglevel++; 442 if(debuglevel < 2) 443 debuglevel = 2; /* at least VERB_DETAIL */ 444 break; 445 case 'r': 446 check_ub_res(ub_ctx_resolvconf(ctx, "/etc/resolv.conf")); 447 break; --- 43 unchanged lines hidden --- | 447 case 'd': 448 debuglevel++; 449 if(debuglevel < 2) 450 debuglevel = 2; /* at least VERB_DETAIL */ 451 break; 452 case 'r': 453 check_ub_res(ub_ctx_resolvconf(ctx, "/etc/resolv.conf")); 454 break; --- 43 unchanged lines hidden --- |