diff options
Diffstat (limited to 'lib')
185 files changed, 3469 insertions, 1086 deletions
diff --git a/lib/bind9/Makefile.in b/lib/bind9/Makefile.in index b6633e56f5e0f..e9e65daa96613 100644 --- a/lib/bind9/Makefile.in +++ b/lib/bind9/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007, 2009, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2009, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -79,7 +79,7 @@ installdirs: $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir} install:: timestamp installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libbind9.@A@ ${DESTDIR}${libdir} + ${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libbind9.@A@ ${DESTDIR}${libdir} clean distclean:: rm -f libbind9.@A@ timestamp diff --git a/lib/bind9/api b/lib/bind9/api index 0adc934e71ce3..4d767dc0e2bd9 100644 --- a/lib/bind9/api +++ b/lib/bind9/api @@ -5,5 +5,5 @@ # 9.9: 90-109 # 9.9-sub: 130-139 LIBINTERFACE = 90 -LIBREVISION = 9 +LIBREVISION = 11 LIBAGE = 0 diff --git a/lib/bind9/check.c b/lib/bind9/check.c index af1b87ae23fdc..e44d1d4aba965 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - /*! \file */ #include <config.h> @@ -1316,67 +1314,69 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, const cfg_listelt_t *element; static optionstable options[] = { - { "allow-query", MASTERZONE | SLAVEZONE | STUBZONE | REDIRECTZONE | - CHECKACL | STATICSTUBZONE }, { "allow-notify", SLAVEZONE | CHECKACL }, + { "allow-query", MASTERZONE | SLAVEZONE | STUBZONE | REDIRECTZONE | + CHECKACL | STATICSTUBZONE }, { "allow-transfer", MASTERZONE | SLAVEZONE | CHECKACL }, - { "notify", MASTERZONE | SLAVEZONE }, + { "allow-update", MASTERZONE | CHECKACL }, + { "allow-update-forwarding", SLAVEZONE | CHECKACL }, { "also-notify", MASTERZONE | SLAVEZONE }, + { "auto-dnssec", MASTERZONE | SLAVEZONE }, + { "check-dup-records", MASTERZONE }, + { "check-mx", MASTERZONE }, + { "check-mx-cname", MASTERZONE }, + { "check-srv-cname", MASTERZONE }, + { "check-wildcard", MASTERZONE }, + { "database", MASTERZONE | SLAVEZONE | STUBZONE | REDIRECTZONE }, + { "delegation-only", HINTZONE | STUBZONE | FORWARDZONE | + DELEGATIONZONE }, { "dialup", MASTERZONE | SLAVEZONE | STUBZONE | STREDIRECTZONE }, - { "delegation-only", HINTZONE | STUBZONE | DELEGATIONZONE }, - { "forward", MASTERZONE | SLAVEZONE | STUBZONE | - STATICSTUBZONE | FORWARDZONE }, - { "forwarders", MASTERZONE | SLAVEZONE | STUBZONE | - STATICSTUBZONE | FORWARDZONE }, + { "dnssec-dnskey-kskonly", MASTERZONE | SLAVEZONE }, + { "dnssec-loadkeys-interval", MASTERZONE | SLAVEZONE }, + { "dnssec-secure-to-insecure", MASTERZONE }, + { "file", MASTERZONE | SLAVEZONE | STUBZONE | HINTZONE | REDIRECTZONE }, + { "forward", MASTERZONE | SLAVEZONE | STUBZONE | STATICSTUBZONE | + FORWARDZONE }, + { "forwarders", MASTERZONE | SLAVEZONE | STUBZONE | STATICSTUBZONE | + FORWARDZONE }, + { "integrity-check", MASTERZONE }, + { "ixfr-base", MASTERZONE | SLAVEZONE }, + { "ixfr-tmp-file", MASTERZONE | SLAVEZONE }, + { "journal", MASTERZONE | SLAVEZONE | STREDIRECTZONE }, + { "key-directory", MASTERZONE | SLAVEZONE }, { "maintain-ixfr-base", MASTERZONE | SLAVEZONE | STREDIRECTZONE }, + { "masterfile-format", MASTERZONE | SLAVEZONE | STUBZONE | + REDIRECTZONE }, + { "masters", SLAVEZONE | STUBZONE | REDIRECTZONE }, { "max-ixfr-log-size", MASTERZONE | SLAVEZONE | STREDIRECTZONE }, - { "notify-source", MASTERZONE | SLAVEZONE }, - { "notify-source-v6", MASTERZONE | SLAVEZONE }, - { "transfer-source", SLAVEZONE | STUBZONE | STREDIRECTZONE }, - { "transfer-source-v6", SLAVEZONE | STUBZONE | STREDIRECTZONE }, - { "max-transfer-time-in", SLAVEZONE | STUBZONE | STREDIRECTZONE }, - { "max-transfer-time-out", MASTERZONE | SLAVEZONE }, + { "max-refresh-time", SLAVEZONE | STUBZONE | STREDIRECTZONE }, + { "max-retry-time", SLAVEZONE | STUBZONE | STREDIRECTZONE }, { "max-transfer-idle-in", SLAVEZONE | STUBZONE | STREDIRECTZONE }, { "max-transfer-idle-out", MASTERZONE | SLAVEZONE }, - { "max-retry-time", SLAVEZONE | STUBZONE | STREDIRECTZONE }, - { "min-retry-time", SLAVEZONE | STUBZONE | STREDIRECTZONE }, - { "max-refresh-time", SLAVEZONE | STUBZONE | STREDIRECTZONE }, + { "max-transfer-time-in", SLAVEZONE | STUBZONE | STREDIRECTZONE }, + { "max-transfer-time-out", MASTERZONE | SLAVEZONE }, { "min-refresh-time", SLAVEZONE | STUBZONE | STREDIRECTZONE }, - { "dnssec-secure-to-insecure", MASTERZONE }, + { "min-retry-time", SLAVEZONE | STUBZONE | STREDIRECTZONE }, + { "notify", MASTERZONE | SLAVEZONE }, + { "notify-source", MASTERZONE | SLAVEZONE }, + { "notify-source-v6", MASTERZONE | SLAVEZONE }, + { "pubkey", MASTERZONE | SLAVEZONE | STUBZONE }, + { "request-ixfr", SLAVEZONE | REDIRECTZONE }, + { "server-addresses", STATICSTUBZONE }, + { "server-names", STATICSTUBZONE }, { "sig-re-signing-interval", MASTERZONE | SLAVEZONE }, { "sig-signing-nodes", MASTERZONE | SLAVEZONE }, { "sig-signing-signatures", MASTERZONE | SLAVEZONE }, { "sig-signing-type", MASTERZONE | SLAVEZONE }, { "sig-validity-interval", MASTERZONE | SLAVEZONE }, { "signing", MASTERZONE | SLAVEZONE }, + { "transfer-source", SLAVEZONE | STUBZONE | STREDIRECTZONE }, + { "transfer-source-v6", SLAVEZONE | STUBZONE | STREDIRECTZONE }, + { "try-tcp-refresh", SLAVEZONE | STREDIRECTZONE }, + { "update-check-ksk", MASTERZONE | SLAVEZONE }, + { "update-policy", MASTERZONE }, { "zone-statistics", MASTERZONE | SLAVEZONE | STUBZONE | STATICSTUBZONE | REDIRECTZONE }, - { "allow-update", MASTERZONE | CHECKACL }, - { "allow-update-forwarding", SLAVEZONE | CHECKACL }, - { "file", MASTERZONE | SLAVEZONE | STUBZONE | HINTZONE | REDIRECTZONE }, - { "journal", MASTERZONE | SLAVEZONE | STREDIRECTZONE }, - { "ixfr-base", MASTERZONE | SLAVEZONE }, - { "ixfr-tmp-file", MASTERZONE | SLAVEZONE }, - { "masters", SLAVEZONE | STUBZONE | REDIRECTZONE }, - { "pubkey", MASTERZONE | SLAVEZONE | STUBZONE }, - { "update-policy", MASTERZONE }, - { "database", MASTERZONE | SLAVEZONE | STUBZONE | REDIRECTZONE }, - { "key-directory", MASTERZONE | SLAVEZONE }, - { "check-wildcard", MASTERZONE }, - { "check-mx", MASTERZONE }, - { "check-dup-records", MASTERZONE }, - { "integrity-check", MASTERZONE }, - { "check-mx-cname", MASTERZONE }, - { "check-srv-cname", MASTERZONE }, - { "masterfile-format", MASTERZONE | SLAVEZONE | STUBZONE | HINTZONE | - REDIRECTZONE }, - { "update-check-ksk", MASTERZONE | SLAVEZONE }, - { "dnssec-dnskey-kskonly", MASTERZONE | SLAVEZONE }, - { "dnssec-loadkeys-interval", MASTERZONE | SLAVEZONE }, - { "auto-dnssec", MASTERZONE | SLAVEZONE }, - { "try-tcp-refresh", SLAVEZONE | STREDIRECTZONE }, - { "server-addresses", STATICSTUBZONE }, - { "server-names", STATICSTUBZONE }, }; static optionstable dialups[] = { @@ -1525,12 +1525,36 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, } /* - * Master & slave zones must have a "also-notify" field. + * Master & slave zones may have an "also-notify" field, but + * shouldn't if notify is disabled. */ if (ztype == MASTERZONE || ztype == SLAVEZONE ) { + isc_boolean_t donotify = ISC_TRUE; + obj = NULL; - tresult = cfg_map_get(zoptions, "also-notify", &obj); + tresult = cfg_map_get(zoptions, "notify", &obj); + if (tresult != ISC_R_SUCCESS && voptions != NULL) + tresult = cfg_map_get(voptions, "notify", &obj); + if (tresult != ISC_R_SUCCESS && goptions != NULL) + tresult = cfg_map_get(goptions, "notify", &obj); if (tresult == ISC_R_SUCCESS) { + if (cfg_obj_isboolean(obj)) + donotify = cfg_obj_asboolean(obj); + else { + const char *notifystr = cfg_obj_asstring(obj); + if (ztype != MASTERZONE && + strcasecmp(notifystr, "master-only") == 0) + donotify = ISC_FALSE; + } + } + + obj = NULL; + tresult = cfg_map_get(zoptions, "also-notify", &obj); + if (tresult == ISC_R_SUCCESS && !donotify) { + cfg_obj_log(zoptions, logctx, ISC_LOG_WARNING, + "zone '%s': 'also-notify' set but " + "'notify' is disabled", znamestr); + } else if (tresult == ISC_R_SUCCESS) { isc_uint32_t count; tresult = validate_masters(obj, config, &count, logctx, mctx); @@ -1568,12 +1592,13 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, * Master zones can't have both "allow-update" and "update-policy". */ if (ztype == MASTERZONE || ztype == SLAVEZONE) { + isc_boolean_t ddns = ISC_FALSE, signing = ISC_FALSE; isc_result_t res1, res2, res3; + const cfg_obj_t *au = NULL; const char *arg; - isc_boolean_t ddns = ISC_FALSE, signing = ISC_FALSE; obj = NULL; - res1 = cfg_map_get(zoptions, "allow-update", &obj); + res1 = cfg_map_get(zoptions, "allow-update", &au); obj = NULL; res2 = cfg_map_get(zoptions, "update-policy", &obj); if (res1 == ISC_R_SUCCESS && res2 == ISC_R_SUCCESS) { @@ -1582,10 +1607,40 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, "when 'update-policy' is present", znamestr); result = ISC_R_FAILURE; - } else if (res2 == ISC_R_SUCCESS && - check_update_policy(obj, logctx) != ISC_R_SUCCESS) - result = ISC_R_FAILURE; - ddns = ISC_TF(res1 == ISC_R_SUCCESS || res2 == ISC_R_SUCCESS); + } else if (res2 == ISC_R_SUCCESS) { + res3 = check_update_policy(obj, logctx); + if (res3 != ISC_R_SUCCESS) + result = ISC_R_FAILURE; + } + + /* + * To determine whether auto-dnssec is allowed, + * we should also check for allow-update at the + * view and options levels. + */ + obj = NULL; + if (res1 != ISC_R_SUCCESS && voptions != NULL) + res1 = cfg_map_get(voptions, "allow-update", &au); + if (res1 != ISC_R_SUCCESS && goptions != NULL) + res1 = cfg_map_get(goptions, "allow-update", &au); + + if (res2 == ISC_R_SUCCESS) + ddns = ISC_TRUE; + else if (res1 == ISC_R_SUCCESS) { + dns_acl_t *acl = NULL; + res1 = cfg_acl_fromconfig(au, config, logctx, + actx, mctx, 0, &acl); + if (res1 != ISC_R_SUCCESS) { + cfg_obj_log(au, logctx, ISC_LOG_ERROR, + "acl expansion failed: %s", + isc_result_totext(result)); + result = ISC_R_FAILURE; + } else if (acl != NULL) { + if (!dns_acl_isnone(acl)) + ddns = ISC_TRUE; + dns_acl_detach(&acl); + } + } obj = NULL; res1 = cfg_map_get(zoptions, "inline-signing", &obj); @@ -1606,12 +1661,6 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, " dynamic DNS or" : ""); result = ISC_R_FAILURE; } - if (strcasecmp(arg, "create") == 0) { - cfg_obj_log(obj, logctx, ISC_LOG_ERROR, - "'auto-dnssec create;' is not " - "yet implemented"); - result = ISC_R_FAILURE; - } obj = NULL; res1 = cfg_map_get(zoptions, "sig-signing-type", &obj); diff --git a/lib/bind9/getaddresses.c b/lib/bind9/getaddresses.c index a75e14ef650ec..c4f8decb572f7 100644 --- a/lib/bind9/getaddresses.c +++ b/lib/bind9/getaddresses.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2001, 2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -107,7 +107,7 @@ bind9_getaddresses(const char *hostname, in_port_t port, result = isc_netscope_pton(AF_INET6, d + 1, &in6, &zone); - + if (result != ISC_R_SUCCESS) return (result); #else @@ -129,7 +129,6 @@ bind9_getaddresses(const char *hostname, in_port_t port, *addrcount = 1; return (ISC_R_SUCCESS); - } } #ifdef USE_GETADDRINFO diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in index a3e3e9a4e86ac..eec4c9ef0e77a 100644 --- a/lib/dns/Makefile.in +++ b/lib/dns/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -142,7 +142,7 @@ installdirs: $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir} install:: timestamp installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libdns.@A@ ${DESTDIR}${libdir} + ${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libdns.@A@ ${DESTDIR}${libdir} clean distclean:: rm -f libdns.@A@ timestamp diff --git a/lib/dns/acl.c b/lib/dns/acl.c index dbc6f9cb4f3af..8d3718a22b27b 100644 --- a/lib/dns/acl.c +++ b/lib/dns/acl.c @@ -290,6 +290,9 @@ dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, isc_boolean_t pos) if (newmem == NULL) return (ISC_R_NOMEMORY); + /* Zero. */ + memset(newmem, 0, newalloc * sizeof(dns_aclelement_t)); + /* Copy in the original elements */ memmove(newmem, dest->elements, dest->length * sizeof(dns_aclelement_t)); diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 10d51bc441433..c75ea59f751f8 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: adb.c,v 1.264 2011/12/05 17:10:51 each Exp $ */ - /*! \file * * \note @@ -157,7 +155,7 @@ struct dns_adb { unsigned int *entry_refcnt; isc_event_t cevent; - isc_boolean_t cevent_sent; + isc_boolean_t cevent_out; isc_boolean_t shutting_down; isc_eventlist_t whenshutdown; isc_event_t growentries; @@ -201,6 +199,7 @@ struct dns_adbfetch { unsigned int magic; dns_fetch_t *fetch; dns_rdataset_t rdataset; + unsigned int depth; }; /*% @@ -245,6 +244,7 @@ struct dns_adbentry { isc_sockaddr_t sockaddr; isc_stdtime_t expires; + isc_stdtime_t lastage; /*%< * A nonzero 'expires' field indicates that the entry should * persist until that time. This allows entries found @@ -300,8 +300,7 @@ static inline isc_boolean_t dec_entry_refcnt(dns_adb_t *, isc_boolean_t, static inline void violate_locking_hierarchy(isc_mutex_t *, isc_mutex_t *); static isc_boolean_t clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *); static void clean_target(dns_adb_t *, dns_name_t *); -static void clean_finds_at_name(dns_adbname_t *, isc_eventtype_t, - unsigned int); +static void clean_finds_at_name(dns_adbname_t *, isc_eventtype_t, unsigned int); static isc_boolean_t check_expire_namehooks(dns_adbname_t *, isc_stdtime_t); static isc_boolean_t check_expire_entry(dns_adb_t *, dns_adbentry_t **, isc_stdtime_t); @@ -309,6 +308,7 @@ static void cancel_fetches_at_name(dns_adbname_t *); static isc_result_t dbfind_name(dns_adbname_t *, isc_stdtime_t, dns_rdatatype_t); static isc_result_t fetch_name(dns_adbname_t *, isc_boolean_t, + unsigned int, isc_counter_t *qc, dns_rdatatype_t); static inline void check_exit(dns_adb_t *); static void destroy(dns_adb_t *); @@ -321,6 +321,9 @@ static inline isc_boolean_t unlink_entry(dns_adb_t *, dns_adbentry_t *); static isc_boolean_t kill_name(dns_adbname_t **, isc_eventtype_t); static void water(void *, int); static void dump_entry(FILE *, dns_adbentry_t *, isc_boolean_t, isc_stdtime_t); +static void adjustsrtt(dns_adbaddrinfo_t *addr, unsigned int rtt, + unsigned int factor, isc_stdtime_t now); +static void shutdown_task(isc_task_t *task, isc_event_t *ev); /* * MUST NOT overlap DNS_ADBFIND_* flags! @@ -344,7 +347,7 @@ static void dump_entry(FILE *, dns_adbentry_t *, isc_boolean_t, isc_stdtime_t); * Private flag(s) for entries. * MUST NOT overlap FCTX_ADDRINFO_xxx and DNS_FETCHOPT_NOEDNS0. */ -#define ENTRY_IS_DEAD 0x80000000 +#define ENTRY_IS_DEAD 0x00400000 /* * To the name, address classes are all that really exist. If it has a @@ -1498,10 +1501,13 @@ check_exit(dns_adb_t *adb) { * If there aren't any external references either, we're * done. Send the control event to initiate shutdown. */ - INSIST(!adb->cevent_sent); /* Sanity check. */ + INSIST(!adb->cevent_out); /* Sanity check. */ + ISC_EVENT_INIT(&adb->cevent, sizeof(adb->cevent), 0, NULL, + DNS_EVENT_ADBCONTROL, shutdown_task, adb, + adb, NULL, NULL); event = &adb->cevent; isc_task_send(adb->task, &event); - adb->cevent_sent = ISC_TRUE; + adb->cevent_out = ISC_TRUE; } } @@ -1756,6 +1762,7 @@ new_adbentry(dns_adb_t *adb) { e->flags = 0; isc_random_get(&r); e->srtt = (r & 0x1f) + 1; + e->lastage = 0; e->expires = 0; ISC_LIST_INIT(e->lameinfo); ISC_LINK_INIT(e, plink); @@ -2430,10 +2437,9 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, adb->view = view; adb->taskmgr = taskmgr; adb->next_cleanbucket = 0; - ISC_EVENT_INIT(&adb->cevent, sizeof(adb->cevent), 0, NULL, - DNS_EVENT_ADBCONTROL, shutdown_task, adb, - adb, NULL, NULL); - adb->cevent_sent = ISC_FALSE; + ISC_EVENT_INIT(&adb->cevent, sizeof(adb->cevent), + 0, NULL, 0, NULL, NULL, NULL, NULL, NULL); + adb->cevent_out = ISC_FALSE; adb->shutting_down = ISC_FALSE; ISC_LIST_INIT(adb->whenshutdown); @@ -2467,7 +2473,7 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, "intializing table sizes to %u\n", nbuckets[11]); adb->nentries = nbuckets[11]; - adb->nnames= nbuckets[11]; + adb->nnames = nbuckets[11]; } @@ -2740,9 +2746,28 @@ dns_adb_whenshutdown(dns_adb_t *adb, isc_task_t *task, isc_event_t **eventp) { UNLOCK(&adb->lock); } +static void +shutdown_stage2(isc_task_t *task, isc_event_t *event) { + dns_adb_t *adb; + + UNUSED(task); + + adb = event->ev_arg; + INSIST(DNS_ADB_VALID(adb)); + + LOCK(&adb->lock); + INSIST(adb->shutting_down); + adb->cevent_out = ISC_FALSE; + (void)shutdown_names(adb); + (void)shutdown_entries(adb); + if (dec_adb_irefcnt(adb)) + check_exit(adb); + UNLOCK(&adb->lock); +} + void dns_adb_shutdown(dns_adb_t *adb) { - isc_boolean_t need_check_exit; + isc_event_t *event; /* * Shutdown 'adb'. @@ -2753,11 +2778,16 @@ dns_adb_shutdown(dns_adb_t *adb) { if (!adb->shutting_down) { adb->shutting_down = ISC_TRUE; isc_mem_setwater(adb->mctx, water, adb, 0, 0); - need_check_exit = shutdown_names(adb); - if (!need_check_exit) - need_check_exit = shutdown_entries(adb); - if (need_check_exit) - check_exit(adb); + /* + * Isolate shutdown_names and shutdown_entries calls. + */ + inc_adb_irefcnt(adb); + ISC_EVENT_INIT(&adb->cevent, sizeof(adb->cevent), 0, NULL, + DNS_EVENT_ADBCONTROL, shutdown_stage2, adb, + adb, NULL, NULL); + adb->cevent_out = ISC_TRUE; + event = &adb->cevent; + isc_task_send(adb->task, &event); } UNLOCK(&adb->lock); @@ -2770,6 +2800,19 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, isc_stdtime_t now, dns_name_t *target, in_port_t port, dns_adbfind_t **findp) { + return (dns_adb_createfind2(adb, task, action, arg, name, + qname, qtype, options, now, + target, port, 0, NULL, findp)); +} + +isc_result_t +dns_adb_createfind2(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, + void *arg, dns_name_t *name, dns_name_t *qname, + dns_rdatatype_t qtype, unsigned int options, + isc_stdtime_t now, dns_name_t *target, + in_port_t port, unsigned int depth, isc_counter_t *qc, + dns_adbfind_t **findp) +{ dns_adbfind_t *find; dns_adbname_t *adbname; int bucket; @@ -3000,7 +3043,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, * Start V4. */ if (WANT_INET(wanted_fetches) && - fetch_name(adbname, start_at_zone, + fetch_name(adbname, start_at_zone, depth, qc, dns_rdatatype_a) == ISC_R_SUCCESS) { DP(DEF_LEVEL, "dns_adb_createfind: started A fetch for name %p", @@ -3011,7 +3054,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, * Start V6. */ if (WANT_INET6(wanted_fetches) && - fetch_name(adbname, start_at_zone, + fetch_name(adbname, start_at_zone, depth, qc, dns_rdatatype_aaaa) == ISC_R_SUCCESS) { DP(DEF_LEVEL, "dns_adb_createfind: " @@ -3754,6 +3797,12 @@ fetch_callback(isc_task_t *task, isc_event_t *ev) { DP(DEF_LEVEL, "adb: fetch of '%s' %s failed: %s", buf, address_type == DNS_ADBFIND_INET ? "A" : "AAAA", dns_result_totext(dev->result)); + /* + * Don't record a failure unless this is the initial + * fetch of a chain. + */ + if (fetch->depth > 1) + goto out; /* XXXMLG Don't pound on bad servers. */ if (address_type == DNS_ADBFIND_INET) { name->expire_v4 = ISC_MIN(name->expire_v4, now + 300); @@ -3791,9 +3840,8 @@ fetch_callback(isc_task_t *task, isc_event_t *ev) { } static isc_result_t -fetch_name(dns_adbname_t *adbname, - isc_boolean_t start_at_zone, - dns_rdatatype_t type) +fetch_name(dns_adbname_t *adbname, isc_boolean_t start_at_zone, + unsigned int depth, isc_counter_t *qc, dns_rdatatype_t type) { isc_result_t result; dns_adbfetch_t *fetch = NULL; @@ -3838,12 +3886,14 @@ fetch_name(dns_adbname_t *adbname, result = ISC_R_NOMEMORY; goto cleanup; } - - result = dns_resolver_createfetch(adb->view->resolver, &adbname->name, - type, name, nameservers, NULL, - options, adb->task, fetch_callback, - adbname, &fetch->rdataset, NULL, - &fetch->fetch); + fetch->depth = depth; + + result = dns_resolver_createfetch3(adb->view->resolver, &adbname->name, + type, name, nameservers, NULL, + NULL, 0, options, depth, qc, + adb->task, fetch_callback, adbname, + &fetch->rdataset, NULL, + &fetch->fetch); if (result != ISC_R_SUCCESS) goto cleanup; @@ -3912,8 +3962,7 @@ dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int rtt, unsigned int factor) { int bucket; - unsigned int new_srtt; - isc_stdtime_t now; + isc_stdtime_t now = 0; REQUIRE(DNS_ADB_VALID(adb)); REQUIRE(DNS_ADBADDRINFO_VALID(addr)); @@ -3922,21 +3971,53 @@ dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr, bucket = addr->entry->lock_bucket; LOCK(&adb->entrylocks[bucket]); - if (factor == DNS_ADB_RTTADJAGE) - new_srtt = addr->entry->srtt * 98 / 100; - else + if (addr->entry->expires == 0 || factor == DNS_ADB_RTTADJAGE) + isc_stdtime_get(&now); + adjustsrtt(addr, rtt, factor, now); + + UNLOCK(&adb->entrylocks[bucket]); +} + +void +dns_adb_agesrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr, isc_stdtime_t now) { + int bucket; + + REQUIRE(DNS_ADB_VALID(adb)); + REQUIRE(DNS_ADBADDRINFO_VALID(addr)); + + bucket = addr->entry->lock_bucket; + LOCK(&adb->entrylocks[bucket]); + + adjustsrtt(addr, 0, DNS_ADB_RTTADJAGE, now); + + UNLOCK(&adb->entrylocks[bucket]); +} + +static void +adjustsrtt(dns_adbaddrinfo_t *addr, unsigned int rtt, unsigned int factor, + isc_stdtime_t now) +{ + isc_uint64_t new_srtt; + + if (factor == DNS_ADB_RTTADJAGE) { + if (addr->entry->lastage != now) { + new_srtt = addr->entry->srtt; + new_srtt <<= 9; + new_srtt -= addr->entry->srtt; + new_srtt >>= 9; + addr->entry->lastage = now; + } else + new_srtt = addr->entry->srtt; + } else new_srtt = (addr->entry->srtt / 10 * factor) + (rtt / 10 * (10 - factor)); - addr->entry->srtt = new_srtt; - addr->srtt = new_srtt; + new_srtt &= 0xffffffff; + addr->entry->srtt = (unsigned int) new_srtt; + addr->srtt = (unsigned int) new_srtt; - if (addr->entry->expires == 0) { - isc_stdtime_get(&now); + if (addr->entry->expires == 0) addr->entry->expires = now + ADB_ENTRY_WINDOW; - } - - UNLOCK(&adb->entrylocks[bucket]); } void @@ -3949,6 +4030,9 @@ dns_adb_changeflags(dns_adb_t *adb, dns_adbaddrinfo_t *addr, REQUIRE(DNS_ADB_VALID(adb)); REQUIRE(DNS_ADBADDRINFO_VALID(addr)); + REQUIRE((bits & ENTRY_IS_DEAD) == 0); + REQUIRE((mask & ENTRY_IS_DEAD) == 0); + bucket = addr->entry->lock_bucket; LOCK(&adb->entrylocks[bucket]); diff --git a/lib/dns/api b/lib/dns/api index cc5437d0be7b5..b11beb8343db1 100644 --- a/lib/dns/api +++ b/lib/dns/api @@ -4,6 +4,6 @@ # 9.8: 80-89, 120-129 # 9.9: 90-109 # 9.9-sub: 130-139 -LIBINTERFACE = 102 -LIBREVISION = 2 -LIBAGE = 2 +LIBINTERFACE = 105 +LIBREVISION = 0 +LIBAGE = 1 diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index 7af8e644b1971..129895431ddf4 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -819,14 +819,19 @@ deref_portentry(dns_dispatch_t *disp, dispportentry_t **portentryp) { portentry, link); isc_mempool_put(disp->portpool, portentry); } - UNLOCK(&qid->lock); + /* + * Set '*portentryp' to NULL inside the lock so that + * dispsock->portentry does not change in socket_search. + */ *portentryp = NULL; + + UNLOCK(&qid->lock); } /*% * Find a dispsocket for socket address 'dest', and port number 'port'. - * Return NULL if no such entry exists. + * Return NULL if no such entry exists. Requires qid->lock to be held. */ static dispsocket_t * socket_search(dns_qid_t *qid, isc_sockaddr_t *dest, in_port_t port, @@ -1322,8 +1327,8 @@ udp_recv(isc_event_t *ev_in, dns_dispatch_t *disp, dispsocket_t *dispsock) { } else { free_buffer(disp, ev->region.base, ev->region.length); - UNLOCK(&disp->lock); isc_event_free(&ev_in); + UNLOCK(&disp->lock); return; } } else if (ev->result != ISC_R_SUCCESS) { @@ -1334,8 +1339,8 @@ udp_recv(isc_event_t *ev_in, dns_dispatch_t *disp, dispsocket_t *dispsock) { "odd socket result in udp_recv(): %s", isc_result_totext(ev->result)); - UNLOCK(&disp->lock); isc_event_free(&ev_in); + UNLOCK(&disp->lock); return; } @@ -1510,9 +1515,8 @@ udp_recv(isc_event_t *ev_in, dns_dispatch_t *disp, dispsocket_t *dispsock) { */ deactivate_dispsocket(disp, dispsock); } - UNLOCK(&disp->lock); - isc_event_free(&ev_in); + UNLOCK(&disp->lock); } /* @@ -1694,9 +1698,8 @@ tcp_recv(isc_task_t *task, isc_event_t *ev_in) { restart: (void)startrecv(disp, NULL); - UNLOCK(&disp->lock); - isc_event_free(&ev_in); + UNLOCK(&disp->lock); } /* @@ -2286,9 +2289,12 @@ dns_dispatchmgr_setudp(dns_dispatchmgr_t *mgr, /* Create or adjust socket pool */ if (mgr->spool != NULL) { - if (maxrequests < DNS_DISPATCH_POOLSOCKS * 2) - isc_mempool_setmaxalloc(mgr->spool, DNS_DISPATCH_POOLSOCKS * 2); - isc_mempool_setfreemax(mgr->spool, DNS_DISPATCH_POOLSOCKS * 2); + if (maxrequests < DNS_DISPATCH_POOLSOCKS * 2) { + isc_mempool_setmaxalloc(mgr->spool, + DNS_DISPATCH_POOLSOCKS * 2); + isc_mempool_setfreemax(mgr->spool, + DNS_DISPATCH_POOLSOCKS * 2); + } UNLOCK(&mgr->buffer_lock); return (ISC_R_SUCCESS); } diff --git a/lib/dns/dns64.c b/lib/dns/dns64.c index 7d47c66933b54..9bc3cd8266df1 100644 --- a/lib/dns/dns64.c +++ b/lib/dns/dns64.c @@ -63,7 +63,7 @@ dns_dns64_create(isc_mem_t *mctx, isc_netaddr_t *prefix, unsigned int nbytes = 16; REQUIRE(prefix != NULL && prefix->family == AF_INET6); - /* Legal prefix lengths from draft-ietf-behave-address-format-04. */ + /* Legal prefix lengths from rfc6052.txt. */ REQUIRE(prefixlen == 32 || prefixlen == 40 || prefixlen == 48 || prefixlen == 56 || prefixlen == 64 || prefixlen == 96); REQUIRE(isc_netaddr_prefixok(prefix, prefixlen) == ISC_R_SUCCESS); @@ -73,7 +73,7 @@ dns_dns64_create(isc_mem_t *mctx, isc_netaddr_t *prefix, static const unsigned char zeros[16]; REQUIRE(prefix->family == AF_INET6); nbytes = prefixlen / 8 + 4; - /* Bits 64-71 are zeros. draft-ietf-behave-address-format-04 */ + /* Bits 64-71 are zeros. rfc6052.txt */ if (prefixlen >= 32 && prefixlen <= 64) nbytes++; REQUIRE(memcmp(suffix->type.in6.s6_addr, zeros, nbytes) == 0); @@ -169,13 +169,13 @@ dns_dns64_aaaafroma(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr, INSIST(nbytes <= 12); /* Copy prefix. */ memmove(aaaa, dns64->bits, nbytes); - /* Bits 64-71 are zeros. draft-ietf-behave-address-format-04 */ + /* Bits 64-71 are zeros. rfc6052.txt */ if (nbytes == 8) aaaa[nbytes++] = 0; /* Copy mapped address. */ for (i = 0; i < 4U; i++) { aaaa[nbytes++] = a[i]; - /* Bits 64-71 are zeros. draft-ietf-behave-address-format-04 */ + /* Bits 64-71 are zeros. rfc6052.txt */ if (nbytes == 8) aaaa[nbytes++] = 0; } diff --git a/lib/dns/dnssec.c b/lib/dns/dnssec.c index d7addc681430a..6a749ea56b328 100644 --- a/lib/dns/dnssec.c +++ b/lib/dns/dnssec.c @@ -1247,7 +1247,10 @@ get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) { /* Metadata says activate (so we must also publish) */ if (actset && active <= now) { key->hint_sign = ISC_TRUE; - key->hint_publish = ISC_TRUE; + + /* Only publish if publish time has already passed. */ + if (pubset && publish <= now) + key->hint_publish = ISC_TRUE; } /* @@ -1522,7 +1525,7 @@ dns_dnssec_keylistfromrdataset(dns_name_t *origin, const char *directory, isc_mem_t *mctx, dns_rdataset_t *keyset, dns_rdataset_t *keysigs, dns_rdataset_t *soasigs, isc_boolean_t savekeys, - isc_boolean_t public, + isc_boolean_t publickey, dns_dnsseckeylist_t *keylist) { dns_rdataset_t keys; @@ -1551,7 +1554,7 @@ dns_dnssec_keylistfromrdataset(dns_name_t *origin, if (!dns_name_equal(origin, dst_key_name(pubkey))) goto skip; - if (public) { + if (publickey) { RETERR(addkey(keylist, &pubkey, savekeys, mctx)); goto skip; } diff --git a/lib/dns/ecdb.c b/lib/dns/ecdb.c index 8b3f7740081bd..22cd810a773c7 100644 --- a/lib/dns/ecdb.c +++ b/lib/dns/ecdb.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2011, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009-2011, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -14,8 +14,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ecdb.c,v 1.10 2011/12/20 00:06:53 marka Exp $ */ - #include "config.h" #include <isc/result.h> @@ -772,19 +770,24 @@ rdataset_settrust(dns_rdataset_t *rdataset, dns_trust_t trust) { static void rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp) { - ecdb_rdatasetiter_t *ecdbiterator; isc_mem_t *mctx; + union { + dns_rdatasetiter_t *rdatasetiterator; + ecdb_rdatasetiter_t *ecdbiterator; + } u; REQUIRE(iteratorp != NULL); - ecdbiterator = (ecdb_rdatasetiter_t *)*iteratorp; - REQUIRE(DNS_RDATASETITER_VALID(&ecdbiterator->common)); + REQUIRE(DNS_RDATASETITER_VALID(*iteratorp)); - mctx = ecdbiterator->common.db->mctx; + u.rdatasetiterator = *iteratorp; - ecdbiterator->common.magic = 0; + mctx = u.ecdbiterator->common.db->mctx; + u.ecdbiterator->common.magic = 0; - dns_db_detachnode(ecdbiterator->common.db, &ecdbiterator->common.node); - isc_mem_put(mctx, ecdbiterator, sizeof(ecdb_rdatasetiter_t)); + dns_db_detachnode(u.ecdbiterator->common.db, + &u.ecdbiterator->common.node); + isc_mem_put(mctx, u.ecdbiterator, + sizeof(ecdb_rdatasetiter_t)); *iteratorp = NULL; } diff --git a/lib/dns/gen.c b/lib/dns/gen.c index b934c9990fb3f..ff41de6d624a0 100644 --- a/lib/dns/gen.c +++ b/lib/dns/gen.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2012-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -331,15 +331,20 @@ insert_into_typenames(int type, const char *typename, const char *attr) { exit(1); } + /* XXXMUKS: This is redundant due to the INSIST above. */ if (strlen(typename) > sizeof(ttn->typename) - 1) { fprintf(stderr, "Error: type name %s is too long\n", typename); exit(1); } + strncpy(ttn->typename, typename, sizeof(ttn->typename)); - ttn->type = type; + ttn->typename[sizeof(ttn->typename) - 1] = '\0'; strncpy(ttn->macroname, ttn->typename, sizeof(ttn->macroname)); + ttn->macroname[sizeof(ttn->macroname) - 1] = '\0'; + + ttn->type = type; c = strlen(ttn->macroname); while (c > 0) { if (ttn->macroname[c - 1] == '-') @@ -365,7 +370,10 @@ insert_into_typenames(int type, const char *typename, const char *attr) { attr, typename); exit(1); } + strncpy(ttn->attr, attr, sizeof(ttn->attr)); + ttn->attr[sizeof(ttn->attr) - 1] = '\0'; + ttn->sorted = 0; if (maxtype < type) maxtype = type; @@ -394,11 +402,17 @@ add(int rdclass, const char *classname, int type, const char *typename, newtt->next = NULL; newtt->rdclass = rdclass; newtt->type = type; + strncpy(newtt->classname, classname, sizeof(newtt->classname)); + newtt->classname[sizeof(newtt->classname) - 1] = '\0'; + strncpy(newtt->typename, typename, sizeof(newtt->typename)); + newtt->typename[sizeof(newtt->typename) - 1] = '\0'; + if (strncmp(dirname, "./", 2) == 0) dirname += 2; strncpy(newtt->dirname, dirname, sizeof(newtt->dirname)); + newtt->dirname[sizeof(newtt->dirname) - 1] = '\0'; tt = types; oldtt = NULL; @@ -437,6 +451,7 @@ add(int rdclass, const char *classname, int type, const char *typename, } newcc->rdclass = rdclass; strncpy(newcc->classname, classname, sizeof(newcc->classname)); + newcc->classname[sizeof(newcc->classname) - 1] = '\0'; cc = classes; oldcc = NULL; diff --git a/lib/dns/gssapictx.c b/lib/dns/gssapictx.c index d4209d378a76e..f28c07aba4361 100644 --- a/lib/dns/gssapictx.c +++ b/lib/dns/gssapictx.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -233,7 +233,7 @@ check_config(const char *gss_name) { krb5_free_context(krb5_ctx); return; } - p = strchr(gss_name, '/'); + p = strchr(gss_name, '@'); if (p == NULL) { gss_log(ISC_LOG_ERROR, "badly formatted " "tkey-gssapi-credentials (%s)", gss_name); diff --git a/lib/dns/include/dns/Makefile.in b/lib/dns/include/dns/Makefile.in index 6ff682f70d372..640a63e2c8e76 100644 --- a/lib/dns/include/dns/Makefile.in +++ b/lib/dns/include/dns/Makefile.in @@ -21,18 +21,22 @@ top_srcdir = @top_srcdir@ @BIND9_VERSION@ -HEADERS = acl.h adb.h byaddr.h cache.h callbacks.h cert.h compress.h \ +HEADERS = acache.h acl.h adb.h bit.h byaddr.h cache.h callbacks.h cert.h \ client.h clientinfo.h compress.h \ db.h dbiterator.h dbtable.h diff.h dispatch.h \ - dlz.h dnssec.h ds.h events.h fixedname.h iptable.h journal.h \ - keyflags.h keytable.h keyvalues.h lib.h log.h \ - master.h masterdump.h message.h name.h ncache.h nsec.h \ - peer.h portlist.h private.h rbt.h rcode.h \ - rdata.h rdataclass.h rdatalist.h rdataset.h rdatasetiter.h \ - rdataslab.h rdatatype.h request.h resolver.h result.h \ - rootns.h rpz.h sdb.h sdlz.h secalg.h secproto.h soa.h ssu.h \ - tcpmsg.h time.h tkey.h tsec.h tsig.h ttl.h types.h \ - validator.h version.h view.h xfrin.h zone.h zonekey.h zt.h + dlz.h dlz_dlopen.h dns64.h dnssec.h ds.h \ + ecdb.h events.h fixedname.h forward.h iptable.h \ + journal.h keydata.h keyflags.h keytable.h keyvalues.h \ + lib.h lookup.h log.h master.h masterdump.h message.h \ + name.h ncache.h nsec.h nsec3.h opcode.h order.h \ + peer.h portlist.h private.h \ + rbt.h rcode.h rdata.h rdataclass.h rdatalist.h \ + rdataset.h rdatasetiter.h rdataslab.h rdatatype.h request.h \ + resolver.h result.h rootns.h rpz.h rriterator.h rrl.h \ + sdb.h sdlz.h secalg.h secproto.h soa.h ssu.h stats.h \ + tcpmsg.h time.h timer.h tkey.h tsec.h tsig.h ttl.h types.h \ + update.h validator.h version.h view.h xfrin.h \ + zone.h zonekey.h zt.h GENHEADERS = enumclass.h enumtype.h rdatastruct.h diff --git a/lib/dns/include/dns/adb.h b/lib/dns/include/dns/adb.h index a5a312406affa..8222bd2110063 100644 --- a/lib/dns/include/dns/adb.h +++ b/lib/dns/include/dns/adb.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008, 2011, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008, 2011, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -334,6 +334,13 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, dns_rdatatype_t qtype, unsigned int options, isc_stdtime_t now, dns_name_t *target, in_port_t port, dns_adbfind_t **find); +isc_result_t +dns_adb_createfind2(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, + void *arg, dns_name_t *name, dns_name_t *qname, + dns_rdatatype_t qtype, unsigned int options, + isc_stdtime_t now, dns_name_t *target, in_port_t port, + unsigned int depth, isc_counter_t *qc, + dns_adbfind_t **find); /*%< * Main interface for clients. The adb will look up the name given in * "name" and will build up a list of found addresses, and perhaps start @@ -510,7 +517,12 @@ dns_adb_marklame(dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *qname, */ /* - * A reasonable default for RTT adjustments + * Reasonable defaults for RTT adjustments + * + * (Note: these values function both as scaling factors and as + * indicators of the type of RTT adjustment operation taking place. + * Adjusting the scaling factors is fine, as long as they all remain + * unique values.) */ #define DNS_ADB_RTTADJDEFAULT 7 /*%< default scale */ #define DNS_ADB_RTTADJREPLACE 0 /*%< replace with our rtt */ @@ -521,18 +533,6 @@ dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int rtt, unsigned int factor); /*%< * Mix the round trip time into the existing smoothed rtt. - - * The formula used - * (where srtt is the existing rtt value, and rtt and factor are arguments to - * this function): - * - *\code - * new_srtt = (old_srtt / 10 * factor) + (rtt / 10 * (10 - factor)); - *\endcode - * - * XXXRTH Do we want to publish the formula? What if we want to change how - * this works later on? Recommend/require that the units are - * microseconds? * * Requires: * @@ -549,6 +549,24 @@ dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr, */ void +dns_adb_agesrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr, isc_stdtime_t now); +/* + * dns_adb_agesrtt is equivalent to dns_adb_adjustsrtt with factor + * equal to DNS_ADB_RTTADJAGE and the current time passed in. + * + * Requires: + * + *\li adb be valid. + * + *\li addr be valid. + * + * Note: + * + *\li The srtt in addr will be updated to reflect the new global + * srtt value. This may include changes made by others. + */ + +void dns_adb_changeflags(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int bits, unsigned int mask); /*% diff --git a/lib/dns/include/dns/dns64.h b/lib/dns/include/dns/dns64.h index eb8f8d6436a66..4d0e801585413 100644 --- a/lib/dns/include/dns/dns64.h +++ b/lib/dns/include/dns/dns64.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2010, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -84,7 +84,7 @@ dns_dns64_create(isc_mem_t *mctx, isc_netaddr_t *prefix, * zero. * 'client' to be NULL or a valid acl. * 'mapped' to be NULL or a valid acl. - * 'exculded' to be NULL or a valid acl. + * 'excluded' to be NULL or a valid acl. * * Returns: * ISC_R_SUCCESS diff --git a/lib/dns/include/dns/dnssec.h b/lib/dns/include/dns/dnssec.h index 7202d99b5da94..936454fc465e8 100644 --- a/lib/dns/include/dns/dnssec.h +++ b/lib/dns/include/dns/dnssec.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009-2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -314,11 +314,11 @@ dns_dnssec_keylistfromrdataset(dns_name_t *origin, const char *directory, isc_mem_t *mctx, dns_rdataset_t *keyset, dns_rdataset_t *keysigs, dns_rdataset_t *soasigs, isc_boolean_t savekeys, - isc_boolean_t public, + isc_boolean_t publickey, dns_dnsseckeylist_t *keylist); /*%< * Append the contents of a DNSKEY rdataset 'keyset' to 'keylist'. - * Omit duplicates. If 'public' is ISC_FALSE, search 'directory' for + * Omit duplicates. If 'publickey' is ISC_FALSE, search 'directory' for * matching key files, and load the private keys that go with * the public ones. If 'savekeys' is ISC_TRUE, mark the keys so * they will not be deleted or inactivated regardless of metadata. diff --git a/lib/dns/include/dns/message.h b/lib/dns/include/dns/message.h index 6b2f39fc95835..c678238d22246 100644 --- a/lib/dns/include/dns/message.h +++ b/lib/dns/include/dns/message.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2010, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010, 2012-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -106,6 +106,10 @@ /*%< EDNS0 extended OPT codes */ #define DNS_OPT_NSID 0x0003 /*%< NSID opt code */ #define DNS_OPT_CLIENT_SUBNET 0x0008 /*%< client subnet opt code */ +#define DNS_OPT_EXPIRE 0x0009 /*%< EXPIRE opt code */ + +/*%< The number of EDNS options we know about. */ +#define DNS_EDNSOPTIONS 3 #define DNS_MESSAGE_REPLYPRESERVE (DNS_MESSAGEFLAG_RD|DNS_MESSAGEFLAG_CD) #define DNS_MESSAGEEXTFLAG_REPLYPRESERVE (DNS_MESSAGEEXTFLAG_DO) diff --git a/lib/dns/include/dns/rbt.h b/lib/dns/include/dns/rbt.h index 3e9dc886576fa..8b382b5ed6be9 100644 --- a/lib/dns/include/dns/rbt.h +++ b/lib/dns/include/dns/rbt.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -914,6 +914,31 @@ dns_rbtnodechain_nextflat(dns_rbtnodechain_t *chain, dns_name_t *name); #define dns_rbtnode_refinit(node, n) ((node)->references = (n)) #define dns_rbtnode_refdestroy(node) REQUIRE((node)->references == 0) #define dns_rbtnode_refcurrent(node) ((node)->references) + +#if (__STDC_VERSION__ + 0) >= 199901L || defined __GNUC__ +static inline void +dns_rbtnode_refincrement0(dns_rbtnode_t *node, unsigned int *refs) { + node->references++; + if (refs != NULL) + *refs = node->references; +} + +static inline void +dns_rbtnode_refincrement(dns_rbtnode_t *node, unsigned int *refs) { + REQUIRE(node->references > 0); + node->references++; + if (refs != NULL) + *refs = node->references; +} + +static inline void +dns_rbtnode_refdecrement(dns_rbtnode_t *node, unsigned int *refs) { + REQUIRE(node->references > 0); + node->references--; + if (refs != NULL) + *refs = node->references; +} +#else #define dns_rbtnode_refincrement0(node, refs) \ do { \ unsigned int *_tmp = (unsigned int *)(refs); \ @@ -935,6 +960,7 @@ dns_rbtnodechain_nextflat(dns_rbtnodechain_t *chain, dns_name_t *name); if ((refs) != NULL) \ (*refs) = (node)->references; \ } while (0) +#endif #endif /* DNS_RBT_USEISCREFCOUNT */ ISC_LANG_ENDDECLS diff --git a/lib/dns/include/dns/rdataset.h b/lib/dns/include/dns/rdataset.h index 31bcd15f1424e..c266d14655eea 100644 --- a/lib/dns/include/dns/rdataset.h +++ b/lib/dns/include/dns/rdataset.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -199,7 +199,8 @@ struct dns_rdataset { #define DNS_RDATASETATTR_NXDOMAIN 0x00002000 #define DNS_RDATASETATTR_NOQNAME 0x00004000 #define DNS_RDATASETATTR_CHECKNAMES 0x00008000 /*%< Used by resolver. */ -#define DNS_RDATASETATTR_REQUIREDGLUE 0x00010000 +#define DNS_RDATASETATTR_REQUIRED 0x00010000 +#define DNS_RDATASETATTR_REQUIREDGLUE DNS_RDATASETATTR_REQUIRED #define DNS_RDATASETATTR_LOADORDER 0x00020000 #define DNS_RDATASETATTR_RESIGN 0x00040000 #define DNS_RDATASETATTR_CLOSEST 0x00080000 @@ -673,7 +674,7 @@ dns_rdataset_trimttl(dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, const char * dns_trust_totext(dns_trust_t trust); -/* +/*%< * Display trust in textual form. */ diff --git a/lib/dns/include/dns/resolver.h b/lib/dns/include/dns/resolver.h index 095269ea2dd29..a533f4ed2b24f 100644 --- a/lib/dns/include/dns/resolver.h +++ b/lib/dns/include/dns/resolver.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -97,6 +97,7 @@ typedef struct dns_fetchevent { UDP buffer. */ #define DNS_FETCHOPT_WANTNSID 0x80 /*%< Request NSID */ +/* Reserved in use by adb.c 0x00400000 */ #define DNS_FETCHOPT_EDNSVERSIONSET 0x00800000 #define DNS_FETCHOPT_EDNSVERSIONMASK 0xff000000 #define DNS_FETCHOPT_EDNSVERSIONSHIFT 24 @@ -274,6 +275,18 @@ dns_resolver_createfetch2(dns_resolver_t *res, dns_name_t *name, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp); +isc_result_t +dns_resolver_createfetch3(dns_resolver_t *res, dns_name_t *name, + dns_rdatatype_t type, + dns_name_t *domain, dns_rdataset_t *nameservers, + dns_forwarders_t *forwarders, + isc_sockaddr_t *client, isc_uint16_t id, + unsigned int options, unsigned int depth, + isc_counter_t *qc, isc_task_t *task, + isc_taskaction_t action, void *arg, + dns_rdataset_t *rdataset, + dns_rdataset_t *sigrdataset, + dns_fetch_t **fetchp); /*%< * Recurse to answer a question. * @@ -575,6 +588,30 @@ dns_resolver_printbadcache(dns_resolver_t *resolver, FILE *fp); * \li resolver to be valid. */ +void +dns_resolver_setmaxdepth(dns_resolver_t *resolver, unsigned int maxdepth); +unsigned int +dns_resolver_getmaxdepth(dns_resolver_t *resolver); +/*% + * Get and set how many NS indirections will be followed when looking for + * nameserver addresses. + * + * Requires: + * \li resolver to be valid. + */ + +void +dns_resolver_setmaxqueries(dns_resolver_t *resolver, unsigned int queries); +unsigned int +dns_resolver_getmaxqueries(dns_resolver_t *resolver); +/*% + * Get and set how many iterative queries will be allowed before + * terminating a recursive query. + * + * Requires: + * \li resolver to be valid. + */ + ISC_LANG_ENDDECLS #endif /* DNS_RESOLVER_H */ diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index 704e5fe3e9993..b9d6084f351ce 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -140,6 +140,7 @@ struct dns_view { dns_acl_t * updateacl; dns_acl_t * upfwdacl; dns_acl_t * denyansweracl; + dns_acl_t * nocasecompress; dns_rbt_t * answeracl_exclude; dns_rbt_t * denyanswernames; dns_rbt_t * answernames_exclude; @@ -711,6 +712,7 @@ dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name, isc_boolean_t allc * Returns: *\li #ISC_R_SUCCESS A matching zone was found. *\li #ISC_R_NOTFOUND No matching zone was found. + *\li #ISC_R_MULTIPLE Multiple zones with the same name were found. */ isc_result_t diff --git a/lib/dns/keytable.c b/lib/dns/keytable.c index c49847f326ad7..56fefcd2c122b 100644 --- a/lib/dns/keytable.c +++ b/lib/dns/keytable.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2009, 2010, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009, 2010, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -174,6 +174,7 @@ insert(dns_keytable_t *keytable, isc_boolean_t managed, for (k = node->data; k != NULL; k = k->next) { if (k->key == NULL) { k->key = *keyp; + *keyp = NULL; /* transfer ownership */ break; } if (dst_key_compare(k->key, *keyp) == ISC_TRUE) @@ -182,7 +183,7 @@ insert(dns_keytable_t *keytable, isc_boolean_t managed, if (k == NULL) result = ISC_R_SUCCESS; - else + else if (*keyp != NULL) dst_key_free(keyp); } @@ -575,6 +576,8 @@ dns_keytable_dump(dns_keytable_t *keytable, FILE *fp) dns_rbtnodechain_current(&chain, NULL, NULL, &node); for (knode = node->data; knode != NULL; knode = knode->next) { + if (knode->key == NULL) + continue; dst_key_format(knode->key, pbuf, sizeof(pbuf)); fprintf(fp, "%s ; %s\n", pbuf, knode->managed ? "managed" : "trusted"); diff --git a/lib/dns/master.c b/lib/dns/master.c index 9e796e6e0ac73..dcea97a0bdd4d 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2011-2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2011-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -91,6 +91,8 @@ #define DNS_MASTER_LHS 2048 #define DNS_MASTER_RHS MINTSIZ +#define CHECKNAMESFAIL(x) (((x) & DNS_MASTER_CHECKNAMESFAIL) != 0) + typedef ISC_LIST(dns_rdatalist_t) rdatalist_head_t; typedef struct dns_incctx dns_incctx_t; @@ -798,13 +800,12 @@ generate(dns_loadctx_t *lctx, char *range, char *lhs, char *gtype, char *rhs, dns_rdatalist_t rdatalist; dns_rdatatype_t type; rdatalist_head_t head; - int n; int target_size = MINTSIZ; /* only one rdata at a time */ isc_buffer_t buffer; isc_buffer_t target; isc_result_t result; isc_textregion_t r; - unsigned int start, stop, step, i; + int i, n, start, stop, step = 0; dns_incctx_t *ictx; ictx = lctx->inc; @@ -822,8 +823,10 @@ generate(dns_loadctx_t *lctx, char *range, char *lhs, char *gtype, char *rhs, } isc_buffer_init(&target, target_mem, target_size); - n = sscanf(range, "%u-%u/%u", &start, &stop, &step); - if (n < 2 || stop < start) { + n = sscanf(range, "%d-%d/%d", &start, &stop, &step); + if ((n < 2) || (start < 0) || (stop < 0) || (step < 0) || + (stop < start)) + { (*callbacks->error)(callbacks, "%s: %s:%lu: invalid range '%s'", "$GENERATE", source, line, range); @@ -1759,7 +1762,8 @@ load_text(dns_loadctx_t *lctx) { dns_name_format(name, namebuf, sizeof(namebuf)); result = DNS_R_BADOWNERNAME; desc = dns_result_totext(result); - if ((lctx->options & DNS_MASTER_CHECKNAMESFAIL) != 0) { + if (CHECKNAMESFAIL(lctx->options) || + type == dns_rdatatype_nsec3) { (*callbacks->error)(callbacks, "%s:%lu: %s: %s", source, line, @@ -2132,7 +2136,7 @@ load_raw(dns_loadctx_t *lctx) { isc_result_totext(result)); return (result); } - isc_buffer_add(&target, commonlen); + isc_buffer_add(&target, (unsigned int)commonlen); header.format = isc_buffer_getuint32(&target); if (header.format != dns_masterformat_raw) { (*callbacks->error)(callbacks, @@ -2165,7 +2169,7 @@ load_raw(dns_loadctx_t *lctx) { return (result); } - isc_buffer_add(&target, remainder); + isc_buffer_add(&target, (unsigned int)remainder); header.dumptime = isc_buffer_getuint32(&target); if (header.version == DNS_RAWFORMAT_VERSION) { header.flags = isc_buffer_getuint32(&target); @@ -2275,7 +2279,7 @@ load_raw(dns_loadctx_t *lctx) { rdatalist.covers = isc_buffer_getuint16(&target); rdatalist.ttl = isc_buffer_getuint32(&target); rdcount = isc_buffer_getuint32(&target); - if (rdcount == 0) { + if (rdcount == 0 || rdcount > 0xffff) { result = ISC_R_RANGE; goto cleanup; } diff --git a/lib/dns/message.c b/lib/dns/message.c index 901c6b6d991dd..d76eb4fb26c62 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -1377,6 +1377,16 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, covers = 0; /* + * Check the ownername of NSEC3 records + */ + if (rdtype == dns_rdatatype_nsec3 && + !dns_rdata_checkowner(name, msg->rdclass, rdtype, + ISC_FALSE)) { + result = DNS_R_BADOWNERNAME; + goto cleanup; + } + + /* * If we are doing a dynamic update or this is a meta-type, * don't bother searching for a name, just append this one * to the end of the message. @@ -3196,7 +3206,8 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_pseudosection_t section, const dns_master_style_t *style, dns_messagetextflag_t flags, - isc_buffer_t *target) { + isc_buffer_t *target) +{ dns_rdataset_t *ps = NULL; dns_name_t *name = NULL; isc_result_t result; @@ -3270,8 +3281,11 @@ dns_message_pseudosectiontotext(dns_message_t *msg, sprintf(buf, "%02x ", optdata[i]); ADD_STRING(target, buf); } + for (i = 0; i < optlen; i++) { ADD_STRING(target, " ("); + if (!isc_buffer_availablelength(target)) + return (ISC_R_NOSPACE); if (isprint(optdata[i])) isc_buffer_putmem(target, &optdata[i], diff --git a/lib/dns/name.c b/lib/dns/name.c index 9b24ed3638042..5207f74b42401 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -53,7 +53,6 @@ typedef enum { typedef enum { fw_start = 0, fw_ordinary, - fw_copy, fw_newcurrent } fw_state; @@ -1161,7 +1160,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, count++; CONVERTTOASCII(c); if (downcase) - c = maptolower[(int)c]; + c = maptolower[c & 0xff]; *ndata++ = c; nrem--; nused++; @@ -1185,7 +1184,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, count++; CONVERTTOASCII(c); if (downcase) - c = maptolower[(int)c]; + c = maptolower[c & 0xff]; *ndata++ = c; nrem--; nused++; @@ -1200,7 +1199,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, if (!isdigit(c & 0xff)) return (DNS_R_BADESCAPE); value *= 10; - value += digitvalue[(int)c]; + value += digitvalue[c & 0xff]; digits++; if (digits == 3) { if (value > 255) @@ -1252,7 +1251,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, while (n2 > 0) { c = *label++; if (downcase) - c = maptolower[(int)c]; + c = maptolower[c & 0xff]; *ndata++ = c; n2--; } @@ -1859,7 +1858,6 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, 0) return (DNS_R_DISALLOWED); new_current = c & 0x3F; - n = 1; state = fw_newcurrent; } else return (DNS_R_BADLABELTYPE); @@ -1867,8 +1865,6 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, case fw_ordinary: if (downcase) c = maptolower[c]; - /* FALLTHROUGH */ - case fw_copy: *ndata++ = c; n--; if (n == 0) @@ -1877,9 +1873,6 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, case fw_newcurrent: new_current *= 256; new_current += c; - n--; - if (n != 0) - break; if (new_current >= biggest_pointer) return (DNS_R_BADPOINTER); biggest_pointer = new_current; diff --git a/lib/dns/nsec.c b/lib/dns/nsec.c index 5d1197d093b09..6183ef281c02e 100644 --- a/lib/dns/nsec.c +++ b/lib/dns/nsec.c @@ -436,7 +436,7 @@ dns_nsec_noexistnodata(dns_rdatatype_t type, dns_name_t *name, nlabels, &common); } result = dns_name_concatenate(dns_wildcardname, &common, - wild, NULL); + wild, NULL); if (result != ISC_R_SUCCESS) { dns_rdata_freestruct(&nsec); (*logit)(arg, ISC_LOG_DEBUG(3), diff --git a/lib/dns/nsec3.c b/lib/dns/nsec3.c index 3724118cb3fe9..ef43c35d27bb4 100644 --- a/lib/dns/nsec3.c +++ b/lib/dns/nsec3.c @@ -253,11 +253,11 @@ dns_nsec3_hashname(dns_fixedname_t *result, if (hash_length != NULL) *hash_length = len; - /* convert the hash to base32hex */ + /* convert the hash to base32hex non-padded */ region.base = rethash; region.length = (unsigned int)len; isc_buffer_init(&namebuffer, nametext, sizeof nametext); - isc_base32hex_totext(®ion, 1, "", &namebuffer); + isc_base32hexnp_totext(®ion, 1, "", &namebuffer); /* convert the hex to a domain name */ dns_fixedname_init(result); @@ -269,7 +269,8 @@ unsigned int dns_nsec3_hashlength(dns_hash_t hash) { switch (hash) { - case dns_hash_sha1: return(ISC_SHA1_DIGESTLENGTH); + case dns_hash_sha1: + return(ISC_SHA1_DIGESTLENGTH); } return (0); } @@ -277,7 +278,8 @@ dns_nsec3_hashlength(dns_hash_t hash) { isc_boolean_t dns_nsec3_supportedhash(dns_hash_t hash) { switch (hash) { - case dns_hash_sha1: return (ISC_TRUE); + case dns_hash_sha1: + return (ISC_TRUE); } return (ISC_FALSE); } @@ -565,6 +567,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version, CHECK(dns_nsec3_hashname(&fixed, nexthash, &next_length, name, origin, hash, iterations, salt, salt_length)); + INSIST(next_length <= sizeof(nexthash)); /* * Create the node if it doesn't exist and hold @@ -842,8 +845,8 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version, dns_db_detachnode(db, &newnode); } while (1); - if (result == ISC_R_NOMORE) - result = ISC_R_SUCCESS; + /* result cannot be ISC_R_NOMORE here */ + INSIST(result != ISC_R_NOMORE); failure: if (dbit != NULL) @@ -2072,6 +2075,9 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, dns_name_t* name, if ((nsec3.flags & DNS_NSEC3FLAG_OPTOUT) != 0) (*logit)(arg, ISC_LOG_DEBUG(3), "NSEC3 indicates optout"); + else + (*logit)(arg, ISC_LOG_DEBUG(3), + "NSEC3 indicates secure range"); *optout = ISC_TF(nsec3.flags & DNS_NSEC3FLAG_OPTOUT); } diff --git a/lib/dns/openssl_link.c b/lib/dns/openssl_link.c index 56465aa006454..a0a2724f41c14 100644 --- a/lib/dns/openssl_link.c +++ b/lib/dns/openssl_link.c @@ -1,5 +1,5 @@ /* - * Portions Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (C) 2004-2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -242,8 +242,7 @@ dst__openssl_init(const char *engine) { } void -dst__openssl_destroy() { - +dst__openssl_destroy(void) { /* * Sequence taken from apps_shutdown() in <apps/apps.h>. */ diff --git a/lib/dns/peer.c b/lib/dns/peer.c index ec9e08cb27b76..b17bbea1328ab 100644 --- a/lib/dns/peer.c +++ b/lib/dns/peer.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -300,10 +300,15 @@ peer_delete(dns_peer_t **peer) { isc_mem_put(mem, p->key, sizeof(dns_name_t)); } - if (p->transfer_source != NULL) { + if (p->query_source != NULL) + isc_mem_put(mem, p->query_source, sizeof(*p->query_source)); + + if (p->notify_source != NULL) + isc_mem_put(mem, p->notify_source, sizeof(*p->notify_source)); + + if (p->transfer_source != NULL) isc_mem_put(mem, p->transfer_source, sizeof(*p->transfer_source)); - } isc_mem_put(mem, p, sizeof(*p)); diff --git a/lib/dns/rbt.c b/lib/dns/rbt.c index d97fcce28eb9b..0e9c5f9505692 100644 --- a/lib/dns/rbt.c +++ b/lib/dns/rbt.c @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - /*! \file */ /* Principal Authors: DCL */ @@ -134,7 +132,10 @@ struct dns_rbt { * of memory concerns, when chains were first implemented). */ #define ADD_LEVEL(chain, node) \ - (chain)->levels[(chain)->level_count++] = (node) + do { \ + INSIST((chain)->level_count < DNS_RBT_LEVELBLOCK); \ + (chain)->levels[(chain)->level_count++] = (node); \ + } while (0) /*% * The following macros directly access normally private name variables. diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 013bf34a0a09c..a8ad8329c73ba 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - /*! \file */ /* @@ -93,6 +91,127 @@ typedef isc_uint64_t rbtdb_serial_t; #define dns_rbtdb_t dns_rbtdb64_t #define rdatasetheader_t rdatasetheader64_t #define rbtdb_version_t rbtdb_version64_t + +#define init_count init_count64 + +#define cache_methods cache_methods64 +#define dbiterator_methods dbiterator_methods64 +#define rdataset_methods rdataset_methods64 +#define rdatasetiter_methods rdatasetiter_methods64 +#define zone_methods zone_methods64 + +#define acache_callback acache_callback64 +#define acache_cancelentry acache_cancelentry64 +#define activeempty activeempty64 +#define activeemtpynode activeemtpynode64 +#define add32 add64 +#define add_changed add_changed64 +#define add_empty_wildcards add_empty_wildcards64 +#define add_wildcard_magic add_wildcard_magic64 +#define addrdataset addrdataset64 +#define allrdatasets allrdatasets64 +#define attach attach64 +#define attachnode attachnode64 +#define attachversion attachversion64 +#define beginload beginload64 +#define bind_rdataset bind_rdataset64 +#define cache_find cache_find64 +#define cache_findrdataset cache_findrdataset64 +#define cache_findzonecut cache_findzonecut64 +#define cache_zonecut_callback cache_zonecut_callback64 +#define cleanup_dead_nodes cleanup_dead_nodes64 +#define cleanup_dead_nodes_callback cleanup_dead_nodes_callback64 +#define closeversion closeversion64 +#define createiterator createiterator64 +#define currentversion currentversion64 +#define dbiterator_current dbiterator_current64 +#define dbiterator_destroy dbiterator_destroy64 +#define dbiterator_first dbiterator_first64 +#define dbiterator_last dbiterator_last64 +#define dbiterator_next dbiterator_next64 +#define dbiterator_origin dbiterator_origin64 +#define dbiterator_pause dbiterator_pause64 +#define dbiterator_prev dbiterator_prev64 +#define dbiterator_seek dbiterator_seek64 +#define decrement_reference decrement_reference64 +#define delete_callback delete_callback64 +#define delete_node delete_node64 +#define deleterdataset deleterdataset64 +#define detach detach64 +#define detachnode detachnode64 +#define dump dump64 +#define endload endload64 +#define expire_header expire_header64 +#define expirenode expirenode64 +#define find_closest_nsec find_closest_nsec64 +#define find_coveringnsec find_coveringnsec64 +#define find_deepest_zonecut find_deepest_zonecut64 +#define findnode findnode64 +#define findnodeintree findnodeintree64 +#define findnsec3node findnsec3node64 +#define flush_deletions flush_deletions64 +#define free_acachearray free_acachearray64 +#define free_noqname free_noqname64 +#define free_rbtdb free_rbtdb64 +#define free_rbtdb_callback free_rbtdb_callback64 +#define free_rdataset free_rdataset64 +#define getnsec3parameters getnsec3parameters64 +#define getoriginnode getoriginnode64 +#define getrrsetstats getrrsetstats64 +#define getsigningtime getsigningtime64 +#define isdnssec isdnssec64 +#define ispersistent ispersistent64 +#define issecure issecure64 +#define iszonesecure iszonesecure64 +#define loading_addrdataset loading_addrdataset64 +#define loadnode loadnode64 +#define matchparams matchparams64 +#define maybe_free_rbtdb maybe_free_rbtdb64 +#define new_reference new_reference64 +#define newversion newversion64 +#define nodecount nodecount64 +#define overmem overmem64 +#define previous_closest_nsec previous_closest_nsec64 +#define printnode printnode64 +#define prune_tree prune_tree64 +#define rdataset_clone rdataset_clone64 +#define rdataset_count rdataset_count64 +#define rdataset_current rdataset_current64 +#define rdataset_disassociate rdataset_disassociate64 +#define rdataset_expire rdataset_expire64 +#define rdataset_first rdataset_first64 +#define rdataset_getadditional rdataset_getadditional64 +#define rdataset_getclosest rdataset_getclosest64 +#define rdataset_getnoqname rdataset_getnoqname64 +#define rdataset_next rdataset_next64 +#define rdataset_putadditional rdataset_putadditional64 +#define rdataset_setadditional rdataset_setadditional64 +#define rdataset_settrust rdataset_settrust64 +#define rdatasetiter_current rdatasetiter_current64 +#define rdatasetiter_destroy rdatasetiter_destroy64 +#define rdatasetiter_first rdatasetiter_first64 +#define rdatasetiter_next rdatasetiter_next64 +#define reactivate_node reactivate_node64 +#define resign_delete resign_delete64 +#define resign_insert resign_insert64 +#define resign_sooner resign_sooner64 +#define resigned resigned64 +#define rpz_enabled rpz_enabled64 +#define rpz_findips rpz_findips64 +#define set_index set_index64 +#define set_ttl set_ttl64 +#define setsigningtime setsigningtime64 +#define settask settask64 +#define setup_delegation setup_delegation64 +#define subtractrdataset subtractrdataset64 +#define ttl_sooner ttl_sooner64 +#define update_header update_header64 +#define update_rrsetstats update_rrsetstats64 +#define zone_find zone_find64 +#define zone_findrdataset zone_findrdataset64 +#define zone_findzonecut zone_findzonecut64 +#define zone_zonecut_callback zone_zonecut_callback64 + #else typedef isc_uint32_t rbtdb_serial_t; #endif @@ -537,6 +656,8 @@ static void overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, isc_stdtime_t now, isc_boolean_t tree_locked); static isc_result_t resign_insert(dns_rbtdb_t *rbtdb, int idx, rdatasetheader_t *newheader); +static void resign_delete(dns_rbtdb_t *rbtdb, rbtdb_version_t *version, + rdatasetheader_t *header); static void prune_tree(isc_task_t *task, isc_event_t *event); static void rdataset_settrust(dns_rdataset_t *rdataset, dns_trust_t trust); static void rdataset_expire(dns_rdataset_t *rdataset); @@ -774,7 +895,7 @@ resign_sooner(void *v1, void *v2) { rdatasetheader_t *h1 = v1; rdatasetheader_t *h2 = v2; - if (h1->resign < h2->resign) + if (isc_serial_lt(h1->resign, h2->resign)) return (ISC_TRUE); return (ISC_FALSE); } @@ -2372,8 +2493,18 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) { lock = &rbtdb->node_locks[header->node->locknum].lock; NODE_LOCK(lock, isc_rwlocktype_write); - if (rollback) - resign_insert(rbtdb, header->node->locknum, header); + if (rollback && !IGNORE(header)) { + isc_result_t result; + result = resign_insert(rbtdb, header->node->locknum, + header); + if (result != ISC_R_SUCCESS) + isc_log_write(dns_lctx, + DNS_LOGCATEGORY_DATABASE, + DNS_LOGMODULE_ZONE, ISC_LOG_ERROR, + "Unable to reinsert header to " + "re-signing heap: %s\n", + dns_result_totext(result)); + } decrement_reference(rbtdb, header->node, least_serial, isc_rwlocktype_write, isc_rwlocktype_none, ISC_FALSE); @@ -5874,10 +6005,28 @@ resign_insert(dns_rbtdb_t *rbtdb, int idx, rdatasetheader_t *newheader) { return (result); } +static void +resign_delete(dns_rbtdb_t *rbtdb, rbtdb_version_t *version, + rdatasetheader_t *header) +{ + /* + * Remove the old header from the heap + */ + if (header != NULL && header->heap_index != 0) { + isc_heap_delete(rbtdb->heaps[header->node->locknum], + header->heap_index); + header->heap_index = 0; + if (version != NULL) { + new_reference(rbtdb, header->node); + ISC_LIST_APPEND(version->resigned_list, header, link); + } + } +} + static isc_result_t -add(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, - rdatasetheader_t *newheader, unsigned int options, isc_boolean_t loading, - dns_rdataset_t *addedrdataset, isc_stdtime_t now) +add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, + rdatasetheader_t *newheader, unsigned int options, isc_boolean_t loading, + dns_rdataset_t *addedrdataset, isc_stdtime_t now) { rbtdb_changed_t *changed = NULL; rdatasetheader_t *topheader, *topheader_prev, *header, *sigheader; @@ -6211,6 +6360,19 @@ add(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, */ newheader->down = NULL; free_rdataset(rbtdb, rbtdb->common.mctx, header); + + idx = newheader->node->locknum; + if (IS_CACHE(rbtdb)) { + ISC_LIST_PREPEND(rbtdb->rdatasets[idx], + newheader, link); + INSIST(rbtdb->heaps != NULL); + (void)isc_heap_insert(rbtdb->heaps[idx], + newheader); + } else if (RESIGN(newheader)) { + result = resign_insert(rbtdb, idx, newheader); + if (result != ISC_R_SUCCESS) + return (result); + } } else { newheader->down = topheader; topheader->next = newheader; @@ -6238,9 +6400,14 @@ add(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, * will not leak... for long. */ INSIST(rbtdb->heaps != NULL); - isc_heap_insert(rbtdb->heaps[idx], newheader); - } else if (RESIGN(newheader)) - resign_insert(rbtdb, idx, newheader); + (void)isc_heap_insert(rbtdb->heaps[idx], + newheader); + } else if (RESIGN(newheader)) { + resign_delete(rbtdb, rbtversion, header); + result = resign_insert(rbtdb, idx, newheader); + if (result != ISC_R_SUCCESS) + return (result); + } } } else { /* @@ -6292,7 +6459,10 @@ add(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, newheader, link); isc_heap_insert(rbtdb->heaps[idx], newheader); } else if (RESIGN(newheader)) { - resign_insert(rbtdb, idx, newheader); + resign_delete(rbtdb, rbtversion, header); + result = resign_insert(rbtdb, idx, newheader); + if (result != ISC_R_SUCCESS) + return (result); } } @@ -6601,8 +6771,8 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, } if (result == ISC_R_SUCCESS) - result = add(rbtdb, rbtnode, rbtversion, newheader, options, - ISC_FALSE, addedrdataset, now); + result = add32(rbtdb, rbtnode, rbtversion, newheader, options, + ISC_FALSE, addedrdataset, now); if (result == ISC_R_SUCCESS && delegating) rbtnode->find_callback = 1; @@ -6778,6 +6948,7 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, topheader->next = newheader; rbtnode->dirty = 1; changed->dirty = ISC_TRUE; + resign_delete(rbtdb, rbtversion, header); } else { /* * The rdataset doesn't exist, so we don't need to do anything @@ -6847,8 +7018,8 @@ deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, NODE_LOCK(&rbtdb->node_locks[rbtnode->locknum].lock, isc_rwlocktype_write); - result = add(rbtdb, rbtnode, rbtversion, newheader, DNS_DBADD_FORCE, - ISC_FALSE, NULL, 0); + result = add32(rbtdb, rbtnode, rbtversion, newheader, DNS_DBADD_FORCE, + ISC_FALSE, NULL, 0); NODE_UNLOCK(&rbtdb->node_locks[rbtnode->locknum].lock, isc_rwlocktype_write); @@ -7042,8 +7213,8 @@ loading_addrdataset(void *arg, dns_name_t *name, dns_rdataset_t *rdataset) { } else newheader->resign = 0; - result = add(rbtdb, node, rbtdb->current_version, newheader, - DNS_DBADD_MERGE, ISC_TRUE, NULL, 0); + result = add32(rbtdb, node, rbtdb->current_version, newheader, + DNS_DBADD_MERGE, ISC_TRUE, NULL, 0); if (result == ISC_R_SUCCESS && delegating_type(rbtdb, node, rdataset->type)) node->find_callback = 1; @@ -7411,6 +7582,9 @@ resigned(dns_db_t *db, dns_rdataset_t *rdataset, dns_dbversion_t *version) INSIST(header != NULL); header--; + if (header->heap_index == 0) + return; + RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_write); NODE_LOCK(&rbtdb->node_locks[node->locknum].lock, isc_rwlocktype_write); @@ -7418,11 +7592,7 @@ resigned(dns_db_t *db, dns_rdataset_t *rdataset, dns_dbversion_t *version) * Delete from heap and save to re-signed list so that it can * be restored if we backout of this change. */ - new_reference(rbtdb, node); - isc_heap_delete(rbtdb->heaps[node->locknum], header->heap_index); - header->heap_index = 0; - ISC_LIST_APPEND(rbtversion->resigned_list, header, link); - + resign_delete(rbtdb, rbtversion, header); NODE_UNLOCK(&rbtdb->node_locks[node->locknum].lock, isc_rwlocktype_write); RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_write); diff --git a/lib/dns/rcode.c b/lib/dns/rcode.c index 69007f881efdf..2fdb751e6dbf1 100644 --- a/lib/dns/rcode.c +++ b/lib/dns/rcode.c @@ -212,11 +212,13 @@ maybe_numeric(unsigned int *valuep, isc_textregion_t *source, return (ISC_R_BADNUMBER); /* - * We have a potential number. Try to parse it with - * isc_parse_uint32(). isc_parse_uint32() requires + * We have a potential number. Try to parse it with + * isc_parse_uint32(). isc_parse_uint32() requires * null termination, so we must make a copy. */ - strncpy(buffer, source->base, NUMBERSIZE); + strncpy(buffer, source->base, sizeof(buffer)); + buffer[sizeof(buffer) - 1] = '\0'; + INSIST(buffer[source->length] == '\0'); result = isc_parse_uint32(&n, buffer, 10); diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index 5bdd1255b5f75..08bfa34aa678d 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -116,7 +116,7 @@ typedef struct dns_rdata_textctx { } dns_rdata_textctx_t; static isc_result_t -txt_totext(isc_region_t *source, isc_buffer_t *target); +txt_totext(isc_region_t *source, isc_boolean_t quote, isc_buffer_t *target); static isc_result_t txt_fromtext(isc_textregion_t *source, isc_buffer_t *target); @@ -130,9 +130,6 @@ multitxt_totext(isc_region_t *source, isc_buffer_t *target); static isc_result_t multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target); -static isc_result_t -multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target); - static isc_boolean_t name_prefix(dns_name_t *name, dns_name_t *origin, dns_name_t *target); @@ -1131,7 +1128,7 @@ name_length(dns_name_t *name) { } static isc_result_t -txt_totext(isc_region_t *source, isc_buffer_t *target) { +txt_totext(isc_region_t *source, isc_boolean_t quote, isc_buffer_t *target) { unsigned int tl; unsigned int n; unsigned char *sp; @@ -1146,13 +1143,20 @@ txt_totext(isc_region_t *source, isc_buffer_t *target) { n = *sp++; REQUIRE(n + 1 <= source->length); + if (n == 0U) + REQUIRE(quote == ISC_TRUE); - if (tl < 1) - return (ISC_R_NOSPACE); - *tp++ = '"'; - tl--; + if (quote) { + if (tl < 1) + return (ISC_R_NOSPACE); + *tp++ = '"'; + tl--; + } while (n--) { - if (*sp < 0x20 || *sp >= 0x7f) { + /* + * \DDD space (0x20) if not quoting. + */ + if (*sp < (quote ? 0x20 : 0x21) || *sp >= 0x7f) { if (tl < 4) return (ISC_R_NOSPACE); *tp++ = 0x5c; @@ -1163,8 +1167,13 @@ txt_totext(isc_region_t *source, isc_buffer_t *target) { tl -= 4; continue; } - /* double quote, semi-colon, backslash */ - if (*sp == 0x22 || *sp == 0x3b || *sp == 0x5c) { + /* + * Escape double quote, semi-colon, backslash. + * If we are not enclosing the string in double + * quotes also escape at sign. + */ + if (*sp == 0x22 || *sp == 0x3b || *sp == 0x5c || + (!quote && *sp == 0x40)) { if (tl < 2) return (ISC_R_NOSPACE); *tp++ = '\\'; @@ -1175,10 +1184,12 @@ txt_totext(isc_region_t *source, isc_buffer_t *target) { *tp++ = *sp++; tl--; } - if (tl < 1) - return (ISC_R_NOSPACE); - *tp++ = '"'; - tl--; + if (quote) { + if (tl < 1) + return (ISC_R_NOSPACE); + *tp++ = '"'; + tl--; + } isc_buffer_add(target, (unsigned int)(tp - (char *)region.base)); isc_region_consume(source, *source->base + 1); return (ISC_R_SUCCESS); @@ -1274,6 +1285,9 @@ txt_fromwire(isc_buffer_t *source, isc_buffer_t *target) { return (ISC_R_SUCCESS); } +/* + * Conversion of TXT-like rdata fields without length limits. + */ static isc_result_t multitxt_totext(isc_region_t *source, isc_buffer_t *target) { unsigned int tl; @@ -1292,9 +1306,8 @@ multitxt_totext(isc_region_t *source, isc_buffer_t *target) { *tp++ = '"'; tl--; do { - n0 = n = *sp++; - - REQUIRE(n0 + 1 <= source->length); + n = source->length; + n0 = source->length - 1; while (n--) { if (*sp < 0x20 || *sp >= 0x7f) { @@ -1346,17 +1359,11 @@ multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target) { do { isc_buffer_availableregion(target, &tregion); - t0 = tregion.base; + t0 = t = tregion.base; nrem = tregion.length; if (nrem < 1) return (ISC_R_NOSPACE); - /* length byte */ - t = t0; - nrem--; - t++; - /* 255 byte character-string slice */ - if (nrem > 255) - nrem = 255; + while (n != 0) { --n; c = (*s++) & 0xff; @@ -1390,39 +1397,9 @@ multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target) { } if (escape) return (DNS_R_SYNTAX); - *t0 = (unsigned char)(t - t0 - 1); - isc_buffer_add(target, *t0 + 1); - } while (n != 0); - return (ISC_R_SUCCESS); -} - -static isc_result_t -multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target) { - unsigned int n; - isc_region_t sregion; - isc_region_t tregion; - - isc_buffer_activeregion(source, &sregion); - if (sregion.length == 0) - return(ISC_R_UNEXPECTEDEND); - n = 256U; - do { - if (n != 256U) - return (DNS_R_SYNTAX); - n = *sregion.base + 1; - if (n > sregion.length) - return (ISC_R_UNEXPECTEDEND); - isc_buffer_availableregion(target, &tregion); - if (n > tregion.length) - return (ISC_R_NOSPACE); - - if (tregion.base != sregion.base) - memmove(tregion.base, sregion.base, n); - isc_buffer_forward(source, n); - isc_buffer_add(target, n); - isc_buffer_activeregion(source, &sregion); - } while (sregion.length != 0); + isc_buffer_add(target, t - t0); + } while (n != 0); return (ISC_R_SUCCESS); } diff --git a/lib/dns/rdata/generic/caa_257.c b/lib/dns/rdata/generic/caa_257.c new file mode 100644 index 0000000000000..993e3267e6236 --- /dev/null +++ b/lib/dns/rdata/generic/caa_257.c @@ -0,0 +1,370 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * 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. + */ + +#ifndef GENERIC_CAA_257_C +#define GENERIC_CAA_257_C 1 + +#define RRTYPE_CAA_ATTRIBUTES (0) + +static unsigned char const alphanumeric[256] = { + /* 0x00-0x0f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 0x10-0x1f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 0x20-0x2f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 0x30-0x3f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, + /* 0x40-0x4f */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + /* 0x50-0x5f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + /* 0x60-0x6f */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + /* 0x70-0x7f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + /* 0x80-0x8f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 0x90-0x9f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xa0-0xaf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xb0-0xbf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xc0-0xcf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xd0-0xdf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xe0-0xef */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xf0-0xff */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static inline isc_result_t +fromtext_caa(ARGS_FROMTEXT) { + isc_token_t token; + isc_textregion_t tr; + isc_uint8_t flags; + unsigned int i; + + REQUIRE(type == 257); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(origin); + UNUSED(options); + UNUSED(callbacks); + + /* Flags. */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, + ISC_FALSE)); + if (token.value.as_ulong > 255U) + RETTOK(ISC_R_RANGE); + flags = token.value.as_ulong; + RETERR(uint8_tobuffer(flags, target)); + + /* + * Tag + */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, + ISC_FALSE)); + tr = token.value.as_textregion; + for (i = 0; i < tr.length; i++) + if (!alphanumeric[(unsigned int) tr.base[i]]) + RETTOK(DNS_R_SYNTAX); + RETERR(uint8_tobuffer(tr.length, target)); + RETERR(mem_tobuffer(target, tr.base, tr.length)); + + /* + * Value + */ + RETERR(isc_lex_getmastertoken(lexer, &token, + isc_tokentype_qstring, ISC_FALSE)); + if (token.type != isc_tokentype_qstring && + token.type != isc_tokentype_string) + RETERR(DNS_R_SYNTAX); + RETERR(multitxt_fromtext(&token.value.as_textregion, target)); + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +totext_caa(ARGS_TOTEXT) { + isc_region_t region; + isc_uint8_t flags; + char buf[256]; + + UNUSED(tctx); + + REQUIRE(rdata->type == 257); + REQUIRE(rdata->length >= 3U); + REQUIRE(rdata->data != NULL); + + dns_rdata_toregion(rdata, ®ion); + + /* + * Flags + */ + flags = uint8_consume_fromregion(®ion); + sprintf(buf, "%u ", flags); + RETERR(str_totext(buf, target)); + + /* + * Tag + */ + RETERR(txt_totext(®ion, ISC_FALSE, target)); + RETERR(str_totext(" ", target)); + + /* + * Value + */ + RETERR(multitxt_totext(®ion, target)); + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +fromwire_caa(ARGS_FROMWIRE) { + isc_region_t sr; + unsigned int len, i; + + REQUIRE(type == 257); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(dctx); + UNUSED(options); + + /* + * Flags + */ + isc_buffer_activeregion(source, &sr); + if (sr.length < 2) + return (ISC_R_UNEXPECTEDEND); + + /* + * Flags, tag length + */ + RETERR(mem_tobuffer(target, sr.base, 2)); + len = sr.base[1]; + isc_region_consume(&sr, 2); + isc_buffer_forward(source, 2); + + /* + * Zero length tag fields are illegal. + */ + if (sr.length < len || len == 0) + RETERR(DNS_R_FORMERR); + + /* Check the Tag's value */ + for (i = 0; i < len; i++) + if (!alphanumeric[sr.base[i]]) + RETERR(DNS_R_FORMERR); + /* + * Tag + Value + */ + isc_buffer_forward(source, sr.length); + return (mem_tobuffer(target, sr.base, sr.length)); +} + +static inline isc_result_t +towire_caa(ARGS_TOWIRE) { + isc_region_t region; + + REQUIRE(rdata->type == 257); + REQUIRE(rdata->length >= 3U); + REQUIRE(rdata->data != NULL); + + UNUSED(cctx); + + dns_rdata_toregion(rdata, ®ion); + return (mem_tobuffer(target, region.base, region.length)); +} + +static inline int +compare_caa(ARGS_COMPARE) { + isc_region_t r1, r2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == 257); + REQUIRE(rdata1->length >= 3U); + REQUIRE(rdata2->length >= 3U); + REQUIRE(rdata1->data != NULL); + REQUIRE(rdata2->data != NULL); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (isc_region_compare(&r1, &r2)); +} + +static inline isc_result_t +fromstruct_caa(ARGS_FROMSTRUCT) { + dns_rdata_caa_t *caa = source; + isc_region_t region; + unsigned int i; + + REQUIRE(type == 257); + REQUIRE(source != NULL); + REQUIRE(caa->common.rdtype == type); + REQUIRE(caa->common.rdclass == rdclass); + REQUIRE(caa->tag != NULL && caa->tag_len != 0); + REQUIRE(caa->value != NULL); + + UNUSED(type); + UNUSED(rdclass); + + /* + * Flags + */ + RETERR(uint8_tobuffer(caa->flags, target)); + + /* + * Tag length + */ + RETERR(uint8_tobuffer(caa->tag_len, target)); + + /* + * Tag + */ + region.base = caa->tag; + region.length = caa->tag_len; + for (i = 0; i < region.length; i++) + if (!alphanumeric[region.base[i]]) + RETERR(DNS_R_SYNTAX); + RETERR(isc_buffer_copyregion(target, ®ion)); + + /* + * Value + */ + region.base = caa->value; + region.length = caa->value_len; + return (isc_buffer_copyregion(target, ®ion)); +} + +static inline isc_result_t +tostruct_caa(ARGS_TOSTRUCT) { + dns_rdata_caa_t *caa = target; + isc_region_t sr; + + REQUIRE(rdata->type == 257); + REQUIRE(target != NULL); + REQUIRE(rdata->length >= 3U); + REQUIRE(rdata->data != NULL); + + caa->common.rdclass = rdata->rdclass; + caa->common.rdtype = rdata->type; + ISC_LINK_INIT(&caa->common, link); + + dns_rdata_toregion(rdata, &sr); + + /* + * Flags + */ + if (sr.length < 1) + return (ISC_R_UNEXPECTEDEND); + caa->flags = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + + /* + * Tag length + */ + if (sr.length < 1) + return (ISC_R_UNEXPECTEDEND); + caa->tag_len = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + + /* + * Tag + */ + if (sr.length < caa->tag_len) + return (ISC_R_UNEXPECTEDEND); + caa->tag = mem_maybedup(mctx, sr.base, caa->tag_len); + if (caa->tag == NULL) + return (ISC_R_NOMEMORY); + isc_region_consume(&sr, caa->tag_len); + + /* + * Value + */ + caa->value_len = sr.length; + caa->value = mem_maybedup(mctx, sr.base, sr.length); + if (caa->value == NULL) + return (ISC_R_NOMEMORY); + + caa->mctx = mctx; + return (ISC_R_SUCCESS); +} + +static inline void +freestruct_caa(ARGS_FREESTRUCT) { + dns_rdata_caa_t *caa = (dns_rdata_caa_t *) source; + + REQUIRE(source != NULL); + REQUIRE(caa->common.rdtype == 257); + + if (caa->mctx == NULL) + return; + + if (caa->tag != NULL) + isc_mem_free(caa->mctx, caa->tag); + if (caa->value != NULL) + isc_mem_free(caa->mctx, caa->value); + caa->mctx = NULL; +} + +static inline isc_result_t +additionaldata_caa(ARGS_ADDLDATA) { + REQUIRE(rdata->type == 257); + REQUIRE(rdata->data != NULL); + REQUIRE(rdata->length >= 3U); + + UNUSED(rdata); + UNUSED(add); + UNUSED(arg); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +digest_caa(ARGS_DIGEST) { + isc_region_t r; + + REQUIRE(rdata->type == 257); + REQUIRE(rdata->data != NULL); + REQUIRE(rdata->length >= 3U); + + dns_rdata_toregion(rdata, &r); + + return ((digest)(arg, &r)); +} + +static inline isc_boolean_t +checkowner_caa(ARGS_CHECKOWNER) { + + REQUIRE(type == 257); + + UNUSED(name); + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); + + return (ISC_TRUE); +} + +static inline isc_boolean_t +checknames_caa(ARGS_CHECKNAMES) { + + REQUIRE(rdata->type == 257); + REQUIRE(rdata->data != NULL); + REQUIRE(rdata->length >= 3U); + + UNUSED(rdata); + UNUSED(owner); + UNUSED(bad); + + return (ISC_TRUE); +} + +static inline int +casecompare_caa(ARGS_COMPARE) { + return (compare_caa(rdata1, rdata2)); +} + +#endif /* GENERIC_CAA_257_C */ diff --git a/lib/dns/rdata/generic/caa_257.h b/lib/dns/rdata/generic/caa_257.h new file mode 100644 index 0000000000000..9432f0f7f1ad1 --- /dev/null +++ b/lib/dns/rdata/generic/caa_257.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * 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. + */ + +#ifndef GENERIC_CAA_257_H +#define GENERIC_CAA_257_H 1 + +/* $Id$ */ + +typedef struct dns_rdata_caa { + dns_rdatacommon_t common; + isc_mem_t * mctx; + isc_uint8_t flags; + unsigned char * tag; + isc_uint8_t tag_len; + unsigned char *value; + isc_uint8_t value_len; +} dns_rdata_caa_t; + +#endif /* GENERIC_CAA_257_H */ diff --git a/lib/dns/rdata/generic/cdnskey_60.c b/lib/dns/rdata/generic/cdnskey_60.c new file mode 100644 index 0000000000000..a1e681403b757 --- /dev/null +++ b/lib/dns/rdata/generic/cdnskey_60.c @@ -0,0 +1,378 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * 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. + */ + +/* $Id$ */ + +/* + * Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley. + */ + +/* RFC2535 */ + +#ifndef RDATA_GENERIC_CDNSKEY_60_C +#define RDATA_GENERIC_CDNSKEY_60_C + +#include <dst/dst.h> + +#define RRTYPE_CDNSKEY_ATTRIBUTES (DNS_RDATATYPEATTR_DNSSEC) + +static inline isc_result_t +fromtext_cdnskey(ARGS_FROMTEXT) { + isc_result_t result; + isc_token_t token; + dns_secalg_t alg; + dns_secproto_t proto; + dns_keyflags_t flags; + + REQUIRE(type == 60); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(origin); + UNUSED(options); + UNUSED(callbacks); + + /* flags */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, + ISC_FALSE)); + RETTOK(dns_keyflags_fromtext(&flags, &token.value.as_textregion)); + RETERR(uint16_tobuffer(flags, target)); + + /* protocol */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, + ISC_FALSE)); + RETTOK(dns_secproto_fromtext(&proto, &token.value.as_textregion)); + RETERR(mem_tobuffer(target, &proto, 1)); + + /* algorithm */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, + ISC_FALSE)); + RETTOK(dns_secalg_fromtext(&alg, &token.value.as_textregion)); + RETERR(mem_tobuffer(target, &alg, 1)); + + /* No Key? */ + if ((flags & 0xc000) == 0xc000) + return (ISC_R_SUCCESS); + + result = isc_base64_tobuffer(lexer, target, -1); + if (result != ISC_R_SUCCESS) + return (result); + + /* Ensure there's at least enough data to compute a key ID for MD5 */ + if (alg == DST_ALG_RSAMD5 && isc_buffer_usedlength(target) < 7) + return (ISC_R_UNEXPECTEDEND); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +totext_cdnskey(ARGS_TOTEXT) { + isc_region_t sr; + char buf[sizeof("64000")]; + unsigned int flags; + unsigned char algorithm; + char algbuf[DNS_NAME_FORMATSIZE]; + const char *keyinfo; + + REQUIRE(rdata->type == 60); + REQUIRE(rdata->length != 0); + + dns_rdata_toregion(rdata, &sr); + + /* flags */ + flags = uint16_fromregion(&sr); + isc_region_consume(&sr, 2); + sprintf(buf, "%u", flags); + RETERR(str_totext(buf, target)); + RETERR(str_totext(" ", target)); + if ((flags & DNS_KEYFLAG_KSK) != 0) { + if (flags & DNS_KEYFLAG_REVOKE) + keyinfo = "revoked KSK"; + else + keyinfo = "KSK"; + } else + keyinfo = "ZSK"; + + /* protocol */ + sprintf(buf, "%u", sr.base[0]); + isc_region_consume(&sr, 1); + RETERR(str_totext(buf, target)); + RETERR(str_totext(" ", target)); + + /* algorithm */ + algorithm = sr.base[0]; + sprintf(buf, "%u", algorithm); + isc_region_consume(&sr, 1); + RETERR(str_totext(buf, target)); + + /* No Key? */ + if ((flags & 0xc000) == 0xc000) + return (ISC_R_SUCCESS); + + if ((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0 && + algorithm == DNS_KEYALG_PRIVATEDNS) { + dns_name_t name; + dns_name_init(&name, NULL); + dns_name_fromregion(&name, &sr); + dns_name_format(&name, algbuf, sizeof(algbuf)); + } else { + dns_secalg_format((dns_secalg_t) algorithm, algbuf, + sizeof(algbuf)); + } + + /* key */ + if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) + RETERR(str_totext(" (", target)); + RETERR(str_totext(tctx->linebreak, target)); + if (tctx->width == 0) /* No splitting */ + RETERR(isc_base64_totext(&sr, 0, "", target)); + else + RETERR(isc_base64_totext(&sr, tctx->width - 2, + tctx->linebreak, target)); + + if ((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0) + RETERR(str_totext(tctx->linebreak, target)); + else if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) + RETERR(str_totext(" ", target)); + + if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) + RETERR(str_totext(")", target)); + + if ((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0) { + isc_region_t tmpr; + + RETERR(str_totext(" ; ", target)); + RETERR(str_totext(keyinfo, target)); + RETERR(str_totext("; alg = ", target)); + RETERR(str_totext(algbuf, target)); + RETERR(str_totext("; key id = ", target)); + dns_rdata_toregion(rdata, &tmpr); + sprintf(buf, "%u", dst_region_computeid(&tmpr, algorithm)); + RETERR(str_totext(buf, target)); + } + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +fromwire_cdnskey(ARGS_FROMWIRE) { + unsigned char algorithm; + isc_region_t sr; + + REQUIRE(type == 60); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(dctx); + UNUSED(options); + + isc_buffer_activeregion(source, &sr); + if (sr.length < 4) + return (ISC_R_UNEXPECTEDEND); + + algorithm = sr.base[3]; + RETERR(mem_tobuffer(target, sr.base, 4)); + isc_region_consume(&sr, 4); + isc_buffer_forward(source, 4); + + if (algorithm == DNS_KEYALG_PRIVATEDNS) { + dns_name_t name; + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); + dns_name_init(&name, NULL); + RETERR(dns_name_fromwire(&name, source, dctx, options, target)); + } + + /* + * RSAMD5 computes key ID differently from other + * algorithms: we need to ensure there's enough data + * present for the computation + */ + if (algorithm == DST_ALG_RSAMD5 && sr.length < 3) + return (ISC_R_UNEXPECTEDEND); + + isc_buffer_activeregion(source, &sr); + isc_buffer_forward(source, sr.length); + return (mem_tobuffer(target, sr.base, sr.length)); +} + +static inline isc_result_t +towire_cdnskey(ARGS_TOWIRE) { + isc_region_t sr; + + REQUIRE(rdata->type == 60); + REQUIRE(rdata->length != 0); + + UNUSED(cctx); + + dns_rdata_toregion(rdata, &sr); + return (mem_tobuffer(target, sr.base, sr.length)); +} + +static inline int +compare_cdnskey(ARGS_COMPARE) { + isc_region_t r1; + isc_region_t r2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == 60); + REQUIRE(rdata1->length != 0); + REQUIRE(rdata2->length != 0); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (isc_region_compare(&r1, &r2)); +} + +static inline isc_result_t +fromstruct_cdnskey(ARGS_FROMSTRUCT) { + dns_rdata_cdnskey_t *dnskey = source; + + REQUIRE(type == 60); + REQUIRE(source != NULL); + REQUIRE(dnskey->common.rdtype == type); + REQUIRE(dnskey->common.rdclass == rdclass); + + UNUSED(type); + UNUSED(rdclass); + + /* Flags */ + RETERR(uint16_tobuffer(dnskey->flags, target)); + + /* Protocol */ + RETERR(uint8_tobuffer(dnskey->protocol, target)); + + /* Algorithm */ + RETERR(uint8_tobuffer(dnskey->algorithm, target)); + + /* Data */ + return (mem_tobuffer(target, dnskey->data, dnskey->datalen)); +} + +static inline isc_result_t +tostruct_cdnskey(ARGS_TOSTRUCT) { + dns_rdata_cdnskey_t *dnskey = target; + isc_region_t sr; + + REQUIRE(rdata->type == 60); + REQUIRE(target != NULL); + REQUIRE(rdata->length != 0); + + dnskey->common.rdclass = rdata->rdclass; + dnskey->common.rdtype = rdata->type; + ISC_LINK_INIT(&dnskey->common, link); + + dns_rdata_toregion(rdata, &sr); + + /* Flags */ + if (sr.length < 2) + return (ISC_R_UNEXPECTEDEND); + dnskey->flags = uint16_fromregion(&sr); + isc_region_consume(&sr, 2); + + /* Protocol */ + if (sr.length < 1) + return (ISC_R_UNEXPECTEDEND); + dnskey->protocol = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + + /* Algorithm */ + if (sr.length < 1) + return (ISC_R_UNEXPECTEDEND); + dnskey->algorithm = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + + /* Data */ + dnskey->datalen = sr.length; + dnskey->data = mem_maybedup(mctx, sr.base, dnskey->datalen); + if (dnskey->data == NULL) + return (ISC_R_NOMEMORY); + + dnskey->mctx = mctx; + return (ISC_R_SUCCESS); +} + +static inline void +freestruct_cdnskey(ARGS_FREESTRUCT) { + dns_rdata_cdnskey_t *dnskey = (dns_rdata_cdnskey_t *) source; + + REQUIRE(source != NULL); + REQUIRE(dnskey->common.rdtype == 60); + + if (dnskey->mctx == NULL) + return; + + if (dnskey->data != NULL) + isc_mem_free(dnskey->mctx, dnskey->data); + dnskey->mctx = NULL; +} + +static inline isc_result_t +additionaldata_cdnskey(ARGS_ADDLDATA) { + REQUIRE(rdata->type == 60); + + UNUSED(rdata); + UNUSED(add); + UNUSED(arg); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +digest_cdnskey(ARGS_DIGEST) { + isc_region_t r; + + REQUIRE(rdata->type == 60); + + dns_rdata_toregion(rdata, &r); + + return ((digest)(arg, &r)); +} + +static inline isc_boolean_t +checkowner_cdnskey(ARGS_CHECKOWNER) { + + REQUIRE(type == 60); + + UNUSED(name); + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); + + return (ISC_TRUE); +} + +static inline isc_boolean_t +checknames_cdnskey(ARGS_CHECKNAMES) { + + REQUIRE(rdata->type == 60); + + UNUSED(rdata); + UNUSED(owner); + UNUSED(bad); + + return (ISC_TRUE); +} + +static inline int +casecompare_cdnskey(ARGS_COMPARE) { + + /* + * Treat ALG 253 (private DNS) subtype name case sensistively. + */ + return (compare_cdnskey(rdata1, rdata2)); +} + +#endif /* RDATA_GENERIC_CDNSKEY_60_C */ diff --git a/lib/dns/rdata/generic/cdnskey_60.h b/lib/dns/rdata/generic/cdnskey_60.h new file mode 100644 index 0000000000000..d284177c118d7 --- /dev/null +++ b/lib/dns/rdata/generic/cdnskey_60.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * 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. + */ + +#ifndef GENERIC_CDNSKEY_60_H +#define GENERIC_CDNSKEY_60_H 1 + +/* CDNSKEY records have the same RDATA fields as DNSKEY records. */ +typedef struct dns_rdata_cdnskey { + dns_rdatacommon_t common; + isc_mem_t * mctx; + isc_uint16_t flags; + isc_uint8_t protocol; + isc_uint8_t algorithm; + isc_uint16_t datalen; + unsigned char * data; +} dns_rdata_cdnskey_t; + + +#endif /* GENERIC_CDNSKEY_60_H */ diff --git a/lib/dns/rdata/generic/cds_59.c b/lib/dns/rdata/generic/cds_59.c new file mode 100644 index 0000000000000..fcf49662c46a3 --- /dev/null +++ b/lib/dns/rdata/generic/cds_59.c @@ -0,0 +1,354 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * 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. + */ + +/* $Id$ */ + +/* draft-ietf-dnsext-delegation-signer-05.txt */ + +#ifndef RDATA_GENERIC_CDS_59_C +#define RDATA_GENERIC_CDS_59_C + +#define RRTYPE_CDS_ATTRIBUTES \ + (DNS_RDATATYPEATTR_DNSSEC|DNS_RDATATYPEATTR_ATPARENT) + +#include <isc/sha1.h> +#include <isc/sha2.h> + +#include <dns/ds.h> + +static inline isc_result_t +fromtext_cds(ARGS_FROMTEXT) { + isc_token_t token; + unsigned char c; + int length; + + REQUIRE(type == 59); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(origin); + UNUSED(options); + UNUSED(callbacks); + + /* + * Key tag. + */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, + ISC_FALSE)); + if (token.value.as_ulong > 0xffffU) + RETTOK(ISC_R_RANGE); + RETERR(uint16_tobuffer(token.value.as_ulong, target)); + + /* + * Algorithm. + */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, + ISC_FALSE)); + RETTOK(dns_secalg_fromtext(&c, &token.value.as_textregion)); + RETERR(mem_tobuffer(target, &c, 1)); + + /* + * Digest type. + */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, + ISC_FALSE)); + if (token.value.as_ulong > 0xffU) + RETTOK(ISC_R_RANGE); + RETERR(uint8_tobuffer(token.value.as_ulong, target)); + c = (unsigned char) token.value.as_ulong; + + /* + * Digest. + */ + switch (c) { + case DNS_DSDIGEST_SHA1: + length = ISC_SHA1_DIGESTLENGTH; + break; + case DNS_DSDIGEST_SHA256: + length = ISC_SHA256_DIGESTLENGTH; + break; + case DNS_DSDIGEST_GOST: + length = ISC_GOST_DIGESTLENGTH; + break; + case DNS_DSDIGEST_SHA384: + length = ISC_SHA384_DIGESTLENGTH; + break; + default: + length = -1; + break; + } + return (isc_hex_tobuffer(lexer, target, length)); +} + +static inline isc_result_t +totext_cds(ARGS_TOTEXT) { + isc_region_t sr; + char buf[sizeof("64000 ")]; + unsigned int n; + + REQUIRE(rdata->type == 59); + REQUIRE(rdata->length != 0); + + UNUSED(tctx); + + dns_rdata_toregion(rdata, &sr); + + /* + * Key tag. + */ + n = uint16_fromregion(&sr); + isc_region_consume(&sr, 2); + sprintf(buf, "%u ", n); + RETERR(str_totext(buf, target)); + + /* + * Algorithm. + */ + n = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + sprintf(buf, "%u ", n); + RETERR(str_totext(buf, target)); + + /* + * Digest type. + */ + n = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + sprintf(buf, "%u", n); + RETERR(str_totext(buf, target)); + + /* + * Digest. + */ + if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) + RETERR(str_totext(" (", target)); + RETERR(str_totext(tctx->linebreak, target)); + if (tctx->width == 0) /* No splitting */ + RETERR(isc_hex_totext(&sr, 0, "", target)); + else + RETERR(isc_hex_totext(&sr, tctx->width - 2, + tctx->linebreak, target)); + if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) + RETERR(str_totext(" )", target)); + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +fromwire_cds(ARGS_FROMWIRE) { + isc_region_t sr; + + REQUIRE(type == 59); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(dctx); + UNUSED(options); + + isc_buffer_activeregion(source, &sr); + + /* + * Check digest lengths if we know them. + */ + if (sr.length < 4 || + (sr.base[3] == DNS_DSDIGEST_SHA1 && + sr.length < 4 + ISC_SHA1_DIGESTLENGTH) || + (sr.base[3] == DNS_DSDIGEST_SHA256 && + sr.length < 4 + ISC_SHA256_DIGESTLENGTH) || + (sr.base[3] == DNS_DSDIGEST_GOST && + sr.length < 4 + ISC_GOST_DIGESTLENGTH) || + (sr.base[3] == DNS_DSDIGEST_SHA384 && + sr.length < 4 + ISC_SHA384_DIGESTLENGTH)) + return (ISC_R_UNEXPECTEDEND); + + /* + * Only copy digest lengths if we know them. + * If there is extra data dns_rdata_fromwire() will + * detect that. + */ + if (sr.base[3] == DNS_DSDIGEST_SHA1) + sr.length = 4 + ISC_SHA1_DIGESTLENGTH; + else if (sr.base[3] == DNS_DSDIGEST_SHA256) + sr.length = 4 + ISC_SHA256_DIGESTLENGTH; + else if (sr.base[3] == DNS_DSDIGEST_GOST) + sr.length = 4 + ISC_GOST_DIGESTLENGTH; + else if (sr.base[3] == DNS_DSDIGEST_SHA384) + sr.length = 4 + ISC_SHA384_DIGESTLENGTH; + + isc_buffer_forward(source, sr.length); + return (mem_tobuffer(target, sr.base, sr.length)); +} + +static inline isc_result_t +towire_cds(ARGS_TOWIRE) { + isc_region_t sr; + + REQUIRE(rdata->type == 59); + REQUIRE(rdata->length != 0); + + UNUSED(cctx); + + dns_rdata_toregion(rdata, &sr); + return (mem_tobuffer(target, sr.base, sr.length)); +} + +static inline int +compare_cds(ARGS_COMPARE) { + isc_region_t r1; + isc_region_t r2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == 59); + REQUIRE(rdata1->length != 0); + REQUIRE(rdata2->length != 0); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (isc_region_compare(&r1, &r2)); +} + +static inline isc_result_t +fromstruct_cds(ARGS_FROMSTRUCT) { + dns_rdata_cds_t *ds = source; + + REQUIRE(type == 59); + REQUIRE(source != NULL); + REQUIRE(ds->common.rdtype == type); + REQUIRE(ds->common.rdclass == rdclass); + switch (ds->digest_type) { + case DNS_DSDIGEST_SHA1: + REQUIRE(ds->length == ISC_SHA1_DIGESTLENGTH); + break; + case DNS_DSDIGEST_SHA256: + REQUIRE(ds->length == ISC_SHA256_DIGESTLENGTH); + break; + case DNS_DSDIGEST_GOST: + REQUIRE(ds->length == ISC_GOST_DIGESTLENGTH); + break; + case DNS_DSDIGEST_SHA384: + REQUIRE(ds->length == ISC_SHA384_DIGESTLENGTH); + break; + } + + UNUSED(type); + UNUSED(rdclass); + + RETERR(uint16_tobuffer(ds->key_tag, target)); + RETERR(uint8_tobuffer(ds->algorithm, target)); + RETERR(uint8_tobuffer(ds->digest_type, target)); + + return (mem_tobuffer(target, ds->digest, ds->length)); +} + +static inline isc_result_t +tostruct_cds(ARGS_TOSTRUCT) { + dns_rdata_cds_t *ds = target; + isc_region_t region; + + REQUIRE(rdata->type == 59); + REQUIRE(target != NULL); + REQUIRE(rdata->length != 0); + + ds->common.rdclass = rdata->rdclass; + ds->common.rdtype = rdata->type; + ISC_LINK_INIT(&ds->common, link); + + dns_rdata_toregion(rdata, ®ion); + + ds->key_tag = uint16_fromregion(®ion); + isc_region_consume(®ion, 2); + ds->algorithm = uint8_fromregion(®ion); + isc_region_consume(®ion, 1); + ds->digest_type = uint8_fromregion(®ion); + isc_region_consume(®ion, 1); + ds->length = region.length; + + ds->digest = mem_maybedup(mctx, region.base, region.length); + if (ds->digest == NULL) + return (ISC_R_NOMEMORY); + + ds->mctx = mctx; + return (ISC_R_SUCCESS); +} + +static inline void +freestruct_cds(ARGS_FREESTRUCT) { + dns_rdata_cds_t *ds = source; + + REQUIRE(ds != NULL); + REQUIRE(ds->common.rdtype == 59); + + if (ds->mctx == NULL) + return; + + if (ds->digest != NULL) + isc_mem_free(ds->mctx, ds->digest); + ds->mctx = NULL; +} + +static inline isc_result_t +additionaldata_cds(ARGS_ADDLDATA) { + REQUIRE(rdata->type == 59); + + UNUSED(rdata); + UNUSED(add); + UNUSED(arg); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +digest_cds(ARGS_DIGEST) { + isc_region_t r; + + REQUIRE(rdata->type == 59); + + dns_rdata_toregion(rdata, &r); + + return ((digest)(arg, &r)); +} + +static inline isc_boolean_t +checkowner_cds(ARGS_CHECKOWNER) { + + REQUIRE(type == 59); + + UNUSED(name); + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); + + return (ISC_TRUE); +} + +static inline isc_boolean_t +checknames_cds(ARGS_CHECKNAMES) { + + REQUIRE(rdata->type == 59); + + UNUSED(rdata); + UNUSED(owner); + UNUSED(bad); + + return (ISC_TRUE); +} + +static inline int +casecompare_cds(ARGS_COMPARE) { + return (compare_cds(rdata1, rdata2)); +} + +#endif /* RDATA_GENERIC_CDS_59_C */ diff --git a/lib/dns/rdata/generic/cds_59.h b/lib/dns/rdata/generic/cds_59.h new file mode 100644 index 0000000000000..099cba39468c5 --- /dev/null +++ b/lib/dns/rdata/generic/cds_59.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * 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. + */ + +#ifndef GENERIC_CDS_59_H +#define GENERIC_CDS_59_H 1 + +/* CDS records have the same RDATA fields as DS records. */ +typedef struct dns_rdata_cds { + dns_rdatacommon_t common; + isc_mem_t *mctx; + isc_uint16_t key_tag; + isc_uint8_t algorithm; + isc_uint8_t digest_type; + isc_uint16_t length; + unsigned char *digest; +} dns_rdata_cds_t; + +#endif /* GENERIC_CDS_59_H */ diff --git a/lib/dns/rdata/generic/gpos_27.c b/lib/dns/rdata/generic/gpos_27.c index ce71822b82377..e9ba59eacb6a4 100644 --- a/lib/dns/rdata/generic/gpos_27.c +++ b/lib/dns/rdata/generic/gpos_27.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -61,7 +61,7 @@ totext_gpos(ARGS_TOTEXT) { dns_rdata_toregion(rdata, ®ion); for (i = 0; i < 3; i++) { - RETERR(txt_totext(®ion, target)); + RETERR(txt_totext(®ion, ISC_TRUE, target)); if (i != 2) RETERR(str_totext(" ", target)); } diff --git a/lib/dns/rdata/generic/hinfo_13.c b/lib/dns/rdata/generic/hinfo_13.c index 10b4fec79deaf..411d6b56866e1 100644 --- a/lib/dns/rdata/generic/hinfo_13.c +++ b/lib/dns/rdata/generic/hinfo_13.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2007, 2009, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -58,9 +58,9 @@ totext_hinfo(ARGS_TOTEXT) { REQUIRE(rdata->length != 0); dns_rdata_toregion(rdata, ®ion); - RETERR(txt_totext(®ion, target)); + RETERR(txt_totext(®ion, ISC_TRUE, target)); RETERR(str_totext(" ", target)); - return (txt_totext(®ion, target)); + return (txt_totext(®ion, ISC_TRUE, target)); } static inline isc_result_t diff --git a/lib/dns/rdata/generic/hip_55.c b/lib/dns/rdata/generic/hip_55.c index 5198497dcb078..eee581f26a952 100644 --- a/lib/dns/rdata/generic/hip_55.c +++ b/lib/dns/rdata/generic/hip_55.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2011, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2011, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -318,6 +318,8 @@ tostruct_hip(ARGS_TOSTRUCT) { goto cleanup; isc_region_consume(®ion, hip->hit_len); + INSIST(hip->key_len <= region.length); + hip->key = mem_maybedup(mctx, region.base, hip->key_len); if (hip->key == NULL) goto cleanup; @@ -466,23 +468,19 @@ casecompare_hip(ARGS_COMPARE) { INSIST(r1.length > 4); INSIST(r2.length > 4); - r1.length = 4; - r2.length = 4; - order = isc_region_compare(&r1, &r2); + order = memcmp(r1.base, r2.base, 4); if (order != 0) return (order); hit_len = uint8_fromregion(&r1); isc_region_consume(&r1, 2); /* hit length + algorithm */ key_len = uint16_fromregion(&r1); - - dns_rdata_toregion(rdata1, &r1); - dns_rdata_toregion(rdata2, &r2); - isc_region_consume(&r1, 4); + isc_region_consume(&r1, 2); /* key length */ isc_region_consume(&r2, 4); + INSIST(r1.length >= (unsigned) (hit_len + key_len)); INSIST(r2.length >= (unsigned) (hit_len + key_len)); - order = isc_region_compare(&r1, &r2); + order = memcmp(r1.base, r2.base, hit_len + key_len); if (order != 0) return (order); isc_region_consume(&r1, hit_len + key_len); diff --git a/lib/dns/rdata/generic/isdn_20.c b/lib/dns/rdata/generic/isdn_20.c index 0bf2146013e8a..dea36f0f658a9 100644 --- a/lib/dns/rdata/generic/isdn_20.c +++ b/lib/dns/rdata/generic/isdn_20.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2009, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -65,11 +65,11 @@ totext_isdn(ARGS_TOTEXT) { UNUSED(tctx); dns_rdata_toregion(rdata, ®ion); - RETERR(txt_totext(®ion, target)); + RETERR(txt_totext(®ion, ISC_TRUE, target)); if (region.length == 0) return (ISC_R_SUCCESS); RETERR(str_totext(" ", target)); - return (txt_totext(®ion, target)); + return (txt_totext(®ion, ISC_TRUE, target)); } static inline isc_result_t diff --git a/lib/dns/rdata/generic/naptr_35.c b/lib/dns/rdata/generic/naptr_35.c index 83439a59293ee..d7452ac176fec 100644 --- a/lib/dns/rdata/generic/naptr_35.c +++ b/lib/dns/rdata/generic/naptr_35.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007-2009, 2011-2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007-2009, 2011-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -224,19 +224,19 @@ totext_naptr(ARGS_TOTEXT) { /* * Flags. */ - RETERR(txt_totext(®ion, target)); + RETERR(txt_totext(®ion, ISC_TRUE, target)); RETERR(str_totext(" ", target)); /* * Service. */ - RETERR(txt_totext(®ion, target)); + RETERR(txt_totext(®ion, ISC_TRUE, target)); RETERR(str_totext(" ", target)); /* * Regexp. */ - RETERR(txt_totext(®ion, target)); + RETERR(txt_totext(®ion, ISC_TRUE, target)); RETERR(str_totext(" ", target)); /* diff --git a/lib/dns/rdata/generic/nsec3_50.c b/lib/dns/rdata/generic/nsec3_50.c index 19b94efa06dca..35fcf5d582290 100644 --- a/lib/dns/rdata/generic/nsec3_50.c +++ b/lib/dns/rdata/generic/nsec3_50.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2008, 2009, 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -100,7 +100,7 @@ fromtext_nsec3(ARGS_FROMTEXT) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); isc_buffer_init(&b, bm, sizeof(bm)); - RETTOK(isc_base32hex_decodestring(DNS_AS_STR(token), &b)); + RETTOK(isc_base32hexnp_decodestring(DNS_AS_STR(token), &b)); if (isc_buffer_usedlength(&b) > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(isc_buffer_usedlength(&b), target)); @@ -191,7 +191,7 @@ totext_nsec3(ARGS_TOTEXT) { i = sr.length; sr.length = j; - RETERR(isc_base32hex_totext(&sr, 1, "", target)); + RETERR(isc_base32hexnp_totext(&sr, 1, "", target)); sr.length = i - j; if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) == 0) @@ -474,15 +474,26 @@ digest_nsec3(ARGS_DIGEST) { static inline isc_boolean_t checkowner_nsec3(ARGS_CHECKOWNER) { + unsigned char owner[NSEC3_MAX_HASH_LENGTH]; + isc_buffer_t buffer; + dns_label_t label; - REQUIRE(type == 50); + REQUIRE(type == 50); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); - UNUSED(name); - UNUSED(type); - UNUSED(rdclass); - UNUSED(wildcard); + /* + * First label is a base32hex string without padding. + */ + dns_name_getlabel(name, 0, &label); + isc_region_consume(&label, 1); + isc_buffer_init(&buffer, owner, sizeof(owner)); + if (isc_base32hexnp_decoderegion(&label, &buffer) == ISC_R_SUCCESS) + return (ISC_TRUE); - return (ISC_TRUE); + return (ISC_FALSE); } static inline isc_boolean_t diff --git a/lib/dns/rdata/generic/opt_41.c b/lib/dns/rdata/generic/opt_41.c index bd2adb5fe9711..ae09abf71e914 100644 --- a/lib/dns/rdata/generic/opt_41.c +++ b/lib/dns/rdata/generic/opt_41.c @@ -151,6 +151,14 @@ fromwire_opt(ARGS_FROMWIRE) { isc_region_consume(&sregion, addrbytes); break; } + case DNS_OPT_EXPIRE: + /* + * Request has zero length. Response is 32 bits. + */ + if (length != 0 && length != 4) + return (DNS_R_FORMERR); + isc_region_consume(&sregion, length); + break; default: isc_region_consume(&sregion, length); break; diff --git a/lib/dns/rdata/generic/spf_99.c b/lib/dns/rdata/generic/spf_99.c index c7cdfc9fbbad5..10e86b888f3a2 100644 --- a/lib/dns/rdata/generic/spf_99.c +++ b/lib/dns/rdata/generic/spf_99.c @@ -64,7 +64,7 @@ totext_spf(ARGS_TOTEXT) { dns_rdata_toregion(rdata, ®ion); while (region.length > 0) { - RETERR(txt_totext(®ion, target)); + RETERR(txt_totext(®ion, ISC_TRUE, target)); if (region.length > 0) RETERR(str_totext(" ", target)); } diff --git a/lib/dns/rdata/generic/tkey_249.c b/lib/dns/rdata/generic/tkey_249.c index 6f1ec02538811..0c91fd221ed88 100644 --- a/lib/dns/rdata/generic/tkey_249.c +++ b/lib/dns/rdata/generic/tkey_249.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2007, 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2007, 2009, 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -465,6 +465,7 @@ tostruct_tkey(ARGS_TOSTRUCT) { /* * Key. */ + INSIST(tkey->keylen + 2U <= sr.length); tkey->key = mem_maybedup(mctx, sr.base, tkey->keylen); if (tkey->key == NULL) goto cleanup; @@ -479,6 +480,7 @@ tostruct_tkey(ARGS_TOSTRUCT) { /* * Other. */ + INSIST(tkey->otherlen <= sr.length); tkey->other = mem_maybedup(mctx, sr.base, tkey->otherlen); if (tkey->other == NULL) goto cleanup; diff --git a/lib/dns/rdata/generic/tlsa_52.c b/lib/dns/rdata/generic/tlsa_52.c index 11c6d7528f98e..b46556d35d4e2 100644 --- a/lib/dns/rdata/generic/tlsa_52.c +++ b/lib/dns/rdata/generic/tlsa_52.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -16,7 +16,7 @@ /* $Id$ */ -/* draft-ietf-dane-protocol-19.txt */ +/* rfc6698.txt */ #ifndef RDATA_GENERIC_TLSA_52_C #define RDATA_GENERIC_TLSA_52_C diff --git a/lib/dns/rdata/generic/tlsa_52.h b/lib/dns/rdata/generic/tlsa_52.h index 83ce9529976d1..31bbf015c167a 100644 --- a/lib/dns/rdata/generic/tlsa_52.h +++ b/lib/dns/rdata/generic/tlsa_52.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -20,7 +20,7 @@ #define GENERIC_TLSA_52_H 1 /*! - * \brief per draft-ietf-dane-protocol-19.txt + * \brief per rfc6698.txt */ typedef struct dns_rdata_tlsa { dns_rdatacommon_t common; diff --git a/lib/dns/rdata/generic/txt_16.c b/lib/dns/rdata/generic/txt_16.c index 76109251a766d..41e2702792160 100644 --- a/lib/dns/rdata/generic/txt_16.c +++ b/lib/dns/rdata/generic/txt_16.c @@ -71,7 +71,7 @@ totext_txt(ARGS_TOTEXT) { dns_rdata_toregion(rdata, ®ion); while (region.length > 0) { - RETERR(txt_totext(®ion, target)); + RETERR(txt_totext(®ion, ISC_TRUE, target)); if (region.length > 0) RETERR(str_totext(" ", target)); } diff --git a/lib/dns/rdata/generic/uri_256.c b/lib/dns/rdata/generic/uri_256.c index 799eb694e666d..3ddd790847ac3 100644 --- a/lib/dns/rdata/generic/uri_256.c +++ b/lib/dns/rdata/generic/uri_256.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -115,15 +115,12 @@ fromwire_uri(ARGS_FROMWIRE) { isc_buffer_activeregion(source, ®ion); if (region.length < 4) return (ISC_R_UNEXPECTEDEND); - RETERR(mem_tobuffer(target, region.base, 4)); - isc_buffer_forward(source, 4); /* - * Target URI + * Priority, weight and target URI */ - RETERR(multitxt_fromwire(source, target)); - - return (ISC_R_SUCCESS); + isc_buffer_forward(source, region.length); + return (mem_tobuffer(target, region.base, region.length)); } static inline isc_result_t @@ -178,8 +175,6 @@ compare_uri(ARGS_COMPARE) { static inline isc_result_t fromstruct_uri(ARGS_FROMSTRUCT) { dns_rdata_uri_t *uri = source; - isc_region_t region; - isc_uint8_t len; REQUIRE(type == 256); REQUIRE(source != NULL); @@ -203,18 +198,6 @@ fromstruct_uri(ARGS_FROMSTRUCT) { /* * Target URI */ - len = 255U; - region.base = uri->target; - region.length = uri->tgt_len; - while (region.length > 0) { - REQUIRE(len == 255U); - len = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - if (region.length < len) - return (ISC_R_UNEXPECTEDEND); - isc_region_consume(®ion, len); - } - return (mem_tobuffer(target, uri->target, uri->tgt_len)); } diff --git a/lib/dns/rdata/generic/x25_19.c b/lib/dns/rdata/generic/x25_19.c index 6867fecd86f8b..c5fe2d18b08cf 100644 --- a/lib/dns/rdata/generic/x25_19.c +++ b/lib/dns/rdata/generic/x25_19.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -60,7 +60,7 @@ totext_x25(ARGS_TOTEXT) { REQUIRE(rdata->length != 0); dns_rdata_toregion(rdata, ®ion); - return (txt_totext(®ion, target)); + return (txt_totext(®ion, ISC_TRUE, target)); } static inline isc_result_t diff --git a/lib/dns/rdataslab.c b/lib/dns/rdataslab.c index 1c02b60201b28..9367127d9eaf3 100644 --- a/lib/dns/rdataslab.c +++ b/lib/dns/rdataslab.c @@ -148,21 +148,36 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, buflen = reservelen + 2; - nalloc = dns_rdataset_count(rdataset); - nitems = nalloc; - if (nitems == 0 && rdataset->type != 0) - return (ISC_R_FAILURE); + nitems = dns_rdataset_count(rdataset); - if (nalloc > 0xffff) - return (ISC_R_NOSPACE); + /* + * If there are no rdata then we can just need to allocate a header + * with zero a record count. + */ + if (nitems == 0) { + if (rdataset->type != 0) + return (ISC_R_FAILURE); + rawbuf = isc_mem_get(mctx, buflen); + if (rawbuf == NULL) + return (ISC_R_NOMEMORY); + region->base = rawbuf; + region->length = buflen; + rawbuf += reservelen; + *rawbuf++ = 0; + *rawbuf = 0; + return (ISC_R_SUCCESS); + } + if (nitems > 0xffff) + return (ISC_R_NOSPACE); - if (nalloc != 0) { - x = isc_mem_get(mctx, nalloc * sizeof(struct xrdata)); - if (x == NULL) - return (ISC_R_NOMEMORY); - } else - x = NULL; + /* + * Remember the original number of items. + */ + nalloc = nitems; + x = isc_mem_get(mctx, nalloc * sizeof(struct xrdata)); + if (x == NULL) + return (ISC_R_NOMEMORY); /* * Save all of the rdata members into an array. @@ -180,12 +195,12 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, #endif result = dns_rdataset_next(rdataset); } - if (result != ISC_R_NOMORE) - goto free_rdatas; - if (i != nalloc) { + if (i != nalloc || result != ISC_R_NOMORE) { /* * Somehow we iterated over fewer rdatas than - * dns_rdataset_count() said there were! + * dns_rdataset_count() said there were or there + * were more items than dns_rdataset_count said + * there were. */ result = ISC_R_FAILURE; goto free_rdatas; @@ -194,7 +209,8 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, /* * Put into DNSSEC order. */ - qsort(x, nalloc, sizeof(struct xrdata), compare_rdata); + if (nalloc > 1U) + qsort(x, nalloc, sizeof(struct xrdata), compare_rdata); /* * Remove duplicates and compute the total storage required. @@ -230,17 +246,15 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, buflen++; } } + /* * Don't forget the last item! */ - if (nalloc != 0) { #if DNS_RDATASET_FIXED - buflen += (8 + x[i-1].rdata.length); + buflen += (8 + x[i-1].rdata.length); #else - buflen += (2 + x[i-1].rdata.length); + buflen += (2 + x[i-1].rdata.length); #endif - } - /* * Provide space to store the per RR meta data. */ @@ -330,8 +344,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, result = ISC_R_SUCCESS; free_rdatas: - if (x != NULL) - isc_mem_put(mctx, x, nalloc * sizeof(struct xrdata)); + isc_mem_put(mctx, x, nalloc * sizeof(struct xrdata)); return (result); } diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 2e60cd84cca24..befe3cafe0f2e 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -21,6 +21,7 @@ #include <config.h> +#include <isc/counter.h> #include <isc/log.h> #include <isc/platform.h> #include <isc/print.h> @@ -131,11 +132,20 @@ #define MAXIMUM_QUERY_TIMEOUT 30 /* The maximum time in seconds for the whole query to live. */ #endif +/* The default maximum number of recursions to follow before giving up. */ +#ifndef DEFAULT_RECURSION_DEPTH +#define DEFAULT_RECURSION_DEPTH 7 +#endif + +/* The default maximum number of iterative queries to allow before giving up. */ +#ifndef DEFAULT_MAX_QUERIES +#define DEFAULT_MAX_QUERIES 50 +#endif + /*% * Maximum EDNS0 input packet size. */ #define RECV_BUFFER_SIZE 4096 /* XXXRTH Constant. */ -#define EDNSOPTS 2 /*% * This defines the maximum number of timeouts we will permit before we @@ -163,6 +173,7 @@ typedef struct query { isc_buffer_t *tsig; dns_tsigkey_t *tsigkey; isc_socketevent_t sendevent; + int ednsversion; unsigned int options; unsigned int attributes; unsigned int sends; @@ -234,12 +245,13 @@ struct fetchctx { isc_sockaddrlist_t edns; isc_sockaddrlist_t edns512; isc_sockaddrlist_t bad_edns; - dns_validator_t *validator; + dns_validator_t * validator; ISC_LIST(dns_validator_t) validators; dns_db_t * cache; dns_adb_t * adb; isc_boolean_t ns_ttl_ok; isc_uint32_t ns_ttl; + isc_counter_t * qc; /*% * The number of events we're waiting for. @@ -307,6 +319,7 @@ struct fetchctx { isc_boolean_t timeout; dns_adbaddrinfo_t *addrinfo; isc_sockaddr_t *client; + unsigned int depth; }; #define FCTX_MAGIC ISC_MAGIC('F', '!', '!', '!') @@ -343,6 +356,7 @@ typedef struct { struct dns_fetch { unsigned int magic; + isc_mem_t * mctx; fetchctx_t * private; }; @@ -418,6 +432,8 @@ struct dns_resolver { isc_timer_t * spillattimer; isc_boolean_t zero_no_soa_ttl; unsigned int query_timeout; + unsigned int maxdepth; + unsigned int maxqueries; /* Locked by lock. */ unsigned int references; @@ -449,12 +465,16 @@ struct dns_resolver { #define FCTX_ADDRINFO_MARK 0x0001 #define FCTX_ADDRINFO_FORWARDER 0x1000 #define FCTX_ADDRINFO_TRIED 0x2000 +#define FCTX_ADDRINFO_EDNSOK 0x4000 + #define UNMARKED(a) (((a)->flags & FCTX_ADDRINFO_MARK) \ == 0) #define ISFORWARDER(a) (((a)->flags & \ FCTX_ADDRINFO_FORWARDER) != 0) #define TRIED(a) (((a)->flags & \ FCTX_ADDRINFO_TRIED) != 0) +#define EDNSOK(a) (((a)->flags & \ + FCTX_ADDRINFO_EDNSOK) != 0) #define NXDOMAIN(r) (((r)->attributes & DNS_RDATASETATTR_NXDOMAIN) != 0) #define NEGATIVE(r) (((r)->attributes & DNS_RDATASETATTR_NEGATIVE) != 0) @@ -792,6 +812,7 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp, dns_adbfind_t *find; dns_adbaddrinfo_t *addrinfo; isc_socket_t *socket; + isc_stdtime_t now; query = *queryp; fctx = query->fctx; @@ -862,14 +883,13 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp, /* * Age RTTs of servers not tried. */ - factor = DNS_ADB_RTTADJAGE; + isc_stdtime_get(&now); if (finish != NULL) for (addrinfo = ISC_LIST_HEAD(fctx->forwaddrs); addrinfo != NULL; addrinfo = ISC_LIST_NEXT(addrinfo, publink)) if (UNMARKED(addrinfo)) - dns_adb_adjustsrtt(fctx->adb, addrinfo, - 0, factor); + dns_adb_agesrtt(fctx->adb, addrinfo, now); if (finish != NULL && TRIEDFIND(fctx)) for (find = ISC_LIST_HEAD(fctx->finds); @@ -879,16 +899,15 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp, addrinfo != NULL; addrinfo = ISC_LIST_NEXT(addrinfo, publink)) if (UNMARKED(addrinfo)) - dns_adb_adjustsrtt(fctx->adb, addrinfo, - 0, factor); + dns_adb_agesrtt(fctx->adb, addrinfo, + now); if (finish != NULL && TRIEDALT(fctx)) { for (addrinfo = ISC_LIST_HEAD(fctx->altaddrs); addrinfo != NULL; addrinfo = ISC_LIST_NEXT(addrinfo, publink)) if (UNMARKED(addrinfo)) - dns_adb_adjustsrtt(fctx->adb, addrinfo, - 0, factor); + dns_adb_agesrtt(fctx->adb, addrinfo, now); for (find = ISC_LIST_HEAD(fctx->altfinds); find != NULL; find = ISC_LIST_NEXT(find, publink)) @@ -896,8 +915,8 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp, addrinfo != NULL; addrinfo = ISC_LIST_NEXT(addrinfo, publink)) if (UNMARKED(addrinfo)) - dns_adb_adjustsrtt(fctx->adb, addrinfo, - 0, factor); + dns_adb_agesrtt(fctx->adb, addrinfo, + now); } /* @@ -1533,6 +1552,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, if (result != ISC_R_SUCCESS) goto cleanup_dispatch; } + fctx->querysent++; ISC_LIST_APPEND(fctx->queries, query, link); @@ -1674,7 +1694,7 @@ resquery_send(resquery_t *query) { isc_boolean_t cleanup_cctx = ISC_FALSE; isc_boolean_t secure_domain; isc_boolean_t connecting = ISC_FALSE; - dns_ednsopt_t ednsopts[EDNSOPTS]; + dns_ednsopt_t ednsopts[DNS_EDNSOPTIONS]; unsigned ednsopt = 0; fctx = query->fctx; @@ -1821,12 +1841,12 @@ resquery_send(resquery_t *query) { if (fctx->timeout) { if ((triededns512(fctx, &query->addrinfo->sockaddr) || fctx->timeouts >= (MAX_EDNS0_TIMEOUTS * 2)) && - (query->options & DNS_FETCHOPT_NOEDNS0) == 0) { - query->options |= DNS_FETCHOPT_NOEDNS0; - fctx->reason = "disabling EDNS"; + (query->options & DNS_FETCHOPT_NOEDNS0) == 0 && + !EDNSOK(query->addrinfo)) { } else if ((triededns(fctx, &query->addrinfo->sockaddr) || fctx->timeouts >= MAX_EDNS0_TIMEOUTS) && - (query->options & DNS_FETCHOPT_NOEDNS0) == 0) { + (query->options & DNS_FETCHOPT_NOEDNS0) == 0 && + !EDNSOK(query->addrinfo)) { query->options |= DNS_FETCHOPT_EDNS512; fctx->reason = "reducing the advertised EDNS UDP " "packet size to 512 octets"; @@ -1859,12 +1879,13 @@ resquery_send(resquery_t *query) { if (peer != NULL) (void) dns_peer_getrequestnsid(peer, &reqnsid); if (reqnsid) { - INSIST(ednsopt < EDNSOPTS); + INSIST(ednsopt < DNS_EDNSOPTIONS); ednsopts[ednsopt].code = DNS_OPT_NSID; ednsopts[ednsopt].length = 0; ednsopts[ednsopt].value = NULL; ednsopt++; } + query->ednsversion = version; result = fctx_addopt(fctx->qmessage, version, udpsize, ednsopts, ednsopt); if (reqnsid && result == ISC_R_SUCCESS) { @@ -1876,6 +1897,7 @@ resquery_send(resquery_t *query) { * bit. */ query->options |= DNS_FETCHOPT_NOEDNS0; + query->ednsversion = -1; } } else { /* @@ -1884,8 +1906,10 @@ resquery_send(resquery_t *query) { * not using EDNS0. */ query->options |= DNS_FETCHOPT_NOEDNS0; + query->ednsversion = -1; } - } + } else + query->ednsversion = -1; /* * If we need EDNS0 to do this query and aren't using it, we lose. @@ -2186,9 +2210,9 @@ fctx_finddone(isc_task_t *task, isc_event_t *event) { */ INSIST(!SHUTTINGDOWN(fctx)); fctx->attributes &= ~FCTX_ATTR_ADDRWAIT; - if (event->ev_type == DNS_EVENT_ADBMOREADDRESSES) + if (event->ev_type == DNS_EVENT_ADBMOREADDRESSES) { want_try = ISC_TRUE; - else { + } else { fctx->findfail++; if (fctx->pending == 0) { /* @@ -2217,7 +2241,7 @@ fctx_finddone(isc_task_t *task, isc_event_t *event) { else if (want_done) fctx_done(fctx, ISC_R_FAILURE, __LINE__); else if (destroy) { - fctx_destroy(fctx); + fctx_destroy(fctx); if (bucket_empty) empty_bucket(res); } @@ -2471,12 +2495,13 @@ findname(fetchctx_t *fctx, dns_name_t *name, in_port_t port, * See what we know about this address. */ find = NULL; - result = dns_adb_createfind(fctx->adb, - res->buckets[fctx->bucketnum].task, - fctx_finddone, fctx, name, - &fctx->name, fctx->type, - options, now, NULL, - res->view->dstport, &find); + result = dns_adb_createfind2(fctx->adb, + res->buckets[fctx->bucketnum].task, + fctx_finddone, fctx, name, + &fctx->name, fctx->type, + options, now, NULL, + res->view->dstport, + fctx->depth + 1, fctx->qc, &find); if (result != ISC_R_SUCCESS) { if (result == DNS_R_ALIAS) { /* @@ -2584,6 +2609,14 @@ fctx_getaddresses(fetchctx_t *fctx, isc_boolean_t badcache) { res = fctx->res; + if (fctx->depth > res->maxdepth) { + isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER, + DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(3), + "too much NS indirection resolving '%s'", + fctx->info); + return (DNS_R_SERVFAIL); + } + /* * Forwarders. */ @@ -3059,6 +3092,16 @@ fctx_try(fetchctx_t *fctx, isc_boolean_t retrying, isc_boolean_t badcache) { } } + result = isc_counter_increment(fctx->qc); + if (result != ISC_R_SUCCESS) { + isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER, + DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(3), + "exceeded max queries resolving '%s'", + fctx->info); + fctx_done(fctx, DNS_R_SERVFAIL, __LINE__); + return; + } + result = fctx_query(fctx, addrinfo, fctx->options); if (result != ISC_R_SUCCESS) fctx_done(fctx, result, __LINE__); @@ -3157,6 +3200,7 @@ fctx_destroy(fetchctx_t *fctx) { isc_mem_put(fctx->mctx, sa, sizeof(*sa)); } + isc_counter_detach(&fctx->qc); isc_timer_detach(&fctx->timer); dns_message_destroy(&fctx->rmessage); dns_message_destroy(&fctx->qmessage); @@ -3485,7 +3529,8 @@ log_ns_ttl(fetchctx_t *fctx, const char *where) { static isc_result_t fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, dns_name_t *domain, dns_rdataset_t *nameservers, - unsigned int options, unsigned int bucketnum, fetchctx_t **fctxp) + unsigned int options, unsigned int bucketnum, unsigned int depth, + isc_counter_t *qc, fetchctx_t **fctxp) { fetchctx_t *fctx; isc_result_t result; @@ -3507,6 +3552,21 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, fctx = isc_mem_get(mctx, sizeof(*fctx)); if (fctx == NULL) return (ISC_R_NOMEMORY); + + fctx->qc = NULL; + if (qc != NULL) { + isc_counter_attach(qc, &fctx->qc); + } else { + result = isc_counter_create(res->mctx, + res->maxqueries, &fctx->qc); + if (result != ISC_R_SUCCESS) + goto cleanup_fetch; + } + + /* + * Make fctx->info point to a copy of a formatted string + * "name/type". + */ dns_name_format(name, buf, sizeof(buf)); dns_rdatatype_format(type, typebuf, sizeof(typebuf)); strcat(buf, "/"); /* checked */ @@ -3514,7 +3574,7 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, fctx->info = isc_mem_strdup(mctx, buf); if (fctx->info == NULL) { result = ISC_R_NOMEMORY; - goto cleanup_fetch; + goto cleanup_counter; } FCTXTRACE("create"); dns_name_init(&fctx->name, NULL); @@ -3537,6 +3597,7 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, fctx->state = fetchstate_init; fctx->want_shutdown = ISC_FALSE; fctx->cloned = ISC_FALSE; + fctx->depth = depth; ISC_LIST_INIT(fctx->queries); ISC_LIST_INIT(fctx->finds); ISC_LIST_INIT(fctx->altfinds); @@ -3615,7 +3676,7 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, */ if (dns_rdatatype_atparent(fctx->type)) findoptions |= DNS_DBFIND_NOEXACT; - result = dns_view_findzonecut(res->view, fwdname, + result = dns_view_findzonecut(res->view, name, domain, 0, findoptions, ISC_TRUE, &fctx->nameservers, @@ -3744,6 +3805,9 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, cleanup_info: isc_mem_free(mctx, fctx->info); + cleanup_counter: + isc_counter_detach(&fctx->qc); + cleanup_fetch: isc_mem_put(mctx, fctx, sizeof(*fctx)); @@ -4008,6 +4072,7 @@ validated(isc_task_t *task, isc_event_t *event) { isc_result_t result = ISC_R_SUCCESS; isc_stdtime_t now; isc_uint32_t ttl; + isc_uint32_t bucketnum; UNUSED(task); /* for now */ @@ -4024,7 +4089,8 @@ validated(isc_task_t *task, isc_event_t *event) { FCTXTRACE("received validation completion event"); - LOCK(&res->buckets[fctx->bucketnum].lock); + bucketnum = fctx->bucketnum; + LOCK(&res->buckets[bucketnum].lock); ISC_LIST_UNLINK(fctx->validators, vevent->validator, link); fctx->validator = NULL; @@ -4046,7 +4112,6 @@ validated(isc_task_t *task, isc_event_t *event) { * so, destroy the fctx. */ if (SHUTTINGDOWN(fctx) && !sentresponse) { - isc_uint32_t bucketnum = fctx->bucketnum; isc_boolean_t bucket_empty; bucket_empty = maybe_destroy(fctx, ISC_TRUE); UNLOCK(&res->buckets[bucketnum].lock); @@ -4149,7 +4214,7 @@ validated(isc_task_t *task, isc_event_t *event) { result = fctx->vresult; add_bad(fctx, addrinfo, result, badns_validation); isc_event_free(&event); - UNLOCK(&res->buckets[fctx->bucketnum].lock); + UNLOCK(&res->buckets[bucketnum].lock); INSIST(fctx->validator == NULL); fctx->validator = ISC_LIST_HEAD(fctx->validators); if (fctx->validator != NULL) @@ -4277,7 +4342,7 @@ validated(isc_task_t *task, isc_event_t *event) { dns_db_detachnode(fctx->cache, &node); if (SHUTTINGDOWN(fctx)) bucket_empty = maybe_destroy(fctx, ISC_TRUE); - UNLOCK(&res->buckets[fctx->bucketnum].lock); + UNLOCK(&res->buckets[bucketnum].lock); if (bucket_empty) empty_bucket(res); goto cleanup_event; @@ -4294,7 +4359,7 @@ validated(isc_task_t *task, isc_event_t *event) { * be validated. */ dns_db_detachnode(fctx->cache, &node); - UNLOCK(&res->buckets[fctx->bucketnum].lock); + UNLOCK(&res->buckets[bucketnum].lock); dns_validator_send(ISC_LIST_HEAD(fctx->validators)); goto cleanup_event; } @@ -4377,7 +4442,7 @@ validated(isc_task_t *task, isc_event_t *event) { if (node != NULL) dns_db_detachnode(fctx->cache, &node); - UNLOCK(&res->buckets[fctx->bucketnum].lock); + UNLOCK(&res->buckets[bucketnum].lock); fctx_done(fctx, result, __LINE__); /* Locks bucket. */ cleanup_event: @@ -4913,10 +4978,17 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo, } } - if (valrdataset != NULL) - result = valcreate(fctx, addrinfo, name, fctx->type, - valrdataset, valsigrdataset, valoptions, - task); + if (valrdataset != NULL) { + dns_rdatatype_t vtype = fctx->type; + if (CHAINING(valrdataset)) { + if (valrdataset->type == dns_rdatatype_cname) + vtype = dns_rdatatype_cname; + else + vtype = dns_rdatatype_dname; + } + result = valcreate(fctx, addrinfo, name, vtype, valrdataset, + valsigrdataset, valoptions, task); + } if (result == ISC_R_SUCCESS && have_answer) { fctx->attributes |= FCTX_ATTR_HAVEANSWER; @@ -5657,7 +5729,7 @@ noanswer_response(fetchctx_t *fctx, dns_name_t *oqname, char qbuf[DNS_NAME_FORMATSIZE]; char nbuf[DNS_NAME_FORMATSIZE]; char tbuf[DNS_RDATATYPE_FORMATSIZE]; - dns_rdatatype_format(fctx->type, tbuf, + dns_rdatatype_format(type, tbuf, sizeof(tbuf)); dns_name_format(name, nbuf, sizeof(nbuf)); @@ -5666,8 +5738,8 @@ noanswer_response(fetchctx_t *fctx, dns_name_t *oqname, log_formerr(fctx, "unrelated %s %s in " "%s authority section", - tbuf, qbuf, nbuf); - return (DNS_R_FORMERR); + tbuf, nbuf, qbuf); + goto nextname; } if (type == dns_rdatatype_ns) { /* @@ -5730,6 +5802,7 @@ noanswer_response(fetchctx_t *fctx, dns_name_t *oqname, } } } + nextname: result = dns_message_nextname(message, section); if (result == ISC_R_NOMORE) break; @@ -7015,21 +7088,33 @@ resquery_response(isc_task_t *task, isc_event_t *event) { * EDNS may not be supported so we can now cache the lack of * EDNS support. */ - if (opt == NULL && + if (opt == NULL && !EDNSOK(query->addrinfo) && (message->rcode == dns_rcode_noerror || message->rcode == dns_rcode_nxdomain || message->rcode == dns_rcode_refused || message->rcode == dns_rcode_yxdomain) && bad_edns(fctx, &query->addrinfo->sockaddr)) { - char addrbuf[ISC_SOCKADDR_FORMATSIZE]; - isc_sockaddr_format(&query->addrinfo->sockaddr, addrbuf, - sizeof(addrbuf)); dns_adb_changeflags(fctx->adb, query->addrinfo, DNS_FETCHOPT_NOEDNS0, DNS_FETCHOPT_NOEDNS0); } /* + * If we get a non error EDNS response record the fact so we + * won't fallback to plain DNS in the future for this server. + */ + if (opt != NULL && !EDNSOK(query->addrinfo) && + (query->options & DNS_FETCHOPT_NOEDNS0) == 0 && + (message->rcode == dns_rcode_noerror || + message->rcode == dns_rcode_nxdomain || + message->rcode == dns_rcode_refused || + message->rcode == dns_rcode_yxdomain)) { + dns_adb_changeflags(fctx->adb, query->addrinfo, + FCTX_ADDRINFO_EDNSOK, + FCTX_ADDRINFO_EDNSOK); + } + + /* * Deal with truncated responses by retrying using TCP. */ if ((message->flags & DNS_MESSAGEFLAG_TC) != 0) @@ -7143,6 +7228,18 @@ resquery_response(isc_task_t *task, isc_event_t *event) { DNS_FETCHOPT_EDNSVERSIONSET; mask = DNS_FETCHOPT_EDNSVERSIONMASK | DNS_FETCHOPT_EDNSVERSIONSET; + /* + * Record that we got a good EDNS response. + */ + if (query->ednsversion > (int)version && + !EDNSOK(query->addrinfo)) { + dns_adb_changeflags(fctx->adb, query->addrinfo, + FCTX_ADDRINFO_EDNSOK, + FCTX_ADDRINFO_EDNSOK); + } + /* + * Record the supported EDNS version. + */ switch (version) { case 0: dns_adb_changeflags(fctx->adb, query->addrinfo, @@ -7731,6 +7828,8 @@ dns_resolver_create(dns_view_t *view, res->spillattimer = NULL; res->zero_no_soa_ttl = ISC_FALSE; res->query_timeout = DEFAULT_QUERY_TIMEOUT; + res->maxdepth = DEFAULT_RECURSION_DEPTH; + res->maxqueries = DEFAULT_MAX_QUERIES; res->nbuckets = ntasks; res->activebuckets = ntasks; res->buckets = isc_mem_get(view->mctx, @@ -8169,9 +8268,9 @@ dns_resolver_createfetch(dns_resolver_t *res, dns_name_t *name, dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp) { - return (dns_resolver_createfetch2(res, name, type, domain, + return (dns_resolver_createfetch3(res, name, type, domain, nameservers, forwarders, NULL, 0, - options, task, action, arg, + options, 0, NULL, task, action, arg, rdataset, sigrdataset, fetchp)); } @@ -8187,6 +8286,25 @@ dns_resolver_createfetch2(dns_resolver_t *res, dns_name_t *name, dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp) { + return (dns_resolver_createfetch3(res, name, type, domain, + nameservers, forwarders, client, id, + options, 0, NULL, task, action, arg, + rdataset, sigrdataset, fetchp)); +} + +isc_result_t +dns_resolver_createfetch3(dns_resolver_t *res, dns_name_t *name, + dns_rdatatype_t type, + dns_name_t *domain, dns_rdataset_t *nameservers, + dns_forwarders_t *forwarders, + isc_sockaddr_t *client, dns_messageid_t id, + unsigned int options, unsigned int depth, + isc_counter_t *qc, isc_task_t *task, + isc_taskaction_t action, void *arg, + dns_rdataset_t *rdataset, + dns_rdataset_t *sigrdataset, + dns_fetch_t **fetchp) +{ dns_fetch_t *fetch; fetchctx_t *fctx = NULL; isc_result_t result = ISC_R_SUCCESS; @@ -8222,6 +8340,8 @@ dns_resolver_createfetch2(dns_resolver_t *res, dns_name_t *name, fetch = isc_mem_get(res->mctx, sizeof(*fetch)); if (fetch == NULL) return (ISC_R_NOMEMORY); + fetch->mctx = NULL; + isc_mem_attach(res->mctx, &fetch->mctx); bucketnum = dns_name_fullhash(name, ISC_FALSE) % res->nbuckets; @@ -8273,11 +8393,12 @@ dns_resolver_createfetch2(dns_resolver_t *res, dns_name_t *name, if (fctx == NULL) { result = fctx_create(res, name, type, domain, nameservers, - options, bucketnum, &fctx); + options, bucketnum, depth, qc, &fctx); if (result != ISC_R_SUCCESS) goto unlock; new_fctx = ISC_TRUE; - } + } else if (fctx->depth > depth) + fctx->depth = depth; result = fctx_join(fctx, task, client, id, action, arg, rdataset, sigrdataset, fetch); @@ -8312,7 +8433,7 @@ dns_resolver_createfetch2(dns_resolver_t *res, dns_name_t *name, FTRACE("created"); *fetchp = fetch; } else - isc_mem_put(res->mctx, fetch, sizeof(*fetch)); + isc_mem_putanddetach(&fetch->mctx, fetch, sizeof(*fetch)); return (result); } @@ -8403,7 +8524,7 @@ dns_resolver_destroyfetch(dns_fetch_t **fetchp) { UNLOCK(&res->buckets[bucketnum].lock); - isc_mem_put(res->mctx, fetch, sizeof(*fetch)); + isc_mem_putanddetach(&fetch->mctx, fetch, sizeof(*fetch)); *fetchp = NULL; if (bucket_empty) @@ -9049,3 +9170,27 @@ dns_resolver_settimeout(dns_resolver_t *resolver, unsigned int seconds) { resolver->query_timeout = seconds; } + +void +dns_resolver_setmaxdepth(dns_resolver_t *resolver, unsigned int maxdepth) { + REQUIRE(VALID_RESOLVER(resolver)); + resolver->maxdepth = maxdepth; +} + +unsigned int +dns_resolver_getmaxdepth(dns_resolver_t *resolver) { + REQUIRE(VALID_RESOLVER(resolver)); + return (resolver->maxdepth); +} + +void +dns_resolver_setmaxqueries(dns_resolver_t *resolver, unsigned int queries) { + REQUIRE(VALID_RESOLVER(resolver)); + resolver->maxqueries = queries; +} + +unsigned int +dns_resolver_getmaxqueries(dns_resolver_t *resolver) { + REQUIRE(VALID_RESOLVER(resolver)); + return (resolver->maxqueries); +} diff --git a/lib/dns/rootns.c b/lib/dns/rootns.c index 34971788dd89e..a3d9bd8d60842 100644 --- a/lib/dns/rootns.c +++ b/lib/dns/rootns.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2008, 2010, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2008, 2010, 2012-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -63,6 +63,7 @@ static char root_ns[] = "A.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:503:BA3E::2:30\n" "B.ROOT-SERVERS.NET. 3600000 IN A 192.228.79.201\n" "C.ROOT-SERVERS.NET. 3600000 IN A 192.33.4.12\n" +"C.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:2::c\n" "D.ROOT-SERVERS.NET. 3600000 IN A 199.7.91.13\n" "D.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:2d::d\n" "E.ROOT-SERVERS.NET. 3600000 IN A 192.203.230.10\n" diff --git a/lib/dns/rpz.c b/lib/dns/rpz.c index f617fe7b7c6a3..3dd80664c7dcd 100644 --- a/lib/dns/rpz.c +++ b/lib/dns/rpz.c @@ -496,16 +496,16 @@ ip2name(dns_rpz_cidr_t *cidr, const dns_rpz_cidr_key_t *tgt_ip, } if (canon_name != NULL) { - isc__buffer_init(&buffer, str, sizeof(str)); - isc__buffer_add(&buffer, len); + isc_buffer_init(&buffer, str, sizeof(str)); + isc_buffer_add(&buffer, len); result = dns_name_fromtext(canon_name, &buffer, dns_rootname, 0, NULL); if (result != ISC_R_SUCCESS) return (result); } if (search_name != NULL) { - isc__buffer_init(&buffer, str, sizeof(str)); - isc__buffer_add(&buffer, len); + isc_buffer_init(&buffer, str, sizeof(str)); + isc_buffer_add(&buffer, len); if (type == DNS_RPZ_TYPE_NSIP) name = &cidr->nsip_name; else diff --git a/lib/dns/rrl.c b/lib/dns/rrl.c index 02554e9a9dfbd..08fc8e712ffa0 100644 --- a/lib/dns/rrl.c +++ b/lib/dns/rrl.c @@ -253,6 +253,7 @@ expand_entries(dns_rrl_t *rrl, int new) { static inline dns_rrl_bin_t * get_bin(dns_rrl_hash_t *hash, unsigned int hval) { + INSIST(hash != NULL); return (&hash->bins[hval % hash->length]); } diff --git a/lib/dns/time.c b/lib/dns/time.c index d331ca3bfe102..5dce072811950 100644 --- a/lib/dns/time.c +++ b/lib/dns/time.c @@ -35,7 +35,7 @@ #include <dns/result.h> #include <dns/time.h> -static int days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; +static const int days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; isc_result_t dns_time64_totext(isc_int64_t t, isc_buffer_t *target) { @@ -161,6 +161,14 @@ dns_time64_fromtext(const char *source, isc_int64_t *target) { RANGE(1, 12, month); RANGE(1, days[month - 1] + ((month == 2 && is_leap(year)) ? 1 : 0), day); +#ifdef __COVERITY__ + /* + * Use a simplified range to silence Coverity warning (in + * arithmetic with day below). + */ + RANGE(1, 31, day); +#endif /* __COVERITY__ */ + RANGE(0, 23, hour); RANGE(0, 59, minute); RANGE(0, 60, second); /* 60 == leap second. */ diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c index 00ab570d9e34d..1ddca181a4ab4 100644 --- a/lib/dns/tsig.c +++ b/lib/dns/tsig.c @@ -1317,7 +1317,7 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, alg == DST_ALG_HMACSHA384 || alg == DST_ALG_HMACSHA512) { isc_uint16_t digestbits = dst_key_getbits(key); if (tsig.siglen > siglen) { - tsig_log(msg->tsigkey, 2, "signature length to big"); + tsig_log(msg->tsigkey, 2, "signature length too big"); return (DNS_R_FORMERR); } if (tsig.siglen > 0 && diff --git a/lib/dns/validator.c b/lib/dns/validator.c index d7982caa777a4..0b203d882923e 100644 --- a/lib/dns/validator.c +++ b/lib/dns/validator.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -343,7 +343,7 @@ isdelegation(dns_name_t *name, dns_rdataset_t *rdataset, dns_name_getlabel(&nsec3name, 0, &hashlabel); isc_region_consume(&hashlabel, 1); isc_buffer_init(&buffer, owner, sizeof(owner)); - result = isc_base32hex_decoderegion(&hashlabel, &buffer); + result = isc_base32hexnp_decoderegion(&hashlabel, &buffer); if (result != ISC_R_SUCCESS) { dns_rdataset_disassociate(&set); continue; @@ -918,12 +918,26 @@ authvalidated(isc_task_t *task, isc_event_t *event) { devent->name; } if (!exists) { + dns_name_t *closest; + unsigned int clabels; + val->attributes |= VALATTR_FOUNDNOQNAME; - val->attributes |= VALATTR_FOUNDCLOSEST; + + closest = dns_fixedname_name(&val->closest); + clabels = dns_name_countlabels(closest); + /* + * If we are validating a wildcard response + * clabels will not be zero. We then need + * to check if the generated wilcard from + * dns_nsec_noexistnodata is consistent with + * the wildcard used to generate the response. + */ + if (clabels == 0 || + dns_name_countlabels(wild) == clabels + 1) + val->attributes |= VALATTR_FOUNDCLOSEST; /* * The NSEC noqname proof also contains * the closest encloser. - */ if (NEEDNOQNAME(val)) proofs[DNS_VALIDATOR_NOQNAMEPROOF] = @@ -2803,7 +2817,8 @@ nsecvalidate(dns_validator_t *val, isc_boolean_t resume) { if (!NEEDNODATA(val) && !NEEDNOWILDCARD(val) && NEEDNOQNAME(val)) { if (!FOUNDNOQNAME(val)) findnsec3proofs(val); - if (FOUNDNOQNAME(val) && FOUNDCLOSEST(val)) { + if (FOUNDNOQNAME(val) && FOUNDCLOSEST(val) && + !FOUNDOPTOUT(val)) { validator_log(val, ISC_LOG_DEBUG(3), "marking as secure, noqname proof found"); marksecure(val->event); diff --git a/lib/dns/view.c b/lib/dns/view.c index 142b09edbd748..3730593b9e373 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -182,6 +182,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, view->updateacl = NULL; view->upfwdacl = NULL; view->denyansweracl = NULL; + view->nocasecompress = NULL; view->answeracl_exclude = NULL; view->denyanswernames = NULL; view->answernames_exclude = NULL; @@ -359,6 +360,8 @@ destroy(dns_view_t *view) { dns_db_detach(&view->cachedb); if (view->cache != NULL) dns_cache_detach(&view->cache); + if (view->nocasecompress != NULL) + dns_acl_detach(&view->nocasecompress); if (view->matchclients != NULL) dns_acl_detach(&view->matchclients); if (view->matchdestinations != NULL) @@ -621,6 +624,8 @@ resolver_shutdown(isc_task_t *task, isc_event_t *event) { UNUSED(task); + isc_event_free(&event); + LOCK(&view->lock); view->attributes |= DNS_VIEWATTR_RESSHUTDOWN; @@ -628,8 +633,6 @@ resolver_shutdown(isc_task_t *task, isc_event_t *event) { UNLOCK(&view->lock); - isc_event_free(&event); - if (done) destroy(view); } @@ -645,6 +648,8 @@ adb_shutdown(isc_task_t *task, isc_event_t *event) { UNUSED(task); + isc_event_free(&event); + LOCK(&view->lock); view->attributes |= DNS_VIEWATTR_ADBSHUTDOWN; @@ -652,8 +657,6 @@ adb_shutdown(isc_task_t *task, isc_event_t *event) { UNLOCK(&view->lock); - isc_event_free(&event); - if (done) destroy(view); } @@ -669,6 +672,8 @@ req_shutdown(isc_task_t *task, isc_event_t *event) { UNUSED(task); + isc_event_free(&event); + LOCK(&view->lock); view->attributes |= DNS_VIEWATTR_REQSHUTDOWN; @@ -676,8 +681,6 @@ req_shutdown(isc_task_t *task, isc_event_t *event) { UNLOCK(&view->lock); - isc_event_free(&event); - if (done) destroy(view); } @@ -1216,6 +1219,9 @@ dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname, dns_name_t *zfname; dns_rdataset_t zrdataset, zsigrdataset; dns_fixedname_t zfixedname; +#ifdef BIND9 + unsigned int ztoptions = 0; +#endif #ifndef BIND9 UNUSED(zone); @@ -1242,9 +1248,12 @@ dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname, #ifdef BIND9 zone = NULL; LOCK(&view->lock); - if (view->zonetable != NULL) - result = dns_zt_find(view->zonetable, name, 0, NULL, &zone); - else + if (view->zonetable != NULL) { + if ((options & DNS_DBFIND_NOEXACT) != 0) + ztoptions |= DNS_ZTFIND_NOEXACT; + result = dns_zt_find(view->zonetable, name, ztoptions, + NULL, &zone); + } else result = ISC_R_NOTFOUND; if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) result = dns_zone_getdb(zone, &db); @@ -1461,7 +1470,7 @@ dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name, if (zone2 != NULL) { dns_zone_detach(&zone1); dns_zone_detach(&zone2); - return (ISC_R_NOTFOUND); + return (ISC_R_MULTIPLE); } } diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 01ff97b11dcbc..7a9825bd96b02 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -2639,8 +2639,8 @@ integrity_checks(dns_zone_t *zone, dns_db_t *db) { checkspf: /* - * Check if there is a type TXT spf record without a type SPF - * RRset being present. + * Check if there is a type SPF record without an + * SPF-formatted type TXT record also being present. */ if (!DNS_ZONE_OPTION(zone, DNS_ZONEOPT_CHECKSPF)) goto next; @@ -2669,16 +2669,13 @@ integrity_checks(dns_zone_t *zone, dns_db_t *db) { dns_rdataset_disassociate(&rdataset); notxt: - if (have_spf != have_txt) { + if (have_spf && !have_txt) { char namebuf[DNS_NAME_FORMATSIZE]; - const char *found = have_txt ? "TXT" : "SPF"; - const char *need = have_txt ? "SPF" : "TXT"; dns_name_format(name, namebuf, sizeof(namebuf)); - dns_zone_log(zone, ISC_LOG_WARNING, "'%s' found SPF/%s " - "record but no SPF/%s record found, add " - "matching type %s record", namebuf, found, - need, need); + dns_zone_log(zone, ISC_LOG_WARNING, "'%s' found type " + "SPF record but no SPF TXT record found, " + "add matching type TXT record", namebuf); } next: @@ -4567,6 +4564,21 @@ zone_get_from_db(dns_zone_t *zone, dns_db_t *db, unsigned int *nscount, dns_db_currentversion(db, &version); + if (nscount != NULL) + *nscount = 0; + if (soacount != NULL) + *soacount = 0; + if (serial != NULL) + *serial = 0; + if (refresh != NULL) + *refresh = 0; + if (retry != NULL) + *retry = 0; + if (expire != NULL) + *expire = 0; + if (errors != NULL) + *errors = 0; + node = NULL; result = dns_db_findnode(db, &zone->origin, ISC_FALSE, &node); if (result != ISC_R_SUCCESS) { @@ -8544,8 +8556,10 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { trust_key(zone, keyname, &dnskey, mctx); } - if (!deletekey) + if (!deletekey) { + INSIST(newkey || updatekey); set_refreshkeytimer(zone, &keydata, now); + } } /* @@ -10933,70 +10947,25 @@ create_query(dns_zone_t *zone, dns_rdatatype_t rdtype, static isc_result_t add_opt(dns_message_t *message, isc_uint16_t udpsize, isc_boolean_t reqnsid) { - dns_rdataset_t *rdataset = NULL; - dns_rdatalist_t *rdatalist = NULL; - dns_rdata_t *rdata = NULL; isc_result_t result; - - result = dns_message_gettemprdatalist(message, &rdatalist); - if (result != ISC_R_SUCCESS) - goto cleanup; - result = dns_message_gettemprdata(message, &rdata); - if (result != ISC_R_SUCCESS) - goto cleanup; - result = dns_message_gettemprdataset(message, &rdataset); - if (result != ISC_R_SUCCESS) - goto cleanup; - dns_rdataset_init(rdataset); - - rdatalist->type = dns_rdatatype_opt; - rdatalist->covers = 0; - - /* - * Set Maximum UDP buffer size. - */ - rdatalist->rdclass = udpsize; - - /* - * Set EXTENDED-RCODE, VERSION, DO and Z to 0. - */ - rdatalist->ttl = 0; + dns_rdataset_t *rdataset = NULL; + dns_ednsopt_t ednsopts[DNS_EDNSOPTIONS]; + int count = 0; /* Set EDNS options if applicable */ if (reqnsid) { - unsigned char data[4]; - isc_buffer_t buf; - - isc_buffer_init(&buf, data, sizeof(data)); - isc_buffer_putuint16(&buf, DNS_OPT_NSID); - isc_buffer_putuint16(&buf, 0); - rdata->data = data; - rdata->length = sizeof(data); - } else { - rdata->data = NULL; - rdata->length = 0; + INSIST(count < DNS_EDNSOPTIONS); + ednsopts[count].code = DNS_OPT_NSID; + ednsopts[count].length = 0; + ednsopts[count].value = NULL; + count++; } - - rdata->rdclass = rdatalist->rdclass; - rdata->type = rdatalist->type; - rdata->flags = 0; - - ISC_LIST_INIT(rdatalist->rdata); - ISC_LIST_APPEND(rdatalist->rdata, rdata, link); - RUNTIME_CHECK(dns_rdatalist_tordataset(rdatalist, rdataset) - == ISC_R_SUCCESS); + result = dns_message_buildopt(message, &rdataset, 0, udpsize, 0, + ednsopts, count); + if (result != ISC_R_SUCCESS) + return (result); return (dns_message_setopt(message, rdataset)); - - cleanup: - if (rdatalist != NULL) - dns_message_puttemprdatalist(message, &rdatalist); - if (rdataset != NULL) - dns_message_puttemprdataset(message, &rdataset); - if (rdata != NULL) - dns_message_puttemprdata(message, &rdata); - - return (result); } static void @@ -11846,6 +11815,8 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from, int match = 0; isc_netaddr_t netaddr; isc_sockaddr_t local, remote; + dns_tsigkey_t *tsigkey; + dns_name_t *tsig; REQUIRE(DNS_ZONE_VALID(zone)); @@ -11930,8 +11901,10 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from, * Accept notify requests from non masters if they are on * 'zone->notify_acl'. */ + tsigkey = dns_message_gettsigkey(msg); + tsig = dns_tsigkey_identity(tsigkey); if (i >= zone->masterscnt && zone->notify_acl != NULL && - dns_acl_match(&netaddr, NULL, zone->notify_acl, + dns_acl_match(&netaddr, tsig, zone->notify_acl, &zone->view->aclenv, &match, NULL) == ISC_R_SUCCESS && match > 0) @@ -13048,7 +13021,6 @@ save_nsec3param(dns_zone_t *zone, nsec3paramlist_t *nsec3list) { isc_result_t result; dns_dbnode_t *node = NULL; dns_rdataset_t rdataset, prdataset; - dns_rdata_t rdata_in, prdata_in, prdata_out; dns_dbversion_t *version = NULL; nsec3param_t *nsec3param = NULL; nsec3param_t *nsec3p = NULL; @@ -13060,10 +13032,12 @@ save_nsec3param(dns_zone_t *zone, nsec3paramlist_t *nsec3list) { REQUIRE(nsec3list != NULL); REQUIRE(ISC_LIST_EMPTY(*nsec3list)); + dns_rdataset_init(&rdataset); + dns_rdataset_init(&prdataset); + dns_db_attach(zone->db, &db); CHECK(dns_db_getoriginnode(db, &node)); - dns_rdataset_init(&rdataset); dns_db_currentversion(db, &version); result = dns_db_findrdataset(db, node, version, dns_rdatatype_nsec3param, @@ -13082,8 +13056,10 @@ save_nsec3param(dns_zone_t *zone, nsec3paramlist_t *nsec3list) { result == ISC_R_SUCCESS; result = dns_rdataset_next(&rdataset)) { - dns_rdata_init(&rdata_in); - dns_rdataset_current(&rdataset, &rdata_in); + dns_rdata_t rdata = DNS_RDATA_INIT; + dns_rdata_t private = DNS_RDATA_INIT; + + dns_rdataset_current(&rdataset, &rdata); isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_ZONE, ISC_LOG_DEBUG(3), "looping through nsec3param data"); @@ -13096,16 +13072,14 @@ save_nsec3param(dns_zone_t *zone, nsec3paramlist_t *nsec3list) { * now transfer the data from the rdata to * the nsec3param */ - dns_rdata_init(&prdata_out); - dns_nsec3param_toprivate(&rdata_in, &prdata_out, + dns_nsec3param_toprivate(&rdata, &private, zone->privatetype, nsec3param->data, sizeof(nsec3param->data)); - nsec3param->length = prdata_out.length; + nsec3param->length = private.length; ISC_LIST_APPEND(*nsec3list, nsec3param, link); } getprivate: - dns_rdataset_init(&prdataset); result = dns_db_findrdataset(db, node, version, zone->privatetype, dns_rdatatype_none, 0, &prdataset, NULL); if (result != ISC_R_SUCCESS) @@ -13120,26 +13094,39 @@ save_nsec3param(dns_zone_t *zone, nsec3paramlist_t *nsec3list) { result == ISC_R_SUCCESS; result = dns_rdataset_next(&prdataset)) { - dns_rdata_init(&prdata_in); - dns_rdataset_current(&prdataset, &prdata_in); + dns_rdata_t rdata = DNS_RDATA_INIT; + dns_rdata_t private = DNS_RDATA_INIT; + + dns_rdataset_current(&prdataset, &private); isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_ZONE, ISC_LOG_DEBUG(3), "looping through nsec3param private data"); - if (!dns_nsec3param_fromprivate(&prdata_in, &prdata_out, + /* + * Do we have a valid private record? + */ + if (!dns_nsec3param_fromprivate(&private, &rdata, buf, sizeof(buf))) continue; - if ((prdata_out.data[1] & DNS_NSEC3FLAG_REMOVE) !=0) { - prdata_out.data[1] = 0; + /* + * Remove any NSEC3PARAM records scheduled to be removed. + */ + if (NSEC3REMOVE(rdata.data[1])) { + /* + * Zero out the flags. + */ + rdata.data[1] = 0; for (nsec3p = ISC_LIST_HEAD(*nsec3list); nsec3p != NULL; nsec3p = next) { next = ISC_LIST_NEXT(nsec3p, link); - if (memcmp(prdata_out.data, nsec3p->data, - sizeof(nsec3p->data)) == 0) { + + if (nsec3p->length == rdata.length + 1 && + memcmp(rdata.data, nsec3p->data + 1, + nsec3p->length - 1) == 0) { ISC_LIST_UNLINK(*nsec3list, nsec3p, link); isc_mem_put(zone->mctx, nsec3p, @@ -13154,11 +13141,13 @@ save_nsec3param(dns_zone_t *zone, nsec3paramlist_t *nsec3list) { CHECK(ISC_R_NOMEMORY); ISC_LINK_INIT(nsec3param, link); - dns_rdata_init(&prdata_out); - dns_nsec3param_toprivate(&prdata_in, &prdata_out, - zone->privatetype, nsec3param->data, - sizeof(nsec3param->data)); - nsec3param->length = prdata_out.length; + /* + * Copy the remaining private records so the nsec/nsec3 + * chain gets created. + */ + INSIST(private.length <= sizeof(nsec3param->data)); + memmove(nsec3param->data, private.data, private.length); + nsec3param->length = private.length; ISC_LIST_APPEND(*nsec3list, nsec3param, link); } @@ -13374,6 +13363,12 @@ receive_secure_db(isc_task_t *task, isc_event_t *event) { dns_zone_log(zone, ISC_LOG_ERROR, "receive_secure_db: %s", dns_result_totext(result)); + while (!ISC_LIST_EMPTY(nsec3list)) { + nsec3param_t *nsec3p; + nsec3p = ISC_LIST_HEAD(nsec3list); + ISC_LIST_UNLINK(nsec3list, nsec3p, link); + isc_mem_put(zone->mctx, nsec3p, sizeof(nsec3param_t)); + } if (dns_rdataset_isassociated(&rdataset)) dns_rdataset_disassociate(&rdataset); if (db != NULL) { @@ -13493,7 +13488,6 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) { !DNS_ZONE_FLAG(zone, DNS_ZONEFLG_FORCEXFER)) { isc_uint32_t serial, oldserial; - unsigned int soacount; dns_zone_log(zone, ISC_LOG_DEBUG(3), "generating diffs"); @@ -15691,10 +15685,12 @@ dns_zone_checknames(dns_zone_t *zone, dns_name_t *name, dns_rdata_t *rdata) { REQUIRE(DNS_ZONE_VALID(zone)); - if (!DNS_ZONE_OPTION(zone, DNS_ZONEOPT_CHECKNAMES)) + if (!DNS_ZONE_OPTION(zone, DNS_ZONEOPT_CHECKNAMES) && + rdata->type != dns_rdatatype_nsec3) return (ISC_R_SUCCESS); - if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_CHECKNAMESFAIL)) { + if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_CHECKNAMESFAIL) || + rdata->type == dns_rdatatype_nsec3) { level = ISC_LOG_ERROR; fail = ISC_TRUE; } diff --git a/lib/export/isc/Makefile.in b/lib/export/isc/Makefile.in index a92f66f30a98b..9b0249acf66ec 100644 --- a/lib/export/isc/Makefile.in +++ b/lib/export/isc/Makefile.in @@ -63,7 +63,7 @@ WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/file.@O@ \ # Alphabetically OBJS = @ISC_EXTRA_OBJS@ \ assertions.@O@ backtrace.@O@ backtrace-emptytbl.@O@ base32.@O@ \ - base64.@O@ buffer.@O@ bufferlist.@O@ \ + base64.@O@ buffer.@O@ bufferlist.@O@ counter.@O@ \ error.@O@ event.@O@ \ hash.@O@ hex.@O@ hmacmd5.@O@ hmacsha.@O@ \ inet_aton.@O@ iterated_hash.@O@ lex.@O@ lfsr.@O@ log.@O@ \ @@ -86,7 +86,7 @@ ISCDRIVERSRCS = mem.c task.c lib.c timer.c heap.c SRCS = @ISC_EXTRA_SRCS@ \ assertions.c backtrace.c backtrace-emptytbl.c base32.c \ - base64.c buffer.c bufferlist.c \ + base64.c buffer.c bufferlist.c counter.c \ error.c event.c \ hash.c hex.c hmacmd5.c hmacsha.c \ inet_aton.c iterated_hash.c lex.c log.c lfsr.c \ diff --git a/lib/export/samples/sample-update.c b/lib/export/samples/sample-update.c index 758e02eb33fa1..f7e7dcc765e2f 100644 --- a/lib/export/samples/sample-update.c +++ b/lib/export/samples/sample-update.c @@ -38,6 +38,7 @@ #include <isc/mem.h> #include <isc/parseint.h> #include <isc/sockaddr.h> +#include <isc/string.h> #include <isc/util.h> #include <dns/callbacks.h> diff --git a/lib/irs/Makefile.in b/lib/irs/Makefile.in index c59af263fe4b4..ba802bf478331 100644 --- a/lib/irs/Makefile.in +++ b/lib/irs/Makefile.in @@ -74,7 +74,7 @@ installdirs: $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir} install:: timestamp installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libirs.@A@ ${DESTDIR}${libdir} + ${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libirs.@A@ ${DESTDIR}${libdir} clean distclean:: rm -f libirs.@A@ libirs.la timestamp diff --git a/lib/irs/api b/lib/irs/api index 3f5a2a3b16935..c20ad07b828f0 100644 --- a/lib/irs/api +++ b/lib/irs/api @@ -5,5 +5,5 @@ # 9.9: 90-109 # 9.9-sub: 130-139 LIBINTERFACE = 91 -LIBREVISION = 0 +LIBREVISION = 1 LIBAGE = 0 diff --git a/lib/irs/context.c b/lib/irs/context.c index be69622b5b6ae..b01087d198081 100644 --- a/lib/irs/context.c +++ b/lib/irs/context.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -148,7 +148,7 @@ thread_key_mutex_init(void) { } static isc_result_t -thread_key_init() { +thread_key_init(void) { isc_result_t result; result = isc_once_do(&once, thread_key_mutex_init); diff --git a/lib/irs/getaddrinfo.c b/lib/irs/getaddrinfo.c index 24d35bf691d9d..f821635e984ea 100644 --- a/lib/irs/getaddrinfo.c +++ b/lib/irs/getaddrinfo.c @@ -178,6 +178,7 @@ static int add_ipv6(const char *hostname, int flags, struct addrinfo **aip, int socktype, int port); static void set_order(int, int (**)(const char *, int, struct addrinfo **, int, int)); +static void _freeaddrinfo(struct addrinfo *ai); #define FOUND_IPV4 0x1 #define FOUND_IPV6 0x2 @@ -339,7 +340,7 @@ getaddrinfo(const char *hostname, const char *servname, if (family == AF_INET6 || family == 0) { ai = ai_alloc(AF_INET6, sizeof(struct sockaddr_in6)); if (ai == NULL) { - freeaddrinfo(ai_list); + _freeaddrinfo(ai_list); return (EAI_MEMORY); } ai->ai_socktype = socktype; @@ -458,7 +459,7 @@ getaddrinfo(const char *hostname, const char *servname, NI_NUMERICHOST) == 0) { ai->ai_canonname = strdup(nbuf); if (ai->ai_canonname == NULL) { - freeaddrinfo(ai); + _freeaddrinfo(ai); return (EAI_MEMORY); } } else { @@ -481,7 +482,7 @@ getaddrinfo(const char *hostname, const char *servname, socktype, port); if (err != 0) { if (ai_list != NULL) { - freeaddrinfo(ai_list); + _freeaddrinfo(ai_list); ai_list = NULL; } break; @@ -831,7 +832,7 @@ process_answer(isc_task_t *task, isc_event_t *event) { error = EAI_NONAME; } else { if (trans->ai_sentinel.ai_next != NULL) { - freeaddrinfo(trans->ai_sentinel.ai_next); + _freeaddrinfo(trans->ai_sentinel.ai_next); trans->ai_sentinel.ai_next = NULL; } } @@ -1123,7 +1124,7 @@ add_ipv4(const char *hostname, int flags, struct addrinfo **aip, ai = ai_clone(*aip, AF_INET); /* don't use ai_clone() */ if (ai == NULL) { - freeaddrinfo(*aip); + _freeaddrinfo(*aip); return (EAI_MEMORY); } @@ -1161,6 +1162,11 @@ add_ipv6(const char *hostname, int flags, struct addrinfo **aip, /*% Free address info. */ void freeaddrinfo(struct addrinfo *ai) { + _freeaddrinfo(ai); +} + +static void +_freeaddrinfo(struct addrinfo *ai) { struct addrinfo *ai_next; while (ai != NULL) { diff --git a/lib/irs/include/irs/Makefile.in b/lib/irs/include/irs/Makefile.in index eca98eb136719..2a47975516748 100644 --- a/lib/irs/include/irs/Makefile.in +++ b/lib/irs/include/irs/Makefile.in @@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@ # machine generated. The latter are handled specially in the # install target below. # -HEADERS = version.h +HEADERS = context.h dnsconf.h resconf.h types.h version.h SUBDIRS = TARGETS = @@ -39,8 +39,6 @@ install:: installdirs done ${INSTALL_DATA} netdb.h ${DESTDIR}${includedir}/irs ${INSTALL_DATA} platform.h ${DESTDIR}${includedir}/irs - ${INSTALL_DATA} resconf.h ${DESTDIR}${includedir}/irs - ${INSTALL_DATA} types.h ${DESTDIR}${includedir}/irs distclean:: rm -f netdb.h platform.h diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index f513eb97ff9eb..3176a267988d6 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -13,8 +13,6 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id$ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -53,7 +51,7 @@ WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/file.@O@ \ OBJS = @ISC_EXTRA_OBJS@ \ assertions.@O@ backtrace.@O@ base32.@O@ base64.@O@ \ bitstring.@O@ buffer.@O@ bufferlist.@O@ commandline.@O@ \ - error.@O@ event.@O@ \ + counter.@O@ error.@O@ event.@O@ \ hash.@O@ heap.@O@ hex.@O@ hmacmd5.@O@ hmacsha.@O@ \ httpd.@O@ inet_aton.@O@ iterated_hash.@O@ \ lex.@O@ lfsr.@O@ lib.@O@ log.@O@ \ @@ -71,8 +69,8 @@ SYMTBLOBJS = backtrace-emptytbl.@O@ # Alphabetically SRCS = @ISC_EXTRA_SRCS@ \ assertions.c backtrace.c base32.c base64.c bitstring.c \ - buffer.c bufferlist.c commandline.c error.c event.c \ - heap.c hex.c hmacmd5.c hmacsha.c \ + buffer.c bufferlist.c commandline.c counter.c \ + error.c event.c heap.c hex.c hmacmd5.c hmacsha.c \ httpd.c inet_aton.c iterated_hash.c \ lex.c lfsr.c lib.c log.c \ md5.c mem.c mutexblock.c \ @@ -134,7 +132,7 @@ installdirs: $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir} install:: timestamp installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libisc.@A@ ${DESTDIR}${libdir} + ${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libisc.@A@ ${DESTDIR}${libdir} clean distclean:: rm -f libisc.@A@ libisc-nosymtbl.@A@ libisc.la \ diff --git a/lib/isc/api b/lib/isc/api index a1fe77ff05b65..d8990f0ffbea1 100644 --- a/lib/isc/api +++ b/lib/isc/api @@ -4,6 +4,6 @@ # 9.8: 80-89, 120-129 # 9.9: 90-109 # 9.9-sub: 130-139 -LIBINTERFACE = 100 +LIBINTERFACE = 103 LIBREVISION = 0 -LIBAGE = 5 +LIBAGE = 8 diff --git a/lib/isc/backtrace.c b/lib/isc/backtrace.c index a5b1a0fdba7e1..2a510421474f4 100644 --- a/lib/isc/backtrace.c +++ b/lib/isc/backtrace.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -140,7 +140,7 @@ isc_backtrace_gettrace(void **addrs, int maxaddrs, int *nframes) { #elif defined(BACKTRACE_X86STACK) #ifdef __x86_64__ static unsigned long -getrbp() { +getrbp(void) { __asm("movq %rbp, %rax\n"); } #endif diff --git a/lib/isc/base32.c b/lib/isc/base32.c index ad0b0da569e1f..2ee99b182426b 100644 --- a/lib/isc/base32.c +++ b/lib/isc/base32.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: base32.c,v 1.6 2009/10/21 01:22:29 each Exp $ */ +/* $Id: base32.c,v 1.6.698.1 2012/02/15 05:00:16 marka Exp $ */ /*! \file */ @@ -54,7 +54,7 @@ static const char base32hex[] = static isc_result_t base32_totext(isc_region_t *source, int wordlength, const char *wordbreak, - isc_buffer_t *target, const char base[]) + isc_buffer_t *target, const char base[], char pad) { char buf[9]; unsigned int loops = 0; @@ -67,8 +67,8 @@ base32_totext(isc_region_t *source, int wordlength, const char *wordbreak, buf[0] = base[((source->base[0]>>3)&0x1f)]; /* 5 + */ if (source->length == 1) { buf[1] = base[(source->base[0]<<2)&0x1c]; - buf[2] = buf[3] = buf[4] = '='; - buf[5] = buf[6] = buf[7] = '='; + buf[2] = buf[3] = buf[4] = pad; + buf[5] = buf[6] = buf[7] = pad; RETERR(str_totext(buf, target)); break; } @@ -77,7 +77,7 @@ base32_totext(isc_region_t *source, int wordlength, const char *wordbreak, buf[2] = base[((source->base[1]>>1)&0x1f)]; /* 5 + */ if (source->length == 2) { buf[3] = base[(source->base[1]<<4)&0x10]; - buf[4] = buf[5] = buf[6] = buf[7] = '='; + buf[4] = buf[5] = buf[6] = buf[7] = pad; RETERR(str_totext(buf, target)); break; } @@ -85,7 +85,7 @@ base32_totext(isc_region_t *source, int wordlength, const char *wordbreak, ((source->base[2]>>4)&0x0f)]; /* 4 + */ if (source->length == 3) { buf[4] = base[(source->base[2]<<1)&0x1e]; - buf[5] = buf[6] = buf[7] = '='; + buf[5] = buf[6] = buf[7] = pad; RETERR(str_totext(buf, target)); break; } @@ -94,7 +94,7 @@ base32_totext(isc_region_t *source, int wordlength, const char *wordbreak, buf[5] = base[((source->base[3]>>2)&0x1f)]; /* 5 + */ if (source->length == 4) { buf[6] = base[(source->base[3]<<3)&0x18]; - buf[7] = '='; + buf[7] = pad; RETERR(str_totext(buf, target)); break; } @@ -121,7 +121,8 @@ isc_result_t isc_base32_totext(isc_region_t *source, int wordlength, const char *wordbreak, isc_buffer_t *target) { - return (base32_totext(source, wordlength, wordbreak, target, base32)); + return (base32_totext(source, wordlength, wordbreak, target, + base32, '=')); } isc_result_t @@ -129,7 +130,15 @@ isc_base32hex_totext(isc_region_t *source, int wordlength, const char *wordbreak, isc_buffer_t *target) { return (base32_totext(source, wordlength, wordbreak, target, - base32hex)); + base32hex, '=')); +} + +isc_result_t +isc_base32hexnp_totext(isc_region_t *source, int wordlength, + const char *wordbreak, isc_buffer_t *target) +{ + return (base32_totext(source, wordlength, wordbreak, target, + base32hex, 0)); } /*% @@ -143,11 +152,12 @@ typedef struct { int val[8]; const char *base; /*%< Which encoding we are using */ int seen_32; /*%< Number of significant bytes if non zero */ + isc_boolean_t pad; /*%< Expect padding */ } base32_decode_ctx_t; static inline void -base32_decode_init(base32_decode_ctx_t *ctx, int length, - const char base[], isc_buffer_t *target) +base32_decode_init(base32_decode_ctx_t *ctx, int length, const char base[], + isc_boolean_t pad, isc_buffer_t *target) { ctx->digits = 0; ctx->seen_end = ISC_FALSE; @@ -155,6 +165,7 @@ base32_decode_init(base32_decode_ctx_t *ctx, int length, ctx->length = length; ctx->target = target; ctx->base = base; + ctx->pad = pad; } static inline isc_result_t @@ -167,16 +178,25 @@ base32_decode_char(base32_decode_ctx_t *ctx, int c) { if ((s = strchr(ctx->base, c)) == NULL) return (ISC_R_BADBASE32); last = (unsigned int)(s - ctx->base); + /* * Handle lower case. */ if (last > 32) last -= 33; + /* * Check that padding is contiguous. */ if (last != 32 && ctx->seen_32 != 0) return (ISC_R_BADBASE32); + + /* + * If padding is not permitted flag padding as a error. + */ + if (last == 32 && !ctx->pad) + return (ISC_R_BADBASE32); + /* * Check that padding starts at the right place and that * bits that should be zero are. @@ -212,6 +232,7 @@ base32_decode_char(base32_decode_ctx_t *ctx, int c) { ctx->seen_32 = 4; break; } + /* * Zero fill pad values. */ @@ -244,23 +265,33 @@ base32_decode_char(base32_decode_ctx_t *ctx, int c) { static inline isc_result_t base32_decode_finish(base32_decode_ctx_t *ctx) { + if (ctx->length > 0) return (ISC_R_UNEXPECTEDEND); + /* + * Add missing padding if required. + */ + if (!ctx->pad && ctx->digits != 0) { + ctx->pad = ISC_TRUE; + do { + RETERR(base32_decode_char(ctx, '=')); + } while (ctx->digits != 0); + } if (ctx->digits != 0) return (ISC_R_BADBASE32); return (ISC_R_SUCCESS); } static isc_result_t -base32_tobuffer(isc_lex_t *lexer, const char base[], isc_buffer_t *target, - int length) +base32_tobuffer(isc_lex_t *lexer, const char base[], isc_boolean_t pad, + isc_buffer_t *target, int length) { base32_decode_ctx_t ctx; isc_textregion_t *tr; isc_token_t token; isc_boolean_t eol; - base32_decode_init(&ctx, length, base, target); + base32_decode_init(&ctx, length, base, pad, target); while (!ctx.seen_end && (ctx.length != 0)) { unsigned int i; @@ -285,19 +316,26 @@ base32_tobuffer(isc_lex_t *lexer, const char base[], isc_buffer_t *target, isc_result_t isc_base32_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { - return (base32_tobuffer(lexer, base32, target, length)); + return (base32_tobuffer(lexer, base32, ISC_TRUE, target, length)); } isc_result_t isc_base32hex_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { - return (base32_tobuffer(lexer, base32hex, target, length)); + return (base32_tobuffer(lexer, base32hex, ISC_TRUE, target, length)); +} + +isc_result_t +isc_base32hexnp_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { + return (base32_tobuffer(lexer, base32hex, ISC_FALSE, target, length)); } static isc_result_t -base32_decodestring(const char *cstr, const char base[], isc_buffer_t *target) { +base32_decodestring(const char *cstr, const char base[], isc_boolean_t pad, + isc_buffer_t *target) +{ base32_decode_ctx_t ctx; - base32_decode_init(&ctx, -1, base, target); + base32_decode_init(&ctx, -1, base, pad, target); for (;;) { int c = *cstr++; if (c == '\0') @@ -312,19 +350,26 @@ base32_decodestring(const char *cstr, const char base[], isc_buffer_t *target) { isc_result_t isc_base32_decodestring(const char *cstr, isc_buffer_t *target) { - return (base32_decodestring(cstr, base32, target)); + return (base32_decodestring(cstr, base32, ISC_TRUE, target)); } isc_result_t isc_base32hex_decodestring(const char *cstr, isc_buffer_t *target) { - return (base32_decodestring(cstr, base32hex, target)); + return (base32_decodestring(cstr, base32hex, ISC_TRUE, target)); +} + +isc_result_t +isc_base32hexnp_decodestring(const char *cstr, isc_buffer_t *target) { + return (base32_decodestring(cstr, base32hex, ISC_FALSE, target)); } static isc_result_t -base32_decoderegion(isc_region_t *source, const char base[], isc_buffer_t *target) { +base32_decoderegion(isc_region_t *source, const char base[], + isc_boolean_t pad, isc_buffer_t *target) +{ base32_decode_ctx_t ctx; - base32_decode_init(&ctx, -1, base, target); + base32_decode_init(&ctx, -1, base, pad, target); while (source->length != 0) { int c = *source->base; RETERR(base32_decode_char(&ctx, c)); @@ -336,12 +381,17 @@ base32_decoderegion(isc_region_t *source, const char base[], isc_buffer_t *targe isc_result_t isc_base32_decoderegion(isc_region_t *source, isc_buffer_t *target) { - return (base32_decoderegion(source, base32, target)); + return (base32_decoderegion(source, base32, ISC_TRUE, target)); } isc_result_t isc_base32hex_decoderegion(isc_region_t *source, isc_buffer_t *target) { - return (base32_decoderegion(source, base32hex, target)); + return (base32_decoderegion(source, base32hex, ISC_TRUE, target)); +} + +isc_result_t +isc_base32hexnp_decoderegion(isc_region_t *source, isc_buffer_t *target) { + return (base32_decoderegion(source, base32hex, ISC_FALSE, target)); } static isc_result_t diff --git a/lib/isc/counter.c b/lib/isc/counter.c new file mode 100644 index 0000000000000..d7d187bbeee46 --- /dev/null +++ b/lib/isc/counter.c @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * 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. + */ + +/*! \file */ + +#include <config.h> + +#include <stddef.h> + +#include <isc/counter.h> +#include <isc/magic.h> +#include <isc/mem.h> +#include <isc/util.h> + +#define COUNTER_MAGIC ISC_MAGIC('C', 'n', 't', 'r') +#define VALID_COUNTER(r) ISC_MAGIC_VALID(r, COUNTER_MAGIC) + +struct isc_counter { + unsigned int magic; + isc_mem_t *mctx; + isc_mutex_t lock; + unsigned int references; + unsigned int limit; + unsigned int used; +}; + +isc_result_t +isc_counter_create(isc_mem_t *mctx, int limit, isc_counter_t **counterp) { + isc_result_t result; + isc_counter_t *counter; + + REQUIRE(counterp != NULL && *counterp == NULL); + + counter = isc_mem_get(mctx, sizeof(*counter)); + if (counter == NULL) + return (ISC_R_NOMEMORY); + + result = isc_mutex_init(&counter->lock); + if (result != ISC_R_SUCCESS) { + isc_mem_put(mctx, counter, sizeof(*counter)); + return (result); + } + + counter->mctx = NULL; + isc_mem_attach(mctx, &counter->mctx); + + counter->references = 1; + counter->limit = limit; + counter->used = 0; + + counter->magic = COUNTER_MAGIC; + *counterp = counter; + return (ISC_R_SUCCESS); +} + +isc_result_t +isc_counter_increment(isc_counter_t *counter) { + isc_result_t result = ISC_R_SUCCESS; + + LOCK(&counter->lock); + counter->used++; + if (counter->limit != 0 && counter->used >= counter->limit) + result = ISC_R_QUOTA; + UNLOCK(&counter->lock); + + return (result); +} + +unsigned int +isc_counter_used(isc_counter_t *counter) { + REQUIRE(VALID_COUNTER(counter)); + + return (counter->used); +} + +void +isc_counter_setlimit(isc_counter_t *counter, int limit) { + REQUIRE(VALID_COUNTER(counter)); + + LOCK(&counter->lock); + counter->limit = limit; + UNLOCK(&counter->lock); +} + +void +isc_counter_attach(isc_counter_t *source, isc_counter_t **targetp) { + REQUIRE(VALID_COUNTER(source)); + REQUIRE(targetp != NULL && *targetp == NULL); + + LOCK(&source->lock); + source->references++; + INSIST(source->references > 0); + UNLOCK(&source->lock); + + *targetp = source; +} + +static void +destroy(isc_counter_t *counter) { + counter->magic = 0; + isc_mutex_destroy(&counter->lock); + isc_mem_putanddetach(&counter->mctx, counter, sizeof(*counter)); +} + +void +isc_counter_detach(isc_counter_t **counterp) { + isc_counter_t *counter; + isc_boolean_t want_destroy = ISC_FALSE; + + REQUIRE(counterp != NULL && *counterp != NULL); + counter = *counterp; + REQUIRE(VALID_COUNTER(counter)); + + *counterp = NULL; + + LOCK(&counter->lock); + INSIST(counter->references > 0); + counter->references--; + if (counter->references == 0) + want_destroy = ISC_TRUE; + UNLOCK(&counter->lock); + + if (want_destroy) + destroy(counter); +} diff --git a/lib/isc/event.c b/lib/isc/event.c index 8ab75240dca9a..895e3d82fe8d7 100644 --- a/lib/isc/event.c +++ b/lib/isc/event.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -41,7 +41,26 @@ destroy(isc_event_t *event) { isc_event_t * isc_event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type, - isc_taskaction_t action, const void *arg, size_t size) + isc_taskaction_t action, void *arg, size_t size) +{ + isc_event_t *event; + + REQUIRE(size >= sizeof(struct isc_event)); + REQUIRE(action != NULL); + + event = isc_mem_get(mctx, size); + if (event == NULL) + return (NULL); + + ISC_EVENT_INIT(event, size, 0, NULL, type, action, arg, + sender, destroy, mctx); + + return (event); +} + +isc_event_t * +isc_event_constallocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type, + isc_taskaction_t action, const void *arg, size_t size) { isc_event_t *event; void *deconst_arg; diff --git a/lib/isc/hash.c b/lib/isc/hash.c index f70e7943312d9..e12c47183f21c 100644 --- a/lib/isc/hash.c +++ b/lib/isc/hash.c @@ -283,7 +283,7 @@ isc_hash_ctxinit(isc_hash_t *hctx) { } void -isc_hash_init() { +isc_hash_init(void) { INSIST(hash != NULL && VALID_HASH(hash)); isc_hash_ctxinit(hash); @@ -348,7 +348,7 @@ isc_hash_ctxdetach(isc_hash_t **hctxp) { } void -isc_hash_destroy() { +isc_hash_destroy(void) { unsigned int refs; INSIST(hash != NULL && VALID_HASH(hash)); diff --git a/lib/isc/include/isc/Makefile.in b/lib/isc/include/isc/Makefile.in index 54524beddc2a3..572bb3e1046b8 100644 --- a/lib/isc/include/isc/Makefile.in +++ b/lib/isc/include/isc/Makefile.in @@ -13,8 +13,6 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id$ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -26,18 +24,20 @@ top_srcdir = @top_srcdir@ # machine generated. The latter are handled specially in the # install target below. # -HEADERS = app.h assertions.h base64.h bind9.h bitstring.h boolean.h \ - buffer.h bufferlist.h commandline.h entropy.h error.h event.h \ +HEADERS = app.h assertions.h backtrace.h base32.h base64.h \ + bind9.h bitstring.h boolean.h buffer.h bufferlist.h \ + commandline.h counter.h entropy.h error.h event.h \ eventclass.h file.h formatcheck.h fsaccess.h \ hash.h heap.h hex.h hmacmd5.h hmacsha.h httpd.h \ interfaceiter.h @ISC_IPV6_H@ iterated_hash.h \ lang.h lex.h lfsr.h lib.h list.h log.h \ magic.h md5.h mem.h msgcat.h msgs.h mutexblock.h \ - namespace.h netaddr.h ondestroy.h os.h parseint.h \ - print.h quota.h radix.h random.h ratelimiter.h \ - refcount.h regex.h region.h resource.h \ - result.h resultclass.h rwlock.h safe.h serial.h sha1.h sha2.h \ - sockaddr.h socket.h stdio.h stdlib.h string.h symtab.h \ + namespace.h netaddr.h netscope.h ondestroy.h os.h parseint.h \ + pool.h portset.h print.h queue.h quota.h \ + radix.h random.h ratelimiter.h refcount.h regex.h \ + region.h resource.h result.h resultclass.h rwlock.h \ + safe.h serial.h sha1.h sha2.h sockaddr.h socket.h \ + stats.h stdio.h stdlib.h string.h symtab.h \ task.h taskpool.h timer.h tm.h types.h util.h version.h \ xml.h diff --git a/lib/isc/include/isc/base32.h b/lib/isc/include/isc/base32.h index 978a8db463ae2..347b8ed40a09b 100644 --- a/lib/isc/include/isc/base32.h +++ b/lib/isc/include/isc/base32.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2008, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -14,8 +14,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: base32.h,v 1.3 2008/09/25 04:02:39 tbox Exp $ */ - #ifndef ISC_BASE32_H #define ISC_BASE32_H 1 @@ -27,6 +25,8 @@ * * Base 32 hex preserves the sort order of data when it is encoded / * decoded. + * + * Base 32 hex "np" is base 32 hex but no padding is produced or accepted. */ #include <isc/lang.h> @@ -44,6 +44,9 @@ isc_base32_totext(isc_region_t *source, int wordlength, isc_result_t isc_base32hex_totext(isc_region_t *source, int wordlength, const char *wordbreak, isc_buffer_t *target); +isc_result_t +isc_base32hexnp_totext(isc_region_t *source, int wordlength, + const char *wordbreak, isc_buffer_t *target); /*!< * \brief Convert data into base32 encoded text. * @@ -69,8 +72,11 @@ isc_result_t isc_base32_decodestring(const char *cstr, isc_buffer_t *target); isc_result_t isc_base32hex_decodestring(const char *cstr, isc_buffer_t *target); +isc_result_t +isc_base32hexnp_decodestring(const char *cstr, isc_buffer_t *target); /*!< - * \brief Decode a null-terminated base32 string. + * \brief Decode a null-terminated string in base32, base32hex, or + * base32hex non-padded. * * Requires: *\li 'cstr' is non-null. @@ -91,8 +97,11 @@ isc_result_t isc_base32_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length); isc_result_t isc_base32hex_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length); +isc_result_t +isc_base32hexnp_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length); /*!< - * \brief Convert base32 encoded text from a lexer context into data. + * \brief Convert text encoded in base32, base32hex, or base32hex + * non-padded from a lexer context into data. * * Requires: *\li 'lex' is a valid lexer context @@ -110,8 +119,11 @@ isc_result_t isc_base32_decoderegion(isc_region_t *source, isc_buffer_t *target); isc_result_t isc_base32hex_decoderegion(isc_region_t *source, isc_buffer_t *target); +isc_result_t +isc_base32hexnp_decoderegion(isc_region_t *source, isc_buffer_t *target); /*!< - * \brief Decode a packed (no white space permitted) base32 region. + * \brief Decode a packed (no white space permitted) region in + * base32, base32hex or base32hex non-padded. * * Requires: *\li 'source' is a valid region. diff --git a/lib/isc/include/isc/buffer.h b/lib/isc/include/isc/buffer.h index 5aff01c247909..f9c0775790e72 100644 --- a/lib/isc/include/isc/buffer.h +++ b/lib/isc/include/isc/buffer.h @@ -664,12 +664,12 @@ ISC_LANG_ENDDECLS /*! \note * XXXDCL Something more could be done with initializing buffers that - * point to const data. For example, a new function, isc_buffer_initconst, - * could be used, and a new boolean flag in the buffer structure could - * indicate whether the buffer was initialized with that function. - * (isc_bufer_init itself would be reprototyped to *not* have its "base" - * parameter be const.) Then if the boolean were true, the isc_buffer_put* - * functions could assert a contractual requirement for a non-const buffer. + * point to const data. For example, isc_buffer_constinit() could + * set a new boolean flag in the buffer structure indicating whether + * the buffer was initialized with that function. * Then if the + * boolean were true, the isc_buffer_put* functions could assert a + * contractual requirement for a non-const buffer. + * * One drawback is that the isc_buffer_* functions (macros) that return * pointers would still need to return non-const pointers to avoid compiler * warnings, so it would be up to code that uses them to have to deal diff --git a/lib/isc/include/isc/counter.h b/lib/isc/include/isc/counter.h new file mode 100644 index 0000000000000..e7ebd25332547 --- /dev/null +++ b/lib/isc/include/isc/counter.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * 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. + */ + +#ifndef ISC_COUNTER_H +#define ISC_COUNTER_H 1 + +/***** + ***** Module Info + *****/ + +/*! \file isc/counter.h + * + * \brief The isc_counter_t object is a simplified version of the + * isc_quota_t object; it tracks the consumption of limited + * resources, returning an error condition when the quota is + * exceeded. However, unlike isc_quota_t, attaching and detaching + * from a counter object does not increment or decrement the counter. + */ + +/*** + *** Imports. + ***/ + +#include <isc/lang.h> +#include <isc/mutex.h> +#include <isc/types.h> + +/***** + ***** Types. + *****/ + +ISC_LANG_BEGINDECLS + +isc_result_t +isc_counter_create(isc_mem_t *mctx, int limit, isc_counter_t **counterp); +/*%< + * Allocate and initialize a counter object. + */ + +isc_result_t +isc_counter_increment(isc_counter_t *counter); +/*%< + * Increment the counter. + * + * If the counter limit is nonzero and has been reached, then + * return ISC_R_QUOTA, otherwise ISC_R_SUCCESS. (The counter is + * incremented regardless of return value.) + */ + +unsigned int +isc_counter_used(isc_counter_t *counter); +/*%< + * Return the current counter value. + */ + +void +isc_counter_setlimit(isc_counter_t *counter, int limit); +/*%< + * Set the counter limit. + */ + +void +isc_counter_attach(isc_counter_t *source, isc_counter_t **targetp); +/*%< + * Attach to a counter object, increasing its reference counter. + */ + +void +isc_counter_detach(isc_counter_t **counterp); +/*%< + * Detach (and destroy if reference counter has dropped to zero) + * a counter object. + */ + +ISC_LANG_ENDDECLS + +#endif /* ISC_COUNTER_H */ diff --git a/lib/isc/include/isc/event.h b/lib/isc/include/isc/event.h index 68fabb2fcc3cd..38206f53b9c9f 100644 --- a/lib/isc/include/isc/event.h +++ b/lib/isc/include/isc/event.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -90,9 +90,12 @@ ISC_LANG_BEGINDECLS isc_event_t * isc_event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type, - isc_taskaction_t action, const void *arg, size_t size); + isc_taskaction_t action, void *arg, size_t size); +isc_event_t * +isc_event_constallocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type, + isc_taskaction_t action, const void *arg, size_t size); /*%< - * Allocate an event structure. + * Allocate an event structure. * * Allocate and initialize in a structure with initial elements * defined by: @@ -103,7 +106,7 @@ isc_event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type, * ... * }; * \endcode - * + * * Requires: *\li 'size' >= sizeof(struct isc_event) *\li 'action' to be non NULL diff --git a/lib/isc/include/isc/file.h b/lib/isc/include/isc/file.h index a974bbd7219bb..7137410b613dc 100644 --- a/lib/isc/include/isc/file.h +++ b/lib/isc/include/isc/file.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009, 2011-2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009, 2011-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -62,7 +62,7 @@ isc_file_getmodtime(const char *file, isc_time_t *time); *\li #ISC_R_NOPERM * The file's metainformation could not be retrieved because * permission was denied to some part of the file's path. - *\li #ISC_R_EIO + *\li #ISC_R_IOERROR * Hardware error interacting with the filesystem. *\li #ISC_R_UNEXPECTED * Something totally unexpected happened. @@ -213,7 +213,7 @@ isc_file_isplainfile(const char *name); * permitted in addition to ISC_R_SUCCESS. This is done since * the next call in logconf.c is to isc_stdio_open(), which * will create the file if it can. - *\li #other ISC_R_* errors translated from errno + *\li other ISC_R_* errors translated from errno * These occur when stat returns -1 and an errno. */ @@ -229,7 +229,7 @@ isc_file_isdirectory(const char *name); * File is not a directory. *\li #ISC_R_FILENOTFOUND * File does not exist. - *\li #other ISC_R_* errors translated from errno + *\li other ISC_R_* errors translated from errno * These occur when stat returns -1 and an errno. */ diff --git a/lib/isc/include/isc/iterated_hash.h b/lib/isc/include/isc/iterated_hash.h index a8173f0ab22fe..5c0512c328c1a 100644 --- a/lib/isc/include/isc/iterated_hash.h +++ b/lib/isc/include/isc/iterated_hash.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2008, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -23,7 +23,7 @@ #include <isc/sha1.h> /* - * The maximal hash length that can be encoded it a name + * The maximal hash length that can be encoded in a name * using base32hex. floor(255/8)*5 */ #define NSEC3_MAX_HASH_LENGTH 155 diff --git a/lib/isc/include/isc/print.h b/lib/isc/include/isc/print.h index cd1e38eaf6fb1..2b9169001fec9 100644 --- a/lib/isc/include/isc/print.h +++ b/lib/isc/include/isc/print.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -38,10 +38,13 @@ */ #if !defined(ISC_PLATFORM_NEEDVSNPRINTF) && defined(ISC__PRINT_SOURCE) #define ISC_PLATFORM_NEEDVSNPRINTF +#undef snprintf +#undef vsnprintf #endif #if !defined(ISC_PLATFORM_NEEDSPRINTF) && defined(ISC__PRINT_SOURCE) #define ISC_PLATFORM_NEEDSPRINTF +#undef sprintf #endif /*** diff --git a/lib/isc/include/isc/result.h b/lib/isc/include/isc/result.h index dcd457b3d1b0c..ed1bc63e7364e 100644 --- a/lib/isc/include/isc/result.h +++ b/lib/isc/include/isc/result.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -88,9 +88,10 @@ #define ISC_R_BADADDRESSFORM 59 /*%< invalid address format */ #define ISC_R_BADBASE32 60 /*%< bad base32 encoding */ #define ISC_R_UNSET 61 /*%< unset */ +#define ISC_R_MULTIPLE 62 /*%< multiple */ /*% Not a result code: the number of results. */ -#define ISC_R_NRESULTS 62 +#define ISC_R_NRESULTS 63 ISC_LANG_BEGINDECLS diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h index 2ccd41a2d5c36..97e2f7605b9c7 100644 --- a/lib/isc/include/isc/socket.h +++ b/lib/isc/include/isc/socket.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2011-2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2011-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -281,7 +281,7 @@ typedef struct isc_socketmethods { unsigned int options); isc_result_t (*sendto)(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_taskaction_t action, - const void *arg, isc_sockaddr_t *address, + void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo); isc_result_t (*sendto2)(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_sockaddr_t *address, @@ -290,10 +290,10 @@ typedef struct isc_socketmethods { unsigned int flags); isc_result_t (*connect)(isc_socket_t *sock, isc_sockaddr_t *addr, isc_task_t *task, isc_taskaction_t action, - const void *arg); + void *arg); isc_result_t (*recv)(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, isc_task_t *task, - isc_taskaction_t action, const void *arg); + isc_taskaction_t action, void *arg); isc_result_t (*recv2)(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, isc_task_t *task, isc_socketevent_t *event, unsigned int flags); @@ -675,7 +675,7 @@ isc_socket_listen(isc_socket_t *sock, unsigned int backlog); isc_result_t isc_socket_accept(isc_socket_t *sock, - isc_task_t *task, isc_taskaction_t action, const void *arg); + isc_task_t *task, isc_taskaction_t action, void *arg); /*%< * Queue accept event. When a new connection is received, the task will * get an ISC_SOCKEVENT_NEWCONN event with the sender set to the listen @@ -699,7 +699,7 @@ isc_socket_accept(isc_socket_t *sock, isc_result_t isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addressp, isc_task_t *task, isc_taskaction_t action, - const void *arg); + void *arg); /*%< * Connect 'socket' to peer with address *saddr. When the connection * succeeds, or when an error occurs, a CONNECT event with action 'action' @@ -766,11 +766,11 @@ isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp); isc_result_t isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, - isc_task_t *task, isc_taskaction_t action, const void *arg); + isc_task_t *task, isc_taskaction_t action, void *arg); isc_result_t isc_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist, unsigned int minimum, - isc_task_t *task, isc_taskaction_t action, const void *arg); + isc_task_t *task, isc_taskaction_t action, void *arg); isc_result_t isc_socket_recv2(isc_socket_t *sock, isc_region_t *region, @@ -853,21 +853,21 @@ isc_socket_recv2(isc_socket_t *sock, isc_region_t *region, /*@{*/ isc_result_t isc_socket_send(isc_socket_t *sock, isc_region_t *region, - isc_task_t *task, isc_taskaction_t action, const void *arg); + isc_task_t *task, isc_taskaction_t action, void *arg); isc_result_t isc_socket_sendto(isc_socket_t *sock, isc_region_t *region, - isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo); isc_result_t isc_socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist, - isc_task_t *task, isc_taskaction_t action, const void *arg); + isc_task_t *task, isc_taskaction_t action, void *arg); isc_result_t isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist, - isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo); isc_result_t isc_socket_sendtov2(isc_socket_t *sock, isc_bufferlist_t *buflist, - isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo, unsigned int flags); isc_result_t diff --git a/lib/isc/include/isc/task.h b/lib/isc/include/isc/task.h index 7abf2ef2be608..a42a7e6b2a511 100644 --- a/lib/isc/include/isc/task.h +++ b/lib/isc/include/isc/task.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009-2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009-2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -128,7 +128,7 @@ typedef struct isc_taskmethods { unsigned int (*unsend)(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag, isc_eventlist_t *events); isc_result_t (*onshutdown)(isc_task_t *task, isc_taskaction_t action, - const void *arg); + void *arg); void (*shutdown)(isc_task_t *task); void (*setname)(isc_task_t *task, const char *name, void *tag); unsigned int (*purgeevents)(isc_task_t *task, void *sender, @@ -441,7 +441,7 @@ isc_task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, isc_result_t isc_task_onshutdown(isc_task_t *task, isc_taskaction_t action, - const void *arg); + void *arg); /*%< * Send a shutdown event with action 'action' and argument 'arg' when * 'task' is shutdown. diff --git a/lib/isc/include/isc/timer.h b/lib/isc/include/isc/timer.h index 0598f79b58e07..d72a86a379f91 100644 --- a/lib/isc/include/isc/timer.h +++ b/lib/isc/include/isc/timer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -112,7 +112,7 @@ typedef struct { const isc_interval_t *interval, isc_task_t *task, isc_taskaction_t action, - const void *arg, + void *arg, isc_timer_t **timerp); } isc_timermgrmethods_t; @@ -173,7 +173,7 @@ isc_timer_create(isc_timermgr_t *manager, const isc_interval_t *interval, isc_task_t *task, isc_taskaction_t action, - const void *arg, + void *arg, isc_timer_t **timerp); /*%< * Create a new 'type' timer managed by 'manager'. The timers parameters diff --git a/lib/isc/include/isc/types.h b/lib/isc/include/isc/types.h index a1edadd10db7e..6f6e64ea1e677 100644 --- a/lib/isc/include/isc/types.h +++ b/lib/isc/include/isc/types.h @@ -50,6 +50,7 @@ typedef struct isc_buffer isc_buffer_t; /*%< Buffer */ typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t; /*%< Buffer List */ typedef struct isc_constregion isc_constregion_t; /*%< Const region */ typedef struct isc_consttextregion isc_consttextregion_t; /*%< Const Text Region */ +typedef struct isc_counter isc_counter_t; /*%< Counter */ typedef struct isc_entropy isc_entropy_t; /*%< Entropy */ typedef struct isc_entropysource isc_entropysource_t; /*%< Entropy Source */ typedef struct isc_event isc_event_t; /*%< Event */ diff --git a/lib/isc/lib.c b/lib/isc/lib.c index a50542551df32..0ab72420c2b96 100644 --- a/lib/isc/lib.c +++ b/lib/isc/lib.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -96,7 +96,7 @@ do_register(void) { } void -isc_lib_register() { +isc_lib_register(void) { RUNTIME_CHECK(isc_once_do(®ister_once, do_register) == ISC_R_SUCCESS); } diff --git a/lib/isc/log.c b/lib/isc/log.c index 2cf584b44a6da..986ed61352e6b 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -1633,6 +1633,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, TIME_NOW(&new->time); + ISC_LINK_INIT(new, link); ISC_LIST_APPEND(lctx->messages, new, link); } diff --git a/lib/isc/mem.c b/lib/isc/mem.c index f45a077e1e94e..043a579077fa9 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -1778,7 +1778,6 @@ isc__mem_setwater(isc_mem_t *ctx0, isc_mem_water_t water, void *water_arg, ctx->water_arg = water_arg; ctx->hi_water = hiwater; ctx->lo_water = lowater; - ctx->hi_called = ISC_FALSE; } MCTXUNLOCK(ctx, &ctx->lock); @@ -2258,7 +2257,7 @@ isc__mempool_getfillcount(isc_mempool_t *mpctx0) { #ifdef USE_MEMIMPREGISTER isc_result_t -isc__mem_register() { +isc__mem_register(void) { return (isc_mem_register(isc__mem_create2)); } #endif diff --git a/lib/isc/netaddr.c b/lib/isc/netaddr.c index 0940df1713e5d..dcbfba42eae88 100644 --- a/lib/isc/netaddr.c +++ b/lib/isc/netaddr.c @@ -235,11 +235,12 @@ isc_netaddr_prefixok(const isc_netaddr_t *na, unsigned int prefixlen) { nbytes = prefixlen / 8; nbits = prefixlen % 8; if (nbits != 0) { + INSIST(nbytes < ipbytes); if ((p[nbytes] & (0xff>>nbits)) != 0U) return (ISC_R_FAILURE); nbytes++; } - if (memcmp(p + nbytes, zeros, ipbytes - nbytes) != 0) + if (nbytes < ipbytes && memcmp(p + nbytes, zeros, ipbytes - nbytes) != 0) return (ISC_R_FAILURE); return (ISC_R_SUCCESS); } diff --git a/lib/isc/print.c b/lib/isc/print.c index a5e5ba6699d66..06719e83a5477 100644 --- a/lib/isc/print.c +++ b/lib/isc/print.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008, 2010 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008, 2010, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -117,7 +117,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { dot = neg = space = plus = left = zero = alt = h = l = q = 0; width = precision = 0; head = ""; - length = pad = zeropad = 0; + pad = zeropad = 0; do { if (*format == '#') { @@ -260,7 +260,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { if (hi != 0) sprintf(buf, "%lu", hi); else - buf[0] = '\n'; + buf[0] = '\0'; sprintf(buf + strlen(buf), "%lu", mid); sprintf(buf + strlen(buf), "%lu", lo); } @@ -317,7 +317,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { if (hi != 0) sprintf(buf, "%lu", hi); else - buf[0] = '\n'; + buf[0] = '\0'; sprintf(buf + strlen(buf), "%lu", mid); sprintf(buf + strlen(buf), "%lu", lo); } diff --git a/lib/isc/radix.c b/lib/isc/radix.c index 82090d1fde912..df26615fa9bfb 100644 --- a/lib/isc/radix.c +++ b/lib/isc/radix.c @@ -634,12 +634,12 @@ isc_radix_remove(isc_radix_tree_t *radix, isc_radix_node_t *node) { if (node->r == NULL && node->l == NULL) { parent = node->parent; _deref_prefix(node->prefix); - isc_mem_put(radix->mctx, node, sizeof(*node)); - radix->num_active_node--; if (parent == NULL) { INSIST(radix->head == node); radix->head = NULL; + isc_mem_put(radix->mctx, node, sizeof(*node)); + radix->num_active_node--; return; } @@ -652,11 +652,13 @@ isc_radix_remove(isc_radix_tree_t *radix, isc_radix_node_t *node) { child = parent->r; } + isc_mem_put(radix->mctx, node, sizeof(*node)); + radix->num_active_node--; + if (parent->prefix) return; /* We need to remove parent too. */ - if (parent->parent == NULL) { INSIST(radix->head == parent); radix->head = child; @@ -666,6 +668,7 @@ isc_radix_remove(isc_radix_tree_t *radix, isc_radix_node_t *node) { INSIST(parent->parent->l == parent); parent->parent->l = child; } + child->parent = parent->parent; isc_mem_put(radix->mctx, parent, sizeof(*parent)); radix->num_active_node--; @@ -678,19 +681,23 @@ isc_radix_remove(isc_radix_tree_t *radix, isc_radix_node_t *node) { INSIST(node->l != NULL); child = node->l; } + parent = node->parent; child->parent = parent; _deref_prefix(node->prefix); - isc_mem_put(radix->mctx, node, sizeof(*node)); - radix->num_active_node--; if (parent == NULL) { INSIST(radix->head == node); radix->head = child; + isc_mem_put(radix->mctx, node, sizeof(*node)); + radix->num_active_node--; return; } + isc_mem_put(radix->mctx, node, sizeof(*node)); + radix->num_active_node--; + if (parent->r == node) { parent->r = child; } else { diff --git a/lib/isc/random.c b/lib/isc/random.c index 4c48e60fd77d4..d18204d6e3375 100644 --- a/lib/isc/random.c +++ b/lib/isc/random.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2009, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -67,8 +67,16 @@ isc_random_seed(isc_uint32_t seed) #ifndef HAVE_ARC4RANDOM srand(seed); -#else +#elif defined(HAVE_ARC4RANDOM_ADDRANDOM) arc4random_addrandom((u_char *) &seed, sizeof(isc_uint32_t)); +#else + /* + * If arcrandom() is available and no corresponding seeding + * function arc4random_addrandom() is available, no seeding is + * done on such platforms (e.g., OpenBSD 5.5). This is because + * the OS itself is supposed to seed the RNG and it is assumed + * that no explicit seeding is required. + */ #endif } diff --git a/lib/isc/regex.c b/lib/isc/regex.c index 279bcdc437fbd..2ee13653bdde5 100644 --- a/lib/isc/regex.c +++ b/lib/isc/regex.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2013, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -220,7 +220,7 @@ isc_regex_validate(const char *c) { ++c; switch (*c) { case '.': /* collating element */ - if (range) --range; + if (range != 0) --range; ++c; state = parse_ce; seen_ce = ISC_FALSE; @@ -255,11 +255,11 @@ isc_regex_validate(const char *c) { default: inside: seen_char = ISC_TRUE; - if (range == 2 && *c < range_start) + if (range == 2 && (*c & 0xff) < range_start) FAIL("out of order range"); if (range != 0) --range; - range_start = *c; + range_start = *c & 0xff; ++c; break; }; diff --git a/lib/isc/result.c b/lib/isc/result.c index a9405fddf0557..2bd2fb4218ed8 100644 --- a/lib/isc/result.c +++ b/lib/isc/result.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2008, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2008, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -103,6 +103,7 @@ static const char *text[ISC_R_NRESULTS] = { "invalid address format", /*%< 59 */ "bad base32 encoding", /*%< 60 */ "unset", /*%< 61 */ + "multiple", /*%< 62 */ }; #define ISC_RESULT_RESULTSET 2 diff --git a/lib/isc/socket_api.c b/lib/isc/socket_api.c index 1fba3e0ac19ac..dca6c34fc37a4 100644 --- a/lib/isc/socket_api.c +++ b/lib/isc/socket_api.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -131,7 +131,7 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr, isc_result_t isc_socket_sendto(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, - isc_taskaction_t action, const void *arg, + isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); @@ -154,7 +154,7 @@ isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region, isc_result_t isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr, isc_task_t *task, - isc_taskaction_t action, const void *arg) + isc_taskaction_t action, void *arg) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); @@ -163,7 +163,7 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr, isc_task_t *task, isc_result_t isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, - isc_task_t *task, isc_taskaction_t action, const void *arg) + isc_task_t *task, isc_taskaction_t action, void *arg) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); diff --git a/lib/isc/task.c b/lib/isc/task.c index b743271339f9f..02d6e2abaf60a 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -208,7 +208,7 @@ isc__task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag, isc_eventlist_t *events); ISC_TASKFUNC_SCOPE isc_result_t isc__task_onshutdown(isc_task_t *task0, isc_taskaction_t action, - const void *arg); + void *arg); ISC_TASKFUNC_SCOPE void isc__task_shutdown(isc_task_t *task0); ISC_TASKFUNC_SCOPE void @@ -796,7 +796,7 @@ isc__task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, ISC_TASKFUNC_SCOPE isc_result_t isc__task_onshutdown(isc_task_t *task0, isc_taskaction_t action, - const void *arg) + void *arg) { isc__task_t *task = (isc__task_t *)task0; isc_boolean_t disallowed = ISC_FALSE; @@ -1751,7 +1751,7 @@ isc__task_privilege(isc_task_t *task0) { #ifdef USE_SOCKETIMPREGISTER isc_result_t -isc__task_register() { +isc__task_register(void) { return (isc_task_register(isc__taskmgr_create)); } #endif diff --git a/lib/isc/task_api.c b/lib/isc/task_api.c index f49ab321b2d3d..44aaa17611514 100644 --- a/lib/isc/task_api.c +++ b/lib/isc/task_api.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009-2012, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -172,7 +172,7 @@ isc_task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, } isc_result_t -isc_task_onshutdown(isc_task_t *task, isc_taskaction_t action, const void *arg) +isc_task_onshutdown(isc_task_t *task, isc_taskaction_t action, void *arg) { REQUIRE(ISCAPI_TASK_VALID(task)); @@ -204,7 +204,7 @@ isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag) void isc_taskmgr_setexcltask(isc_taskmgr_t *mgr, isc_task_t *task) { REQUIRE(ISCAPI_TASK_VALID(task)); - return (mgr->methods->setexcltask(mgr, task)); + mgr->methods->setexcltask(mgr, task); } isc_result_t diff --git a/lib/isc/timer.c b/lib/isc/timer.c index 23fcbbef64986..f48259dddbccd 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007-2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007-2009, 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -131,7 +131,7 @@ struct isc__timermgr { ISC_TIMERFUNC_SCOPE isc_result_t isc__timer_create(isc_timermgr_t *manager, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, - isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_task_t *task, isc_taskaction_t action, void *arg, isc_timer_t **timerp); ISC_TIMERFUNC_SCOPE isc_result_t isc__timer_reset(isc_timer_t *timer, isc_timertype_t type, @@ -393,7 +393,7 @@ destroy(isc__timer_t *timer) { ISC_TIMERFUNC_SCOPE isc_result_t isc__timer_create(isc_timermgr_t *manager0, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, - isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_task_t *task, isc_taskaction_t action, void *arg, isc_timer_t **timerp) { isc__timermgr_t *manager = (isc__timermgr_t *)manager0; @@ -1066,7 +1066,7 @@ isc__timermgr_dispatch(isc_timermgr_t *manager0) { #ifdef USE_TIMERIMPREGISTER isc_result_t -isc__timer_register() { +isc__timer_register(void) { return (isc_timer_register(isc__timermgr_create)); } #endif diff --git a/lib/isc/timer_api.c b/lib/isc/timer_api.c index 39b33e3c7444d..f6091b47c41d2 100644 --- a/lib/isc/timer_api.c +++ b/lib/isc/timer_api.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -97,7 +97,7 @@ isc_timermgr_destroy(isc_timermgr_t **managerp) { isc_result_t isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, - isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_task_t *task, isc_taskaction_t action, void *arg, isc_timer_t **timerp) { REQUIRE(ISCAPI_TIMERMGR_VALID(manager)); diff --git a/lib/isc/tm.c b/lib/isc/tm.c index 08af2bcc95dde..842a2f7fb4ab8 100644 --- a/lib/isc/tm.c +++ b/lib/isc/tm.c @@ -147,6 +147,12 @@ isc_tm_strptime(const char *buf, const char *fmt, struct tm *tm) { size_t len = 0; int alt_format, i, split_year = 0; + REQUIRE(buf != NULL); + REQUIRE(fmt != NULL); + REQUIRE(tm != NULL); + + memset(tm, 0, sizeof(struct tm)); + bp = buf; while ((c = *fmt) != '\0') { diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c index d97d7c6bbcc93..6c53559fb0327 100644 --- a/lib/isc/unix/app.c +++ b/lib/isc/unix/app.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007-2009, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007-2009, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -379,7 +379,7 @@ isc__app_start(void) { } presult = sigprocmask(SIG_UNBLOCK, &sset, NULL); if (presult != 0) { - isc__strerror(presult, strbuf, sizeof(strbuf)); + isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_start() sigprocmask: %s", strbuf); return (ISC_R_UNEXPECTED); @@ -718,7 +718,7 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { } ISC_APPFUNC_SCOPE isc_result_t -isc__app_run() { +isc__app_run(void) { return (isc__app_ctxrun((isc_appctx_t *)&isc_g_appctx)); } @@ -773,7 +773,7 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) { } ISC_APPFUNC_SCOPE isc_result_t -isc__app_shutdown() { +isc__app_shutdown(void) { return (isc__app_ctxshutdown((isc_appctx_t *)&isc_g_appctx)); } @@ -955,7 +955,7 @@ isc__appctx_settimermgr(isc_appctx_t *ctx0, isc_timermgr_t *timermgr) { #ifdef USE_APPIMPREGISTER isc_result_t -isc__app_register() { +isc__app_register(void) { return (isc_app_register(isc__appctx_create)); } #endif diff --git a/lib/isc/unix/include/isc/Makefile.in b/lib/isc/unix/include/isc/Makefile.in index 6acad0067a770..9cd96d71b7504 100644 --- a/lib/isc/unix/include/isc/Makefile.in +++ b/lib/isc/unix/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012-2014 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -21,8 +21,8 @@ top_srcdir = @top_srcdir@ @BIND9_VERSION@ -HEADERS = dir.h int.h net.h netdb.h offset.h stat.h stdtime.h \ - syslog.h time.h +HEADERS = dir.h int.h keyboard.h net.h netdb.h offset.h stat.h \ + stdtime.h strerror.h syslog.h time.h SUBDIRS = TARGETS = diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index efa67c223bef8..c9ceaf774e897 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2008, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2008, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/lib/isc/unix/include/isc/stat.h b/lib/isc/unix/include/isc/stat.h index b7a7986492252..4d59f922c15c9 100644 --- a/lib/isc/unix/include/isc/stat.h +++ b/lib/isc/unix/include/isc/stat.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -24,7 +24,7 @@ *****/ /* - * Portable netdb.h support. + * Portable <sys/stat.h> support. * * This module is responsible for defining S_IS??? macros. * diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index d1ac96f535147..2a004234d4294 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -34,6 +34,9 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> /* uintptr_t */ +#endif #include <isc/buffer.h> #include <isc/bufferlist.h> @@ -49,6 +52,7 @@ #include <isc/platform.h> #include <isc/print.h> #include <isc/region.h> +#include <isc/resource.h> #include <isc/socket.h> #include <isc/stats.h> #include <isc/strerror.h> @@ -374,6 +378,8 @@ struct isc__socketmgr { #endif /* USE_EPOLL */ #ifdef USE_DEVPOLL int devpoll_fd; + isc_resourcevalue_t open_max; + unsigned int calls; int nevents; struct pollfd *events; #endif /* USE_DEVPOLL */ @@ -481,32 +487,32 @@ isc__socketmgr_destroy(isc_socketmgr_t **managerp); ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist, unsigned int minimum, isc_task_t *task, - isc_taskaction_t action, const void *arg); + isc_taskaction_t action, void *arg); ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, isc_task_t *task, - isc_taskaction_t action, const void *arg); + isc_taskaction_t action, void *arg); ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_recv2(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, isc_task_t *task, isc_socketevent_t *event, unsigned int flags); ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_send(isc_socket_t *sock, isc_region_t *region, - isc_task_t *task, isc_taskaction_t action, const void *arg); + isc_task_t *task, isc_taskaction_t action, void *arg); ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_sendto(isc_socket_t *sock, isc_region_t *region, - isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo); ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist, - isc_task_t *task, isc_taskaction_t action, const void *arg); + isc_task_t *task, isc_taskaction_t action, void *arg); ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist, - isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo); ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_sendtov2(isc_socket_t *sock, isc_bufferlist_t *buflist, - isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo, unsigned int flags); ISC_SOCKETFUNC_SCOPE isc_result_t @@ -528,11 +534,11 @@ ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_listen(isc_socket_t *sock, unsigned int backlog); ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_accept(isc_socket_t *sock, - isc_task_t *task, isc_taskaction_t action, const void *arg); + isc_task_t *task, isc_taskaction_t action, void *arg); ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr, isc_task_t *task, isc_taskaction_t action, - const void *arg); + void *arg); ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp); ISC_SOCKETFUNC_SCOPE isc_result_t @@ -1091,8 +1097,6 @@ select_readmsg(isc__socketmgr_t *mgr, int *fd, int *msg) { "read() failed " "during watcher poke: %s"), strbuf); - - return; } INSIST(cc == sizeof(buf)); @@ -1593,7 +1597,7 @@ destroy_socketevent(isc_event_t *event) { static isc_socketevent_t * allocate_socketevent(isc__socket_t *sock, isc_eventtype_t eventtype, - isc_taskaction_t action, const void *arg) + isc_taskaction_t action, void *arg) { isc_socketevent_t *ev; @@ -1951,7 +1955,7 @@ doio_send(isc__socket_t *sock, isc_socketevent_t *dev) { * references exist. */ static void -closesocket(isc__socketmgr_t *manager, isc__socket_t *sock, int fd) { +socketclose(isc__socketmgr_t *manager, isc__socket_t *sock, int fd) { isc_sockettype_t type = sock->type; int lockid = FDLOCK_ID(fd); @@ -2031,7 +2035,7 @@ destroy(isc__socket_t **sockp) { if (sock->fd >= 0) { fd = sock->fd; sock->fd = -1; - closesocket(manager, sock, fd); + socketclose(manager, sock, fd); } LOCK(&manager->lock); @@ -2903,7 +2907,7 @@ isc__socket_close(isc_socket_t *sock0) { UNLOCK(&sock->lock); - closesocket(manager, sock, fd); + socketclose(manager, sock, fd); return (ISC_R_SUCCESS); } @@ -3822,8 +3826,10 @@ watcher(void *uap) { #elif defined (USE_EPOLL) const char *fnname = "epoll_wait()"; #elif defined(USE_DEVPOLL) + isc_result_t result; const char *fnname = "ioctl(DP_POLL)"; struct dvpoll dvp; + int pass; #elif defined (USE_SELECT) const char *fnname = "select()"; int maxfd; @@ -3850,17 +3856,45 @@ watcher(void *uap) { cc = epoll_wait(manager->epoll_fd, manager->events, manager->nevents, -1); #elif defined(USE_DEVPOLL) - dvp.dp_fds = manager->events; - dvp.dp_nfds = manager->nevents; + /* + * Re-probe every thousand calls. + */ + if (manager->calls++ > 1000U) { + result = isc_resource_getcurlimit( + isc_resource_openfiles, + &manager->open_max); + if (result != ISC_R_SUCCESS) + manager->open_max = 64; + manager->calls = 0; + } + for (pass = 0; pass < 2; pass++) { + dvp.dp_fds = manager->events; + dvp.dp_nfds = manager->nevents; + if (dvp.dp_nfds >= manager->open_max) + dvp.dp_nfds = manager->open_max - 1; #ifndef ISC_SOCKET_USE_POLLWATCH - dvp.dp_timeout = -1; -#else - if (pollstate == poll_idle) dvp.dp_timeout = -1; - else - dvp.dp_timeout = ISC_SOCKET_POLLWATCH_TIMEOUT; +#else + if (pollstate == poll_idle) + dvp.dp_timeout = -1; + else + dvp.dp_timeout = + ISC_SOCKET_POLLWATCH_TIMEOUT; #endif /* ISC_SOCKET_USE_POLLWATCH */ - cc = ioctl(manager->devpoll_fd, DP_POLL, &dvp); + cc = ioctl(manager->devpoll_fd, DP_POLL, &dvp); + if (cc == -1 && errno == EINVAL) { + /* + * {OPEN_MAX} may have dropped. Look + * up the current value and try again. + */ + result = isc_resource_getcurlimit( + isc_resource_openfiles, + &manager->open_max); + if (result != ISC_R_SUCCESS) + manager->open_max = 64; + } else + break; + } #elif defined(USE_SELECT) LOCK(&manager->lock); memmove(manager->read_fds_copy, manager->read_fds, @@ -4022,11 +4056,12 @@ setup_watcher(isc_mem_t *mctx, isc__socketmgr_t *manager) { } #endif /* USE_WATCHER_THREAD */ #elif defined(USE_DEVPOLL) - /* - * XXXJT: /dev/poll seems to reject large numbers of events, - * so we should be careful about redefining ISC_SOCKET_MAXEVENTS. - */ manager->nevents = ISC_SOCKET_MAXEVENTS; + result = isc_resource_getcurlimit(isc_resource_openfiles, + &manager->open_max); + if (result != ISC_R_SUCCESS) + manager->open_max = 64; + manager->calls = 0; manager->events = isc_mem_get(mctx, sizeof(struct pollfd) * manager->nevents); if (manager->events == NULL) @@ -4557,7 +4592,7 @@ socket_recv(isc__socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_recvv(isc_socket_t *sock0, isc_bufferlist_t *buflist, unsigned int minimum, isc_task_t *task, - isc_taskaction_t action, const void *arg) + isc_taskaction_t action, void *arg) { isc__socket_t *sock = (isc__socket_t *)sock0; isc_socketevent_t *dev; @@ -4611,7 +4646,7 @@ isc__socket_recvv(isc_socket_t *sock0, isc_bufferlist_t *buflist, ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_recv(isc_socket_t *sock0, isc_region_t *region, unsigned int minimum, isc_task_t *task, - isc_taskaction_t action, const void *arg) + isc_taskaction_t action, void *arg) { isc__socket_t *sock = (isc__socket_t *)sock0; isc_socketevent_t *dev; @@ -4756,7 +4791,7 @@ socket_send(isc__socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_send(isc_socket_t *sock, isc_region_t *region, - isc_task_t *task, isc_taskaction_t action, const void *arg) + isc_task_t *task, isc_taskaction_t action, void *arg) { /* * REQUIRE() checking is performed in isc_socket_sendto(). @@ -4767,7 +4802,7 @@ isc__socket_send(isc_socket_t *sock, isc_region_t *region, ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_sendto(isc_socket_t *sock0, isc_region_t *region, - isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo) { isc__socket_t *sock = (isc__socket_t *)sock0; @@ -4795,7 +4830,7 @@ isc__socket_sendto(isc_socket_t *sock0, isc_region_t *region, ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist, - isc_task_t *task, isc_taskaction_t action, const void *arg) + isc_task_t *task, isc_taskaction_t action, void *arg) { return (isc__socket_sendtov2(sock, buflist, task, action, arg, NULL, NULL, 0)); @@ -4803,7 +4838,7 @@ isc__socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist, ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist, - isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo) { return (isc__socket_sendtov2(sock, buflist, task, action, arg, address, @@ -4812,7 +4847,7 @@ isc__socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist, ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_sendtov2(isc_socket_t *sock0, isc_bufferlist_t *buflist, - isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo, unsigned int flags) { @@ -5211,7 +5246,7 @@ isc__socket_listen(isc_socket_t *sock0, unsigned int backlog) { */ ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_accept(isc_socket_t *sock0, - isc_task_t *task, isc_taskaction_t action, const void *arg) + isc_task_t *task, isc_taskaction_t action, void *arg) { isc__socket_t *sock = (isc__socket_t *)sock0; isc_socket_newconnev_t *dev; @@ -5286,7 +5321,7 @@ isc__socket_accept(isc_socket_t *sock0, ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_connect(isc_socket_t *sock0, isc_sockaddr_t *addr, - isc_task_t *task, isc_taskaction_t action, const void *arg) + isc_task_t *task, isc_taskaction_t action, void *arg) { isc__socket_t *sock = (isc__socket_t *)sock0; isc_socket_connev_t *dev; @@ -5796,8 +5831,6 @@ isc__socketmgr_waitevents(isc_socketmgr_t *manager0, struct timeval *tvp, isc_socketwait_t **swaitp) { isc__socketmgr_t *manager = (isc__socketmgr_t *)manager0; - - int n; #ifdef USE_KQUEUE struct timespec ts, *tsp; @@ -5806,6 +5839,8 @@ isc__socketmgr_waitevents(isc_socketmgr_t *manager0, struct timeval *tvp, int timeout; #endif #ifdef USE_DEVPOLL + isc_result_t result; + int pass; struct dvpoll dvp; #endif @@ -5839,15 +5874,41 @@ isc__socketmgr_waitevents(isc_socketmgr_t *manager0, struct timeval *tvp, manager->nevents, timeout); n = swait_private.nevents; #elif defined(USE_DEVPOLL) - dvp.dp_fds = manager->events; - dvp.dp_nfds = manager->nevents; - if (tvp != NULL) { - dvp.dp_timeout = tvp->tv_sec * 1000 + - (tvp->tv_usec + 999) / 1000; - } else - dvp.dp_timeout = -1; - swait_private.nevents = ioctl(manager->devpoll_fd, DP_POLL, &dvp); - n = swait_private.nevents; + /* + * Re-probe every thousand calls. + */ + if (manager->calls++ > 1000U) { + result = isc_resource_getcurlimit(isc_resource_openfiles, + &manager->open_max); + if (result != ISC_R_SUCCESS) + manager->open_max = 64; + manager->calls = 0; + } + for (pass = 0; pass < 2; pass++) { + dvp.dp_fds = manager->events; + dvp.dp_nfds = manager->nevents; + if (dvp.dp_nfds >= manager->open_max) + dvp.dp_nfds = manager->open_max - 1; + if (tvp != NULL) { + dvp.dp_timeout = tvp->tv_sec * 1000 + + (tvp->tv_usec + 999) / 1000; + } else + dvp.dp_timeout = -1; + n = ioctl(manager->devpoll_fd, DP_POLL, &dvp); + if (n == -1 && errno == EINVAL) { + /* + * {OPEN_MAX} may have dropped. Look + * up the current value and try again. + */ + result = isc_resource_getcurlimit( + isc_resource_openfiles, + &manager->open_max); + if (result != ISC_R_SUCCESS) + manager->open_max = 64; + } else + break; + } + swait_private.nevents = n; #elif defined(USE_SELECT) memmove(manager->read_fds_copy, manager->read_fds, manager->fd_bufsize); memmove(manager->write_fds_copy, manager->write_fds, @@ -5923,7 +5984,7 @@ isc__socket_gettag(isc_socket_t *socket0) { #ifdef USE_SOCKETIMPREGISTER isc_result_t -isc__socket_register() { +isc__socket_register(void) { return (isc_socket_register(isc__socketmgr_create)); } #endif diff --git a/lib/isccc/Makefile.in b/lib/isccc/Makefile.in index efa834133c735..1a33be9163b2e 100644 --- a/lib/isccc/Makefile.in +++ b/lib/isccc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007, 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2009, 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001, 2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -80,7 +80,7 @@ installdirs: $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir} install:: timestamp installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libisccc.@A@ ${DESTDIR}${libdir} + ${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libisccc.@A@ ${DESTDIR}${libdir} clean distclean:: rm -f libisccc.@A@ timestamp diff --git a/lib/isccfg/Makefile.in b/lib/isccfg/Makefile.in index 19ec61edd9e33..6e07da3dcedd9 100644 --- a/lib/isccfg/Makefile.in +++ b/lib/isccfg/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2005, 2007, 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2005, 2007, 2009, 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001-2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -78,7 +78,7 @@ installdirs: $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir} install:: timestamp installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libisccfg.@A@ ${DESTDIR}${libdir} + ${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libisccfg.@A@ ${DESTDIR}${libdir} clean distclean:: rm -f libisccfg.@A@ timestamp diff --git a/lib/isccfg/aclconf.c b/lib/isccfg/aclconf.c index af5659909e100..e1b68971738af 100644 --- a/lib/isccfg/aclconf.c +++ b/lib/isccfg/aclconf.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -213,14 +213,16 @@ convert_keyname(const cfg_obj_t *keyobj, isc_log_t *lctx, isc_mem_t *mctx, * elements table after all the nested ACLs have been merged in to the * parent. */ -static int +static isc_result_t count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx, - isc_boolean_t *has_negative) + isc_log_t *lctx, cfg_aclconfctx_t *ctx, isc_mem_t *mctx, + isc_uint32_t *count, isc_boolean_t *has_negative) { const cfg_listelt_t *elt; - const cfg_obj_t *cacl = NULL; isc_result_t result; - int n = 0; + isc_uint32_t n = 0; + + REQUIRE(count != NULL); if (has_negative != NULL) *has_negative = ISC_FALSE; @@ -241,7 +243,12 @@ count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx, n++; } else if (cfg_obj_islist(ce)) { isc_boolean_t negative; - n += count_acl_elements(ce, cctx, &negative); + isc_uint32_t sub; + result = count_acl_elements(ce, cctx, lctx, ctx, mctx, + &sub, &negative); + if (result != ISC_R_SUCCESS) + return (result); + n += sub; if (negative) n++; } else if (cfg_obj_isstring(ce)) { @@ -251,26 +258,45 @@ count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx, n++; } else if (strcasecmp(name, "any") != 0 && strcasecmp(name, "none") != 0) { - result = get_acl_def(cctx, name, &cacl); - if (result == ISC_R_SUCCESS) - n += count_acl_elements(cacl, cctx, - NULL) + 1; + dns_acl_t *inneracl = NULL; + /* + * Convert any named acls we reference now if + * they have not already been converted. + */ + result = convert_named_acl(ce, cctx, lctx, ctx, + mctx, 0, &inneracl); + if (result == ISC_R_SUCCESS) { + if (inneracl->has_negatives) + n++; + else + n += inneracl->length; + dns_acl_detach(&inneracl); + } else + return (result); } } } - return n; + *count = n; + return (ISC_R_SUCCESS); } isc_result_t -cfg_acl_fromconfig(const cfg_obj_t *caml, - const cfg_obj_t *cctx, - isc_log_t *lctx, - cfg_aclconfctx_t *ctx, - isc_mem_t *mctx, - unsigned int nest_level, +cfg_acl_fromconfig(const cfg_obj_t *caml, const cfg_obj_t *cctx, + isc_log_t *lctx, cfg_aclconfctx_t *ctx, + isc_mem_t *mctx, unsigned int nest_level, dns_acl_t **target) { + return (cfg_acl_fromconfig2(caml, cctx, lctx, ctx, mctx, + nest_level, 0, target)); +} + +isc_result_t +cfg_acl_fromconfig2(const cfg_obj_t *caml, const cfg_obj_t *cctx, + isc_log_t *lctx, cfg_aclconfctx_t *ctx, + isc_mem_t *mctx, unsigned int nest_level, + isc_uint16_t family, dns_acl_t **target) +{ isc_result_t result; dns_acl_t *dacl = NULL, *inneracl = NULL; dns_aclelement_t *de; @@ -300,11 +326,14 @@ cfg_acl_fromconfig(const cfg_obj_t *caml, * elements table. (Note that if nest_level is nonzero, * *everything* goes in the elements table.) */ - int nelem; + isc_uint32_t nelem; - if (nest_level == 0) - nelem = count_acl_elements(caml, cctx, NULL); - else + if (nest_level == 0) { + result = count_acl_elements(caml, cctx, lctx, ctx, + mctx, &nelem, NULL); + if (result != ISC_R_SUCCESS) + return (result); + } else nelem = cfg_list_length(caml, ISC_FALSE); result = dns_acl_create(mctx, nelem, &dacl); @@ -319,6 +348,8 @@ cfg_acl_fromconfig(const cfg_obj_t *caml, const cfg_obj_t *ce = cfg_listelt_value(elt); isc_boolean_t neg; + INSIST(dacl->length <= dacl->alloc); + if (cfg_obj_istuple(ce)) { /* This must be a negated element. */ ce = cfg_tuple_get(ce, "value"); @@ -349,6 +380,16 @@ cfg_acl_fromconfig(const cfg_obj_t *caml, unsigned int bitlen; cfg_obj_asnetprefix(ce, &addr, &bitlen); + if (family != 0 && family != addr.family) { + char buf[ISC_NETADDR_FORMATSIZE + 1]; + isc_netaddr_format(&addr, buf, sizeof(buf)); + cfg_obj_log(ce, lctx, ISC_LOG_WARNING, + "'%s': incorrect address family; " + "ignoring", buf); + if (nest_level != 0) + dns_acl_detach(&de->nestedacl); + continue; + } /* * If nesting ACLs (nest_level != 0), we negate @@ -360,6 +401,7 @@ cfg_acl_fromconfig(const cfg_obj_t *caml, goto cleanup; if (nest_level > 0) { + INSIST(dacl->length < dacl->alloc); de->type = dns_aclelementtype_nestedacl; de->negative = neg; } else @@ -381,6 +423,7 @@ cfg_acl_fromconfig(const cfg_obj_t *caml, goto cleanup; nested_acl: if (nest_level > 0 || inneracl->has_negatives) { + INSIST(dacl->length < dacl->alloc); de->type = dns_aclelementtype_nestedacl; de->negative = neg; if (de->nestedacl != NULL) @@ -390,14 +433,18 @@ nested_acl: dns_acl_detach(&inneracl); /* Fall through. */ } else { + INSIST(dacl->length + inneracl->length + <= dacl->alloc); dns_acl_merge(dacl, inneracl, ISC_TF(!neg)); de += inneracl->length; /* elements added */ dns_acl_detach(&inneracl); + INSIST(dacl->length <= dacl->alloc); continue; } } else if (cfg_obj_istype(ce, &cfg_type_keyref)) { /* Key name. */ + INSIST(dacl->length < dacl->alloc); de->type = dns_aclelementtype_keyname; de->negative = neg; dns_name_init(&de->keyname, NULL); @@ -416,6 +463,7 @@ nested_acl: goto cleanup; if (nest_level != 0) { + INSIST(dacl->length < dacl->alloc); de->type = dns_aclelementtype_nestedacl; de->negative = neg; } else @@ -437,19 +485,26 @@ nested_acl: dacl->has_negatives = !neg; if (nest_level != 0) { + INSIST(dacl->length < dacl->alloc); de->type = dns_aclelementtype_nestedacl; de->negative = !neg; } else continue; } else if (strcasecmp(name, "localhost") == 0) { + INSIST(dacl->length < dacl->alloc); de->type = dns_aclelementtype_localhost; de->negative = neg; } else if (strcasecmp(name, "localnets") == 0) { + INSIST(dacl->length < dacl->alloc); de->type = dns_aclelementtype_localnets; de->negative = neg; } else { if (inneracl != NULL) dns_acl_detach(&inneracl); + /* + * This call should just find the cached + * of the named acl. + */ result = convert_named_acl(ce, cctx, lctx, ctx, mctx, new_nest_level, &inneracl); diff --git a/lib/isccfg/api b/lib/isccfg/api index 7e580435abb97..3ee8eef93a670 100644 --- a/lib/isccfg/api +++ b/lib/isccfg/api @@ -4,6 +4,6 @@ # 9.8: 80-89, 120-129 # 9.9: 90-109 # 9.9-sub: 130-139 -LIBINTERFACE = 91 -LIBREVISION = 0 -LIBAGE = 1 +LIBINTERFACE = 92 +LIBREVISION = 3 +LIBAGE = 2 diff --git a/lib/isccfg/include/isccfg/Makefile.in b/lib/isccfg/include/isccfg/Makefile.in index 211583a5f1e4d..d6f395ca72b09 100644 --- a/lib/isccfg/include/isccfg/Makefile.in +++ b/lib/isccfg/include/isccfg/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2005, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2005, 2007, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001, 2002 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -26,7 +26,8 @@ top_srcdir = @top_srcdir@ # machine generated. The latter are handled specially in the # install target below. # -HEADERS = aclconf.h cfg.h grammar.h log.h namedconf.h version.h +HEADERS = aclconf.h cfg.h dnsconf.h grammar.h log.h namedconf.h \ + version.h SUBDIRS = TARGETS = diff --git a/lib/isccfg/include/isccfg/aclconf.h b/lib/isccfg/include/isccfg/aclconf.h index 38ab9f696fb09..deeec6954c3c4 100644 --- a/lib/isccfg/include/isccfg/aclconf.h +++ b/lib/isccfg/include/isccfg/aclconf.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2010-2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2010-2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -58,13 +58,16 @@ cfg_aclconfctx_attach(cfg_aclconfctx_t *src, cfg_aclconfctx_t **dest); */ isc_result_t -cfg_acl_fromconfig(const cfg_obj_t *caml, - const cfg_obj_t *cctx, - isc_log_t *lctx, - cfg_aclconfctx_t *ctx, - isc_mem_t *mctx, - unsigned int nest_level, +cfg_acl_fromconfig(const cfg_obj_t *caml, const cfg_obj_t *cctx, + isc_log_t *lctx, cfg_aclconfctx_t *ctx, + isc_mem_t *mctx, unsigned int nest_level, dns_acl_t **target); + +isc_result_t +cfg_acl_fromconfig2(const cfg_obj_t *caml, const cfg_obj_t *cctx, + isc_log_t *lctx, cfg_aclconfctx_t *ctx, + isc_mem_t *mctx, unsigned int nest_level, + isc_uint16_t family, dns_acl_t **target); /* * Construct a new dns_acl_t from configuration data in 'caml' and * 'cctx'. Memory is allocated through 'mctx'. @@ -75,6 +78,11 @@ cfg_acl_fromconfig(const cfg_obj_t *caml, * nested dns_acl_t object when the referring objects were created * passing the same ACL configuration context 'ctx'. * + * cfg_acl_fromconfig() is a backward-compatible version of + * cfg_acl_fromconfig2(), which allows an address family to be + * specified. If 'family' is not zero, then only addresses/prefixes + * of a matching family (AF_INET or AF_INET6) may be configured. + * * On success, attach '*target' to the new dns_acl_t object. */ diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index f11e2938e861f..1c82f9bfd0680 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - /*! \file */ #include <config.h> @@ -123,34 +121,8 @@ static cfg_type_t cfg_type_view; static cfg_type_t cfg_type_viewopts; static cfg_type_t cfg_type_zone; static cfg_type_t cfg_type_zoneopts; -static cfg_type_t cfg_type_dynamically_loadable_zones; -static cfg_type_t cfg_type_dynamically_loadable_zones_opts; static cfg_type_t cfg_type_v4_aaaa; - -/* - * Clauses that can be found in a 'dynamically loadable zones' statement - */ -static cfg_clausedef_t -dynamically_loadable_zones_clauses[] = { - { "database", &cfg_type_astring, 0 }, - { NULL, NULL, 0 } -}; - -/* - * A dynamically loadable zones statement. - */ -static cfg_tuplefielddef_t dynamically_loadable_zones_fields[] = { - { "name", &cfg_type_astring, 0 }, - { "options", &cfg_type_dynamically_loadable_zones_opts, 0 }, - { NULL, NULL, 0 } -}; - -static cfg_type_t cfg_type_dynamically_loadable_zones = { - "dlz", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, - &cfg_rep_tuple, - dynamically_loadable_zones_fields - }; - +static cfg_type_t cfg_type_dlz; /*% tkey-dhkey */ @@ -896,7 +868,7 @@ namedconf_or_view_clauses[] = { { "key", &cfg_type_key, CFG_CLAUSEFLAG_MULTI }, { "zone", &cfg_type_zone, CFG_CLAUSEFLAG_MULTI }, /* only 1 DLZ per view allowed */ - { "dlz", &cfg_type_dynamically_loadable_zones, 0 }, + { "dlz", &cfg_type_dlz, 0 }, { "server", &cfg_type_server, CFG_CLAUSEFLAG_MULTI }, { "trusted-keys", &cfg_type_dnsseckeys, CFG_CLAUSEFLAG_MULTI }, { "managed-keys", &cfg_type_managedkeys, CFG_CLAUSEFLAG_MULTI }, @@ -1419,10 +1391,13 @@ view_clauses[] = { { "max-cache-ttl", &cfg_type_uint32, 0 }, { "max-clients-per-query", &cfg_type_uint32, 0 }, { "max-ncache-ttl", &cfg_type_uint32, 0 }, + { "max-recursion-depth", &cfg_type_uint32, 0 }, + { "max-recursion-queries", &cfg_type_uint32, 0 }, { "max-udp-size", &cfg_type_uint32, 0 }, { "min-roots", &cfg_type_uint32, CFG_CLAUSEFLAG_NOTIMP }, { "minimal-responses", &cfg_type_boolean, 0 }, { "preferred-glue", &cfg_type_astring, 0 }, + { "no-case-compress", &cfg_type_bracketed_aml, 0 }, { "provide-ixfr", &cfg_type_boolean, 0 }, /* * Note that the query-source option syntax is different @@ -1513,6 +1488,7 @@ static cfg_type_t cfg_type_validityinterval = { &cfg_rep_tuple, validityinterval_fields }; + /*% * Clauses that can be found in a 'zone' statement, * with defaults in the 'view' or 'options' statement. @@ -1544,6 +1520,7 @@ zone_clauses[] = { { "dnssec-update-mode", &cfg_type_dnssecupdatemode, 0 }, { "forward", &cfg_type_forwardtype, 0 }, { "forwarders", &cfg_type_portiplist, 0 }, + { "inline-signing", &cfg_type_boolean, 0 }, { "key-directory", &cfg_type_qstring, 0 }, { "maintain-ixfr-base", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, { "masterfile-format", &cfg_type_masterformat, 0 }, @@ -1564,13 +1541,12 @@ zone_clauses[] = { { "notify-source-v6", &cfg_type_sockaddr6wild, 0 }, { "notify-to-soa", &cfg_type_boolean, 0 }, { "nsec3-test-zone", &cfg_type_boolean, CFG_CLAUSEFLAG_TESTONLY }, - { "serial-update-method", &cfg_type_updatemethod, 0 }, { "request-ixfr", &cfg_type_boolean, 0 }, + { "serial-update-method", &cfg_type_updatemethod, 0 }, { "sig-signing-nodes", &cfg_type_uint32, 0 }, { "sig-signing-signatures", &cfg_type_uint32, 0 }, { "sig-signing-type", &cfg_type_uint32, 0 }, { "sig-validity-interval", &cfg_type_validityinterval, 0 }, - { "inline-signing", &cfg_type_boolean, 0 }, { "transfer-source", &cfg_type_sockaddr4wild, 0 }, { "transfer-source-v6", &cfg_type_sockaddr6wild, 0 }, { "try-tcp-refresh", &cfg_type_boolean, 0 }, @@ -1672,7 +1648,6 @@ view_clausesets[] = { namedconf_or_view_clauses, view_clauses, zone_clauses, - dynamically_loadable_zones_clauses, NULL }; static cfg_type_t cfg_type_viewopts = { @@ -1692,15 +1667,19 @@ static cfg_type_t cfg_type_zoneopts = { /*% The "dynamically loadable zones" statement syntax. */ +static cfg_clausedef_t +dlz_clauses[] = { + { "database", &cfg_type_astring, 0 }, + { NULL, NULL, 0 } +}; static cfg_clausedef_t * -dynamically_loadable_zones_clausesets[] = { - dynamically_loadable_zones_clauses, +dlz_clausesets[] = { + dlz_clauses, NULL }; -static cfg_type_t cfg_type_dynamically_loadable_zones_opts = { - "dynamically_loadable_zones_opts", cfg_parse_map, - cfg_print_map, cfg_doc_map, &cfg_rep_map, - dynamically_loadable_zones_clausesets +static cfg_type_t cfg_type_dlz = { + "dlz", cfg_parse_named_map, cfg_print_map, cfg_doc_map, + &cfg_rep_map, dlz_clausesets }; /*% @@ -1730,21 +1709,21 @@ static cfg_type_t cfg_type_key = { static cfg_clausedef_t server_clauses[] = { { "bogus", &cfg_type_boolean, 0 }, - { "provide-ixfr", &cfg_type_boolean, 0 }, - { "request-ixfr", &cfg_type_boolean, 0 }, - { "support-ixfr", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, - { "transfers", &cfg_type_uint32, 0 }, - { "transfer-format", &cfg_type_transferformat, 0 }, - { "keys", &cfg_type_server_key_kludge, 0 }, { "edns", &cfg_type_boolean, 0 }, { "edns-udp-size", &cfg_type_uint32, 0 }, + { "keys", &cfg_type_server_key_kludge, 0 }, { "max-udp-size", &cfg_type_uint32, 0 }, { "notify-source", &cfg_type_sockaddr4wild, 0 }, { "notify-source-v6", &cfg_type_sockaddr6wild, 0 }, + { "provide-ixfr", &cfg_type_boolean, 0 }, { "query-source", &cfg_type_querysource4, 0 }, { "query-source-v6", &cfg_type_querysource6, 0 }, + { "request-ixfr", &cfg_type_boolean, 0 }, + { "support-ixfr", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, + { "transfer-format", &cfg_type_transferformat, 0 }, { "transfer-source", &cfg_type_sockaddr4wild, 0 }, { "transfer-source-v6", &cfg_type_sockaddr6wild, 0 }, + { "transfers", &cfg_type_uint32, 0 }, { NULL, NULL, 0 } }; static cfg_clausedef_t * diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 1708344e06074..492241d742c25 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -1306,8 +1306,9 @@ cfg_parse_mapbody(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) "not implemented", clause->name); if ((clause->flags & CFG_CLAUSEFLAG_NOTCONFIGURED) != 0) { - cfg_parser_warning(pctx, 0, "option '%s' is not " - "configured", clause->name); + cfg_parser_warning(pctx, 0, "option '%s' was not " + "enabled at compile time", + clause->name); result = ISC_R_FAILURE; goto cleanup; } diff --git a/lib/lwres/Makefile.in b/lib/lwres/Makefile.in index 0cf873b515600..dd8eb65eed5f5 100644 --- a/lib/lwres/Makefile.in +++ b/lib/lwres/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2005, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2005, 2007, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2000, 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -31,25 +31,25 @@ CDEFINES = CWARNINGS = # Alphabetically -OBJS = context.@O@ gai_strerror.@O@ getaddrinfo.@O@ gethost.@O@ \ +OBJS = compat.@O@ context.@O@ \ + gai_strerror.@O@ getaddrinfo.@O@ gethost.@O@ \ getipnode.@O@ getnameinfo.@O@ getrrset.@O@ herror.@O@ \ lwbuffer.@O@ lwconfig.@O@ lwpacket.@O@ lwresutil.@O@ \ lwres_gabn.@O@ lwres_gnba.@O@ lwres_grbn.@O@ lwres_noop.@O@ \ - lwinetaton.@O@ lwinetpton.@O@ lwinetntop.@O@ print.@O@ \ - strtoul.@O@ + lwinetaton.@O@ lwinetpton.@O@ lwinetntop.@O@ print.@O@ # Alphabetically -SRCS = context.c gai_strerror.c getaddrinfo.c gethost.c \ +SRCS = compat.c context.c gai_strerror.c getaddrinfo.c gethost.c \ getipnode.c getnameinfo.c getrrset.c herror.c \ lwbuffer.c lwconfig.c lwpacket.c lwresutil.c \ lwres_gabn.c lwres_gnba.c lwres_grbn.c lwres_noop.c \ - lwinetaton.c lwinetpton.c lwinetntop.c print.c \ - strtoul.c + lwinetaton.c lwinetpton.c lwinetntop.c print.c LIBS = @LIBS@ SUBDIRS = include man unix TARGETS = timestamp +TESTDIRS = @UNITTESTS@ @BIND9_MAKE_RULES@ @@ -78,7 +78,7 @@ installdirs: $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir} install:: timestamp installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} liblwres.@A@ ${DESTDIR}${libdir} + ${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} liblwres.@A@ ${DESTDIR}${libdir} clean distclean:: rm -f liblwres.@A@ liblwres.la timestamp diff --git a/lib/lwres/api b/lib/lwres/api index a27437f4335bc..3f5a2a3b16935 100644 --- a/lib/lwres/api +++ b/lib/lwres/api @@ -4,6 +4,6 @@ # 9.8: 80-89, 120-129 # 9.9: 90-109 # 9.9-sub: 130-139 -LIBINTERFACE = 90 -LIBREVISION = 7 +LIBINTERFACE = 91 +LIBREVISION = 0 LIBAGE = 0 diff --git a/lib/lwres/strtoul.c b/lib/lwres/compat.c index 82d215f43c10b..b8ae31f1968d8 100644 --- a/lib/lwres/strtoul.c +++ b/lib/lwres/compat.c @@ -49,8 +49,6 @@ static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ -/* $Id: strtoul.c,v 1.4 2007/06/19 23:47:22 tbox Exp $ */ - #include <config.h> #include <limits.h> @@ -58,6 +56,7 @@ static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93"; #include <errno.h> #include <lwres/stdlib.h> +#include <lwres/string.h> #define DE_CONST(konst, var) \ do { \ @@ -129,3 +128,28 @@ lwres_strtoul(const char *nptr, char **endptr, int base) { DE_CONST(any ? s - 1 : nptr, *endptr); return (acc); } + +size_t +lwres_strlcpy(char *dst, const char *src, size_t size) { + char *d = dst; + const char *s = src; + size_t n = size; + + /* Copy as many bytes as will fit */ + if (n != 0U && --n != 0U) { + do { + if ((*d++ = *s++) == 0) + break; + } while (--n != 0U); + } + + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0U) { + if (size != 0U) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) + ; + } + + return(s - src - 1); /* count does not include NUL */ +} diff --git a/lib/lwres/gai_strerror.c b/lib/lwres/gai_strerror.c index 70b35b0d80b07..a3075ce3119b5 100644 --- a/lib/lwres/gai_strerror.c +++ b/lib/lwres/gai_strerror.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -63,7 +63,8 @@ static const char *gai_messages[] = { "ai_socktype not supported", "system error returned in errno", "bad hints", - "bad protocol" + "bad protocol", + "overflow" }; /*% Returns an error message corresponding to an error code returned by getaddrinfo() */ diff --git a/lib/lwres/getaddrinfo.c b/lib/lwres/getaddrinfo.c index 1ebafd85a6788..133f0c1f9ec4d 100644 --- a/lib/lwres/getaddrinfo.c +++ b/lib/lwres/getaddrinfo.c @@ -134,13 +134,13 @@ #include <config.h> #include <errno.h> - -#include <isc/string.h> +#include <string.h> #include <lwres/lwres.h> #include <lwres/net.h> #include <lwres/netdb.h> #include <lwres/stdlib.h> +#include <lwres/string.h> #define SA(addr) ((struct sockaddr *)(addr)) #define SIN(addr) ((struct sockaddr_in *)(addr)) @@ -706,12 +706,16 @@ get_local(const char *name, int socktype, struct addrinfo **res) { if (socktype == 0) return (EAI_SOCKTYPE); + if (strlen(name) >= sizeof(slocal->sun_path)) + return (EAI_OVERFLOW); + ai = ai_alloc(AF_LOCAL, sizeof(*slocal)); if (ai == NULL) return (EAI_MEMORY); slocal = SLOCAL(ai->ai_addr); strncpy(slocal->sun_path, name, sizeof(slocal->sun_path)); + slocal->sun_path[sizeof(slocal->sun_path) - 1] = '\0'; ai->ai_socktype = socktype; /* diff --git a/lib/lwres/gethost.c b/lib/lwres/gethost.c index e36fc188e5c36..922d2aa45e14e 100644 --- a/lib/lwres/gethost.c +++ b/lib/lwres/gethost.c @@ -153,6 +153,9 @@ #include <errno.h> #include <string.h> +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> /* uintptr_t */ +#endif #include <lwres/net.h> #include <lwres/netdb.h> diff --git a/lib/lwres/include/lwres/Makefile.in b/lib/lwres/include/lwres/Makefile.in index 36b8b03d5d0a7..aed4e750f4b8d 100644 --- a/lib/lwres/include/lwres/Makefile.in +++ b/lib/lwres/include/lwres/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2000, 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -13,8 +13,6 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.23 2007/06/19 23:47:22 tbox Exp $ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -24,8 +22,9 @@ top_srcdir = @top_srcdir@ # machine generated. The latter are handled specially in the # install target below. # -HEADERS = context.h lwbuffer.h lwpacket.h lwres.h result.h \ - int.h lang.h list.h ipv6.h version.h +HEADERS = context.h int.h ipv6.h lang.h list.h \ + lwbuffer.h lwpacket.h lwres.h result.h \ + stdlib.h string.h version.h SUBDIRS = TARGETS = diff --git a/lib/lwres/include/lwres/lwres.h b/lib/lwres/include/lwres/lwres.h index 6912448cf9ee8..5b2b03a99eec0 100644 --- a/lib/lwres/include/lwres/lwres.h +++ b/lib/lwres/include/lwres/lwres.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -121,6 +121,7 @@ struct lwres_addr { lwres_uint32_t family; lwres_uint16_t length; unsigned char address[LWRES_ADDR_MAXLEN]; + lwres_uint32_t zone; LWRES_LINK(lwres_addr_t) link; }; diff --git a/lib/lwres/include/lwres/netdb.h.in b/lib/lwres/include/lwres/netdb.h.in index 0844384e52190..1c115dfa39f7d 100644 --- a/lib/lwres/include/lwres/netdb.h.in +++ b/lib/lwres/include/lwres/netdb.h.in @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -88,6 +88,7 @@ struct addrinfo { #undef EAI_SYSTEM #undef EAI_BADHINTS #undef EAI_PROTOCOL +#undef EAI_OVERFLOW #undef EAI_MAX #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ @@ -103,7 +104,8 @@ struct addrinfo { #define EAI_SYSTEM 11 /* system error returned in errno */ #define EAI_BADHINTS 12 #define EAI_PROTOCOL 13 -#define EAI_MAX 14 +#define EAI_OVERFLOW 14 +#define EAI_MAX 15 /* * Flag values for getaddrinfo() diff --git a/lib/lwres/include/lwres/platform.h.in b/lib/lwres/include/lwres/platform.h.in index bb4f6ee235e9e..d350a6a1043d8 100644 --- a/lib/lwres/include/lwres/platform.h.in +++ b/lib/lwres/include/lwres/platform.h.in @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -59,7 +59,7 @@ @LWRES_PLATFORM_NEEDIN6ADDRANY@ /* - * If this system is missing in6addr_loopback, + * If this system is missing in6addr_loopback, * LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK will be defined. */ @LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK@ @@ -84,7 +84,7 @@ * Defined this system needs vsnprintf() and snprintf(). */ @LWRES_PLATFORM_NEEDVSNPRINTF@ - + /* * If this system need a modern sprintf() that returns (int) not (char*). */ @@ -100,6 +100,11 @@ */ @LWRES_PLATFORM_NEEDSTRTOUL@ +/*! \brief + * Define if this system needs strlcpy. + */ +@LWRES_PLATFORM_NEEDSTRLCPY@ + #ifndef LWRES_PLATFORM_USEDECLSPEC #define LIBLWRES_EXTERNAL_DATA #else diff --git a/lib/lwres/include/lwres/stdlib.h b/lib/lwres/include/lwres/stdlib.h index 25a109ee30c70..4ee1dd2dacc41 100644 --- a/lib/lwres/include/lwres/stdlib.h +++ b/lib/lwres/include/lwres/stdlib.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: stdlib.h,v 1.6 2007/06/19 23:47:23 tbox Exp $ */ - #ifndef LWRES_STDLIB_H #define LWRES_STDLIB_H 1 diff --git a/lib/lwres/include/lwres/string.h b/lib/lwres/include/lwres/string.h new file mode 100644 index 0000000000000..deebb5a51c46d --- /dev/null +++ b/lib/lwres/include/lwres/string.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * 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. + */ + +#ifndef LWRES_STRING_H +#define LWRES_STRING_H 1 + +/*! \file lwres/string.h */ + +#include <stdlib.h> + +#include <lwres/lang.h> +#include <lwres/platform.h> + +#ifdef LWRES_PLATFORM_NEEDSTRLCPY +#define strlcpy lwres_strlcpy +#endif + +LWRES_LANG_BEGINDECLS + +size_t lwres_strlcpy(char *dst, const char *src, size_t size); + +LWRES_LANG_ENDDECLS + +#endif diff --git a/lib/lwres/lwconfig.c b/lib/lwres/lwconfig.c index 62630238e1211..32019b973182c 100644 --- a/lib/lwres/lwconfig.c +++ b/lib/lwres/lwconfig.c @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - /*! \file */ /** @@ -67,9 +65,12 @@ #include <lwres/lwres.h> #include <lwres/net.h> #include <lwres/result.h> +#include <lwres/stdlib.h> +#include <lwres/string.h> #include "assert_p.h" #include "context_p.h" +#include "print_p.h" #if ! defined(NS_INADDRSZ) @@ -204,6 +205,7 @@ lwres_resetaddr(lwres_addr_t *addr) { memset(addr->address, 0, LWRES_ADDR_MAXLEN); addr->family = 0; addr->length = 0; + addr->zone = 0; } static char * @@ -449,6 +451,18 @@ static lwres_result_t lwres_create_addr(const char *buffer, lwres_addr_t *addr, int convert_zero) { struct in_addr v4; struct in6_addr v6; + char buf[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") + + sizeof("%4294967295")]; + char *percent; + size_t n; + + n = strlcpy(buf, buffer, sizeof(buf)); + if (n >= sizeof(buf)) + return (LWRES_R_FAILURE); + + percent = strchr(buf, '%'); + if (percent != NULL) + *percent = 0; if (lwres_net_aton(buffer, &v4) == 1) { if (convert_zero) { @@ -459,15 +473,35 @@ lwres_create_addr(const char *buffer, lwres_addr_t *addr, int convert_zero) { } addr->family = LWRES_ADDRTYPE_V4; addr->length = NS_INADDRSZ; + addr->zone = 0; memmove((void *)addr->address, &v4, NS_INADDRSZ); - } else if (lwres_net_pton(AF_INET6, buffer, &v6) == 1) { + } else if (lwres_net_pton(AF_INET6, buf, &v6) == 1) { addr->family = LWRES_ADDRTYPE_V6; addr->length = NS_IN6ADDRSZ; memmove((void *)addr->address, &v6, NS_IN6ADDRSZ); - } else { + if (percent != NULL) { + unsigned long zone; + char *ep; + + percent++; + +#ifdef HAVE_IF_NAMETOINDEX + zone = if_nametoindex(percent); + if (zone != 0U) { + addr->zone = zone; + return (LWRES_R_SUCCESS); + } +#endif + zone = strtoul(percent, &ep, 10); + if (ep != percent && *ep == 0) + addr->zone = zone; + else + return (LWRES_R_FAILURE); + } else + addr->zone = 0; + } else return (LWRES_R_FAILURE); /* Unrecognised format. */ - } return (LWRES_R_SUCCESS); } @@ -630,6 +664,7 @@ lwres_conf_print(lwres_context_t *ctx, FILE *fp) { int i; int af; char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; + char buf[sizeof("%4000000000")]; const char *p; lwres_conf_t *confdata; lwres_addr_t tmpaddr; @@ -647,7 +682,13 @@ lwres_conf_print(lwres_context_t *ctx, FILE *fp) { if (p != tmp) return (LWRES_R_FAILURE); - fprintf(fp, "nameserver %s\n", tmp); + if (af == AF_INET6 && confdata->lwservers[i].zone != 0) { + snprintf(buf, sizeof(buf), "%%%u", + confdata->nameservers[i].zone); + } else + buf[0] = 0; + + fprintf(fp, "nameserver %s%s\n", tmp, buf); } for (i = 0; i < confdata->lwnext; i++) { @@ -658,7 +699,13 @@ lwres_conf_print(lwres_context_t *ctx, FILE *fp) { if (p != tmp) return (LWRES_R_FAILURE); - fprintf(fp, "lwserver %s\n", tmp); + if (af == AF_INET6 && confdata->lwservers[i].zone != 0) { + snprintf(buf, sizeof(buf), "%%%u", + confdata->nameservers[i].zone); + } else + buf[0] = 0; + + fprintf(fp, "lwserver %s%s\n", tmp, buf); } if (confdata->domainname != NULL) { diff --git a/lib/lwres/man/lwres.3 b/lib/lwres/man/lwres.3 index 8ce65f3486d7a..2c03e3ae9ff11 100644 --- a/lib/lwres/man/lwres.3 +++ b/lib/lwres/man/lwres.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -39,7 +39,7 @@ lwres \- introduction to the lightweight resolver library .PP The BIND 9 lightweight resolver library is a simple, name service independent stub resolver library. It provides hostname\-to\-address and address\-to\-hostname lookup services to applications by transmitting lookup requests to a resolver daemon \fBlwresd\fR -running on the local host. The resover daemon performs the lookup using the DNS or possibly other name service protocols, and returns the results to the application through the library. The library and resolver daemon communicate using a simple UDP\-based protocol. +running on the local host. The resolver daemon performs the lookup using the DNS or possibly other name service protocols, and returns the results to the application through the library. The library and resolver daemon communicate using a simple UDP\-based protocol. .SH "OVERVIEW" .PP The lwresd library implements multiple name service APIs. The standard @@ -159,7 +159,7 @@ bit should be set. \fBresolver\fR(5), \fBlwresd\fR(8). .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres.docbook b/lib/lwres/man/lwres.docbook index 97d591c9d8d3f..26723e5f0cabc 100644 --- a/lib/lwres/man/lwres.docbook +++ b/lib/lwres/man/lwres.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres.docbook,v 1.10 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -40,6 +39,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -63,7 +63,7 @@ and address-to-hostname lookup services to applications by transmitting lookup requests to a resolver daemon <command>lwresd</command> - running on the local host. The resover daemon performs the + running on the local host. The resolver daemon performs the lookup using the DNS or possibly other name service protocols, and returns the results to the application through the library. The library and resolver daemon communicate using a simple diff --git a/lib/lwres/man/lwres.html b/lib/lwres/man/lwres.html index 84008b625e05b..cb8a0776af48f 100644 --- a/lib/lwres/man/lwres.html +++ b/lib/lwres/man/lwres.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -22,7 +22,7 @@ <meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476274"></a><div class="titlepage"></div> +<a name="id2476275"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres — introduction to the lightweight resolver library</p> @@ -32,14 +32,14 @@ <div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <lwres/lwres.h></pre></div> </div> <div class="refsect1" lang="en"> -<a name="id2543350"></a><h2>DESCRIPTION</h2> +<a name="id2543357"></a><h2>DESCRIPTION</h2> <p> The BIND 9 lightweight resolver library is a simple, name service independent stub resolver library. It provides hostname-to-address and address-to-hostname lookup services to applications by transmitting lookup requests to a resolver daemon <span><strong class="command">lwresd</strong></span> - running on the local host. The resover daemon performs the + running on the local host. The resolver daemon performs the lookup using the DNS or possibly other name service protocols, and returns the results to the application through the library. The library and resolver daemon communicate using a simple @@ -47,7 +47,7 @@ </p> </div> <div class="refsect1" lang="en"> -<a name="id2543363"></a><h2>OVERVIEW</h2> +<a name="id2543370"></a><h2>OVERVIEW</h2> <p> The lwresd library implements multiple name service APIs. The standard @@ -101,7 +101,7 @@ </p> </div> <div class="refsect1" lang="en"> -<a name="id2543427"></a><h2>CLIENT-SIDE LOW-LEVEL API CALL FLOW</h2> +<a name="id2543434"></a><h2>CLIENT-SIDE LOW-LEVEL API CALL FLOW</h2> <p> When a client program wishes to make an lwres request using the native low-level API, it typically performs the following @@ -149,7 +149,7 @@ </p> </div> <div class="refsect1" lang="en"> -<a name="id2543575"></a><h2>SERVER-SIDE LOW-LEVEL API CALL FLOW</h2> +<a name="id2543582"></a><h2>SERVER-SIDE LOW-LEVEL API CALL FLOW</h2> <p> When implementing the server side of the lightweight resolver protocol using the lwres library, a sequence of actions like the @@ -191,7 +191,7 @@ <p></p> </div> <div class="refsect1" lang="en"> -<a name="id2543658"></a><h2>SEE ALSO</h2> +<a name="id2543666"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres_gethostent</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres_getipnode</span>(3)</span>, diff --git a/lib/lwres/man/lwres_buffer.3 b/lib/lwres/man/lwres_buffer.3 index 1ec60136ed788..22b14ab2e68cd 100644 --- a/lib/lwres/man/lwres_buffer.3 +++ b/lib/lwres/man/lwres_buffer.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_buffer .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_BUFFER" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_BUFFER" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -227,7 +227,7 @@ bytes of memory from to \fIbase\fR. .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_buffer.docbook b/lib/lwres/man/lwres_buffer.docbook index 97c52bdec499b..17ccbf549f4ad 100644 --- a/lib/lwres/man/lwres_buffer.docbook +++ b/lib/lwres/man/lwres_buffer.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +18,9 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_buffer.docbook,v 1.10 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -35,6 +34,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_buffer.html b/lib/lwres/man/lwres_buffer.html index b2a9bfc62fec3..4e7735ef81696 100644 --- a/lib/lwres/man/lwres_buffer.html +++ b/lib/lwres/man/lwres_buffer.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -262,7 +262,7 @@ void </div> </div> <div class="refsect1" lang="en"> -<a name="id2543893"></a><h2>DESCRIPTION</h2> +<a name="id2543901"></a><h2>DESCRIPTION</h2> <p> These functions provide bounds checked access to a region of memory where data is being read or written. diff --git a/lib/lwres/man/lwres_config.3 b/lib/lwres/man/lwres_config.3 index 42f0e695f7b31..25b11810051fe 100644 --- a/lib/lwres/man/lwres_config.3 +++ b/lib/lwres/man/lwres_config.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_config .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_CONFIG" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_CONFIG" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -100,7 +100,7 @@ unless an error occurred when converting the network addresses to a numeric host .PP \fI/etc/resolv.conf\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_config.docbook b/lib/lwres/man/lwres_config.docbook index 5736ef3b6490a..5af37eaf7ceae 100644 --- a/lib/lwres/man/lwres_config.docbook +++ b/lib/lwres/man/lwres_config.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_config.docbook,v 1.9 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_config.html b/lib/lwres/man/lwres_config.html index ed10069c355ad..b3b81f7a82881 100644 --- a/lib/lwres/man/lwres_config.html +++ b/lib/lwres/man/lwres_config.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -90,7 +90,7 @@ lwres_conf_t * </div> </div> <div class="refsect1" lang="en"> -<a name="id2543442"></a><h2>DESCRIPTION</h2> +<a name="id2543450"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_conf_init()</code> creates an empty <span class="type">lwres_conf_t</span> @@ -123,7 +123,7 @@ lwres_conf_t * </p> </div> <div class="refsect1" lang="en"> -<a name="id2543509"></a><h2>RETURN VALUES</h2> +<a name="id2543517"></a><h2>RETURN VALUES</h2> <p><code class="function">lwres_conf_parse()</code> returns <span class="errorcode">LWRES_R_SUCCESS</span> if it successfully read and parsed @@ -142,13 +142,13 @@ lwres_conf_t * </p> </div> <div class="refsect1" lang="en"> -<a name="id2543546"></a><h2>SEE ALSO</h2> +<a name="id2543555"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">stdio</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">resolver</span>(5)</span>. </p> </div> <div class="refsect1" lang="en"> -<a name="id2543572"></a><h2>FILES</h2> +<a name="id2543580"></a><h2>FILES</h2> <p><code class="filename">/etc/resolv.conf</code> </p> </div> diff --git a/lib/lwres/man/lwres_context.3 b/lib/lwres/man/lwres_context.3 index 5764809fbd500..d544a3c39819b 100644 --- a/lib/lwres/man/lwres_context.3 +++ b/lib/lwres/man/lwres_context.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001, 2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_context .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_CONTEXT" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_CONTEXT" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -164,7 +164,7 @@ times out waiting for a response. \fBmalloc\fR(3), \fBfree\fR(3). .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001, 2003 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_context.docbook b/lib/lwres/man/lwres_context.docbook index ad0392e4e51e9..e0a45eecf31d0 100644 --- a/lib/lwres/man/lwres_context.docbook +++ b/lib/lwres/man/lwres_context.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_context.docbook,v 1.11 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_context.html b/lib/lwres/man/lwres_context.html index e13539d9f9246..ba6b858a4d322 100644 --- a/lib/lwres/man/lwres_context.html +++ b/lib/lwres/man/lwres_context.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -172,7 +172,7 @@ void * </div> </div> <div class="refsect1" lang="en"> -<a name="id2543532"></a><h2>DESCRIPTION</h2> +<a name="id2543541"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_context_create()</code> creates a <span class="type">lwres_context_t</span> structure for use in lightweight resolver operations. It holds a socket and other @@ -258,7 +258,7 @@ void * </p> </div> <div class="refsect1" lang="en"> -<a name="id2543720"></a><h2>RETURN VALUES</h2> +<a name="id2543729"></a><h2>RETURN VALUES</h2> <p><code class="function">lwres_context_create()</code> returns <span class="errorcode">LWRES_R_NOMEMORY</span> if memory for the <span class="type">struct lwres_context</span> could not be allocated, @@ -283,7 +283,7 @@ void * </p> </div> <div class="refsect1" lang="en"> -<a name="id2543770"></a><h2>SEE ALSO</h2> +<a name="id2543779"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres_conf_init</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">malloc</span>(3)</span>, diff --git a/lib/lwres/man/lwres_gabn.3 b/lib/lwres/man/lwres_gabn.3 index ea746903d4e7a..f67126eb54593 100644 --- a/lib/lwres/man/lwres_gabn.3 +++ b/lib/lwres/man/lwres_gabn.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_gabn .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_GABN" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_GABN" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -53,7 +53,7 @@ These are low\-level routines for creating and parsing lightweight resolver name .PP There are four main functions for the getaddrbyname opcode. One render function converts a getaddrbyname request structure \(em \fBlwres_gabnrequest_t\fR -\(em to the lighweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a getaddrbyname request structure. Another render function converts the getaddrbyname response structure \(em +\(em to the lightweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a getaddrbyname request structure. Another render function converts the getaddrbyname response structure \(em \fBlwres_gabnresponse_t\fR \(em to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a getaddrbyname response structure. .PP @@ -189,7 +189,7 @@ indicate that the packet is not a response to an earlier query. .PP \fBlwres_packet\fR(3) .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_gabn.docbook b/lib/lwres/man/lwres_gabn.docbook index d0b5c190c318a..8743696c123ec 100644 --- a/lib/lwres/man/lwres_gabn.docbook +++ b/lib/lwres/man/lwres_gabn.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_gabn.docbook,v 1.10 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -120,7 +120,7 @@ void There are four main functions for the getaddrbyname opcode. One render function converts a getaddrbyname request structure — <type>lwres_gabnrequest_t</type> — - to the lighweight resolver's canonical format. + to the lightweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a getaddrbyname request structure. Another render function converts the getaddrbyname response structure diff --git a/lib/lwres/man/lwres_gabn.html b/lib/lwres/man/lwres_gabn.html index 270620d3d6618..a00f82d3acaaa 100644 --- a/lib/lwres/man/lwres_gabn.html +++ b/lib/lwres/man/lwres_gabn.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -22,7 +22,7 @@ <meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476274"></a><div class="titlepage"></div> +<a name="id2476275"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free — lightweight resolver getaddrbyname message handling</p> @@ -178,7 +178,7 @@ void </div> </div> <div class="refsect1" lang="en"> -<a name="id2543524"></a><h2>DESCRIPTION</h2> +<a name="id2543531"></a><h2>DESCRIPTION</h2> <p> These are low-level routines for creating and parsing lightweight resolver name-to-address lookup request and @@ -188,7 +188,7 @@ void There are four main functions for the getaddrbyname opcode. One render function converts a getaddrbyname request structure — <span class="type">lwres_gabnrequest_t</span> — - to the lighweight resolver's canonical format. + to the lightweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a getaddrbyname request structure. Another render function converts the getaddrbyname response structure @@ -278,7 +278,7 @@ typedef struct { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543669"></a><h2>RETURN VALUES</h2> +<a name="id2543676"></a><h2>RETURN VALUES</h2> <p> The getaddrbyname opcode functions <code class="function">lwres_gabnrequest_render()</code>, @@ -316,7 +316,7 @@ typedef struct { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543735"></a><h2>SEE ALSO</h2> +<a name="id2543742"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3)</span> </p> </div> diff --git a/lib/lwres/man/lwres_gai_strerror.3 b/lib/lwres/man/lwres_gai_strerror.3 index fa3f494dd6f36..8da3828f9144d 100644 --- a/lib/lwres/man/lwres_gai_strerror.3 +++ b/lib/lwres/man/lwres_gai_strerror.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_gai_strerror .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_GAI_STRERROR" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_GAI_STRERROR" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -123,7 +123,7 @@ used by \fBgetaddrinfo\fR(3), \fBRFC2133\fR(). .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_gai_strerror.docbook b/lib/lwres/man/lwres_gai_strerror.docbook index c33fee5ea6cfe..a9314d31998e4 100644 --- a/lib/lwres/man/lwres_gai_strerror.docbook +++ b/lib/lwres/man/lwres_gai_strerror.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_gai_strerror.docbook,v 1.10 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_gai_strerror.html b/lib/lwres/man/lwres_gai_strerror.html index f2faacecfb6a8..85d228ec1544f 100644 --- a/lib/lwres/man/lwres_gai_strerror.html +++ b/lib/lwres/man/lwres_gai_strerror.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -42,7 +42,7 @@ char * </div> </div> <div class="refsect1" lang="en"> -<a name="id2543362"></a><h2>DESCRIPTION</h2> +<a name="id2543370"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_gai_strerror()</code> returns an error message corresponding to an error code returned by <code class="function">getaddrinfo()</code>. @@ -110,7 +110,7 @@ char * </p> </div> <div class="refsect1" lang="en"> -<a name="id2543577"></a><h2>SEE ALSO</h2> +<a name="id2543586"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">strerror</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres_getaddrinfo</span>(3)</span>, diff --git a/lib/lwres/man/lwres_getaddrinfo.3 b/lib/lwres/man/lwres_getaddrinfo.3 index a80904b8abba9..88b4beabd2ceb 100644 --- a/lib/lwres/man/lwres_getaddrinfo.3 +++ b/lib/lwres/man/lwres_getaddrinfo.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001, 2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_getaddrinfo .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_GETADDRINFO" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_GETADDRINFO" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -240,7 +240,7 @@ returns \fBsendmsg\fR(2), \fBsocket\fR(2). .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001, 2003 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_getaddrinfo.docbook b/lib/lwres/man/lwres_getaddrinfo.docbook index a328764dbbe90..76927fd822506 100644 --- a/lib/lwres/man/lwres_getaddrinfo.docbook +++ b/lib/lwres/man/lwres_getaddrinfo.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_getaddrinfo.docbook,v 1.13 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_getaddrinfo.html b/lib/lwres/man/lwres_getaddrinfo.html index 270236742964c..b4845f56b440a 100644 --- a/lib/lwres/man/lwres_getaddrinfo.html +++ b/lib/lwres/man/lwres_getaddrinfo.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -89,7 +89,7 @@ struct addrinfo { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543413"></a><h2>DESCRIPTION</h2> +<a name="id2543421"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_getaddrinfo()</code> is used to get a list of IP addresses and port numbers for host <em class="parameter"><code>hostname</code></em> and service @@ -283,7 +283,7 @@ struct addrinfo { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543790"></a><h2>RETURN VALUES</h2> +<a name="id2543799"></a><h2>RETURN VALUES</h2> <p><code class="function">lwres_getaddrinfo()</code> returns zero on success or one of the error codes listed in <span class="citerefentry"><span class="refentrytitle">gai_strerror</span>(3)</span> @@ -294,7 +294,7 @@ struct addrinfo { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543828"></a><h2>SEE ALSO</h2> +<a name="id2543836"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres_getaddrinfo</span>(3)</span>, diff --git a/lib/lwres/man/lwres_gethostent.3 b/lib/lwres/man/lwres_gethostent.3 index 37067273f8903..e53aa33c17556 100644 --- a/lib/lwres/man/lwres_gethostent.3 +++ b/lib/lwres/man/lwres_gethostent.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_gethostent .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_GETHOSTENT" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_GETHOSTENT" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -309,7 +309,7 @@ The resolver daemon does not currently support any non\-DNS name services such a or \fBNIS\fR, consequently the above functions don't, either. .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_gethostent.docbook b/lib/lwres/man/lwres_gethostent.docbook index a3f084bc2fe7c..487fb7f9ea18e 100644 --- a/lib/lwres/man/lwres_gethostent.docbook +++ b/lib/lwres/man/lwres_gethostent.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_gethostent.docbook,v 1.11 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_gethostent.html b/lib/lwres/man/lwres_gethostent.html index 2c990850805f5..3435f1c18078a 100644 --- a/lib/lwres/man/lwres_gethostent.html +++ b/lib/lwres/man/lwres_gethostent.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -228,7 +228,7 @@ void </div> </div> <div class="refsect1" lang="en"> -<a name="id2543609"></a><h2>DESCRIPTION</h2> +<a name="id2543618"></a><h2>DESCRIPTION</h2> <p> These functions provide hostname-to-address and address-to-hostname lookups by means of the lightweight resolver. @@ -366,7 +366,7 @@ struct hostent { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543960"></a><h2>RETURN VALUES</h2> +<a name="id2543969"></a><h2>RETURN VALUES</h2> <p> The functions <code class="function">lwres_gethostbyname()</code>, @@ -430,7 +430,7 @@ struct hostent { </p> </div> <div class="refsect1" lang="en"> -<a name="id2544194"></a><h2>SEE ALSO</h2> +<a name="id2544202"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">gethostent</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres_getipnode</span>(3)</span>, @@ -439,7 +439,7 @@ struct hostent { </p> </div> <div class="refsect1" lang="en"> -<a name="id2544228"></a><h2>BUGS</h2> +<a name="id2544236"></a><h2>BUGS</h2> <p><code class="function">lwres_gethostbyname()</code>, <code class="function">lwres_gethostbyname2()</code>, <code class="function">lwres_gethostbyaddr()</code> diff --git a/lib/lwres/man/lwres_getipnode.3 b/lib/lwres/man/lwres_getipnode.3 index 3632e64b12395..4eb58cc2b147b 100644 --- a/lib/lwres/man/lwres_getipnode.3 +++ b/lib/lwres/man/lwres_getipnode.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001, 2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_getipnode .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_GETIPNODE" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_GETIPNODE" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -200,7 +200,7 @@ translates these error codes to suitable error messages. \fBlwres_getnameinfo\fR(3), \fBlwres_hstrerror\fR(3). .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001, 2003 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_getipnode.docbook b/lib/lwres/man/lwres_getipnode.docbook index 825f46209cb7e..44b628b5582f8 100644 --- a/lib/lwres/man/lwres_getipnode.docbook +++ b/lib/lwres/man/lwres_getipnode.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_getipnode.docbook,v 1.12 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_getipnode.html b/lib/lwres/man/lwres_getipnode.html index 0fc483d1a8aa9..6fe0ec64750a2 100644 --- a/lib/lwres/man/lwres_getipnode.html +++ b/lib/lwres/man/lwres_getipnode.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -98,7 +98,7 @@ void </div> </div> <div class="refsect1" lang="en"> -<a name="id2543432"></a><h2>DESCRIPTION</h2> +<a name="id2543441"></a><h2>DESCRIPTION</h2> <p> These functions perform thread safe, protocol independent nodename-to-address and address-to-nodename @@ -217,7 +217,7 @@ struct hostent { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543690"></a><h2>RETURN VALUES</h2> +<a name="id2543699"></a><h2>RETURN VALUES</h2> <p> If an error occurs, <code class="function">lwres_getipnodebyname()</code> @@ -261,7 +261,7 @@ struct hostent { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543787"></a><h2>SEE ALSO</h2> +<a name="id2543796"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">RFC2553</span></span>, <span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>, diff --git a/lib/lwres/man/lwres_getnameinfo.3 b/lib/lwres/man/lwres_getnameinfo.3 index 8ceb47cf6ec1a..993b172144b75 100644 --- a/lib/lwres/man/lwres_getnameinfo.3 +++ b/lib/lwres/man/lwres_getnameinfo.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_getnameinfo .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_GETNAMEINFO" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_GETNAMEINFO" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -111,7 +111,7 @@ RFC2133 fails to define what the nonzero return values of \fBgetnameinfo\fR(3) are. .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_getnameinfo.docbook b/lib/lwres/man/lwres_getnameinfo.docbook index 504dfb70adeaa..34a72cb884ae0 100644 --- a/lib/lwres/man/lwres_getnameinfo.docbook +++ b/lib/lwres/man/lwres_getnameinfo.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_getnameinfo.docbook,v 1.10 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_getnameinfo.html b/lib/lwres/man/lwres_getnameinfo.html index 9cc7d5ae3cd1a..6153e3b372c10 100644 --- a/lib/lwres/man/lwres_getnameinfo.html +++ b/lib/lwres/man/lwres_getnameinfo.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -82,7 +82,7 @@ int </div> </div> <div class="refsect1" lang="en"> -<a name="id2543394"></a><h2>DESCRIPTION</h2> +<a name="id2543402"></a><h2>DESCRIPTION</h2> <p> This function is equivalent to the <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span> function defined in RFC2133. @@ -149,13 +149,13 @@ int </p> </div> <div class="refsect1" lang="en"> -<a name="id2543536"></a><h2>RETURN VALUES</h2> +<a name="id2543544"></a><h2>RETURN VALUES</h2> <p><code class="function">lwres_getnameinfo()</code> returns 0 on success or a non-zero error code if an error occurs. </p> </div> <div class="refsect1" lang="en"> -<a name="id2543547"></a><h2>SEE ALSO</h2> +<a name="id2543556"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">RFC2133</span></span>, <span class="citerefentry"><span class="refentrytitle">getservbyport</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>, @@ -165,7 +165,7 @@ int </p> </div> <div class="refsect1" lang="en"> -<a name="id2543605"></a><h2>BUGS</h2> +<a name="id2543613"></a><h2>BUGS</h2> <p> RFC2133 fails to define what the nonzero return values of <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span> diff --git a/lib/lwres/man/lwres_getrrsetbyname.3 b/lib/lwres/man/lwres_getrrsetbyname.3 index f2e33413b8459..6397a6e0fe743 100644 --- a/lib/lwres/man/lwres_getrrsetbyname.3 +++ b/lib/lwres/man/lwres_getrrsetbyname.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_getrrsetbyname .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Oct 18, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_GETRRSETBYNAME" "3" "Oct 18, 2000" "BIND9" "BIND9" +.TH "LWRES_GETRRSETBYNAME" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -158,7 +158,7 @@ other failure .PP \fBlwres\fR(3). .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_getrrsetbyname.docbook b/lib/lwres/man/lwres_getrrsetbyname.docbook index 5f2a68d1da1ab..aceb5a1f9f340 100644 --- a/lib/lwres/man/lwres_getrrsetbyname.docbook +++ b/lib/lwres/man/lwres_getrrsetbyname.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_getrrsetbyname.docbook,v 1.10 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Oct 18, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_getrrsetbyname.html b/lib/lwres/man/lwres_getrrsetbyname.html index e7d68bb54d3d0..ad56c485b10d4 100644 --- a/lib/lwres/man/lwres_getrrsetbyname.html +++ b/lib/lwres/man/lwres_getrrsetbyname.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -102,7 +102,7 @@ struct rrsetinfo { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543415"></a><h2>DESCRIPTION</h2> +<a name="id2543424"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_getrrsetbyname()</code> gets a set of resource records associated with a <em class="parameter"><code>hostname</code></em>, <em class="parameter"><code>class</code></em>, @@ -150,7 +150,7 @@ struct rrsetinfo { <p></p> </div> <div class="refsect1" lang="en"> -<a name="id2543527"></a><h2>RETURN VALUES</h2> +<a name="id2543536"></a><h2>RETURN VALUES</h2> <p><code class="function">lwres_getrrsetbyname()</code> returns zero on success, and one of the following error codes if an error occurred: @@ -184,7 +184,7 @@ struct rrsetinfo { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543627"></a><h2>SEE ALSO</h2> +<a name="id2543636"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>. </p> </div> diff --git a/lib/lwres/man/lwres_gnba.3 b/lib/lwres/man/lwres_gnba.3 index 413519035e412..5c64f07142913 100644 --- a/lib/lwres/man/lwres_gnba.3 +++ b/lib/lwres/man/lwres_gnba.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_gnba .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_GNBA" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_GNBA" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -177,7 +177,7 @@ indicate that the packet is not a response to an earlier query. .PP \fBlwres_packet\fR(3). .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_gnba.docbook b/lib/lwres/man/lwres_gnba.docbook index 452cdfcb0f43b..ebb7487b031ec 100644 --- a/lib/lwres/man/lwres_gnba.docbook +++ b/lib/lwres/man/lwres_gnba.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_gnba.docbook,v 1.11 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_gnba.html b/lib/lwres/man/lwres_gnba.html index 6d61b87bb43e8..f05c05b36d85f 100644 --- a/lib/lwres/man/lwres_gnba.html +++ b/lib/lwres/man/lwres_gnba.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -22,7 +22,7 @@ <meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476274"></a><div class="titlepage"></div> +<a name="id2476275"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free — lightweight resolver getnamebyaddress message handling</p> @@ -183,7 +183,7 @@ void </div> </div> <div class="refsect1" lang="en"> -<a name="id2543527"></a><h2>DESCRIPTION</h2> +<a name="id2543534"></a><h2>DESCRIPTION</h2> <p> These are low-level routines for creating and parsing lightweight resolver address-to-name lookup request and @@ -270,7 +270,7 @@ typedef struct { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543667"></a><h2>RETURN VALUES</h2> +<a name="id2543674"></a><h2>RETURN VALUES</h2> <p> The getnamebyaddr opcode functions <code class="function">lwres_gnbarequest_render()</code>, @@ -308,7 +308,7 @@ typedef struct { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543733"></a><h2>SEE ALSO</h2> +<a name="id2543740"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3)</span>. </p> </div> diff --git a/lib/lwres/man/lwres_hstrerror.3 b/lib/lwres/man/lwres_hstrerror.3 index 6d24cf65e3fdf..a8fa9788b4c4e 100644 --- a/lib/lwres/man/lwres_hstrerror.3 +++ b/lib/lwres/man/lwres_hstrerror.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_hstrerror .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_HSTRERROR" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_HSTRERROR" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -93,7 +93,7 @@ is not a valid error code. \fBherror\fR(3), \fBlwres_hstrerror\fR(3). .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_hstrerror.docbook b/lib/lwres/man/lwres_hstrerror.docbook index ca4589e080b4a..d091b347dac5c 100644 --- a/lib/lwres/man/lwres_hstrerror.docbook +++ b/lib/lwres/man/lwres_hstrerror.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_hstrerror.docbook,v 1.11 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_hstrerror.html b/lib/lwres/man/lwres_hstrerror.html index 8d4e9d60b5be2..654e73f12d8ef 100644 --- a/lib/lwres/man/lwres_hstrerror.html +++ b/lib/lwres/man/lwres_hstrerror.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -50,7 +50,7 @@ const char * </div> </div> <div class="refsect1" lang="en"> -<a name="id2543380"></a><h2>DESCRIPTION</h2> +<a name="id2543388"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_herror()</code> prints the string <em class="parameter"><code>s</code></em> on <span class="type">stderr</span> followed by the string generated by @@ -84,7 +84,7 @@ const char * </p> </div> <div class="refsect1" lang="en"> -<a name="id2543498"></a><h2>RETURN VALUES</h2> +<a name="id2543507"></a><h2>RETURN VALUES</h2> <p> The string <span class="errorname">Unknown resolver error</span> is returned by <code class="function">lwres_hstrerror()</code> @@ -94,7 +94,7 @@ const char * </p> </div> <div class="refsect1" lang="en"> -<a name="id2543518"></a><h2>SEE ALSO</h2> +<a name="id2543527"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">herror</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres_hstrerror</span>(3)</span>. diff --git a/lib/lwres/man/lwres_inetntop.3 b/lib/lwres/man/lwres_inetntop.3 index 0dfe5e6eca6b2..c27b25e3d54c1 100644 --- a/lib/lwres/man/lwres_inetntop.3 +++ b/lib/lwres/man/lwres_inetntop.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_inetntop .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_INETNTOP" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_INETNTOP" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -71,7 +71,7 @@ is not supported. \fBinet_ntop\fR(3), \fBerrno\fR(3). .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_inetntop.docbook b/lib/lwres/man/lwres_inetntop.docbook index 26f1779d3139d..b2d170f297069 100644 --- a/lib/lwres/man/lwres_inetntop.docbook +++ b/lib/lwres/man/lwres_inetntop.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_inetntop.docbook,v 1.10 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_inetntop.html b/lib/lwres/man/lwres_inetntop.html index 6f1a37f6d7a42..99cad662b090e 100644 --- a/lib/lwres/man/lwres_inetntop.html +++ b/lib/lwres/man/lwres_inetntop.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -62,7 +62,7 @@ const char * </div> </div> <div class="refsect1" lang="en"> -<a name="id2543380"></a><h2>DESCRIPTION</h2> +<a name="id2543388"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_net_ntop()</code> converts an IP address of protocol family <em class="parameter"><code>af</code></em> — IPv4 or IPv6 — at @@ -80,7 +80,7 @@ const char * </p> </div> <div class="refsect1" lang="en"> -<a name="id2543412"></a><h2>RETURN VALUES</h2> +<a name="id2543420"></a><h2>RETURN VALUES</h2> <p> If successful, the function returns <em class="parameter"><code>dst</code></em>: a pointer to a string containing the presentation format of the @@ -93,7 +93,7 @@ const char * </p> </div> <div class="refsect1" lang="en"> -<a name="id2543445"></a><h2>SEE ALSO</h2> +<a name="id2543453"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">RFC1884</span></span>, <span class="citerefentry"><span class="refentrytitle">inet_ntop</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">errno</span>(3)</span>. diff --git a/lib/lwres/man/lwres_noop.3 b/lib/lwres/man/lwres_noop.3 index c0fc47ed65483..cacbd4b6a4cda 100644 --- a/lib/lwres/man/lwres_noop.3 +++ b/lib/lwres/man/lwres_noop.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_noop .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_NOOP" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_NOOP" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -57,7 +57,7 @@ packet: a packet is sent to the resolver daemon and is simply echoed back. The o .PP There are four main functions for the no\-op opcode. One render function converts a no\-op request structure \(em \fBlwres_nooprequest_t\fR -\(em to the lighweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a no\-op request structure. Another render function converts the no\-op response structure \(em +\(em to the lightweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a no\-op request structure. Another render function converts the no\-op response structure \(em \fBlwres_noopresponse_t\fR to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a no\-op response structure. .PP @@ -177,7 +177,7 @@ indicate that the packet is not a response to an earlier query. .PP \fBlwres_packet\fR(3) .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_noop.docbook b/lib/lwres/man/lwres_noop.docbook index eb823b77335b0..8f40990b478f8 100644 --- a/lib/lwres/man/lwres_noop.docbook +++ b/lib/lwres/man/lwres_noop.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_noop.docbook,v 1.11 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -127,7 +127,7 @@ void There are four main functions for the no-op opcode. One render function converts a no-op request structure — <type>lwres_nooprequest_t</type> — - to the lighweight resolver's canonical format. + to the lightweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a no-op request structure. Another render function converts the no-op response structure — diff --git a/lib/lwres/man/lwres_noop.html b/lib/lwres/man/lwres_noop.html index 69d0d386b3662..e1d499cff7043 100644 --- a/lib/lwres/man/lwres_noop.html +++ b/lib/lwres/man/lwres_noop.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -22,7 +22,7 @@ <meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476274"></a><div class="titlepage"></div> +<a name="id2476275"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_nooprequest_render, lwres_noopresponse_render, lwres_nooprequest_parse, lwres_noopresponse_parse, lwres_noopresponse_free, lwres_nooprequest_free — lightweight resolver no-op message handling</p> @@ -179,7 +179,7 @@ void </div> </div> <div class="refsect1" lang="en"> -<a name="id2543524"></a><h2>DESCRIPTION</h2> +<a name="id2543531"></a><h2>DESCRIPTION</h2> <p> These are low-level routines for creating and parsing lightweight resolver no-op request and response messages. @@ -195,7 +195,7 @@ void There are four main functions for the no-op opcode. One render function converts a no-op request structure — <span class="type">lwres_nooprequest_t</span> — - to the lighweight resolver's canonical format. + to the lightweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a no-op request structure. Another render function converts the no-op response structure — @@ -270,7 +270,7 @@ typedef struct { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543674"></a><h2>RETURN VALUES</h2> +<a name="id2543682"></a><h2>RETURN VALUES</h2> <p> The no-op opcode functions <code class="function">lwres_nooprequest_render()</code>, @@ -309,7 +309,7 @@ typedef struct { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543740"></a><h2>SEE ALSO</h2> +<a name="id2543748"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3)</span> </p> </div> diff --git a/lib/lwres/man/lwres_packet.3 b/lib/lwres/man/lwres_packet.3 index 49ebff7ada41a..a33990fc3de91 100644 --- a/lib/lwres/man/lwres_packet.3 +++ b/lib/lwres/man/lwres_packet.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_packet .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_PACKET" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_PACKET" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -164,7 +164,7 @@ and lightweight resolver packet both functions return \fBLWRES_R_UNEXPECTEDEND\fR. .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_packet.docbook b/lib/lwres/man/lwres_packet.docbook index 87841db7c71a0..b9462635023be 100644 --- a/lib/lwres/man/lwres_packet.docbook +++ b/lib/lwres/man/lwres_packet.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_packet.docbook,v 1.13 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> diff --git a/lib/lwres/man/lwres_packet.html b/lib/lwres/man/lwres_packet.html index fad9076a6e8c3..d0542daa72db9 100644 --- a/lib/lwres/man/lwres_packet.html +++ b/lib/lwres/man/lwres_packet.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -66,7 +66,7 @@ lwres_result_t </div> </div> <div class="refsect1" lang="en"> -<a name="id2543390"></a><h2>DESCRIPTION</h2> +<a name="id2543399"></a><h2>DESCRIPTION</h2> <p> These functions rely on a <span class="type">struct lwres_lwpacket</span> @@ -219,7 +219,7 @@ struct lwres_lwpacket { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543707"></a><h2>RETURN VALUES</h2> +<a name="id2543716"></a><h2>RETURN VALUES</h2> <p> Successful calls to <code class="function">lwres_lwpacket_renderheader()</code> and diff --git a/lib/lwres/man/lwres_resutil.3 b/lib/lwres/man/lwres_resutil.3 index 0e9cf6f97800c..0125c788d13c3 100644 --- a/lib/lwres/man/lwres_resutil.3 +++ b/lib/lwres/man/lwres_resutil.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -20,11 +20,11 @@ .\" Title: lwres_resutil .\" Author: .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: Jun 30, 2000 +.\" Date: June 18, 2007 .\" Manual: BIND9 .\" Source: BIND9 .\" -.TH "LWRES_RESUTIL" "3" "Jun 30, 2000" "BIND9" "BIND9" +.TH "LWRES_RESUTIL" "3" "June 18, 2007" "BIND9" "BIND9" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -97,7 +97,7 @@ functions. .PP The lightweight resolver uses \fBlwres_getaddrsbyname()\fR -to perform foward lookups. Hostname +to perform forward lookups. Hostname \fIname\fR is looked up using the resolver context \fIctx\fR @@ -164,7 +164,7 @@ if the buffers used for sending queries and receiving replies are too small. \fBlwres_buffer\fR(3), \fBlwres_gabn\fR(3). .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_resutil.docbook b/lib/lwres/man/lwres_resutil.docbook index e6184d912f5d8..0a0c4704aa2da 100644 --- a/lib/lwres/man/lwres_resutil.docbook +++ b/lib/lwres/man/lwres_resutil.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,11 +18,10 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: lwres_resutil.docbook,v 1.12 2007/06/18 23:47:51 tbox Exp $ --> <refentry> <refentryinfo> - <date>Jun 30, 2000</date> + <date>June 18, 2007</date> </refentryinfo> <refmeta> @@ -36,6 +35,7 @@ <year>2004</year> <year>2005</year> <year>2007</year> + <year>2014</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -153,7 +153,7 @@ typedef struct { <para> The lightweight resolver uses <function>lwres_getaddrsbyname()</function> to perform - foward lookups. + forward lookups. Hostname <parameter>name</parameter> is looked up using the resolver context <parameter>ctx</parameter> for memory allocation. diff --git a/lib/lwres/man/lwres_resutil.html b/lib/lwres/man/lwres_resutil.html index 4db7610448c56..28e571b4aec04 100644 --- a/lib/lwres/man/lwres_resutil.html +++ b/lib/lwres/man/lwres_resutil.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -134,7 +134,7 @@ lwres_result_t </div> </div> <div class="refsect1" lang="en"> -<a name="id2543467"></a><h2>DESCRIPTION</h2> +<a name="id2543476"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_string_parse()</code> retrieves a DNS-encoded string starting the current pointer of lightweight resolver buffer <em class="parameter"><code>b</code></em>: i.e. @@ -186,7 +186,7 @@ typedef struct { <p> The lightweight resolver uses <code class="function">lwres_getaddrsbyname()</code> to perform - foward lookups. + forward lookups. Hostname <em class="parameter"><code>name</code></em> is looked up using the resolver context <em class="parameter"><code>ctx</code></em> for memory allocation. @@ -210,7 +210,7 @@ typedef struct { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543606"></a><h2>RETURN VALUES</h2> +<a name="id2543614"></a><h2>RETURN VALUES</h2> <p> Successful calls to <code class="function">lwres_string_parse()</code> @@ -248,7 +248,7 @@ typedef struct { </p> </div> <div class="refsect1" lang="en"> -<a name="id2543677"></a><h2>SEE ALSO</h2> +<a name="id2543686"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres_buffer</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres_gabn</span>(3)</span>. diff --git a/lib/lwres/print.c b/lib/lwres/print.c index 87f30323fe9a7..4f44814bece7e 100644 --- a/lib/lwres/print.c +++ b/lib/lwres/print.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - #include <config.h> #include <ctype.h> @@ -26,6 +24,7 @@ #define LWRES__PRINT_SOURCE /* Used to get the lwres_print_* prototypes. */ #include <lwres/stdlib.h> +#include <lwres/string.h> #include "assert_p.h" #include "print_p.h" |