resolve.c revision 98922b2b2b024dcca25be7c220cf3b16b1e6c4b5
/*
* Copyright (C) 2009, 2012-2014 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <config.h>
#ifndef WIN32
#include <netdb.h>
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/commandline.h>
#include <isc/sockaddr.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/rdataset.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
static char *algname;
static isc_result_t
isc_region_t r;
char t[4096];
if (!dns_rdataset_isassociated(rdataset)) {
printf("[WARN: empty]\n");
return (ISC_R_SUCCESS);
}
isc_buffer_init(&target, t, sizeof(t));
&target);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_usedregion(&target, &r);
return (ISC_R_SUCCESS);
}
ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void
usage(void) {
"[[-a algorithm] [-e] -k keyname -K keystring] "
"[-S domain:serveraddr_for_domain ] [-s server_address]"
"[-b address[#port]] hostname\n");
exit(1);
}
static void
{
unsigned int namelen;
unsigned char keydata[4096];
unsigned char rrdata[4096];
isc_buffer_t b;
isc_region_t r;
if (result != ISC_R_SUCCESS) {
exit(1);
}
if (result != ISC_R_SUCCESS) {
exit(1);
}
} else
if (is_sep)
if (result != ISC_R_SUCCESS) {
exit(1);
}
isc_buffer_usedregion(&keydatabuf, &r);
if (result != ISC_R_SUCCESS) {
exit(1);
}
isc_buffer_add(&b, namelen);
if (result != ISC_R_SUCCESS) {
exit(1);
}
if (result != ISC_R_SUCCESS) {
exit(1);
}
}
static void
const char *namespace)
{
int gai_error;
unsigned int namelen;
isc_buffer_t b;
if (gai_error != 0) {
exit(1);
}
isc_buffer_add(&b, namelen);
if (result != ISC_R_SUCCESS) {
result);
exit(1);
}
}
&servers);
if (result != ISC_R_SUCCESS) {
exit(1);
}
}
int
int ch;
char *altserveraddr = NULL;
char *altservername = NULL;
char *keynamestr = NULL;
isc_buffer_t b;
unsigned int namelen;
const char *port = "53";
"a:b:es:t:k:K:p:S:")) != -1) {
switch (ch) {
case 't':
if (result != ISC_R_SUCCESS) {
"invalid RRtype: %s\n",
exit(1);
}
break;
case 'a':
break;
case 'b':
"address per family "
"can be specified\n");
exit(1);
}
&in6) == 1) {
"address per family "
"can be specified\n");
exit(1);
}
} else {
exit(1);
}
break;
case 'e':
break;
case 'S':
"already defined: %s\n",
exit(1);
}
break;
case 's':
"already defined: %s\n",
server);
exit(1);
}
break;
case 'k':
break;
case 'K':
break;
case 'p':
break;
default:
usage();
}
}
if (argc < 1)
usage();
char *cp;
exit(1);
}
*cp = '\0';
}
result = dns_lib_init();
if (result != ISC_R_SUCCESS) {
exit(1);
}
if (result != ISC_R_SUCCESS) {
exit(1);
}
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
clientopt = 0;
if (result != ISC_R_SUCCESS) {
exit(1);
}
/* Set the nameserver */
result);
exit(1);
}
NULL, nameservers);
if (result != ISC_R_SUCCESS) {
result);
exit(1);
}
} else {
}
/* Set the alternate nameserver (when specified) */
/* Install DNSSEC key (if given) */
if (keynamestr != NULL) {
"key string is missing "
"while key name is provided\n");
exit(1);
}
}
/* Construct qname */
isc_buffer_add(&b, namelen);
if (result != ISC_R_SUCCESS)
/* Perform resolution */
if (keynamestr == NULL)
if (result != ISC_R_SUCCESS) {
}
}
}
/* Cleanup */
if (keynamestr != NULL)
return (0);
}