Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/apache2/mDNSResponder/dist import latest mDNSResponder
details: https://anonhg.NetBSD.org/src/rev/ea63f108de9e
branches: trunk
changeset: 358712:ea63f108de9e
user: christos <christos%NetBSD.org@localhost>
date: Sun Jan 14 18:43:01 2018 +0000
description:
import latest mDNSResponder
diffstat:
external/apache2/mDNSResponder/dist/Clients/ClientCommon.c | 60 +-
external/apache2/mDNSResponder/dist/Clients/dnsctl.c | 178 +
external/apache2/mDNSResponder/dist/mDNSCore/CryptoAlg.c | 280 +
external/apache2/mDNSResponder/dist/mDNSCore/CryptoAlg.h | 61 +
external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.h | 173 +-
external/apache2/mDNSResponder/dist/mDNSCore/anonymous.c | 597 +
external/apache2/mDNSResponder/dist/mDNSCore/anonymous.h | 31 +
external/apache2/mDNSResponder/dist/mDNSCore/dnsproxy.c | 836 +
external/apache2/mDNSResponder/dist/mDNSCore/dnsproxy.h | 30 +
external/apache2/mDNSResponder/dist/mDNSCore/dnssec.c | 4111 ++++
external/apache2/mDNSResponder/dist/mDNSCore/dnssec.h | 157 +
external/apache2/mDNSResponder/dist/mDNSCore/mDNSDebug.h | 116 +-
external/apache2/mDNSResponder/dist/mDNSCore/nsec.c | 1266 +
external/apache2/mDNSResponder/dist/mDNSCore/nsec.h | 33 +
external/apache2/mDNSResponder/dist/mDNSCore/nsec3.c | 769 +
external/apache2/mDNSResponder/dist/mDNSCore/nsec3.h | 28 +
external/apache2/mDNSResponder/dist/mDNSCore/uDNS.c | 10019 +++++----
external/apache2/mDNSResponder/dist/mDNSCore/uDNS.h | 85 +-
external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.h | 37 +-
external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.h | 55 +-
external/apache2/mDNSResponder/dist/mDNSShared/CommonServices.h | 2217 +-
external/apache2/mDNSResponder/dist/mDNSShared/GenLinkedList.c | 348 +-
external/apache2/mDNSResponder/dist/mDNSShared/GenLinkedList.h | 70 +-
external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.h | 4 +-
external/apache2/mDNSResponder/dist/mDNSShared/dnsextd_parser.y | 585 +
external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.c | 216 +-
external/apache2/mDNSResponder/dist/mDNSShared/mDNSDebug.c | 54 +-
external/apache2/mDNSResponder/dist/mDNSShared/mDNSResponder.8 | 6 +-
external/apache2/mDNSResponder/dist/mDNSShared/uds_daemon.h | 60 +-
29 files changed, 16274 insertions(+), 6208 deletions(-)
diffs (truncated from 24039 to 300 lines):
diff -r 3a369da17266 -r ea63f108de9e external/apache2/mDNSResponder/dist/Clients/ClientCommon.c
--- a/external/apache2/mDNSResponder/dist/Clients/ClientCommon.c Sun Jan 14 18:23:03 2018 +0000
+++ b/external/apache2/mDNSResponder/dist/Clients/ClientCommon.c Sun Jan 14 18:43:01 2018 +0000
@@ -39,37 +39,37 @@
*/
#include <ctype.h>
-#include <stdio.h> // For stdout, stderr
+#include <stdio.h> // For stdout, stderr
#include "ClientCommon.h"
const char *GetNextLabel(const char *cstr, char label[64])
- {
- char *ptr = label;
- while (*cstr && *cstr != '.') // While we have characters in the label...
- {
- char c = *cstr++;
- if (c == '\\' && *cstr) // If we have a backslash, and it's not the last character of the string
- {
- c = *cstr++;
- if (isdigit(cstr[-1]) && isdigit(cstr[0]) && isdigit(cstr[1]))
- {
- int v0 = cstr[-1] - '0'; // then interpret as three-digit decimal
- int v1 = cstr[ 0] - '0';
- int v2 = cstr[ 1] - '0';
- int val = v0 * 100 + v1 * 10 + v2;
- // If valid three-digit decimal value, use it
- // Note that although ascii nuls are possible in DNS labels
- // we're building a C string here so we have no way to represent that
- if (val == 0) val = '-';
- if (val <= 255) { c = (char)val; cstr += 2; }
- }
- }
- *ptr++ = c;
- if (ptr >= label+64) { label[63] = 0; return(NULL); } // Illegal label more than 63 bytes
- }
- *ptr = 0; // Null-terminate label text
- if (ptr == label) return(NULL); // Illegal empty label
- if (*cstr) cstr++; // Skip over the trailing dot (if present)
- return(cstr);
- }
+{
+ char *ptr = label;
+ while (*cstr && *cstr != '.') // While we have characters in the label...
+ {
+ char c = *cstr++;
+ if (c == '\\' && *cstr) // If we have a backslash, and it's not the last character of the string
+ {
+ c = *cstr++;
+ if (isdigit(cstr[-1]) && isdigit(cstr[0]) && isdigit(cstr[1]))
+ {
+ int v0 = cstr[-1] - '0'; // then interpret as three-digit decimal
+ int v1 = cstr[ 0] - '0';
+ int v2 = cstr[ 1] - '0';
+ int val = v0 * 100 + v1 * 10 + v2;
+ // If valid three-digit decimal value, use it
+ // Note that although ascii nuls are possible in DNS labels
+ // we're building a C string here so we have no way to represent that
+ if (val == 0) val = '-';
+ if (val <= 255) { c = (char)val; cstr += 2; }
+ }
+ }
+ *ptr++ = c;
+ if (ptr >= label+64) { label[63] = 0; return(NULL); } // Illegal label more than 63 bytes
+ }
+ *ptr = 0; // Null-terminate label text
+ if (ptr == label) return(NULL); // Illegal empty label
+ if (*cstr) cstr++; // Skip over the trailing dot (if present)
+ return(cstr);
+}
diff -r 3a369da17266 -r ea63f108de9e external/apache2/mDNSResponder/dist/Clients/dnsctl.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/apache2/mDNSResponder/dist/Clients/dnsctl.c Sun Jan 14 18:43:01 2018 +0000
@@ -0,0 +1,178 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 2012 Apple Inc. All rights reserved.
+ *
+ * dnsctl.c
+ * Command-line tool using libdns_services.dylib
+ *
+ * To build only this tool, copy and paste the following on the command line:
+ * On Apple 64bit Platforms ONLY OSX/iOS:
+ * clang -Wall dnsctl.c /usr/lib/libdns_services.dylib -o dnsctl
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <net/if.h> // if_nametoindex()
+
+#include <dispatch/dispatch.h>
+#include "dns_services.h"
+
+//*************************************************************************************************************
+// Globals:
+//*************************************************************************************************************
+
+static const char kFilePathSep = '/';
+static DNSXConnRef ClientRef = NULL;
+
+//*************************************************************************************************************
+// Utility Funcs:
+//*************************************************************************************************************
+
+static void printtimestamp(void)
+{
+ struct tm tm;
+ int ms;
+ static char date[16];
+ static char new_date[16];
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ localtime_r((time_t*)&tv.tv_sec, &tm);
+ ms = tv.tv_usec/1000;
+ strftime(new_date, sizeof(new_date), "%a %d %b %Y", &tm);
+ //display date only if it has changed
+ if (strncmp(date, new_date, sizeof(new_date)))
+ {
+ printf("DATE: ---%s---\n", new_date);
+ strncpy(date, new_date, sizeof(date));
+ }
+ printf("%2d:%02d:%02d.%03d ", tm.tm_hour, tm.tm_min, tm.tm_sec, ms);
+}
+
+static void print_usage(const char *arg0)
+{
+ fprintf(stderr, "%s USAGE: \n", arg0);
+ fprintf(stderr, "%s -DP Enable DNS Proxy with Default Parameters \n", arg0);
+ fprintf(stderr, "%s -DP [-o <output interface>] [-i <input interface(s)>] Enable DNS Proxy \n", arg0);
+}
+
+//*************************************************************************************************************
+// CallBack Funcs:
+//*************************************************************************************************************
+
+// DNSXEnableProxy Callback from the Daemon
+static void dnsproxy_reply(DNSXConnRef connRef, DNSXErrorType errCode)
+{
+ (void) connRef;
+ printtimestamp();
+ switch (errCode)
+ {
+ case kDNSX_NoError : printf(" SUCCESS \n"); break;
+ case kDNSX_DictError : printf(" DICT ERROR \n"); break;
+ case kDNSX_DaemonNotRunning : printf(" NO DAEMON \n");
+ DNSXRefDeAlloc(ClientRef); break;
+ case kDNSX_Engaged : printf(" ENGAGED \n");
+ DNSXRefDeAlloc(ClientRef); break;
+ case kDNSX_UnknownErr :
+ default : printf("UNKNOWN ERR \n");
+ DNSXRefDeAlloc(ClientRef); break;
+ }
+ fflush(NULL);
+
+}
+
+//*************************************************************************************************************
+
+int main(int argc, char **argv)
+{
+ DNSXErrorType err;
+
+ // Default i/p intf is lo0 and o/p intf is primary interface
+ IfIndex Ipintfs[MaxInputIf] = {1, 0, 0, 0, 0};
+ IfIndex Opintf = kDNSIfindexAny;
+
+ // Extract program name from argv[0], which by convention contains the path to this executable
+ const char *a0 = strrchr(argv[0], kFilePathSep) + 1;
+ if (a0 == (const char *)1)
+ a0 = argv[0];
+
+ // Must run as root
+ if (0 != geteuid())
+ {
+ fprintf(stderr, "%s MUST run as root!!\n", a0);
+ exit(-1);
+ }
+ if ((sizeof(argv) == 8))
+ printf("dnsctl running in 64-bit mode\n");
+ else if ((sizeof(argv) == 4))
+ printf("dnsctl running in 32-bit mode\n");
+
+ // expects atleast one argument
+ if (argc < 2)
+ goto Usage;
+
+ if ( !strcmp(argv[1], "-DP") || !strcmp(argv[1], "-dp") )
+ {
+ if (argc == 2)
+ {
+ printtimestamp();
+ printf("Proceeding to Enable DNSProxy on mDNSResponder with Default Parameters\n");
+ dispatch_queue_t my_Q = dispatch_queue_create("com.apple.dnsctl.callback_queue", NULL);
+ err = DNSXEnableProxy(&ClientRef, kDNSProxyEnable, Ipintfs, Opintf, my_Q, dnsproxy_reply);
+ }
+ else if (argc > 2)
+ {
+ argc--;
+ argv++;
+ if (!strcmp(argv[1], "-o"))
+ {
+ Opintf = if_nametoindex(argv[2]);
+ if (!Opintf)
+ Opintf = atoi(argv[2]);
+ if (!Opintf)
+ {
+ fprintf(stderr, "Could not parse o/p interface [%s]: Passing default primary \n", argv[2]);
+ Opintf = kDNSIfindexAny;
+ }
+ argc -= 2;
+ argv += 2;
+ }
+ if (argc > 2 && !strcmp(argv[1], "-i"))
+ {
+ int i;
+ argc--;
+ argv++;
+ for (i = 0; i < MaxInputIf && argc > 1; i++)
+ {
+ Ipintfs[i] = if_nametoindex(argv[1]);
+ if (!Ipintfs[i])
+ Ipintfs[i] = atoi(argv[1]);
+ if (!Ipintfs[i])
+ {
+ fprintf(stderr, "Could not parse i/p interface [%s]: Passing default lo0 \n", argv[2]);
+ Ipintfs[i] = 1;
+ }
+ argc--;
+ argv++;
+ }
+ }
+ printtimestamp();
+ printf("Proceeding to Enable DNSProxy on mDNSResponder \n");
+ dispatch_queue_t my_Q = dispatch_queue_create("com.apple.dnsctl.callback_queue", NULL);
+ err = DNSXEnableProxy(&ClientRef, kDNSProxyEnable, Ipintfs, Opintf, my_Q, dnsproxy_reply);
+ }
+ }
+ else
+ {
+ goto Usage;
+ }
+
+ dispatch_main();
+
+Usage:
+ print_usage(a0);
+ return 0;
+}
+
diff -r 3a369da17266 -r ea63f108de9e external/apache2/mDNSResponder/dist/mDNSCore/CryptoAlg.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/apache2/mDNSResponder/dist/mDNSCore/CryptoAlg.c Sun Jan 14 18:43:01 2018 +0000
@@ -0,0 +1,280 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ***************************************************************************
+// CryptoAlg.c:
+// Interface to DNSSEC cryptographic algorithms. The crypto support itself is
+// provided by the platform and the functions in this file just provide an
+// interface to access them in a more generic way.
+// ***************************************************************************
+
+#include "mDNSEmbeddedAPI.h"
+#include "CryptoAlg.h"
+
+AlgFuncs *DigestAlgFuncs[DIGEST_TYPE_MAX];
+AlgFuncs *CryptoAlgFuncs[CRYPTO_ALG_MAX];
+AlgFuncs *EncAlgFuncs[ENC_ALG_MAX];
+
+mDNSexport mStatus DigestAlgInit(mDNSu8 digestType, AlgFuncs *func)
+{
+ if (digestType >= DIGEST_TYPE_MAX)
+ {
+ LogMsg("DigestAlgInit: digestType %d exceeds bounds", digestType);
+ return mStatus_BadParamErr;
+ }
+ // As digestTypes may not be consecutive, check for specific digest types
+ // that we support
+ if (digestType != SHA1_DIGEST_TYPE &&
+ digestType != SHA256_DIGEST_TYPE)
+ {
Home |
Main Index |
Thread Index |
Old Index