dighost.c revision 92d23165938a5e595f80b2e3fb5d8cb918ac7dac
70e5a7403f0e0a3bd292b8287c5fed5772c15270Automatic Updater * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Copyright (C) 2000-2003 Internet Software Consortium.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Permission to use, copy, modify, and distribute this software for any
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * purpose with or without fee is hereby granted, provided that the above
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * copyright notice and this permission notice appear in all copies.
0c865fa57d3b9b072c2878b09fad17c732be2eb9Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
0c865fa57d3b9b072c2878b09fad17c732be2eb9Mark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
0c865fa57d3b9b072c2878b09fad17c732be2eb9Mark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
0c865fa57d3b9b072c2878b09fad17c732be2eb9Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
0c865fa57d3b9b072c2878b09fad17c732be2eb9Mark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
0c865fa57d3b9b072c2878b09fad17c732be2eb9Mark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * PERFORMANCE OF THIS SOFTWARE.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉/* $Id: dighost.c,v 1.296 2006/12/07 01:21:04 marka Exp $ */
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Notice to programmers: Do not use this code as an example of how to
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * use the ISC library to perform DNS lookups. Dig and Host both operate
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * on the request level, since they allow fine-tuning of output and are
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * intended as debugging tools. As a result, they perform many of the
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * functions which could be better handled using the dns_resolver
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * functions in most applications.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉unsigned int timeout = 0;
0d8971a4b8abed599ec9d9b7d1b51b8de8038ce2Shane Kerrstatic void initialize_idn(void);
602784c4ceb4f36f614afe5da80c7964eb9a766cShane Kerrstatic isc_result_t output_filter(isc_buffer_t *buffer,
0d8971a4b8abed599ec9d9b7d1b51b8de8038ce2Shane Kerr unsigned int used_org,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉static idn_result_t append_textname(char *name, const char *origin,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉static void idn_check_result(idn_result_t r, const char *msg);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 *\li 0 Everything went well, including things like NXDOMAIN
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 *\li 1 Usage error
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 *\li 7 Got too many RR's or Names
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 *\li 8 Couldn't open batch file
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 *\li 9 No reply from server
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 *\li 10 Internal error
0d8971a4b8abed599ec9d9b7d1b51b8de8038ce2Shane Kerrunsigned int digestbits = 0;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t get_trusted_key(isc_mem_t *mctx);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉dns_rdataset_t * sigchase_scanname(dns_rdatatype_t type,
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉dns_rdataset_t * chase_scanname_section(dns_message_t *msg,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t advanced_rrsearch(dns_rdataset_t **rdataset,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t sigchase_verify_sig_key(dns_name_t *name,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t sigchase_verify_sig(dns_name_t *name,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t sigchase_verify_ds(dns_name_t *name,
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉void print_rdata(dns_rdata_t *rdata, isc_mem_t *mctx);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_rdataset_t *rdataset, isc_mem_t *mctx);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉void dup_name(dns_name_t *source, dns_name_t* target,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉void free_name(dns_name_t *name, isc_mem_t *mctx);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉void dump_database_section(dns_message_t *msg, int section);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉dns_rdataset_t * search_type(dns_name_t *name, dns_rdatatype_t type,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t contains_trusted_key(dns_name_t *name,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t prove_nx_domain(dns_message_t * msg,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t prove_nx_type(dns_message_t * msg, dns_name_t *name,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t prove_nx(dns_message_t * msg, dns_name_t * name,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉static void nameFromString(const char *str, dns_name_t *p_ret);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉int inf_name(dns_name_t * name1, dns_name_t * name2);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t opentmpkey(isc_mem_t *mctx, const char *file,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t removetmpkey(isc_mem_t *mctx, const char *file);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t getneededrr(dns_message_t *msg);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉void sigchase_bottom_up(dns_message_t *msg);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t initialization(dns_name_t *name);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t prepare_lookup(dns_name_t *name);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t grandfather_pb_test(dns_name_t * zone_name,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_result_t child_of_zone(dns_name_t *name,
0d8971a4b8abed599ec9d9b7d1b51b8de8038ce2Shane Kerr * the current name is the parent name when we follow delegation
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * the child name is used for delegation (NS DS responses in AUTHORITY section)
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_boolean_t chase_siglookedup = ISC_FALSE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_boolean_t chase_keylookedup = ISC_FALSE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_boolean_t chase_sigkeylookedup = ISC_FALSE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_boolean_t chase_dslookedup = ISC_FALSE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_boolean_t chase_sigdslookedup = ISC_FALSE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_boolean_t chase_nslookedup = ISC_FALSE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_boolean_t delegation_follow = ISC_FALSE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉isc_boolean_t have_delegation_ns = ISC_FALSE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉ISC_LIST(dig_message_t) chase_message_list;
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉ISC_LIST(dig_message_t) chase_message_list2;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉struct_tk_list tk_list = { {NULL, NULL, NULL, NULL, NULL}, 0};
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 * Apply and clear locks at the event level in global task.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Can I get rid of these using shutdown events? XXX
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 debug("lock_lookup %s:%d", __FILE__, __LINE__);\
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(isc_mutex_lock((&lookup_lock)), "isc_mutex_lock");\
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 debug("unlock_lookup %s:%d", __FILE__, __LINE__);\
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(isc_mutex_unlock((&lookup_lock)),\
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 "isc_mutex_unlock");\
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉recv_done(isc_task_t *task, isc_event_t *event);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉connect_timeout(isc_task_t *task, isc_event_t *event);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉launch_next_query(dig_query_t *query, isc_boolean_t include_question);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉mem_free(void *arg, void *mem, size_t size) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉next_token(char **stringp, const char *delim) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 while (*s != '\0') {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 if (*s == '.')
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Append 'len' bytes of 'text' at '*p', failing with
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * ISC_R_NOSPACE if that would advance p past 'end'.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉append(const char *text, int len, char **p, char *end) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉reverse_octets(const char *in, char **p, char *end) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = reverse_octets(dot + 1, p, end);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int,
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 r = inet_pton(AF_INET6, value, &addr.type.in6);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 /* This is a valid IPv6 address. */
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 unsigned int options = 0;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_byaddr_createptrname2(&addr, options, name);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Not a valid IPv6 address. Assume IPv4.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * If 'strict' is not set, construct the
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * in-addr.arpa name by blindly reversing
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * octets whether or not they look like integers,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * so that this can be used for RFC2317 names
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 if (strict && inet_pton(AF_INET, value, &addr.type.in) != 1)
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 /* Append .in-addr.arpa. and a terminating NUL. */
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = append(".in-addr.arpa.", 15, &p, end);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉check_result(isc_result_t result, const char *msg) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 fatal("%s: %s", msg, isc_result_totext(result));
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Create a server structure, which is part of the lookup structure.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * This is little more than a linked list of servers to query in hopes
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * of finding the answer the user is looking for
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉make_server(const char *servname, const char *userarg) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 srv = isc_mem_allocate(mctx, sizeof(struct dig_server));
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 fatal("memory allocation failure in %s:%d",
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 strncpy(srv->servername, servname, MXNAME);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Create a copy of the server list from the lwres configuration structure.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * The dest list must have already had ISC_LIST_INIT applied.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉copy_server_list(lwres_conf_t *confdata, dig_serverlist_t *dest) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 af = addr2af(confdata->nameservers[i].family);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 lwres_net_ntop(af, confdata->nameservers[i].address,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 while (s != NULL) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 isc_sockaddr_t sockaddrs[DIG_MAX_ADDRESSES];
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = bind9_getaddresses(opt, 0, sockaddrs,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 fatal("couldn't get address for '%s': %s",
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 for (i = 0; i < count; i++) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 isc_netaddr_fromsockaddr(&netaddr, &sockaddrs[i]);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 isc_netaddr_format(&netaddr, tmp, sizeof(tmp));
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉add_nameserver(lwres_conf_t *confdata, const char *addr, int af) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 if (confdata->nsnext >= LWRES_CONFMAXNAMESERVERS)
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 confdata->nameservers[i].family = LWRES_ADDRTYPE_V4;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 confdata->nameservers[i].length = NS_INADDRSZ;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 confdata->nameservers[i].family = LWRES_ADDRTYPE_V6;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 confdata->nameservers[i].length = NS_IN6ADDRSZ;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 if (lwres_net_pton(af, addr, &confdata->nameservers[i].address) == 1) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Produce a cloned server list. The dest list must have already had
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * ISC_LIST_INIT applied.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉clone_server_list(dig_serverlist_t src, dig_serverlist_t *dest) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 newsrv = make_server(srv->servername, srv->userarg);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Create an empty lookup structure, which holds all the information needed
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * to get an answer to a user's question. This structure contains two
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * linked lists: the server list (servers to query) and the query list
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * (outstanding queries which have been made to the listed servers).
0d8971a4b8abed599ec9d9b7d1b51b8de8038ce2Shane Kerr looknew = isc_mem_allocate(mctx, sizeof(struct dig_lookup));
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->identify_previous_line = ISC_FALSE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->trace_root_sigchase = ISC_FALSE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->rdtype_sigchase = dns_rdatatype_any;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->qrdtype_sigchase = dns_rdatatype_any;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->rdclass_sigchase = dns_rdataclass_in;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->rdclass_sigchaseset = ISC_FALSE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Clone a lookup, perhaps copying the server list. This does not clone
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * the query list, since it will be regenerated by the setup_lookup()
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * function, nor does it queue up the new lookup for processing.
602784c4ceb4f36f614afe5da80c7964eb9a766cShane Kerr * Caution: If you don't clone the servers, you MUST clone the server
602784c4ceb4f36f614afe5da80c7964eb9a766cShane Kerr * list seperately from somewhere else, or construct it by hand.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
5597be9bb88de138dfec9fa9176708443813925eTatuya JINMEI 神明達哉 strncpy(looknew->textname, lookold->textname, MXNAME);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 strncpy(looknew->textnamesigchase, lookold->textnamesigchase, MXNAME);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 strncpy(looknew->cmdline, lookold->cmdline, MXNAME);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->rdclassset = lookold->rdclassset;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->ixfr_serial = lookold->ixfr_serial;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->trace_root = lookold->trace_root;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->identify_previous_line = lookold->identify_previous_line;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->servfail_stops = lookold->servfail_stops;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->besteffort = lookold->besteffort;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->do_topdown = lookold->do_topdown;
602784c4ceb4f36f614afe5da80c7964eb9a766cShane Kerr looknew->trace_root_sigchase = lookold->trace_root_sigchase;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->rdtype_sigchaseset = lookold->rdtype_sigchaseset;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->rdtype_sigchase = lookold->rdtype_sigchase;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->qrdtype_sigchase = lookold->qrdtype_sigchase;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->rdclass_sigchase = lookold->rdclass_sigchase;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->rdclass_sigchaseset = lookold->rdclass_sigchaseset;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->ns_search_only = lookold->ns_search_only;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->section_question = lookold->section_question;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->section_answer = lookold->section_answer;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->section_authority = lookold->section_authority;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew->section_additional = lookold->section_additional;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 clone_server_list(lookold->my_server_list,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Requeue a lookup for further processing, perhaps copying the server
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 * list. The new lookup structure is returned to the caller, and is
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 * queued for processing. If servers are not cloned in the requeue, they
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * must be added before allowing the current event to complete, since the
602784c4ceb4f36f614afe5da80c7964eb9a766cShane Kerr * completion of the event may result in the next entry on the lookup
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * queue getting run.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉requeue_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 looknew = clone_lookup(lookold, servers);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 debug("before insertion, init@%p -> %p, new@%p -> %p",
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 lookold, lookold->link.next, looknew, looknew->link.next);
602784c4ceb4f36f614afe5da80c7964eb9a766cShane Kerr debug("after insertion, init -> %p, new = %p, new -> %p",
602784c4ceb4f36f614afe5da80c7964eb9a766cShane Kerr unsigned char *secretstore;
602784c4ceb4f36f614afe5da80c7964eb9a766cShane Kerr result = isc_buffer_allocate(mctx, &namebuf, MXNAME);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 secretstore = isc_mem_allocate(mctx, secretsize);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 fatal("memory allocation failure in %s:%d",
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 isc_buffer_init(&secretbuf, secretstore, secretsize);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = isc_base64_decodestring(keysecret, &secretbuf);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 secretsize = isc_buffer_usedlength(&secretbuf);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_name_fromtext(&keyname, namebuf,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_tsigkey_create(&keyname, hmacname, secretstore,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 printf(";; Couldn't create key %s: %s\n",
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dst_key_fromnamedfile(keyfile, DST_TYPE_PRIVATE | DST_TYPE_KEY,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 fprintf(stderr, "Couldn't read key from %s: %s\n",
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 printf(";; Couldn't create key %s: bad algorithm\n",
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_tsigkey_createfromkey(dst_key_name(dstkey), hmacname,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 printf(";; Couldn't create key %s: %s\n",
9a7d202077fae00fbdca610d8a8d90689e30f331Mark Andrews search = isc_mem_allocate(mctx, sizeof(*search));
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 fatal("memory allocation failure in %s:%d",
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉create_search_list(lwres_conf_t *confdata) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 for (i = 0; i < confdata->searchnxt; i++) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 search = make_searchlist_entry(confdata->search[i]);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_APPEND(search_list, search, link);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Setup the system as a whole, reading key information and resolv.conf
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 lwresult = lwres_context_create(&lwctx, mctx, mem_alloc, mem_free, 1);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 lwresult = lwres_conf_parse(lwctx, RESOLV_CONF);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 if (lwresult != LWRES_R_SUCCESS && lwresult != LWRES_R_NOTFOUND)
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 fatal("parse of %s failed", RESOLV_CONF);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 /* Make the search list */
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 else { /* No search list. Use the domain name if any */
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 domain = make_searchlist_entry(lwconf->domainname);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_INITANDAPPEND(search_list, domain, link);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 /* If we don't find a nameserver fall back to localhost */
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 lwresult = add_nameserver(lwconf, "127.0.0.1", AF_INET);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 lwresult = add_nameserver(lwconf, "::1", AF_INET6);
18d0b5e54be891a1aa938c165b6d439859121ec8Mark Andrews else if (keysecret[0] != 0)
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 /* Setup the list of messages for +sigchase */
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_name_init(&chase_current_name, NULL);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_name_init(&chase_authority_name, NULL);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 while ((search = ISC_LIST_HEAD(search_list)) != NULL) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_UNLINK(search_list, search, link);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Override the search list derived from resolv.conf by 'domain'.
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 ISC_LIST_APPEND(search_list, search, link);
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 * Setup the ISC and DNS libraries for use by the system.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 fatal("can't find either v4 or v6 networking");
0d8971a4b8abed599ec9d9b7d1b51b8de8038ce2Shane Kerr result = isc_taskmgr_create(mctx, 1, 0, &taskmgr);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = isc_task_create(taskmgr, 0, &global_task);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = isc_timermgr_create(mctx, &timermgr);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "isc_timermgr_create");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = isc_socketmgr_create(mctx, &socketmgr);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "isc_socketmgr_create");
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 check_result(result, "isc_entropy_create");
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 result = isc_mempool_create(mctx, COMMSIZE, &commctx);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "isc_mempool_create");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 isc_mempool_setname(commctx, "COMMPOOL");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * 6 and 2 set as reasonable parameters for 3 or 4 nameserver
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Add EDNS0 option record to a message. Currently, the only supported
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * options are UDP buffer size and the DO bit.
0d8971a4b8abed599ec9d9b7d1b51b8de8038ce2Shane Kerradd_opt(dns_message_t *msg, isc_uint16_t udpsize, isc_uint16_t edns,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_gettemprdataset(msg, &rdataset);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "dns_message_gettemprdataset");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_gettemprdatalist(msg, &rdatalist);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "dns_message_gettemprdatalist");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_gettemprdata(msg, &rdata);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "dns_message_gettemprdata");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 debug("setting udp size of %d", udpsize);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_rdatalist_tordataset(rdatalist, rdataset);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_setopt(msg, rdataset);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "dns_message_setopt");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Add a question section to a message, asking for the specified name,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * type, and class.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉add_question(dns_message_t *message, dns_name_t *name,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_rdataclass_t rdclass, dns_rdatatype_t rdtype)
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_gettemprdataset(message, &rdataset);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "dns_message_gettemprdataset()");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_rdataset_makequestion(rdataset, rdclass, rdtype);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_APPEND(name->list, rdataset, link);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Check if we're done with all the queued lookups, which is true iff
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * all sockets, sends, and recvs are accounted for (counters == 0),
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * and the lookup list is empty.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * If we are done, pass control back out to dighost_shutdown() (which is
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * part of dig.c, host.c, or nslookup.c) to either shutdown the system as
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * a whole or reseed the lookup list.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 debug("list %s", ISC_LIST_EMPTY(lookup_list) ? "empty" : "full");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 if (ISC_LIST_EMPTY(lookup_list) && current_lookup == NULL &&
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Clear out a query when we're done with it. WARNING: This routine
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * WILL invalidate the query pointer.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 if (ISC_LINK_LINKED(&query->recvbuf, link))
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_DEQUEUE(query->recvlist, &query->recvbuf,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 if (ISC_LINK_LINKED(&query->lengthbuf, link))
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_DEQUEUE(query->lengthlist, &query->lengthbuf,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 isc_mempool_put(commctx, query->recvspace);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 isc_buffer_invalidate(&query->lengthbuf);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Try and clear out a lookup if we're done with it. Return ISC_TRUE if
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * the lookup was successfully cleared. If ISC_TRUE is returned, the
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * lookup pointer has been invalidated.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 while (q != NULL) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 debug("query to %s still pending", q->servname);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * At this point, we know there are no queries on the lookup,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * so can make it go away also.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 s = ISC_LIST_HEAD(lookup->my_server_list);
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 while (s != NULL) {
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 debug("freeing server %p belonging to %p", s, lookup);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 debug("freeing buffer %p", lookup->querysig);
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 isc_mempool_put(commctx, lookup->sendspace);
24875d713b228dd51e542c71e75ac9fa2f982e0eMark Andrews * If we can, start the next lookup in the queue running.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * This assumes that the lookup on the head of the queue hasn't been
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * started yet. It also removes the lookup from the head of the queue,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * setting the current_lookup pointer pointing to it.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * If there's a current lookup running, we really shouldn't get
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 current_lookup = ISC_LIST_HEAD(lookup_list);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Put the current lookup somewhere so cancel_all can find it
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_DEQUEUE(lookup_list, current_lookup, link);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 "+sigchase option is disabled\n");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 nameFromString(current_lookup->textname, &query_name);
1e844d04a716346f08ec027e365ce43e7b360c51Shane Kerr * Verifier que la temp est bien la plus basse
0d8971a4b8abed599ec9d9b7d1b51b8de8038ce2Shane Kerr ": +sigchase option is disable\n");
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 current_lookup->rdtype = dns_rdatatype_ns;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 current_lookup->rdclass = dns_rdataclass_in;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 strncpy(current_lookup->textnamesigchase,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 current_lookup->trace_root_sigchase = ISC_TRUE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = isc_buffer_allocate(mctx, &b, BUFSIZE);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "isc_buffer_allocate");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_name_totext(dst_key_name(trustedkey),
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 strncpy(current_lookup->textname, (char*)r.base,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 nameFromString(current_lookup->textnamesigchase,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_name_init(&chase_authority_name, NULL);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * If we can, clear the current lookup and start the next one running.
5597be9bb88de138dfec9fa9176708443813925eTatuya JINMEI 神明達哉 * This calls try_clear_lookup, so may invalidate the lookup pointer.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Create and queue a new lookup as a followup to the current lookup,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * based on the supplied message and section. This is used in trace and
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * name server search modes to start a new lookup using servers from
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * NS records in a reply. Returns the number of followup lookups made.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section)
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 isc_boolean_t horizontal = ISC_FALSE, bad = ISC_FALSE;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 debug("following up %s", query->lookup->textname);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 for (result = dns_message_firstname(msg, section);
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 result = dns_message_nextname(msg, section)) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_message_currentname(msg, section, &name);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_findtype(name, dns_rdatatype_soa,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_findtype(name, dns_rdatatype_ns, 0,
0d8971a4b8abed599ec9d9b7d1b51b8de8038ce2Shane Kerr if (query->lookup->trace && !query->lookup->trace_root) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 domain = dns_fixedname_name(&query->lookup->fdomain);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 namereln = dns_name_fullcompare(name, domain,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 printf(";; BAD (HORIZONTAL) REFERRAL\n");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 } else if (namereln != dns_namereln_subdomain) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 for (result = dns_rdataset_first(rdataset);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 (void)dns_rdata_tostruct(&rdata, &ns, NULL);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_name_format(&ns.name, namestr, sizeof(namestr));
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 /* Initialize lookup if we've not yet */
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 debug("found NS %d %s", numLookups, namestr);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 domain = dns_fixedname_name(&lookup->fdomain);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 debug("adding server %s", srv->servername);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_APPEND(lookup->my_server_list, srv, link);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 (query->lookup->trace || query->lookup->ns_search_only))
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 return (followup_lookup(msg, query, DNS_SECTION_AUTHORITY));
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Randomize the order the nameserver will be tried.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 for (i = numLookups; i > 0; i--) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 srv = ISC_LIST_HEAD(lookup->my_server_list);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 while (j-- > 0)
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_DEQUEUE(lookup->my_server_list, srv, link);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_APPEND(my_server_list, srv, link);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_APPENDLIST(lookup->my_server_list,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Create and queue a new lookup using the next origin from the search
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * list, read in setup_system().
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Return ISC_TRUE iff there was another searchlist entry.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉next_origin(dns_message_t *msg, dig_query_t *query) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 debug("following up %s", query->lookup->textname);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * We're not using a search list, so don't even think
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * about finding the next entry.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Then we just did rootorg; there's nothing left.
a1cc4108f61d1fd2a57810242b06dd929eaab4bdMark Andrews lookup = requeue_lookup(query->lookup, ISC_TRUE);
a1cc4108f61d1fd2a57810242b06dd929eaab4bdMark Andrews lookup->origin = ISC_LIST_NEXT(query->lookup->origin, link);
0d8971a4b8abed599ec9d9b7d1b51b8de8038ce2Shane Kerr * Insert an SOA record into the sendmessage in a lookup. Used for
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * creating IXFR queries.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_name_clone(dns_rootname, &soa.origin);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_name_clone(dns_rootname, &soa.contact);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 isc_buffer_init(&lookup->rdatabuf, lookup->rdatastore,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_gettemprdata(lookup->sendmsg, &rdata);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "dns_message_gettemprdata");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_rdata_fromstruct(rdata, lookup->rdclass,
9a6522317c97e5487cea816173f63a0e5b4e428aTatuya JINMEI 神明達哉 check_result(result, "isc_rdata_fromstruct");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_gettemprdatalist(lookup->sendmsg, &rdatalist);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "dns_message_gettemprdatalist");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_gettemprdataset(lookup->sendmsg, &rdataset);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "dns_message_gettemprdataset");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_rdatalist_tordataset(rdatalist, rdataset);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_gettempname(lookup->sendmsg, &soaname);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "dns_message_gettempname");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 ISC_LIST_APPEND(soaname->list, rdataset, link);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_message_addname(lookup->sendmsg, soaname, DNS_SECTION_AUTHORITY);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * Setup the supplied lookup structure, making it ready to start sending
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * queries to servers. Create and initialize the message to be sent as
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * well as the query structures and buffer space for the replies. If the
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * server list is empty, clone it from the system default list.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 char utf8_textname[MXNAME], utf8_origin[MXNAME], idn_textname[MXNAME];
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_name_settotextfilter(output_filter);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "dns_name_settotextfilter");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "dns_message_create");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 if (ISC_LIST_EMPTY(lookup->my_server_list)) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 clone_server_list(server_list, &lookup->my_server_list);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 result = dns_message_gettempname(lookup->sendmsg, &lookup->name);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 check_result(result, "dns_message_gettempname");
0d8971a4b8abed599ec9d9b7d1b51b8de8038ce2Shane Kerr isc_buffer_init(&lookup->namebuf, lookup->namespace,
0d8971a4b8abed599ec9d9b7d1b51b8de8038ce2Shane Kerr isc_buffer_init(&lookup->onamebuf, lookup->onamespace,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * We cannot convert `textname' and `origin' separately.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * `textname' doesn't contain TLD, but local mapping needs
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 mr = idn_encodename(IDN_LOCALCONV | IDN_DELIMMAP, lookup->textname,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 idn_check_result(mr, "convert textname to UTF-8");
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * If the name has too many dots, force the origin to be NULL
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * (which produces an absolute lookup). Otherwise, take the origin
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * we have if there's one in the struct already. If it's NULL,
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * take the first entry in the searchlist iff either usesearch
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 * is TRUE or we got a domain line in the resolv.conf file.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 /* XXX New search here? */
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 if ((count_dots(utf8_textname) >= ndots) || !usesearch)
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 lookup->origin = NULL; /* Force abs lookup */
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 else if (lookup->origin == NULL && lookup->new_search && usesearch)
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 lookup->origin = ISC_LIST_HEAD(search_list);
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 if ((count_dots(lookup->textname) >= ndots) || !usesearch)
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 lookup->origin = NULL; /* Force abs lookup */
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 else if (lookup->origin == NULL && lookup->new_search && usesearch)
#ifdef WITH_IDN
sizeof(utf8_origin));
sizeof(utf8_textname));
#ifdef WITH_IDN
DNS_SECTION_QUESTION, 0);
extrabytes = 0;
ISC_TRUE);
dig_lookup_t *l;
sendcount--;
b != NULL;
dig_lookup_t *l;
unsigned int local_timeout;
if (timeout == 0)
l, &l->timer);
dig_lookup_t *l;
if (specified_source &&
sockcount++;
if (specified_source)
sockcount++;
if (specified_source) {
link);
recvcount++;
sendcount++;
if (!l->tcp_mode)
if (!l->tcp_mode) {
l->retries--;
l->retries);
l->retries--;
cancel_lookup(l);
cancel_lookup(l);
dig_lookup_t *l;
recvcount--;
sizeof(sockstr));
sockcount--;
if (length == 0) {
recvcount++;
dig_lookup_t *l;
sockcount--;
if (include_question)
recvcount++;
sendcount++;
dig_lookup_t *l;
sockcount--;
sockcount--;
static isc_boolean_t
return (ISC_TRUE);
&name);
return (ISC_TRUE);
goto next_rdata;
goto next_rdata;
goto doexit;
goto next_rdata;
goto doexit;
goto doexit;
goto next_rdata;
goto doexit;
goto next_rdata;
goto doexit;
return (ISC_FALSE);
return (ISC_TRUE);
#ifdef DIG_SIGCHASE
dig_lookup_t *n, *l;
unsigned int parseflags;
unsigned int msgflags;
#ifdef DIG_SIGCHASE
isc_region_t r;
recvcount--;
sockcount--;
if (!l->tcp_mode &&
sizeof(buf1));
sizeof(buf2));
if (l->tcp_mode) {
if (fail) {
if (!match) {
recvcount++;
&l->querysig);
if (l->msgcounter != 0)
l->msgcounter++;
#ifdef DIG_SIGCHASE
if (!l->sigchase) {
parseflags = 0;
if (l->besteffort) {
hex_dump(b);
cancel_lookup(l);
cancel_lookup(l);
if (l->tcp_mode)
unsigned int local_timeout;
if (timeout == 0) {
if (l->tcp_mode)
NULL,
&l->interval,
#ifdef DIG_SIGCHASE
if (!do_sigchase)
} else if (l->trace) {
if (!l->ns_search_only)
if (!l->trace_root)
} else if (count == 0)
if (l->trace_root) {
#ifdef DIG_SIGCHASE
if (!do_sigchase)
#ifdef DIG_SIGCHASE
if (do_sigchase) {
sizeof(dig_message_t));
link);
isc_buffer_usedregion(b, &r);
sizeof(dig_message_t));
link);
#ifdef DIG_SIGCHASE
if (l->pending)
if (l->doing_xfr) {
if (!docancel)
if (docancel) {
cancel_lookup(l);
#ifdef DIG_SIGCHASE
if (!l->sigchase)
#ifdef DIG_SIGCHASE
if (!do_sigchase)
cancel_lookup(l);
#ifdef DIG_SIGCHASE
if (do_sigchase)
int count;
start_lookup();
cancel_all(void) {
dig_lookup_t *l, *n;
if (free_now) {
while (q != NULL) {
q, current_lookup);
clear_query(q);
q = nq;
while (l != NULL) {
try_clear_lookup(l);
destroy_libs(void) {
#ifdef DIG_SIGCHASE
void * ptr;
#ifdef WITH_IDN
#ifdef WITH_IDN
if (is_dst_up) {
#ifdef DIG_SIGCHASE
#if DIG_SIGCHASE_TD
#if DIG_SIGCHASE_BU
if (memdebugging != 0)
#ifdef WITH_IDN
initialize_idn(void) {
idn_result_t r;
#ifdef HAVE_SETLOCALE
if (r != idn_success)
idn_result_tostring(r));
static isc_result_t
return (ISC_R_SUCCESS);
fromlen++;
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
tolen--;
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);
static idn_result_t
return idn_success;
return idn_buffer_overflow;
return idn_success;
if (r != idn_success) {
#ifdef DIG_SIGCHASE
isc_region_t r;
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
dump_database(void) {
== ISC_R_SUCCESS)
== ISC_R_SUCCESS)
== ISC_R_SUCCESS)
return (rdataset);
return (rdataset);
return (rdataset);
return (NULL);
int section)
return (rdataset);
return (NULL);
== ISC_R_SUCCESS)
return (rdataset);
== ISC_R_SUCCESS)
rdataset =
return (rdataset);
== ISC_R_SUCCESS)
rdataset =
return (rdataset);
return (NULL);
isc_region_t r;
return (temp);
return (NULL);
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
return (NULL);
return (NULL);
for (i= 0; i < MAX_TRUSTED_KEY; i++) {
char alphnum[] =
int tempnamekeylen;
return (ISC_R_NOMEMORY);
return (result);
int tempnamelen;
int tempnamekeylen;
char *cp;
return (ISC_R_NOMEMORY);
goto cleanup;
cp++;
return (ISC_R_FAILURE);
x = cp--;
x = cp--;
return (ISC_R_NOMEMORY);
return (ISC_R_FAILURE);
*fp = f;
return (ISC_R_SUCCESS);
return (result);
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
filename);
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
#if DIG_SIGCHASE_TD
dig_server_t *s;
void *ptr;
while (s != NULL) {
s, lookup);
ptr = s;
#define __FOLLOW_GLUE__
#ifdef __FOLLOW_GLUE__
isc_region_t r;
#ifdef __FOLLOW_GLUE__
dns_rdatatype_any, &true);
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
dns_rdatatype_any, &true);
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
dns_rdata_reset(&a);
return (ISC_R_SUCCESS);
int orderp;
unsigned int nlabelsp;
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
dns_rdatatype_any, &true);
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
isc_region_t r;
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
return (ISC_R_FAILURE);
== ISC_TRUE) {
mctx)
== ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (result);
return (ISC_R_NOTFOUND);
return (result);
&newdsrdata) == 0) {
mctx);
return (result);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
if (tmplookedup)
return (ISC_R_FAILURE);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
#if DIG_SIGCHASE_TD
== ISC_R_SUCCESS) {
have_answer = true;
&name);
if (have_answer) {
goto cleanandgo;
goto cleanandgo;
if (!delegation_follow) {
mctx);
mctx);
goto cleanandgo;
if (have_response) {
goto cleanandgo;
goto cleanandgo;
&tmp_name);
if (have_response)
goto finalstep;
if (have_delegation_ns) {
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
#if DIG_SIGCHASE_BU
!= ISC_R_SUCCESS) {
return (ISC_R_ADDRNOTAVAIL);
dns_rdatatype_any, &true);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
dns_rdatatype_ds, &true);
mctx);
int ret;
#if DIG_SIGCHASE_TD
#if DIG_SIGCHASE_BU
unsigned int nblabel1;
unsigned int nblabel2;
int min_lum_label;
if (ret < 0)
else if (ret > 0)
!= ISC_R_SUCCESS) {
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
== ISC_R_SUCCESS);
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
return (ret);
!= ISC_R_SUCCESS) {
return (ISC_R_FAILURE);
return (ret);
return (ISC_R_SUCCESS);
return (ret);