resolve.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2009, 2012-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#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);
}