diff --git a/bin/win32/BINDInstall/BINDInstall.vcxproj.in b/bin/win32/BINDInstall/BINDInstall.vcxproj.in index 5ace7e97ef..f4415ad159 100644 --- a/bin/win32/BINDInstall/BINDInstall.vcxproj.in +++ b/bin/win32/BINDInstall/BINDInstall.vcxproj.in @@ -299,12 +299,6 @@ {82ACD33C-E75F-45B8-BB6D-42643A10D7EE} @IF SAMPLES - - {9FC33CA3-CE4A-4EDF-BA99-EECA4B81AD06} - - - {D42B8670-8DF6-4D90-90F7-DB5FB845AFAE} - {F66D8B7E-721D-4602-99AD-820D19AD1313} diff --git a/lib/samples/.gitignore b/lib/samples/.gitignore index 3a07505250..0cc4fa42aa 100644 --- a/lib/samples/.gitignore +++ b/lib/samples/.gitignore @@ -1,4 +1 @@ -process resolve -sample-async -sample-gai diff --git a/lib/samples/Makefile.am b/lib/samples/Makefile.am index 2e73c9b0c6..83183b5762 100644 --- a/lib/samples/Makefile.am +++ b/lib/samples/Makefile.am @@ -6,11 +6,7 @@ AM_CPPFLAGS += \ $(LIBIRS_CFLAGS) noinst_PROGRAMS = \ - resolve \ - sample-async + resolve resolve_SOURCES = resolve.c resolve_LDADD = $(LIBISC_LIBS) $(LIBIRS_LIBS) $(LIBDNS_LIBS) - -sample_async_SOURCES = sample-async.c -sample_async_LDADD = $(LIBISC_LIBS) $(LIBDNS_LIBS) diff --git a/lib/samples/rootkey.sh b/lib/samples/rootkey.sh deleted file mode 100644 index 5fddbca141..0000000000 --- a/lib/samples/rootkey.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, you can obtain one at https://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# Fetch a copy of a current root signing key; used for testing -# DNSSEC validation in 'sample'. -# -# After running this script, "sample `cat sample.key` " will -# perform a lookup as specified in and validate the result -# using the root key. -# -# (This is NOT a secure method of obtaining the root key; it is -# included here for testing purposes only.) -dig +noall +answer dnskey . | perl -n -e ' -local ($dn, $ttl, $class, $type, $flags, $proto, $alg, @rest) = split; -next if ($flags != 257); -local $key = join("", @rest); -print "-a $alg -e -k $dn -K $key\n" -' > sample.key diff --git a/lib/samples/sample-async.c b/lib/samples/sample-async.c deleted file mode 100644 index fd488ce06c..0000000000 --- a/lib/samples/sample-async.c +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#ifndef WIN32 -#include -#include -#include -#include -#include -#endif /* ifndef WIN32 */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#define MAX_SERVERS 10 -#define MAX_QUERIES 100 - -static dns_client_t *client = NULL; -static isc_task_t *query_task = NULL; -static isc_appctx_t *query_actx = NULL; -static unsigned int outstanding_queries = 0; -static const char *def_server = "127.0.0.1"; -static FILE *fp; - -struct query_trans { - int id; - bool inuse; - dns_rdatatype_t type; - dns_fixedname_t fixedname; - dns_name_t *qname; - dns_namelist_t answerlist; - dns_clientrestrans_t *xid; -}; - -static struct query_trans query_array[MAX_QUERIES]; - -static isc_result_t -dispatch_query(struct query_trans *trans); - -static void -ctxs_destroy(isc_mem_t **mctxp, isc_appctx_t **actxp, isc_taskmgr_t **taskmgrp, - isc_socketmgr_t **socketmgrp, isc_timermgr_t **timermgrp) { - if (*taskmgrp != NULL) { - isc_taskmgr_destroy(taskmgrp); - } - - if (*timermgrp != NULL) { - isc_timermgr_destroy(timermgrp); - } - - if (*socketmgrp != NULL) { - isc_socketmgr_destroy(socketmgrp); - } - - if (*actxp != NULL) { - isc_appctx_destroy(actxp); - } - - if (*mctxp != NULL) { - isc_mem_destroy(mctxp); - } -} - -static isc_result_t -ctxs_init(isc_mem_t **mctxp, isc_appctx_t **actxp, isc_taskmgr_t **taskmgrp, - isc_socketmgr_t **socketmgrp, isc_timermgr_t **timermgrp) { - isc_result_t result; - - isc_mem_create(mctxp); - - result = isc_appctx_create(*mctxp, actxp); - if (result != ISC_R_SUCCESS) { - goto fail; - } - - result = isc_taskmgr_createinctx(*mctxp, 1, 0, taskmgrp); - if (result != ISC_R_SUCCESS) { - goto fail; - } - - result = isc_socketmgr_createinctx(*mctxp, socketmgrp); - if (result != ISC_R_SUCCESS) { - goto fail; - } - - result = isc_timermgr_createinctx(*mctxp, timermgrp); - if (result != ISC_R_SUCCESS) { - goto fail; - } - - return (ISC_R_SUCCESS); - -fail: - ctxs_destroy(mctxp, actxp, taskmgrp, socketmgrp, timermgrp); - - return (result); -} - -static isc_result_t -printdata(dns_rdataset_t *rdataset, dns_name_t *owner) { - isc_buffer_t target; - isc_result_t result; - isc_region_t r; - char t[4096]; - - isc_buffer_init(&target, t, sizeof(t)); - - if (!dns_rdataset_isassociated(rdataset)) { - return (ISC_R_SUCCESS); - } - result = dns_rdataset_totext(rdataset, owner, false, false, &target); - if (result != ISC_R_SUCCESS) { - return (result); - } - isc_buffer_usedregion(&target, &r); - printf(" %.*s", (int)r.length, (char *)r.base); - - return (ISC_R_SUCCESS); -} - -static void -process_answer(isc_task_t *task, isc_event_t *event) { - struct query_trans *trans = event->ev_arg; - dns_clientresevent_t *rev = (dns_clientresevent_t *)event; - dns_name_t *name; - dns_rdataset_t *rdataset; - isc_result_t result; - - REQUIRE(task == query_task); - REQUIRE(trans->inuse); - REQUIRE(outstanding_queries > 0); - - printf("answer[%2d]\n", trans->id); - - if (rev->result != ISC_R_SUCCESS) { - printf(" failed: %u(%s)\n", rev->result, - dns_result_totext(rev->result)); - } - - for (name = ISC_LIST_HEAD(rev->answerlist); name != NULL; - name = ISC_LIST_NEXT(name, link)) - { - for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL; - rdataset = ISC_LIST_NEXT(rdataset, link)) - { - (void)printdata(rdataset, name); - } - } - - dns_client_freeresanswer(client, &rev->answerlist); - dns_client_destroyrestrans(&trans->xid); - - isc_event_free(&event); - - trans->inuse = false; - dns_fixedname_invalidate(&trans->fixedname); - trans->qname = NULL; - outstanding_queries--; - - result = dispatch_query(trans); -#if 0 /* for cancel test */ - if (result == ISC_R_SUCCESS) { - static int count = 0; - - if ((++count) % 10 == 0) { - dns_client_cancelresolve(trans->xid); - } - } -#endif /* if 0 */ - if (result == ISC_R_NOMORE && outstanding_queries == 0) { - isc_app_ctxshutdown(query_actx); - } -} - -static isc_result_t -dispatch_query(struct query_trans *trans) { - isc_result_t result; - unsigned int namelen; - isc_buffer_t b; - char buf[4096]; /* XXX ad hoc constant, but should be enough */ - char *cp; - - REQUIRE(trans != NULL); - REQUIRE(!trans->inuse); - REQUIRE(ISC_LIST_EMPTY(trans->answerlist)); - REQUIRE(outstanding_queries < MAX_QUERIES); - - /* Construct qname */ - cp = fgets(buf, sizeof(buf), fp); - if (cp == NULL) { - return (ISC_R_NOMORE); - } - /* zap NL if any */ - if ((cp = strchr(buf, '\n')) != NULL) { - *cp = '\0'; - } - namelen = strlen(buf); - isc_buffer_init(&b, buf, namelen); - isc_buffer_add(&b, namelen); - trans->qname = dns_fixedname_initname(&trans->fixedname); - result = dns_name_fromtext(trans->qname, &b, dns_rootname, 0, NULL); - if (result != ISC_R_SUCCESS) { - goto cleanup; - } - - /* Start resolution */ - result = dns_client_startresolve( - client, trans->qname, dns_rdataclass_in, trans->type, 0, - query_task, process_answer, trans, &trans->xid); - if (result != ISC_R_SUCCESS) { - goto cleanup; - } - - trans->inuse = true; - outstanding_queries++; - - return (ISC_R_SUCCESS); - -cleanup: - dns_fixedname_invalidate(&trans->fixedname); - - return (result); -} - -ISC_NORETURN static void -usage(void); - -static void -usage(void) { - fprintf(stderr, "usage: sample-async [-s server_address] [-t RR type] " - "input_file\n"); - - exit(1); -} - -int -main(int argc, char *argv[]) { - int ch; - isc_textregion_t tr; - isc_mem_t *mctx = NULL; - isc_taskmgr_t *taskmgr = NULL; - isc_socketmgr_t *socketmgr = NULL; - isc_timermgr_t *timermgr = NULL; - int nservers = 0; - const char *serveraddr[MAX_SERVERS]; - isc_sockaddr_t sa[MAX_SERVERS]; - isc_sockaddrlist_t servers; - dns_rdatatype_t type = dns_rdatatype_a; - struct in_addr inaddr; - isc_result_t result; - int i; - - while ((ch = isc_commandline_parse(argc, argv, "s:t:")) != -1) { - switch (ch) { - case 't': - tr.base = isc_commandline_argument; - tr.length = strlen(isc_commandline_argument); - result = dns_rdatatype_fromtext(&type, &tr); - if (result != ISC_R_SUCCESS) { - fprintf(stderr, "invalid RRtype: %s\n", - isc_commandline_argument); - exit(1); - } - break; - case 's': - if (nservers == MAX_SERVERS) { - fprintf(stderr, "too many servers (up to %d)\n", - MAX_SERVERS); - exit(1); - } - serveraddr[nservers++] = - (const char *)isc_commandline_argument; - break; - default: - usage(); - } - } - - argc -= isc_commandline_index; - argv += isc_commandline_index; - if (argc < 1) { - usage(); - } - - if (nservers == 0) { - nservers = 1; - serveraddr[0] = def_server; - } - - for (i = 0; i < MAX_QUERIES; i++) { - query_array[i].id = i; - query_array[i].inuse = false; - query_array[i].type = type; - dns_fixedname_init(&query_array[i].fixedname); - query_array[i].qname = NULL; - ISC_LIST_INIT(query_array[i].answerlist); - query_array[i].xid = NULL; - } - - isc_lib_register(); - result = dns_lib_init(); - if (result != ISC_R_SUCCESS) { - fprintf(stderr, "dns_lib_init failed: %u\n", result); - exit(1); - } - - result = ctxs_init(&mctx, &query_actx, &taskmgr, &socketmgr, &timermgr); - if (result != ISC_R_SUCCESS) { - fprintf(stderr, "ctx create failed: %u\n", result); - exit(1); - } - - isc_app_ctxstart(query_actx); - - result = dns_client_create(mctx, query_actx, taskmgr, socketmgr, - timermgr, 0, &client, NULL, NULL); - if (result != ISC_R_SUCCESS) { - fprintf(stderr, "dns_client_create failed: %u\n", result); - exit(1); - } - - /* Set nameservers */ - ISC_LIST_INIT(servers); - for (i = 0; i < nservers; i++) { - if (inet_pton(AF_INET, serveraddr[i], &inaddr) != 1) { - fprintf(stderr, "failed to parse IPv4 address %s\n", - serveraddr[i]); - exit(1); - } - isc_sockaddr_fromin(&sa[i], &inaddr, 53); - ISC_LIST_APPEND(servers, &sa[i], link); - } - result = dns_client_setservers(client, dns_rdataclass_in, NULL, - &servers); - if (result != ISC_R_SUCCESS) { - fprintf(stderr, "set server failed: %u\n", result); - exit(1); - } - - /* Create the main task */ - query_task = NULL; - result = isc_task_create(taskmgr, 0, &query_task); - if (result != ISC_R_SUCCESS) { - fprintf(stderr, "failed to create task: %u\n", result); - exit(1); - } - - /* Open input file */ - fp = fopen(argv[0], "r"); - if (fp == NULL) { - fprintf(stderr, "failed to open input file: %s\n", argv[1]); - exit(1); - } - - /* Dispatch initial queries */ - for (i = 0; i < MAX_QUERIES; i++) { - result = dispatch_query(&query_array[i]); - if (result == ISC_R_NOMORE) { - break; - } - } - - /* Start event loop */ - isc_app_ctxrun(query_actx); - - /* Sanity check */ - for (i = 0; i < MAX_QUERIES; i++) { - INSIST(!query_array[i].inuse); - } - - /* Cleanup */ - isc_task_detach(&query_task); - dns_client_destroy(&client); - dns_lib_shutdown(); - isc_app_ctxfinish(query_actx); - ctxs_destroy(&mctx, &query_actx, &taskmgr, &socketmgr, &timermgr); - - return (0); -} diff --git a/lib/samples/win32/async.vcxproj.filters.in b/lib/samples/win32/async.vcxproj.filters.in deleted file mode 100644 index 2698e21a4e..0000000000 --- a/lib/samples/win32/async.vcxproj.filters.in +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/lib/samples/win32/async.vcxproj.in b/lib/samples/win32/async.vcxproj.in deleted file mode 100644 index 37a071bdf3..0000000000 --- a/lib/samples/win32/async.vcxproj.in +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - @PLATFORM@ - - - Release - @PLATFORM@ - - - - {9FC33CA3-CE4A-4EDF-BA99-EECA4B81AD06} - Win32Proj - async - @WINDOWS_TARGET_PLATFORM_VERSION@ - - - - Application - true - MultiByte - @PLATFORM_TOOLSET@ - - - Application - false - true - MultiByte - @PLATFORM_TOOLSET@ - - - - - - - - - - - - - true - ..\..\..\Build\$(Configuration)\ - .\$(Configuration)\ - None - - - false - ..\..\..\Build\$(Configuration)\ - .\$(Configuration)\ - None - - - - - - Level4 - false - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - .\$(Configuration)\$(TargetName).pch - .\$(Configuration)\ - .\$(Configuration)\ - $(OutDir)$(TargetName).pdb - true - ..\..\..\config.h - .\;..\..\..\;@LIBXML2_INC@@OPENSSL_INC@..\..\isc\win32;..\..\isc\win32\include;..\..\isc\include;..\..\dns\win32\include;..\..\dns\include;%(AdditionalIncludeDirectories) - CompileAsC - - - Console - true - ..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt) - ..\..\isc\win32\$(Configuration);..\..\dns\win32\$(Configuration);%(AdditionalLibraryDirectories) - @OPENSSL_LIBCRYPTO@@OPENSSL_LIBSSL@libisc.lib;libdns.lib;ws2_32.lib;%(AdditionalDependencies) - - - - - Level1 - true - - - MaxSpeed - true - @INTRINSIC@ - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - OnlyExplicitInline - false - true - .\$(Configuration)\$(TargetName).pch - .\$(Configuration)\ - .\$(Configuration)\ - $(OutDir)$(TargetName).pdb - ..\..\..\config.h - .\;..\..\..\;@LIBXML2_INC@@OPENSSL_INC@..\..\isc\win32;..\..\isc\win32\include;..\..\isc\include;..\..\dns\win32\include;..\..\dns\include;%(AdditionalIncludeDirectories) - CompileAsC - - - Console - false - true - true - ..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt) - Default - ..\..\isc\win32\$(Configuration);..\..\dns\win32\$(Configuration);%(AdditionalLibraryDirectories) - @OPENSSL_LIBCRYPTO@@OPENSSL_LIBSSL@libisc.lib;libdns.lib;ws2_32.lib;%(AdditionalDependencies) - - - - - - - - {3840E563-D180-4761-AA9C-E6155F02EAFF} - - - {5FEBFD4E-CCB0-48B9-B733-E15EEB85C16A} - - - - - - diff --git a/lib/samples/win32/async.vcxproj.user b/lib/samples/win32/async.vcxproj.user deleted file mode 100644 index ace9a86acb..0000000000 --- a/lib/samples/win32/async.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/util/copyrights b/util/copyrights index f5d31b3c9b..44e00db6c6 100644 --- a/util/copyrights +++ b/util/copyrights @@ -2190,11 +2190,6 @@ ./lib/ns/win32/libns.vcxproj.user X 2017,2018,2019,2020,2021 ./lib/ns/xfrout.c C 2017,2018,2019,2020,2021 ./lib/samples/resolve.c C 2009,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021 -./lib/samples/rootkey.sh SH 2013,2016,2018,2019,2020,2021 -./lib/samples/sample-async.c C 2009,2013,2014,2015,2016,2018,2019,2020,2021 -./lib/samples/win32/async.vcxproj.filters.in X 2014,2015,2018,2019,2020 -./lib/samples/win32/async.vcxproj.in X 2014,2015,2016,2017,2018,2019,2020 -./lib/samples/win32/async.vcxproj.user X 2014,2018,2019,2020,2021 ./lib/samples/win32/resolve.vcxproj.filters.in X 2014,2015,2018,2019,2020 ./lib/samples/win32/resolve.vcxproj.in X 2014,2015,2016,2017,2018,2019,2020 ./lib/samples/win32/resolve.vcxproj.user X 2014,2018,2019,2020,2021 diff --git a/win32utils/Configure b/win32utils/Configure index 4d72e10603..29a96a4545 100644 --- a/win32utils/Configure +++ b/win32utils/Configure @@ -131,8 +131,6 @@ my @projectlist = ("../bin/check/win32/checkconf.vcxproj", "../lib/ns/win32/libns.vcxproj", "../lib/samples/win32/resolve.vcxproj", "../lib/samples/win32/resolve.vcxproj.filters", - "../lib/samples/win32/async.vcxproj", - "../lib/samples/win32/async.vcxproj.filters", "../lib/win32/bindevt/bindevt.vcxproj", "../lib/win32/bindevt/bindevt.vcxproj.filters", "bind9.sln"); diff --git a/win32utils/bind9.sln.in b/win32utils/bind9.sln.in index 04ddd20d8e..fc3ad843c7 100644 --- a/win32utils/bind9.sln.in +++ b/win32utils/bind9.sln.in @@ -25,10 +25,6 @@ EndProject @IF SAMPLES Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "resolve", "..\lib\samples\win32\resolve.vcxproj", "{F66D8B7E-721D-4602-99AD-820D19AD1313}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "async", "..\lib\samples\win32\async.vcxproj", "{9FC33CA3-CE4A-4EDF-BA99-EECA4B81AD06}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gai", "..\lib\samples\win32\gai.vcxproj", "{D42B8670-8DF6-4D90-90F7-DB5FB845AFAE}" -EndProject @END SAMPLES Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "named", "..\bin\named\win32\named.vcxproj", "{723C65DA-A96C-4BA3-A34E-44F11CA346F9}" EndProject