summaryrefslogtreecommitdiffstats
path: root/third_party/heimdal/include
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:47:29 +0000
commit4f5791ebd03eaec1c7da0865a383175b05102712 (patch)
tree8ce7b00f7a76baa386372422adebbe64510812d4 /third_party/heimdal/include
parentInitial commit. (diff)
downloadsamba-upstream.tar.xz
samba-upstream.zip
Adding upstream version 2:4.17.12+dfsg.upstream/2%4.17.12+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--third_party/heimdal/include/Makefile.am148
-rw-r--r--third_party/heimdal/include/NTMakefile122
-rw-r--r--third_party/heimdal/include/bits.c329
-rw-r--r--third_party/heimdal/include/config.h.w321494
-rw-r--r--third_party/heimdal/include/crypto-headers.h25
-rw-r--r--third_party/heimdal/include/gssapi/Makefile.am7
-rw-r--r--third_party/heimdal/include/gssapi/NTMakefile34
-rw-r--r--third_party/heimdal/include/hcrypto/Makefile.am31
-rw-r--r--third_party/heimdal/include/hcrypto/NTMakefile34
-rw-r--r--third_party/heimdal/include/heim_threads.h370
-rw-r--r--third_party/heimdal/include/heimqueue.h270
-rw-r--r--third_party/heimdal/include/kadm5/Makefile.am8
-rw-r--r--third_party/heimdal/include/kadm5/NTMakefile34
-rw-r--r--third_party/heimdal/include/krb5-types.cross67
14 files changed, 2973 insertions, 0 deletions
diff --git a/third_party/heimdal/include/Makefile.am b/third_party/heimdal/include/Makefile.am
new file mode 100644
index 0000000..43ebe70
--- /dev/null
+++ b/third_party/heimdal/include/Makefile.am
@@ -0,0 +1,148 @@
+# $Id$
+
+include $(top_srcdir)/Makefile.am.common
+
+SUBDIRS = kadm5 hcrypto gssapi
+
+noinst_PROGRAMS = bits
+CHECK_LOCAL = no-check-local
+
+AM_CPPFLAGS += -DHOST=\"$(CANONICAL_HOST)\"
+
+nodist_include_HEADERS = krb5-types.h
+
+noinst_HEADERS = heimqueue.h heim_threads.h crypto-headers.h
+
+EXTRA_DIST = NTMakefile krb5-types.cross config.h.w32
+
+if !CROSS_COMPILE
+
+krb5-types.h: bits$(EXEEXT)
+ ./bits$(EXEEXT) krb5-types.h
+
+else
+
+krb5-types.h: krb5-types.cross
+ cp $(srcdir)/krb5-types.cross krb5-types.h
+
+endif
+
+CLEANFILES = \
+ an2ln_plugin.h \
+ asn1-common.h \
+ asn1-template.h \
+ asn1.h \
+ asn1_err.h \
+ base64.h \
+ ccache_plugin.h \
+ cms_asn1.h \
+ cms_template_asn1.h \
+ com_err.h \
+ com_right.h \
+ common_plugin.h \
+ crmf_asn1.h \
+ crmf_template_asn1.h \
+ db_plugin.h \
+ der-private.h \
+ der-protos.h \
+ der.h \
+ digest_asn1.h \
+ digest_template_asn1.h \
+ editline.h \
+ err.h \
+ getarg.h \
+ glob.h \
+ gss-preauth-protos.h \
+ gss-preauth-private.h \
+ gssapi.h \
+ gssapi_asn1.h \
+ gssapi_mech.h \
+ gssapi/gssapi_preauth.h \
+ hdb-private.h \
+ hdb-protos.h \
+ hdb.h \
+ hdb_asn1.h \
+ hdb_err.h \
+ heim-ipc.h \
+ heim_asn1.h \
+ heim_err.h \
+ heimbase.h \
+ heimbase-svc.h \
+ heimbase-protos.h \
+ heimntlm-protos.h \
+ heimntlm.h \
+ hex.h \
+ hx509-private.h \
+ hx509-protos.h \
+ hx509.h \
+ hx509_err.h \
+ k524_err.h \
+ k5e1_err.h \
+ kafs.h \
+ kcm-protos.h \
+ kdc-private.h \
+ kdc-protos.h \
+ kdc.h \
+ krb5-private.h \
+ krb5-protos.h \
+ krb5-types.h \
+ krb5.h \
+ krb5_asn1.h \
+ krb5_template_asn1.h \
+ krb5_ccapi.h \
+ krb5_err.h \
+ krb_err.h \
+ kuserok_plugin.h \
+ kx509_asn1.h \
+ kx509_template_asn1.h \
+ kx509_err.h \
+ locate_plugin.h \
+ login-protos.h \
+ ntlm_err.h \
+ ocsp_asn1.h \
+ ocsp_template_asn1.h \
+ otp.h \
+ parse_bytes.h \
+ parse_time.h \
+ parse_units.h \
+ pkcs10_asn1.h \
+ pkcs10_template_asn1.h \
+ pkcs12_asn1.h \
+ pkcs12_template_asn1.h \
+ pkcs8_asn1.h \
+ pkcs8_template_asn1.h \
+ pkcs9_asn1.h \
+ pkcs9_template_asn1.h \
+ pkinit_asn1.h \
+ pkinit_template_asn1.h \
+ resolve.h \
+ rfc2459_asn1.h \
+ rfc2459_template_asn1.h \
+ rfc4108_asn1.h \
+ rfc4108_template_asn1.h \
+ roken-common.h \
+ roken.h \
+ rtbl.h \
+ send_to_kdc_plugin.h \
+ sl.h \
+ sqlite3.h \
+ sqlite3ext.h \
+ test-mem.h \
+ vers.h \
+ vis.h \
+ wind.h \
+ wind_err.h \
+ kdc-plugin.h \
+ kdc-accessors.h \
+ kdc-audit.h \
+ csr_authorizer_plugin.h \
+ gss_preauth_authorizer_plugin.h \
+ token_validator_plugin.h \
+ xdbm.h \
+ x25519_ref10.h \
+ x690sample_asn1.h \
+ x690sample_template_asn1.h
+
+DISTCLEANFILES = \
+ version.h \
+ version.h.in
diff --git a/third_party/heimdal/include/NTMakefile b/third_party/heimdal/include/NTMakefile
new file mode 100644
index 0000000..284ceba
--- /dev/null
+++ b/third_party/heimdal/include/NTMakefile
@@ -0,0 +1,122 @@
+########################################################################
+#
+# Copyright (c) 2009, Secure Endpoints Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+RELDIR=include
+
+SUBDIRS=kadm5 hcrypto gssapi
+
+!include ../windows/NTMakefile.w32
+!include ../windows/NTMakefile.version
+!include ../windows/NTMakefile.config
+
+INCFILES= \
+ $(INCDIR)\config.h \
+ $(INCDIR)\crypto-headers.h \
+ $(INCDIR)\heimqueue.h \
+ $(INCDIR)\heim_threads.h \
+ $(INCDIR)\krb5-types.h \
+ $(INCDIR)\version.h
+
+$(INCDIR)\krb5-types.h: $(OBJ)\bits.exe
+ $(OBJ)\bits.exe $(INCDIR)\krb5-types.h
+
+$(OBJ)\bits.exe: $(OBJ)\bits.obj
+ $(EXECONLINK)
+ $(EXEPREP_NODIST)
+
+$(INCDIR)\config.h: config.h.w32 ..\windows\NTMakefile.config ..\windows\NTMakefile.version NTMakefile
+ $(PERL) << < config.h.w32 > $@
+
+while(<>) {
+
+ if (m/\@FEATURE_DEFS\@/) {
+
+ if ("$(KRB5)") { print "#define KRB5 1\n"; }
+ if ("$(KRB4)") { print "#define KRB4 1\n"; }
+ if ("$(WEAK_CRYPTO)") { print "#define HEIM_WEAK_CRYPTO 1\n"; }
+ if ("$(HCRYPTO_FALLBACK)") { print "#define HCRYPTO_FALLBACK 1\n"; } else { print "#define HCRYPTO_FALLBACK 0\n"; }
+ if ("$(PKINIT)") { print "#define PKINIT 1\n"; }
+ if ("$(NO_AFS)") { print "#define NO_AFS 1\n"; }
+ if ("$(OPENLDAP)") { print "#define OPENLDAP 1\n"; }
+ if ("$(OPENLDAP_MODULE)") { print "#define OPENLDAP_MODULE 1\n"; }
+ if ("$(OTP)") { print "#define OTP 1 \n"; }
+ if ("$(AUTHENTICATION)") { print "#define AUTHENTICATION 1\n"; }
+ if ("$(DIAGNOSTICS)") { print "#define DIAGNOSTICS 1\n"; }
+ if ("$(ENCRYPTION)") { print "#define ENCRYPTION 1\n"; }
+ if ("$(ENABLE_AFS_STRING_TO_KEY)") { print "#define ENABLE_AFS_STRING_TO_KEY 1\n"; }
+ if ("$(ENABLE_PTHREAD_SUPPORT)") { print "#define ENABLE_PTHREAD_SUPPORT 1\n"; }
+ if ("$(HAVE_PTHREAD_H)") { print "#define HAVE_PTHREAD_H 1\n"; }
+ if ("$(ENV_HACK)") { print "#define ENV_HACK 1\n"; }
+ if ("$(HAVE_KCM)") { print "#define HAVE_KCM 1\n"; }
+ if ("$(HAVE_SCC)") { print "#define HAVE_SCC 1\n"; }
+ if ("$(HAVE_STDINT_H)") { print "#define HAVE_STDINT_H 1\n"; }
+ if ("$(DIR_hdbdir)") { print "#define HDB_DB_DIR \"".'$(DIR_hdbdir)'."\"\n"; }
+ if ("$(HAVE_MSLSA_CACHE)") { print "#define HAVE_MSLSA_CACHE 1\n"; }
+ if ("$(NO_LOCALNAME)") { print "#define NO_LOCALNAME 1\n"; }
+
+ } elsif (m/\@VERSION_OPTDEFS\@/) {
+
+ if ("$(VER_PRERELEASE)") { print "#define VER_PRERELEASE 1\n"; }
+ if ("$(VER_PRIVATE)") { print "#define VER_PRIVATE \"$(VER_PRIVATE)\"\n"; }
+ if ("$(VER_SPECIAL)") { print "#define VER_SPECIAL \"$(VER_SPECIAL)\"\n"; }
+ if ("$(BUILD)" eq "dbg") { print "#define VER_DEBUG 1\n"; }
+ print "#define HOST \"$(COMPUTERNAME)\"\n";
+
+ } else {
+
+ s/\@PACKAGE\@/$(VER_PACKAGE)/;
+ s/\@PACKAGE_NAME\@/$(VER_PACKAGE_NAME)/;
+ s{\@PACKAGE_BUGREPORT\@}{$(VER_PACKAGE_BUGREPORT:@=\@)};
+ s/\@PACKAGE_VERSION\@/$(VER_PACKAGE_VERSION)/;
+ s/\@PACKAGE_COPYRIGHT\@/$(VER_PACKAGE_COPYRIGHT)/;
+ s/\@PACKAGE_COMPANY\@/$(VER_PACKAGE_COMPANY)/;
+ s/\@MAJOR\@/$(VER_PRODUCT_MAJOR)/;
+ s/\@MINOR\@/$(VER_PRODUCT_MINOR)/;
+ s/\@AUX\@/$(VER_PRODUCT_AUX)/;
+ s/\@PATCH\@/$(VER_PRODUCT_PATCH)/;
+
+ print $_;
+ }
+}
+
+<<
+
+$(INCDIR)\version.h: ..\windows\NTMakefile.version NTMakefile
+ $(CP) << $@
+const char *heimdal_long_version = "@(#)$$Version: $(VER_PACKAGE_NAME) $(VER_PACKAGE_VERSION) by $(USERNAME) on $(COMPUTERNAME) ($(CPU)-pc-windows) $$";
+const char *heimdal_version = "$(VER_PACKAGE_NAME) $(VER_PACKAGE_VERSION)";
+<<
+
+all:: $(INCFILES)
+
+clean::
+ -$(RM) $(INCFILES)
+
diff --git a/third_party/heimdal/include/bits.c b/third_party/heimdal/include/bits.c
new file mode 100644
index 0000000..6abdb15
--- /dev/null
+++ b/third_party/heimdal/include/bits.c
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 1997-2002 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Portions Copyright (c) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+RCSID("$Id$");
+#endif
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#ifdef WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
+
+#ifdef HAVE_SNPRINTF
+#define BITSIZE(TYPE) \
+{ \
+ int b = 0; TYPE x = 1, zero = 0; const char *pre = "u"; \
+ char tmp[128]; \
+ while(x){ x <<= 1; b++; if(x < zero) pre=""; } \
+ if(b >= len){ \
+ size_t tabs; \
+ snprintf(tmp, sizeof(tmp), "typedef %s %sint%d_t;", #TYPE, \
+ pre, len); \
+ tabs = 5 - strlen(tmp) / 8; \
+ fprintf(f, "%s", tmp); \
+ while(tabs-- > 0) fprintf(f, "\t"); \
+ fprintf(f, "/* %2d bits */\n", b); \
+ return; \
+ } \
+}
+#else
+#define BITSIZE(TYPE) \
+{ \
+ int b = 0; TYPE x = 1, zero = 0; const char *pre = "u"; \
+ char tmp[128], tmp2[128]; \
+ while(x){ x <<= 1; b++; if(x < zero) pre=""; } \
+ if(b >= len){ \
+ size_t tabs; \
+ sprintf(tmp, "%sint%d_t" , pre, len); \
+ sprintf(tmp2, "typedef %s %s;", #TYPE, tmp); \
+ tabs = 5 - strlen(tmp2) / 8; \
+ fprintf(f, "%s", tmp2); \
+ while(tabs-- > 0) \
+ fprintf(f, "\t"); \
+ fprintf(f, "/* %2d bits */\n", b); \
+ return; \
+ } \
+}
+#endif
+#ifndef HAVE___ATTRIBUTE__
+#define __attribute__(x)
+#endif
+
+static void
+try_signed(FILE *f, int len) __attribute__ ((__unused__));
+
+static void
+try_unsigned(FILE *f, int len) __attribute__ ((__unused__));
+
+static int
+print_bt(FILE *f, int flag) __attribute__ ((__unused__));
+
+static void
+try_signed(FILE *f, int len)
+{
+ BITSIZE(signed char);
+ BITSIZE(short);
+ BITSIZE(int);
+ BITSIZE(long);
+#ifdef HAVE_LONG_LONG
+ BITSIZE(long long);
+#endif
+ fprintf(f, "/* There is no %d bit type */\n", len);
+}
+
+static void
+try_unsigned(FILE *f, int len)
+{
+ BITSIZE(unsigned char);
+ BITSIZE(unsigned short);
+ BITSIZE(unsigned int);
+ BITSIZE(unsigned long);
+#ifdef HAVE_LONG_LONG
+ BITSIZE(unsigned long long);
+#endif
+ fprintf(f, "/* There is no %d bit type */\n", len);
+}
+
+static int
+print_bt(FILE *f, int flag)
+{
+ if(flag == 0){
+ fprintf(f, "/* For compatibility with various type definitions */\n");
+ fprintf(f, "#ifndef __BIT_TYPES_DEFINED__\n");
+ fprintf(f, "#define __BIT_TYPES_DEFINED__\n");
+ fprintf(f, "\n");
+ }
+ return 1;
+}
+
+int main(int argc, char **argv)
+{
+ FILE *f;
+ int flag;
+ char *p = NULL;
+ const char *hb;
+
+ if (argc > 1 && strcmp(argv[1], "--version") == 0) {
+ printf("some version");
+ return 0;
+ }
+
+ if(argc < 2){
+ hb = "__BITS_H__";
+ f = stdout;
+ } else {
+ p = malloc(strlen(argv[1]) + 5);
+ sprintf(p, "__%s__", argv[1]);
+ hb = p;
+ for(; *p; p++){
+ if(!isalnum((unsigned char)*p))
+ *p = '_';
+ }
+ f = fopen(argv[1], "w");
+ }
+ fprintf(f, "#ifndef %s\n", hb);
+ fprintf(f, "#define %s\n", hb);
+ fprintf(f, "\n");
+#ifdef HAVE_INTTYPES_H
+ fprintf(f, "#include <inttypes.h>\n");
+#endif
+#ifdef HAVE_SYS_TYPES_H
+ fprintf(f, "#include <sys/types.h>\n");
+#endif
+#ifdef HAVE_SYS_BITYPES_H
+ fprintf(f, "#include <sys/bitypes.h>\n");
+#endif
+#ifdef HAVE_BIND_BITYPES_H
+ fprintf(f, "#include <bind/bitypes.h>\n");
+#endif
+#ifdef HAVE_NETINET_IN6_MACHTYPES_H
+ fprintf(f, "#include <netinet/in6_machtypes.h>\n");
+#endif
+#ifdef HAVE_SOCKLEN_T
+#ifndef WIN32
+ fprintf(f, "#include <sys/socket.h>\n");
+#else
+ fprintf(f, "#include <winsock2.h>\n");
+ fprintf(f, "#include <ws2tcpip.h>\n");
+#endif
+#endif
+ fprintf(f, "\n");
+
+ flag = 0;
+#ifndef HAVE_INT8_T
+ flag = print_bt(f, flag);
+ try_signed (f, 8);
+#endif /* HAVE_INT8_T */
+#ifndef HAVE_INT16_T
+ flag = print_bt(f, flag);
+ try_signed (f, 16);
+#endif /* HAVE_INT16_T */
+#ifndef HAVE_INT32_T
+ flag = print_bt(f, flag);
+ try_signed (f, 32);
+#endif /* HAVE_INT32_T */
+#ifndef HAVE_INT64_T
+ flag = print_bt(f, flag);
+ try_signed (f, 64);
+#endif /* HAVE_INT64_T */
+
+#ifndef HAVE_UINT8_T
+ flag = print_bt(f, flag);
+ try_unsigned (f, 8);
+#endif /* HAVE_UINT8_T */
+#ifndef HAVE_UINT16_T
+ flag = print_bt(f, flag);
+ try_unsigned (f, 16);
+#endif /* HAVE_UINT16_T */
+#ifndef HAVE_UINT32_T
+ flag = print_bt(f, flag);
+ try_unsigned (f, 32);
+#endif /* HAVE_UINT32_T */
+#ifndef HAVE_UINT64_T
+ flag = print_bt(f, flag);
+ try_unsigned (f, 64);
+#endif /* HAVE_UINT64_T */
+
+#define X(S) fprintf(f, "typedef uint" #S "_t u_int" #S "_t;\n")
+#ifndef HAVE_U_INT8_T
+ flag = print_bt(f, flag);
+ X(8);
+#endif /* HAVE_U_INT8_T */
+#ifndef HAVE_U_INT16_T
+ flag = print_bt(f, flag);
+ X(16);
+#endif /* HAVE_U_INT16_T */
+#ifndef HAVE_U_INT32_T
+ flag = print_bt(f, flag);
+ X(32);
+#endif /* HAVE_U_INT32_T */
+#ifndef HAVE_U_INT64_T
+ flag = print_bt(f, flag);
+ X(64);
+#endif /* HAVE_U_INT64_T */
+
+ if(flag){
+ fprintf(f, "\n");
+ fprintf(f, "#endif /* __BIT_TYPES_DEFINED__ */\n\n");
+ }
+#ifdef KRB5
+ fprintf(f, "\n");
+#if defined(HAVE_SOCKLEN_T)
+ fprintf(f, "typedef socklen_t krb5_socklen_t;\n");
+#else
+ fprintf(f, "typedef int krb5_socklen_t;\n");
+#endif
+#if defined(HAVE_SSIZE_T)
+#ifdef HAVE_UNISTD_H
+ fprintf(f, "#include <unistd.h>\n");
+#endif
+ fprintf(f, "typedef ssize_t krb5_ssize_t;\n");
+#else
+ fprintf(f, "typedef int krb5_ssize_t;\n");
+#endif
+ fprintf(f, "\n");
+
+#if defined(_WIN32)
+ fprintf(f, "typedef SOCKET krb5_socket_t;\n");
+#else
+ fprintf(f, "typedef int krb5_socket_t;\n");
+#endif
+ fprintf(f, "\n");
+
+#endif /* KRB5 */
+
+ fprintf(f, "#if !defined(__has_extension)\n");
+ fprintf(f, "#define __has_extension(x) 0\n");
+ fprintf(f, "#endif\n\n");
+
+ fprintf(f, "#ifndef KRB5TYPES_REQUIRE_GNUC\n");
+ fprintf(f, "#define KRB5TYPES_REQUIRE_GNUC(m,n,p) \\\n");
+ fprintf(f, " (((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100) + __GNUC_PATCHLEVEL__) >= \\\n");
+ fprintf(f, " (((m) * 10000) + ((n) * 100) + (p)))\n");
+ fprintf(f, "#endif\n\n");
+
+ fprintf(f, "#ifndef HEIMDAL_DEPRECATED\n");
+ fprintf(f, "#if __has_extension(deprecated) || KRB5TYPES_REQUIRE_GNUC(3,1,0)\n");
+ fprintf(f, "#define HEIMDAL_DEPRECATED __attribute__ ((__deprecated__))\n");
+ fprintf(f, "#elif defined(_MSC_VER) && (_MSC_VER>1200)\n");
+ fprintf(f, "#define HEIMDAL_DEPRECATED __declspec(deprecated)\n");
+ fprintf(f, "#else\n");
+ fprintf(f, "#define HEIMDAL_DEPRECATED\n");
+ fprintf(f, "#endif\n");
+ fprintf(f, "#endif\n\n");
+
+ fprintf(f, "#ifndef HEIMDAL_PRINTF_ATTRIBUTE\n");
+ fprintf(f, "#if __has_extension(format) || KRB5TYPES_REQUIRE_GNUC(3,1,0)\n");
+ fprintf(f, "#define HEIMDAL_PRINTF_ATTRIBUTE(x) __attribute__ ((__format__ x))\n");
+ fprintf(f, "#else\n");
+ fprintf(f, "#define HEIMDAL_PRINTF_ATTRIBUTE(x)\n");
+ fprintf(f, "#endif\n");
+ fprintf(f, "#endif\n\n");
+
+ fprintf(f, "#ifndef HEIMDAL_NORETURN_ATTRIBUTE\n");
+ fprintf(f, "#if __has_extension(noreturn) || KRB5TYPES_REQUIRE_GNUC(3,1,0)\n");
+ fprintf(f, "#define HEIMDAL_NORETURN_ATTRIBUTE __attribute__ ((__noreturn__))\n");
+ fprintf(f, "#else\n");
+ fprintf(f, "#define HEIMDAL_NORETURN_ATTRIBUTE\n");
+ fprintf(f, "#endif\n");
+ fprintf(f, "#endif\n\n");
+
+ fprintf(f, "#ifndef HEIMDAL_UNUSED_ATTRIBUTE\n");
+ fprintf(f, "#if __has_extension(unused) || KRB5TYPES_REQUIRE_GNUC(3,1,0)\n");
+ fprintf(f, "#define HEIMDAL_UNUSED_ATTRIBUTE __attribute__ ((__unused__))\n");
+ fprintf(f, "#else\n");
+ fprintf(f, "#define HEIMDAL_UNUSED_ATTRIBUTE\n");
+ fprintf(f, "#endif\n");
+ fprintf(f, "#endif\n\n");
+
+ fprintf(f, "#ifndef HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE\n");
+ fprintf(f, "#if __has_extension(warn_unused_result) || KRB5TYPES_REQUIRE_GNUC(3,3,0)\n");
+ fprintf(f, "#define HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE __attribute__ ((__warn_unused_result__))\n");
+ fprintf(f, "#else\n");
+ fprintf(f, "#define HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE\n");
+ fprintf(f, "#endif\n");
+ fprintf(f, "#endif\n\n");
+
+ fprintf(f, "#endif /* %s */\n", hb);
+
+ if (f != stdout)
+ fclose(f);
+ return 0;
+}
diff --git a/third_party/heimdal/include/config.h.w32 b/third_party/heimdal/include/config.h.w32
new file mode 100644
index 0000000..5521181
--- /dev/null
+++ b/third_party/heimdal/include/config.h.w32
@@ -0,0 +1,1494 @@
+/***********************************************************************
+ * Copyright (c) 2009-2017, Secure Endpoints Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ **********************************************************************/
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#define fallthrough do {} while(0) /* fallthrough */
+
+#ifndef RCSID
+#define RCSID(msg) \
+static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
+#endif
+
+/* If this file is being included by a resource script, don't bother
+ with anything other than the version macros. */
+#ifndef RC_INVOKED
+
+#if defined(_MSC_VER)
+#define inline __inline
+#endif
+
+#define MaxHostNameLen (64+4)
+#define MaxPathLen MAX_PATH
+
+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN MaxHostNameLen
+#endif
+#ifndef MAXPATHLEN
+#define MAXPATHLEN MaxPathLen
+#endif
+
+#ifdef BUILD_KRB5_LIB
+#ifndef KRB5_LIB
+#ifdef _WIN32
+#define KRB5_LIB_FUNCTION
+#define KRB5_LIB_NORETURN_FUNCTION __declspec(noreturn)
+#define KRB5_LIB_CALL __stdcall
+#define KRB5_LIB_VARIABLE
+#else
+#define KRB5_LIB_FUNCTION
+#define KRB5_LIB_NORETURN_FUNCTION
+#define KRB5_LIB_CALL
+#define KRB5_LIB_VARIABLE
+#endif
+#endif
+#endif
+
+
+#ifdef BUILD_HX509_LIB
+#ifndef HX509_LIB
+#ifdef _WIN32
+#define HX509_LIB_FUNCTION
+#define HX509_LIB_NORETURN_FUNCTION __declspec(noreturn)
+#define HX509_LIB_CALL __stdcall
+#define HX509_LIB_VARIABLE
+#else
+#define HX509_LIB_FUNCTION
+#define HX509_LIB_NORETURN_FUNCTION
+#define HX509_LIB_CALL
+#define HX509_LIB_VARIABLE
+#endif
+#endif
+#endif
+
+
+#ifdef BUILD_ROKEN_LIB
+#ifndef ROKEN_LIB
+#ifdef _WIN32
+#define ROKEN_LIB_FUNCTION
+#define ROKEN_LIB_NORETURN_FUNCTION __declspec(noreturn)
+#define ROKEN_LIB_CALL __cdecl
+#define ROKEN_LIB_VARIABLE
+#else
+#define ROKEN_LIB_FUNCTION
+#define ROKEN_LIB_NORETURN_FUNCTION
+#define ROKEN_LIB_CALL
+#define ROKEN_LIB_VARIABLE
+#endif
+#endif
+#endif
+
+
+#ifdef BUILD_GSSAPI_LIB
+#ifndef GSSAPI_LIB
+#ifdef _WIN32
+#define GSSAPI_LIB_FUNCTION
+#define GSSAPI_LIB_NORETURN_FUNCTION __declspec(noreturn)
+#define GSSAPI_LIB_CALL __stdcall
+#define GSSAPI_LIB_VARIABLE
+#else
+#define GSSAPI_LIB_FUNCTION
+#define GSSAPI_LIB_NORETURN_FUNCTION
+#define GSSAPI_LIB_CALL
+#define GSSAPI_LIB_VARIABLE
+#endif
+#endif
+#endif
+
+
+#ifdef BUILD_KDC_LIB
+#ifndef KDC_LIB
+#ifdef _WIN32
+#define KDC_LIB_FUNCTION
+#define KDC_LIB_NORETURN_FUNCTION __declspec(noreturn)
+#define KDC_LIB_CALL __stdcall
+#define KDC_LIB_VARIABLE
+#else
+#define KDC_LIB_FUNCTION
+#define KDC_LIB_NORETURN_FUNCTION
+#define KDC_LIB_CALL
+#define KDC_LIB_VARIABLE
+#endif
+#endif
+#endif
+
+
+/* Feature macros */
+
+@FEATURE_DEFS@
+
+/* Define is backslashes act as path name delimiters */
+#define BACKSLASH_PATH_DELIM 1
+
+/* Path separator character */
+#define PATH_SEP ";"
+
+/* Define if you want to use DES encryption in telnet. */
+#define DES_ENCRYPTION 1
+
+/* Define this if you want support for broken ENV_{VAR,VAL} telnets. */
+/* #undef ENV_HACK */
+
+/* define if prototype of gethostbyaddr is compatible with struct hostent
+ *gethostbyaddr(const void *, size_t, int) */
+/* #undef GETHOSTBYADDR_PROTO_COMPATIBLE */
+
+/* define if prototype of gethostbyname is compatible with struct hostent
+ *gethostbyname(const char *) */
+#define GETHOSTBYNAME_PROTO_COMPATIBLE 1
+
+/* define if prototype of getservbyname is compatible with struct servent
+ *getservbyname(const char *, const char *) */
+#define GETSERVBYNAME_PROTO_COMPATIBLE 1
+
+/* define if prototype of getsockname is compatible with int getsockname(int,
+ struct sockaddr*, socklen_t*) */
+/* #undef GETSOCKNAME_PROTO_COMPATIBLE */
+
+/* Define if you have the `altzone' variable. */
+/* #undef HAVE_ALTZONE */
+
+/* Define to 1 if you have the `arc4random' function. */
+/* #undef HAVE_ARC4RANDOM */
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+/* #undef HAVE_ARPA_INET_H */
+
+/* Define to 1 if you have the <arpa/nameser.h> header file. */
+/* #undef HAVE_ARPA_NAMESER_H */
+
+/* Define to 1 if you have the <arpa/telnet.h> header file. */
+/* #undef HAVE_ARPA_TELNET_H */
+
+/* Define to 1 if you have the <asl.h> header file. */
+/* #undef HAVE_ASL_H */
+
+/* Define to 1 if you have the `asnprintf' function. */
+/* #undef HAVE_ASNPRINTF */
+
+/* Define to 1 if you have the `asprintf' function. */
+/* #undef HAVE_ASPRINTF */
+
+/* Define to 1 if you have the `atexit' function. */
+#define HAVE_ATEXIT 1
+
+/* Define to 1 if you have the <bind/bitypes.h> header file. */
+/* #undef HAVE_BIND_BITYPES_H */
+
+/* Define to 1 if you have the <bsdsetjmp.h> header file. */
+/* #undef HAVE_BSDSETJMP_H */
+
+/* Define to 1 if you have the `bswap16' function. */
+/* #undef HAVE_BSWAP16 */
+
+/* Define to 1 if you have the `bswap32' function. */
+/* #undef HAVE_BSWAP32 */
+
+/* Define to 1 if you have the <capability.h> header file. */
+/* #undef HAVE_CAPABILITY_H */
+
+/* Define to 1 if you have the `cap_set_proc' function. */
+/* #undef HAVE_CAP_SET_PROC */
+
+/* Define if the system defines 'CHAR' type */
+#define HAVE_CHAR 1
+
+/* Define if you have the function `chown'. */
+#define HAVE_CHOWN 1
+
+/* Define if you have the function `closefrom'. */
+/* #undef HAVE_CLOSEFROM */
+
+/* Define to 1 if you have the <config.h> header file. */
+/* #undef HAVE_CONFIG_H */
+
+/* Define if <conio.h> is present on the system is should be used for
+ handling low level console operations. */
+#define HAVE_CONIO_H
+
+/* Define if you have the function `copyhostent'. */
+/* #undef HAVE_COPYHOSTENT */
+
+/* Define to 1 if you have the `crypt' function. */
+/* #undef HAVE_CRYPT */
+
+/* Define to 1 if you have the <crypt.h> header file. */
+/* #ndef HAVE_CRYPT_H */
+
+/* Define to 1 if you have the <curses.h> header file. */
+/* #undef HAVE_CURSES_H */
+
+/* Define if you have the function `daemon'. */
+/* #define HAVE_DAEMON 1 */
+
+/* define if you have a berkeley db1/2 library */
+/* #undef HAVE_DB1 */
+
+/* define if you have a berkeley db3/4 library */
+/* #define HAVE_DB3 1 */
+
+/* Define to 1 if you have the <db3/db.h> header file. */
+/* #undef HAVE_DB3_DB_H */
+
+/* Define to 1 if you have the <db4/db.h> header file. */
+/* #define HAVE_DB4_DB_H 1 */
+
+/* Define to 1 if you have the `dbm_firstkey' function. */
+/* #define HAVE_DBM_FIRSTKEY 1 */
+
+/* Define to 1 if you have the <dbm.h> header file. */
+/* #undef HAVE_DBM_H */
+
+/* Define to 1 if you have the `dbopen' function. */
+/* #undef HAVE_DBOPEN */
+
+/* Define to 1 if you have the <db_185.h> header file. */
+/* #define HAVE_DB_185_H 1 */
+
+/* Define to 1 if you have the `db_create' function. */
+/* #define HAVE_DB_CREATE 1 */
+
+/* Define to 1 if you have the <db.h> header file. */
+/* #define HAVE_DB_H 1 */
+
+/* define if you have ndbm compat in db */
+/* #define HAVE_DB_NDBM 1 */
+
+/* Define to 1 if you have the declaration of `altzone', and to 0 if you
+ don't. */
+/* #undef HAVE_DECL_ALTZONE */
+
+/* Define to 1 if you have the declaration of `environ', and to 0 if you
+ don't. */
+#define HAVE_DECL_ENVIRON 1
+
+/* Define to 1 if you have the declaration of `h_errlist', and to 0 if you
+ don't. */
+/* #undef HAVE_DECL_H_ERRLIST */
+
+/* Define to 1 if you have the declaration of `h_errno', and to 0 if you
+ don't. */
+#define HAVE_DECL_H_ERRNO 1
+
+/* Define to 1 if you have the declaration of `h_nerr', and to 0 if you don't.
+ */
+/* #undef HAVE_DECL_H_NERR */
+
+/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't.
+ */
+/* #undef HAVE_DECL_OPTARG */
+
+/* Define to 1 if you have the declaration of `opterr', and to 0 if you don't.
+ */
+/* #undef HAVE_DECL_OPTERR */
+
+/* Define to 1 if you have the declaration of `optind', and to 0 if you don't.
+ */
+/* #undef HAVE_DECL_OPTIND */
+
+/* Define to 1 if you have the declaration of `optopt', and to 0 if you don't.
+ */
+/* #undef HAVE_DECL_OPTOPT */
+
+/* Define to 1 if you have the declaration of `timezone', and to 0 if you
+ don't. */
+#define HAVE_DECL_TIMEZONE 1
+
+/* Define to 1 if you have the declaration of `_res', and to 0 if you don't.
+ */
+/* #undef HAVE_DECL__RES */
+
+/* Define to 1 if you have the declaration of `__progname', and to 0 if you
+ don't. */
+#define HAVE_DECL___PROGNAME 0
+
+/* Define to 1 if you have the <dirent.h> header file. */
+/* MSVC doesn't provide a <dirent.h>, but we implement it in
+ lib/roken. */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* MSVC doesn't provide a <dlfcn.h>, but we implement it in lib/roken. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `dlopen' function. */
+/* MSVC doesn't provide a <dlfcn.h>, but we implement it in lib/roken. */
+#define HAVE_DLOPEN 1
+
+/* Define to 1 if you have the `dladdr' function. */
+/* MSVC doesn't provide a <dlfcn.h>, but we implement it in lib/roken. */
+#define HAVE_DLADDR 1
+
+/* Define to 1 if you have the `dn_expand' function. */
+/* #undef HAVE_DN_EXPAND */
+
+/* Define to 1 if you have the `door_create' function. */
+/* #undef HAVE_DOOR_CREATE */
+
+/* Define if you have the function `ecalloc'. */
+/* #undef HAVE_ECALLOC */
+
+/* Define to 1 if you have the `el_init' function. */
+/* #undef HAVE_EL_INIT */
+
+/* Define if you have the function `emalloc'. */
+/* #undef HAVE_EMALLOC */
+
+/* Define if you have the function `erealloc'. */
+/* #undef HAVE_EREALLOC */
+
+/* Define if you have the function `err'. */
+#define HAVE_ERR 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define if you have the function `errx'. */
+#define HAVE_ERRX 1
+
+/* Define to 1 if you have the <err.h> header file. */
+#define HAVE_ERR_H 1
+
+/* Define if you have the function `estrdup'. */
+/* #undef HAVE_ESTRDUP */
+
+/* Define if you have the function `fchown'. */
+/* #undef HAVE_FCHOWN */
+
+/* Define to 1 if you have the `fcntl' function. */
+/* #undef HAVE_FCNTL */
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the function `flock'. */
+/* #undef HAVE_FLOCK */
+
+/* Define if you have the function `fnmatch'. */
+/* #undef HAVE_FNMATCH */
+
+/* Define to 1 if you have the <fnmatch.h> header file. */
+/* #undef HAVE_FNMATCH_H */
+
+/* Define if you have the function `fseeko'. */
+/* #undef HAVE_FSEEKO */
+
+/* Define if you have the function `ftello'. */
+/* #undef HAVE_FTELLO */
+
+/* Define if you have the function `_fseeki64'. */
+#define HAVE__FSEEKI64 1
+
+/* Define if you have the function `_ftelli64'. */
+#define HAVE__FTELLI64 1
+
+/* Define if el_init takes four arguments. */
+/* #undef HAVE_FOUR_VALUED_EL_INIT */
+
+/* Have -framework Security */
+/* #undef HAVE_FRAMEWORK_SECURITY */
+
+/* Define to 1 if you have the `freeaddrinfo' function. */
+#define HAVE_FREEADDRINFO 1
+
+/* Define if you have the function `freehostent'. */
+/* #undef HAVE_FREEHOSTENT */
+
+/* Define to 1 if you have the `gai_strerror' function. */
+#define HAVE_GAI_STRERROR 1
+
+/* Define to 1 if you have the <gdbm/ndbm.h> header file. */
+/* #undef HAVE_GDBM_NDBM_H */
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#define HAVE_GETADDRINFO 1
+
+/* Define to 1 if you have the `getconfattr' function. */
+/* #undef HAVE_GETCONFATTR */
+
+/* Define if you have the function `getcwd'. */
+#define HAVE_GETCWD 1
+
+/* Define if you have the function `getdtablesize'. */
+/* #define HAVE_GETDTABLESIZE 1 */
+
+/* Define if you have the function `getegid'. */
+/* #define HAVE_GETEGID 1 */
+
+/* Define if you have the function `geteuid'. */
+/* #define HAVE_GETEUID 1 */
+
+/* Define if you have the function `getgid'. */
+/* #define HAVE_GETGID 1 */
+
+/* Define to 1 if you have the `gethostbyname2' function. */
+/* #undef HAVE_GETHOSTBYNAME2 */
+
+/* Define if you have the function `gethostname'. */
+#define HAVE_GETHOSTNAME 1
+
+/* Define if you have the function `getifaddrs'. */
+/* #undef HAVE_GETIFADDRS */
+
+/* Define if you have the function `getipnodebyaddr'. */
+/* #undef HAVE_GETIPNODEBYADDR */
+
+/* Define if you have the function `getipnodebyname'. */
+/* #undef HAVE_GETIPNODEBYNAME */
+
+/* Define to 1 if you have the `getlogin' function. */
+/* #define HAVE_GETLOGIN 1 */
+
+/* Define to 1 if you have the `getlogin_r' function. */
+/* #define HAVE_GETLOGIN_R 1 */
+
+/* Define if you have a working getmsg. */
+/* #undef HAVE_GETMSG */
+
+/* Define to 1 if you have the `getnameinfo' function. */
+#define HAVE_GETNAMEINFO 1
+
+/* Define if you have the function `getopt'. */
+/* #define HAVE_GETOPT 1 */
+
+/* Define to 1 if you have the `getpagesize' function. */
+/* #define HAVE_GETPAGESIZE 1 */
+
+/* Define to 1 if you have the `getpeereid' function. */
+/* #define HAVE_GETPEEREID 1 */
+
+/* Define to 1 if you have the `getpeerucred' function. */
+/* #undef HAVE_GETPEERUCRED */
+
+/* Define to 1 if you have the `getprogname' function. */
+/* #define HAVE_GETPROGNAME 1 */
+
+/* Define to 1 if you have the `getpwnam_r' function. */
+/* #define HAVE_GETPWNAM_R 1 */
+
+/* Define to 1 if you have the `getpwuid_r' function. */
+/* #define HAVE_GETPWUID_R 1 */
+
+/* Define to 1 if you have the `getrlimit' function. */
+/* #define HAVE_GETRLIMIT 1 */
+
+/* Define to 1 if you have the `getsockopt' function. */
+#define HAVE_GETSOCKOPT 1
+
+/* Define to 1 if you have the `getspnam' function. */
+/* #undef HAVE_GETSPNAM */
+
+/* Define if you have the function `gettimeofday'. */
+/* #define HAVE_GETTIMEOFDAY 1 */
+
+/* Define to 1 if you have the `getudbnam' function. */
+/* #undef HAVE_GETUDBNAM */
+
+/* Define if you have the function `getuid'. */
+/* #define HAVE_GETUID 1 */
+
+/* Define if you have the function `getusershell'. */
+/* #define HAVE_GETUSERSHELL 1 */
+
+/* Define to 1 if you have the `grantpt' function. */
+/* #define HAVE_GRANTPT 1 */
+
+/* Define to 1 if you have the <grp.h> header file. */
+/* #define HAVE_GRP_H 1 */
+
+/* Define to 1 if you have the `hstrerror' function. */
+/* #define HAVE_HSTRERROR 1 */
+
+/* Define if you have the `h_errlist' variable. */
+/* #undef HAVE_H_ERRLIST */
+
+/* Define if you have the `h_errno' variable. */
+/* #define HAVE_H_ERRNO 1 */
+
+/* Define if you have the `h_nerr' variable. */
+/* #undef HAVE_H_NERR */
+
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+/* #undef HAVE_IFADDRS_H */
+
+/* Define if you have the in6addr_loopback variable */
+/* #undef HAVE_IN6ADDR_LOOPBACK */
+
+/* */
+#define HAVE_INET_ADDR 1
+
+/* define */
+/* #define HAVE_INET_ATON 1 */
+
+/* define */
+/* #define HAVE_INET_NTOP 1 */
+
+/* define */
+/* #define HAVE_INET_PTON 1 */
+
+#if _WIN32_WINNT >= 0x0600
+
+#define HAVE_INET_NTOP 1
+
+#define HAVE_INET_PTON 1
+
+#endif
+
+/* Define if you have the function `initgroups'. */
+/* #define HAVE_INITGROUPS 1 */
+
+/* Define to 1 if you have the `initstate' function. */
+/* #define HAVE_INITSTATE 1 */
+
+/* Define if you have the function `innetgr'. */
+/* #undef HAVE_INNETGR */
+
+/* Define to 1 if the system has the type `int16_t'. */
+/* #define HAVE_INT16_T 1 */
+
+/* Define to 1 if the system has the type `int32_t'. */
+/* #define HAVE_INT32_T 1 */
+
+/* Define to 1 if the system has the type `int64_t'. */
+/* #define HAVE_INT64_T 1 */
+
+/* Define to 1 if the system has the type `int8_t'. */
+/* #define HAVE_INT8_T 1 */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+/* #define HAVE_INTTYPES_H 1 */
+
+/* Define to 1 if you have the <io.h> header file. */
+#define HAVE_IO_H 1
+
+/* Define if you have IPv6. */
+#define HAVE_IPV6 1
+
+/* Define to 1 if you have the `issetugid' function. */
+/* #undef HAVE_ISSETUGID */
+
+/* Define if you want to use the Kerberos Credentials Manager. */
+/* #define HAVE_KCM 1 */
+
+/* Define to 1 if you have the <libutil.h> header file. */
+/* #undef HAVE_LIBUTIL_H */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the `loadquery' function. */
+/* #undef HAVE_LOADQUERY */
+
+/* Define if you have the function `localtime_r'. */
+/* #define HAVE_LOCALTIME_R 1 */
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define to 1 if the system has the type `long long'. */
+#define HAVE_LONG_LONG 1
+
+/* Define if you have the function `lstat'. */
+/* #define HAVE_LSTAT 1 */
+
+/* Define to 1 if you have the <maillock.h> header file. */
+/* #undef HAVE_MAILLOCK_H */
+
+/* Define if you have the function `memmove'. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define if you have the function `mkstemp'. */
+/* #define HAVE_MKSTEMP 1 */
+
+/* Define to 1 if you have a working `mmap' system call. */
+/* #undef HAVE_MMAP */
+
+/* define if you have a ndbm library */
+/* #undef HAVE_NDBM */
+
+/* Define to 1 if you have the <ndbm.h> header file. */
+/* #undef HAVE_NDBM_H */
+
+/* Define to 1 if you have the <netdb.h> header file. */
+/* #define HAVE_NETDB_H 1 */
+
+/* Define to 1 if you have the <netgroup.h> header file. */
+/* #undef HAVE_NETGROUP_H */
+
+/* Define to 1 if you have the <netinet6/in6.h> header file. */
+/* #undef HAVE_NETINET6_IN6_H */
+
+/* Define to 1 if you have the <netinet6/in6_var.h> header file. */
+/* #undef HAVE_NETINET6_IN6_VAR_H */
+
+/* Define to 1 if you have the <netinet/in6.h> header file. */
+/* #undef HAVE_NETINET_IN6_H */
+
+/* Define to 1 if you have the <netinet/in6_machtypes.h> header file. */
+/* #undef HAVE_NETINET_IN6_MACHTYPES_H */
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+/* #define HAVE_NETINET_IN_H 1 */
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+/* #define HAVE_NETINET_TCP_H 1 */
+
+/* Define to 1 if you have the <netinet/in_systm.h> header file. */
+/* #define HAVE_NETINET_IN_SYSTM_H 1 */
+
+/* Define to 1 if you have the <netinet/ip.h> header file. */
+/* #define HAVE_NETINET_IP_H 1 */
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+/* #define HAVE_NETINET_TCP_H 1 */
+
+/* Define to 1 if you have the <net/if.h> header file. */
+/* #define HAVE_NET_IF_H 1 */
+
+/* Define if NDBM really is DB (creates files *.db) */
+/* #define HAVE_NEW_DB 1 */
+
+/* Define to 1 if you have the `on_exit' function. */
+/* #define HAVE_ON_EXIT 1 */
+
+/* Define to 1 if you have the '_onexit' function */
+#define HAVE__ONEXIT 1
+
+/* Define to 1 if you have the `openpty' function. */
+/* #define HAVE_OPENPTY 1 */
+
+/* define to 1 to use openssl's libcrypto as a (default) backend for libhcrypto */
+/* #undef HAVE_HCRYPTO_W_OPENSSL */
+
+/* Define to enable basic OSF C2 support. */
+/* #undef HAVE_OSFC2 */
+
+/* Define to 1 if you have the <paths.h> header file. */
+/* #define HAVE_PATHS_H 1 */
+
+/* Define to 1 if you have the `pidfile' function. */
+/* #undef HAVE_PIDFILE */
+
+/* Define to 1 if you have the `poll' function. */
+/* #define HAVE_POLL 1 */
+
+/* Define to 1 if you have the <poll.h> header file. */
+/* #define HAVE_POLL_H 1 */
+
+/* Define to 1 if you have the <pthread.h> header file. */
+/* This option is added by the NTMakefile if we have a <pthread.h>. */
+/* #define HAVE_PTHREAD_H 1 */
+
+/* Define to 1 if you have the <pty.h> header file. */
+/* #define HAVE_PTY_H 1 */
+
+/* Define if you have the function `putenv'. */
+#define HAVE_PUTENV 1
+
+/* Define to 1 if you have the <pwd.h> header file. */
+/* #define HAVE_PWD_H 1 */
+
+/* Define to 1 if you have the `rand' function. */
+#define HAVE_RAND 1
+
+/* Define to 1 if you have the `random' function. */
+/* #define HAVE_RANDOM 1 */
+
+/* Define if you have the function `rcmd'. */
+/* #define HAVE_RCMD 1 */
+
+/* Define if you have a readline compatible library. */
+/* #define HAVE_READLINE 1 */
+
+/* Define if you have the function `readv'. */
+/* #define HAVE_READV 1 */
+
+/* Define if you have the function `recvmsg'. */
+/* #define HAVE_RECVMSG 1 */
+
+/* Define to 1 if you have the <resolv.h> header file. */
+/* #undef HAVE_RESOLV_H */
+
+/* Define to 1 if you have the `res_ndestroy' function. */
+/* #undef HAVE_RES_NDESTROY */
+
+/* Define to 1 if you have the `res_nsearch' function. */
+/* #undef HAVE_RES_NSEARCH */
+
+/* Define to 1 if you have the `res_search' function. */
+/* #undef HAVE_RES_SEARCH */
+
+/* Define to 1 if you have the <rpcsvc/ypclnt.h> header file. */
+/* #undef HAVE_RPCSVC_YPCLNT_H */
+
+/* Define to 1 if you have the <sac.h> header file. */
+/* #undef HAVE_SAC_H */
+
+/* Define to 1 if the system has the type `sa_family_t'. */
+/* #define HAVE_SA_FAMILY_T 1 */
+
+/* Define to 1 if you have the <security/pam_modules.h> header file. */
+/* #undef HAVE_SECURITY_PAM_MODULES_H */
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define if you have the function `sendmsg'. */
+/* #define HAVE_SENDMSG 1 */
+
+/* Define if you have the function `setegid'. */
+/* #define HAVE_SETEGID 1 */
+
+/* Define if you have the function `setenv'. */
+#define HAVE_SETENV 1
+
+/* Define if you have the function `seteuid'. */
+/* #define HAVE_SETEUID 1 */
+
+/* Define to 1 if you have the `setitimer' function. */
+/* #define HAVE_SETITIMER 1 */
+
+/* Define to 1 if you have the `setlim' function. */
+/* #undef HAVE_SETLIM */
+
+/* Define to 1 if you have the `setlogin' function. */
+/* #undef HAVE_SETLOGIN */
+
+/* Define to 1 if you have the `setprogname' function. */
+/* #define HAVE_SETPROGNAME 1 */
+
+/* Define to 1 if you have the `setregid' function. */
+/* #define HAVE_SETREGID 1 */
+
+/* Define to 1 if you have the `setresgid' function. */
+/* #undef HAVE_SETRESGID */
+
+/* Define to 1 if you have the `setresuid' function. */
+/* #undef HAVE_SETRESUID */
+
+/* Define to 1 if you have the `setreuid' function. */
+/* #define HAVE_SETREUID 1 */
+
+/* Define to 1 if you have the `setsid' function. */
+/* #define HAVE_SETSID 1 */
+
+/* Define to 1 if you have the `setsockopt' function. */
+#define HAVE_SETSOCKOPT 1
+
+/* Define to 1 if you have the `setstate' function. */
+/* #define HAVE_SETSTATE 1 */
+
+/* Define to 1 if you have the <sgtty.h> header file. */
+/* #undef HAVE_SGTTY_H */
+
+/* Define to 1 if you have the <shadow.h> header file. */
+/* #undef HAVE_SHADOW_H */
+
+/* Define to 1 if you have the <siad.h> header file. */
+/* #undef HAVE_SIAD_H */
+
+/* Define to 1 if you have the `sigaction' function. */
+/* #define HAVE_SIGACTION 1 */
+
+/* Define to 1 if you have the <signal.h> header file. */
+#define HAVE_SIGNAL_H 1
+
+/* define if you have a working snprintf */
+/* snprintf() and vsnprintf() do exist. But the implementations are
+ not C99 compliant. */
+/* #define HAVE_SNPRINTF 1 */
+
+/* Define to 1 if the system has the type `socklen_t'. */
+#define HAVE_SOCKLEN_T 1
+
+/* Define to 1 if the system has the type `ssize_t'. */
+/* #define HAVE_SSIZE_T 1 */
+
+/* Define to 1 if you have the <standards.h> header file. */
+/* #undef HAVE_STANDARDS_H */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+/* #define HAVE_STDINT_H 1 */
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define if you have the function `strcasecmp'. */
+#define HAVE_STRCASECMP 1
+#define strcasecmp _stricmp
+
+/* Define if you have the function `strdup'. */
+#define HAVE_STRDUP 1
+
+/* Define if you have the function `strerror'. */
+#define HAVE_STRERROR 1
+
+/* Define if you have the function `strftime'. */
+/* #define HAVE_STRFTIME 1 */
+
+/* Define to 1 if you have the <strings.h> header file. */
+/* #define HAVE_STRINGS_H 1 */
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define if you have the function `strlcat'. */
+/* #define HAVE_STRLCAT 1 */
+
+/* Define if you have the function `strlcpy'. */
+/* #define HAVE_STRLCPY 1 */
+
+/* Define if you have the function `strlwr'. */
+#define HAVE_STRLWR 1
+
+/* Define if you have the function `strncasecmp'. */
+#define HAVE_STRNCASECMP 1
+#define strncasecmp _strnicmp
+
+/* Define if you have the function `strndup'. */
+/* #define HAVE_STRNDUP 1 */
+
+/* Define if you have the function `strnlen'. */
+#define HAVE_STRNLEN 1
+
+/* Define to 1 if you have the <stropts.h> header file. */
+/* #undef HAVE_STROPTS_H */
+
+/* Define if you have the function `strptime'. */
+/* #define HAVE_STRPTIME 1 */
+
+/* Define if you have the function `strsep'. */
+/* #define HAVE_STRSEP 1 */
+
+/* Define if you have the function `strsep_copy'. */
+/* #undef HAVE_STRSEP_COPY */
+
+/* Define to 1 if you have the `strsvis' function. */
+/* #undef HAVE_STRSVIS */
+
+/* Define if you have the function `strtok_r'. */
+/* #define HAVE_STRTOK_R 1 */
+
+#if defined(__has_include)
+# if __has_include(<corecrt.h>)
+# define HAVE_UCRT 1
+# endif
+#endif
+
+#ifdef HAVE_UCRT
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#endif
+
+/* Define to 1 if the system has the type `struct addrinfo'. */
+#define HAVE_STRUCT_ADDRINFO 1
+
+/* Define to 1 if the system has the type `struct ifaddrs'. */
+/* #undef HAVE_STRUCT_IFADDRS */
+
+/* Define to 1 if the system has the type `struct iovec'. */
+/* #define HAVE_STRUCT_IOVEC 1 */
+
+/* Define to 1 if the system has the type `struct msghdr'. */
+/* #define HAVE_STRUCT_MSGHDR 1 */
+
+/* Define to 1 if the system has the type `struct sockaddr'. */
+#define HAVE_STRUCT_SOCKADDR 1
+
+/* Define if struct sockaddr has field sa_len. */
+/* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */
+
+/* Define to 1 if the system has the type `struct sockaddr_storage'. */
+#define HAVE_STRUCT_SOCKADDR_STORAGE 1
+
+/* define if you have struct spwd */
+/* #undef HAVE_STRUCT_SPWD */
+
+/* Define if struct tm has field tm_gmtoff. */
+/* #undef HAVE_STRUCT_TM_TM_GMTOFF */
+
+/* Define if struct tm has field tm_zone. */
+/* #undef HAVE_STRUCT_TM_TM_ZONE */
+
+/* define if struct winsize is declared in sys/termios.h */
+/* #define HAVE_STRUCT_WINSIZE 1 */
+
+/* Define to 1 if you have the `strunvis' function. */
+/* #undef HAVE_STRUNVIS */
+
+/* Define if you have the function `strupr'. */
+#define HAVE_STRUPR 1
+
+/* Define to 1 if you have the `strvis' function. */
+/* #undef HAVE_STRVIS */
+
+/* Define to 1 if you have the `strvisx' function. */
+/* #undef HAVE_STRVISX */
+
+/* Define to 1 if you have the `svis' function. */
+/* #undef HAVE_SVIS */
+
+/* Define if you have the function `swab'. */
+#define HAVE_SWAB 1
+
+/* Define to 1 if you have the `sysconf' function. */
+/* #define HAVE_SYSCONF 1 */
+
+/* Define to 1 if you have the `sysctl' function. */
+/* #undef HAVE_SYSCTL */
+
+/* syslog is provided for _win32 in lib/roken */
+
+/* Define to 1 if you have the <syslog.h> header file. */
+#define HAVE_SYSLOG_H 1
+
+/* Define to 1 if you have the <sys/bitypes.h> header file. */
+/* #undef HAVE_SYS_BITYPES_H */
+
+/* Define to 1 if you have the <sys/bswap.h> header file. */
+/* #undef HAVE_SYS_BSWAP_H */
+
+/* Define to 1 if you have the <sys/capability.h> header file. */
+/* #undef HAVE_SYS_CAPABILITY_H */
+
+/* Define to 1 if you have the <sys/category.h> header file. */
+/* #undef HAVE_SYS_CATEGORY_H */
+
+/* Define to 1 if you have the <sys/file.h> header file. */
+/* #define HAVE_SYS_FILE_H 1 */
+
+/* Define to 1 if you have the <sys/filio.h> header file. */
+/* #undef HAVE_SYS_FILIO_H */
+
+/* Define to 1 if you have the <sys/ioccom.h> header file. */
+/* #undef HAVE_SYS_IOCCOM_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+/* #define HAVE_SYS_IOCTL_H 1 */
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+/* #define HAVE_SYS_MMAN_H 1 */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+/* #define HAVE_SYS_PARAM_H 1 */
+
+/* Define to 1 if you have the <sys/proc.h> header file. */
+/* #undef HAVE_SYS_PROC_H */
+
+/* Define to 1 if you have the <sys/ptyio.h> header file. */
+/* #undef HAVE_SYS_PTYIO_H */
+
+/* Define to 1 if you have the <sys/ptyvar.h> header file. */
+/* #undef HAVE_SYS_PTYVAR_H */
+
+/* Define to 1 if you have the <sys/pty.h> header file. */
+/* #undef HAVE_SYS_PTY_H */
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+/* #define HAVE_SYS_RESOURCE_H 1 */
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+/* #define HAVE_SYS_SELECT_H 1 */
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+/* #define HAVE_SYS_SOCKET_H 1 */
+
+/* Define to 1 if you have the <sys/sockio.h> header file. */
+/* #undef HAVE_SYS_SOCKIO_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/stream.h> header file. */
+/* #undef HAVE_SYS_STREAM_H */
+
+/* Define to 1 if you have the <sys/stropts.h> header file. */
+/* #undef HAVE_SYS_STROPTS_H */
+
+/* Define to 1 if you have the <sys/strtty.h> header file. */
+/* #undef HAVE_SYS_STRTTY_H */
+
+/* Define to 1 if you have the <sys/str_tty.h> header file. */
+/* #undef HAVE_SYS_STR_TTY_H */
+
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+/* #undef HAVE_SYS_SYSCALL_H */
+
+/* Define to 1 if you have the <sys/sysctl.h> header file. */
+/* #undef HAVE_SYS_SYSCTL_H */
+
+/* Define to 1 if you have the <sys/termio.h> header file. */
+/* #define HAVE_SYS_TERMIO_H 1 */
+
+/* Define to 1 if you have the <sys/timeb.h> header file. */
+#define HAVE_SYS_TIMEB_H 1
+
+/* Define to 1 if you have the <sys/times.h> header file. */
+/* #define HAVE_SYS_TIMES_H 1 */
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+/* #define HAVE_SYS_TIME_H 1 */
+
+/* Define to 1 if you have the <sys/tty.h> header file. */
+/* #undef HAVE_SYS_TTY_H */
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/ucred.h> header file. */
+/* #undef HAVE_SYS_UCRED_H */
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+/* #define HAVE_SYS_UIO_H 1 */
+
+/* Define to 1 if you have the <sys/un.h> header file. */
+/* #define HAVE_SYS_UN_H 1 */
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+/* #define HAVE_SYS_UTSNAME_H 1 */
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+/* #define HAVE_SYS_WAIT_H 1 */
+
+/* Define to 1 if you have the <termcap.h> header file. */
+/* #define HAVE_TERMCAP_H 1 */
+
+/* Define to 1 if you have the <termios.h> header file. */
+/* #define HAVE_TERMIOS_H 1 */
+
+/* Define to 1 if you have the <termio.h> header file. */
+/* #define HAVE_TERMIO_H 1 */
+
+/* Define to 1 if you have the <term.h> header file. */
+/* #undef HAVE_TERM_H */
+
+/* Define to 1 if you have the `tgetent' function. */
+/* #define HAVE_TGETENT 1 */
+
+/* Define if you have the function `timegm'. */
+/* #define HAVE_TIMEGM 1 */
+
+/* Define if you have the `timezone' variable. */
+#define HAVE_TIMEZONE 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the <tmpdir.h> header file. */
+/* #undef HAVE_TMPDIR_H */
+
+/* Define to 1 if you have the <udb.h> header file. */
+/* #undef HAVE_UDB_H */
+
+/* Define to 1 if the system has the type `uint16_t'. */
+/* #define HAVE_UINT16_T 1 */
+
+/* Define to 1 if the system has the type `uint32_t'. */
+/* #define HAVE_UINT32_T 1 */
+
+/* Define to 1 if the system has the type `uint64_t'. */
+/* #define HAVE_UINT64_T 1 */
+
+/* Define to 1 if the system has the type `uint8_t'. */
+/* #define HAVE_UINT8_T 1 */
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#define HAVE_UINTPTR_T 1
+
+/* Define to 1 if you have the `uname' function. */
+/* #define HAVE_UNAME 1 */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+/* #define HAVE_UNISTD_H 1 */
+
+/* Define to 1 if you have the `unlockpt' function. */
+/* #define HAVE_UNLOCKPT 1 */
+
+/* Define if you have the function `unsetenv'. */
+/* #define HAVE_UNSETENV 1 */
+
+/* Define to 1 if you have the `unvis' function. */
+/* #undef HAVE_UNVIS */
+
+/* Define to 1 if you have the <userconf.h> header file. */
+/* #undef HAVE_USERCONF_H */
+
+/* Define to 1 if you have the <usersec.h> header file. */
+/* #undef HAVE_USERSEC_H */
+
+/* Define to 1 if you have the <util.h> header file. */
+/* #undef HAVE_UTIL_H */
+
+/* Define to 1 if the system has the type `u_int16_t'. */
+/* #define HAVE_U_INT16_T 1 */
+
+/* Define to 1 if the system has the type `u_int32_t'. */
+/* #define HAVE_U_INT32_T 1 */
+
+/* Define to 1 if the system has the type `u_int64_t'. */
+/* #define HAVE_U_INT64_T 1 */
+
+/* Define to 1 if the system has the type `u_int8_t'. */
+/* #define HAVE_U_INT8_T 1 */
+
+/* Define to 1 if you have the `vasnprintf' function. */
+/* #undef HAVE_VASNPRINTF */
+
+/* Define to 1 if you have the `vasprintf' function. */
+/* #define HAVE_VASPRINTF 1 */
+
+/* Define if you have the function `verr'. */
+/* #define HAVE_VERR 1 */
+
+/* Define if you have the function `verrx'. */
+/* #define HAVE_VERRX 1 */
+
+/* Define to 1 if you have the `vis' function. */
+/* #undef HAVE_VIS */
+
+/* Define to 1 if you have the <vis.h> header file. */
+/* #undef HAVE_VIS_H */
+
+/* define if you have a working vsnprintf */
+/* snprintf() and vsnprintf() do exist. But the implementations are
+ not C99 compliant. */
+/* #define HAVE_VSNPRINTF 1 */
+
+/* Define if you have the function `vsyslog'. */
+#define HAVE_VSYSLOG 1
+
+/* Define if you have the function `vwarn'. */
+/* #define HAVE_VWARN 1 */
+
+/* Define if you have the function `vwarnx'. */
+/* #define HAVE_VWARNX 1 */
+
+/* Define if you have the function `warn'. */
+/* #define HAVE_WARN 1 */
+
+/* Define if you have the function `warnx'. */
+/* #define HAVE_WARNX 1 */
+
+/* Define if you have the function `writev'. */
+/* #define HAVE_WRITEV 1 */
+
+/* Defined if we have WinSock */
+#define HAVE_WINSOCK 1
+
+/* Defined if we have WinDNS */
+#define HAVE_WINDNS 1
+
+/* define if struct winsize has ws_xpixel */
+/* #define HAVE_WS_XPIXEL 1 */
+
+/* define if struct winsize has ws_ypixel */
+/* #define HAVE_WS_YPIXEL 1 */
+
+/* Define if you have the `_res' variable. */
+/* #undef HAVE__RES */
+
+/* Define to 1 if you have the `_scrsize' function. */
+/* #undef HAVE__SCRSIZE */
+
+/* define if your compiler has __attribute__ */
+/* #define HAVE___ATTRIBUTE__ 1 */
+
+/* Define if you have the `__progname' variable. */
+/* #define HAVE___PROGNAME 1 */
+
+/* Define if you are running IRIX 4. */
+/* #undef IRIX4 */
+
+/* define if the system is missing a prototype for asnprintf() */
+/* #define NEED_ASNPRINTF_PROTO 1 */
+
+/* define if the system is missing a prototype for asprintf() */
+/* #undef NEED_ASPRINTF_PROTO */
+
+/* define if the system is missing a prototype for crypt() */
+/* #undef NEED_CRYPT_PROTO */
+
+/* define if the system is missing a prototype for daemon() */
+/* #undef NEED_DAEMON_PROTO */
+
+/* define if the system is missing a prototype for gethostname() */
+/* #undef NEED_GETHOSTNAME_PROTO */
+
+/* define if the system is missing a prototype for getusershell() */
+/* #undef NEED_GETUSERSHELL_PROTO */
+
+/* define if the system is missing a prototype for glob() */
+/* #undef NEED_GLOB_PROTO */
+
+/* define if the system is missing a prototype for hstrerror() */
+/* #undef NEED_HSTRERROR_PROTO */
+
+/* define if the system is missing a prototype for inet_aton() */
+/* #undef NEED_INET_ATON_PROTO */
+
+/* define if the system is missing a prototype for mkstemp() */
+/* #define NEED_MKSTEMP_PROTO 1 */
+
+/* define if the system is missing a prototype for SecKeyGetCSPHandle() */
+/* #undef NEED_SECKEYGETCSPHANDLE_PROTO */
+
+/* define if the system is missing a prototype for setenv() */
+#define NEED_SETENV_PROTO 1
+
+/* define if the system is missing a prototype for snprintf() */
+/* #undef NEED_SNPRINTF_PROTO */
+
+/* define if the system is missing a prototype for strndup() */
+/* #undef NEED_STRNDUP_PROTO */
+
+/* define if the system is missing a prototype for strsep() */
+/* #undef NEED_STRSEP_PROTO */
+
+/* define if the system is missing a prototype for strsvis() */
+/* #define NEED_STRSVIS_PROTO 1 */
+
+/* define if the system is missing a prototype for strtok_r() */
+#define NEED_STRTOK_R_PROTO 1
+
+/* define if the system is missing a prototype for strunvis() */
+/* #define NEED_STRUNVIS_PROTO 1 */
+
+/* define if the system is missing a prototype for strvisx() */
+/* #define NEED_STRVISX_PROTO 1 */
+
+/* define if the system is missing a prototype for strvis() */
+/* #define NEED_STRVIS_PROTO 1 */
+
+/* define if the system is missing a prototype for svis() */
+/* #define NEED_SVIS_PROTO 1 */
+
+/* define if the system is missing a prototype for unsetenv() */
+/* #undef NEED_UNSETENV_PROTO */
+
+/* define if the system is missing a prototype for unvis() */
+/* #define NEED_UNVIS_PROTO 1 */
+
+/* define if the system is missing a prototype for vasnprintf() */
+/* #define NEED_VASNPRINTF_PROTO 1 */
+
+/* define if the system is missing a prototype for vasprintf() */
+/* #undef NEED_VASPRINTF_PROTO */
+
+/* define if the system is missing a prototype for vis() */
+/* #define NEED_VIS_PROTO 1 */
+
+/* define if the system is missing a prototype for vsnprintf() */
+/* #undef NEED_VSNPRINTF_PROTO */
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Define if you don't want to use mmap. */
+#define NO_MMAP 1
+
+/* Define if the Unix rand method is not defined */
+#define NO_RAND_UNIX_METHOD 1
+
+/* Define if the Fortuna rand method is not defined */
+#define NO_RAND_FORTUNA_METHOD 1
+
+/* Define if PID files should not be used. */
+#define NO_PIDFILES 1
+
+/* Define if SIGPIPE is not supported */
+#define NO_SIGPIPE 1
+
+/* Define if SIGXCPU is not supported */
+#define NO_SIGXCPU 1
+
+/* Define if sleep() is not available */
+#define NO_SLEEP 1
+
+/* Define to 1 if Unix sockets (AF_UNIX) are not available. */
+#define NO_UNIX_SOCKETS 1
+
+/* Define to 1 if POSIX link/unlink operations should be avoided.
+ This may be because the behavior of links are not not consistent
+ with POSIX or because the filesystem may not support POSIX
+ links. */
+#define NO_POSIX_LINKS 1
+
+/* Define this to enable old environment option in telnet. */
+/* #define OLD_ENVIRON 1 */
+
+/* define if prototype of openlog is compatible with void openlog(const char
+ *, int, int) */
+#define OPENLOG_PROTO_COMPATIBLE 1
+
+/* Define if getlogin has POSIX flavour (and not BSD). */
+/* #define POSIX_GETLOGIN 1 */
+
+/* Define if getlogin_r has POSIX flavour (and not BSD). */
+/* #define POSIX_GETLOGIN_R 1 */
+
+/* Define if getpwnam_r has POSIX flavour. */
+/* #define POSIX_GETPWNAM_R 1 */
+
+/* Define if getpwnam_r has POSIX flavour. */
+/* #define POSIX_GETPWUID_R 1 */
+
+/* Define if you have the readline package. */
+#define READLINE 1
+
+/* Define if rename() does not unlink an existing file */
+#define RENAME_DOES_NOT_UNLINK 1
+
+/* Define if you want to use samba socket wrappers. */
+/* #undef SOCKET_WRAPPER_REPLACE */
+
+/* Define if a socket is not a file descriptor */
+#define SOCKET_IS_NOT_AN_FD 1
+
+/* Define if FD_SETSIZE check does not apply to this platform */
+#define NO_LIMIT_FD_SETSIZE 1
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if you have streams ptys. */
+/* #undef STREAMSPTY */
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+/* #define TIME_WITH_SYS_TIME 1 */
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+/* #undef TM_IN_SYS_TIME */
+
+/* define if target is big endian */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define to 1 if the X Window System is missing or not being used. */
+#define X_DISPLAY_MISSING 1
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+ `char[]'. */
+/* #undef YYTEXT_POINTER */
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define to enable extensions on glibc-based systems such as Linux. */
+/* #define _GNU_SOURCE 1 */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Set this to the default system lead string for telnetd
+ * can contain %-escapes: %s=sysname, %m=machine, %r=os-release
+ * %v=os-version, %t=tty, %h=hostname, %d=date and time
+ */
+/* #undef USE_IM */
+
+/* Used with login -p */
+/* #undef LOGIN_ARGS */
+
+/* The size of `time_t', as computed by sizeof. */
+#if defined (_USE_64BIT_TIME_T) || !defined( _USE_32BIT_TIME_T)
+#define SIZEOF_TIME_T 8
+#else
+#define SIZEOF_TIME_T 4
+#endif
+
+#ifdef ROKEN_RENAME
+#include "roken_rename.h"
+#endif
+
+#if defined(ENCRYPTION) && !defined(AUTHENTICATION)
+#define AUTHENTICATION 1
+#endif
+
+
+
+/* Paths */
+
+#define SYSCONFDIR "%{COMMONCONFIG}"
+
+#define LIBDIR "%{LIBDIR}"
+
+#define CLIENT_KEYTAB_DEFAULT "FILE:%{LOCAL_APPDATA}\\Kerberos\\client.keytab"
+
+#endif /* RC_INVOKED */
+
+
+/* Version info */
+
+#define PACKAGE "@PACKAGE@"
+
+#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
+
+#define PACKAGE_NAME "@PACKAGE_NAME@"
+
+#define PACKAGE_STRING "@PACKAGE_NAME@ @PACKAGE_VERSION@"
+
+#define PACKAGE_TARNAME "@PACKAGE@"
+
+#define PACKAGE_VERSION "@PACKAGE_VERSION@"
+
+#define PACKAGE_COMPANY "@PACKAGE_COMPANY@"
+
+#define PACKAGE_COPYRIGHT "@PACKAGE_COPYRIGHT@"
+
+#define VERSION "@PACKAGE_VERSION@"
+
+#define RC_PRODVER_MAJOR @MAJOR@
+
+#define RC_PRODVER_MINOR @MINOR@
+
+#define RC_PRODVER_AUX @AUX@
+
+#define RC_PRODVER_PATCH @PATCH@
+
+#define RC_PRODVER_C @MAJOR@,@MINOR@,@AUX@,@PATCH@
+
+#define RC_PRODVER_CS "@MAJOR@,@MINOR@,@AUX@,@PATCH@"
+
+#define RC_PRODVER_DS "@MAJOR@.@MINOR@.@AUX@.@PATCH@"
+
+#define RC_PRODUCT_NAME_0409 PACKAGE_NAME
+
+#define RC_PRODUCT_VER_0409 PACKAGE_VERSION
+
+#define RC_COMPANY_0409 PACKAGE_COMPANY
+
+#define RC_COPYRIGHT_0409 PACKAGE_COPYRIGHT
+
+@VERSION_OPTDEFS@
+
+#endif /* __CONFIG_H__ */
diff --git a/third_party/heimdal/include/crypto-headers.h b/third_party/heimdal/include/crypto-headers.h
new file mode 100644
index 0000000..5c0b242
--- /dev/null
+++ b/third_party/heimdal/include/crypto-headers.h
@@ -0,0 +1,25 @@
+#ifndef __crypto_header__
+#define __crypto_header__
+
+#ifndef PACKAGE_NAME
+#error "need config.h"
+#endif
+
+#ifdef KRB5
+#include <krb5-types.h>
+#endif
+
+#include <hcrypto/evp.h>
+#include <hcrypto/des.h>
+#include <hcrypto/md4.h>
+#include <hcrypto/md5.h>
+#include <hcrypto/sha.h>
+#include <hcrypto/rc4.h>
+#include <hcrypto/rc2.h>
+#include <hcrypto/ui.h>
+#include <hcrypto/rand.h>
+#include <hcrypto/engine.h>
+#include <hcrypto/pkcs12.h>
+#include <hcrypto/hmac.h>
+
+#endif /* __crypto_header__ */
diff --git a/third_party/heimdal/include/gssapi/Makefile.am b/third_party/heimdal/include/gssapi/Makefile.am
new file mode 100644
index 0000000..c0b0508
--- /dev/null
+++ b/third_party/heimdal/include/gssapi/Makefile.am
@@ -0,0 +1,7 @@
+# $Id$
+
+include $(top_srcdir)/Makefile.am.common
+
+CLEANFILES = gssapi.h gssapi_krb5.h gssapi_spnego.h gssapi_ntlm.h gssapi_oid.h
+
+EXTRA_DIST = NTMakefile
diff --git a/third_party/heimdal/include/gssapi/NTMakefile b/third_party/heimdal/include/gssapi/NTMakefile
new file mode 100644
index 0000000..2f0e83b
--- /dev/null
+++ b/third_party/heimdal/include/gssapi/NTMakefile
@@ -0,0 +1,34 @@
+########################################################################
+#
+# Copyright (c) 2009, Secure Endpoints Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+RELDIR=include\gssapi
+
+!include ../../windows/NTMakefile.w32
diff --git a/third_party/heimdal/include/hcrypto/Makefile.am b/third_party/heimdal/include/hcrypto/Makefile.am
new file mode 100644
index 0000000..f15c779
--- /dev/null
+++ b/third_party/heimdal/include/hcrypto/Makefile.am
@@ -0,0 +1,31 @@
+# $Id$
+
+include $(top_srcdir)/Makefile.am.common
+
+CLEANFILES = \
+ aes.h \
+ bn.h \
+ des.h \
+ dh.h \
+ dsa.h \
+ ec.h \
+ ecdsa.h \
+ ecdh.h \
+ engine.h \
+ evp.h \
+ evp-hcrypto.h \
+ evp-cc.h \
+ hmac.h \
+ md2.h \
+ md4.h \
+ md5.h \
+ pkcs12.h \
+ rand.h \
+ rc2.h \
+ rc4.h \
+ rsa.h \
+ sha.h \
+ ui.h \
+ undef.h
+
+EXTRA_DIST = NTMakefile
diff --git a/third_party/heimdal/include/hcrypto/NTMakefile b/third_party/heimdal/include/hcrypto/NTMakefile
new file mode 100644
index 0000000..fd56cec
--- /dev/null
+++ b/third_party/heimdal/include/hcrypto/NTMakefile
@@ -0,0 +1,34 @@
+########################################################################
+#
+# Copyright (c) 2009, Secure Endpoints Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+RELDIR=include\hcrypto
+
+!include ../../windows/NTMakefile.w32
diff --git a/third_party/heimdal/include/heim_threads.h b/third_party/heimdal/include/heim_threads.h
new file mode 100644
index 0000000..3ed06d9
--- /dev/null
+++ b/third_party/heimdal/include/heim_threads.h
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) 2003-2016 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* $Id$ */
+
+/*
+ * Provide wrapper macros for thread synchronization primitives so we
+ * can use native thread functions for those operating system that
+ * supports it.
+ *
+ * This is so libkrb5.so (or more importantly, libgssapi.so) can have
+ * thread support while the program that that dlopen(3)s the library
+ * don't need to be linked to libpthread.
+ */
+
+#ifndef HEIM_THREADS_H
+#define HEIM_THREADS_H 1
+
+#include <errno.h>
+
+#ifdef _MSC_VER
+
+#define HEIMDAL_THREAD_LOCAL __declspec(thread)
+
+#else
+
+#if defined(__clang__) || defined(__GNUC__) || defined(__SUNPRO_C)
+#define HEIMDAL_THREAD_LOCAL __thread
+#else
+#error "thread-local attribute not defined for your compiler"
+#endif /* clang or gcc */
+
+#endif /* _MSC_VER */
+
+/* For testing the for-Windows implementation of thread keys on non-Windows */
+typedef unsigned long HEIM_PRIV_thread_key;
+
+
+/* assume headers already included */
+
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106120000 && __NetBSD_Version__< 299001200 && defined(ENABLE_PTHREAD_SUPPORT)
+
+/*
+ * NetBSD have a thread lib that we can use that part of libc that
+ * works regardless if application are linked to pthreads or not.
+ * NetBSD newer then 2.99.11 just use pthread.h, and the same thing
+ * will happen.
+ */
+#include <threadlib.h>
+
+#define HEIMDAL_MUTEX mutex_t
+#define HEIMDAL_MUTEX_INITIALIZER MUTEX_INITIALIZER
+#define HEIMDAL_MUTEX_init(m) mutex_init(m, NULL)
+#define HEIMDAL_MUTEX_lock(m) mutex_lock(m)
+#define HEIMDAL_MUTEX_unlock(m) mutex_unlock(m)
+#define HEIMDAL_MUTEX_destroy(m) mutex_destroy(m)
+
+#define HEIMDAL_RWLOCK rwlock_t
+#define HEIMDAL_RWLOCK_INITIALIZER RWLOCK_INITIALIZER
+#define HEIMDAL_RWLOCK_init(l) rwlock_init(l, NULL)
+#define HEIMDAL_RWLOCK_rdlock(l) rwlock_rdlock(l)
+#define HEIMDAL_RWLOCK_wrlock(l) rwlock_wrlock(l)
+#define HEIMDAL_RWLOCK_tryrdlock(l) rwlock_tryrdlock(l)
+#define HEIMDAL_RWLOCK_trywrlock(l) rwlock_trywrlock(l)
+#define HEIMDAL_RWLOCK_unlock(l) rwlock_unlock(l)
+#define HEIMDAL_RWLOCK_destroy(l) rwlock_destroy(l)
+
+#define HEIMDAL_thread_key thread_key_t
+#define HEIMDAL_key_create(k,d,r) do { r = thr_keycreate(k,d); } while(0)
+#define HEIMDAL_setspecific(k,s,r) do { r = thr_setspecific(k,s); } while(0)
+#define HEIMDAL_getspecific(k) thr_getspecific(k)
+#define HEIMDAL_key_delete(k) thr_keydelete(k)
+
+#define HEIMDAL_THREAD_ID thr_t
+#define HEIMDAL_THREAD_create(t,f,a) thr_create((t), 0, (f), (a))
+
+#elif defined(ENABLE_PTHREAD_SUPPORT) && (!defined(__NetBSD__) || __NetBSD_Version__ >= 299001200)
+
+#include <pthread.h>
+
+#define HEIMDAL_MUTEX pthread_mutex_t
+#define HEIMDAL_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#define HEIMDAL_MUTEX_init(m) pthread_mutex_init(m, NULL)
+#define HEIMDAL_MUTEX_lock(m) pthread_mutex_lock(m)
+#define HEIMDAL_MUTEX_unlock(m) pthread_mutex_unlock(m)
+#define HEIMDAL_MUTEX_destroy(m) pthread_mutex_destroy(m)
+
+#define HEIMDAL_RWLOCK pthread_rwlock_t
+#define HEIMDAL_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER
+#define HEIMDAL_RWLOCK_init(l) pthread_rwlock_init(l, NULL)
+#define HEIMDAL_RWLOCK_rdlock(l) pthread_rwlock_rdlock(l)
+#define HEIMDAL_RWLOCK_wrlock(l) pthread_rwlock_wrlock(l)
+#define HEIMDAL_RWLOCK_tryrdlock(l) pthread_rwlock_tryrdlock(l)
+#define HEIMDAL_RWLOCK_trywrlock(l) pthread_rwlock_trywrlock(l)
+#define HEIMDAL_RWLOCK_unlock(l) pthread_rwlock_unlock(l)
+#define HEIMDAL_RWLOCK_destroy(l) pthread_rwlock_destroy(l)
+
+#ifdef HEIM_BASE_MAINTAINER
+#define HEIMDAL_thread_key unsigned long
+#define HEIM_PRIV_thread_key HEIMDAL_thread_key
+#define HEIMDAL_key_create(k,d,r) do { r = heim_w32_key_create(k,d); } while(0)
+#define HEIMDAL_setspecific(k,s,r) do { r = heim_w32_setspecific(k,s); } while(0)
+#define HEIMDAL_getspecific(k) (heim_w32_getspecific(k))
+#define HEIMDAL_key_delete(k) (heim_w32_delete_key(k))
+#else
+#define HEIMDAL_thread_key pthread_key_t
+#define HEIMDAL_key_create(k,d,r) do { r = pthread_key_create(k,d); } while(0)
+#define HEIMDAL_setspecific(k,s,r) do { r = pthread_setspecific(k,s); } while(0)
+#define HEIMDAL_getspecific(k) pthread_getspecific(k)
+#define HEIMDAL_key_delete(k) pthread_key_delete(k)
+#endif
+
+#define HEIMDAL_THREAD_ID pthread_t
+#define HEIMDAL_THREAD_create(t,f,a) pthread_create((t), 0, (f), (a))
+
+#elif defined(_WIN32)
+
+typedef struct heim_mutex {
+ HANDLE h;
+} heim_mutex_t;
+
+static inline int
+heim_mutex_init(heim_mutex_t *m)
+{
+ m->h = CreateSemaphore(NULL, 1, 1, NULL);
+ if (m->h == INVALID_HANDLE_VALUE)
+ return EAGAIN;
+ return 0;
+}
+
+static inline int
+heim_mutex_lock(heim_mutex_t *m)
+{
+ HANDLE h, new_h;
+ int created = 0;
+
+ h = InterlockedCompareExchangePointer(&m->h, m->h, m->h);
+ if (h == INVALID_HANDLE_VALUE || h == NULL) {
+ created = 1;
+ new_h = CreateSemaphore(NULL, 0, 1, NULL);
+ if (new_h == INVALID_HANDLE_VALUE)
+ return EAGAIN;
+ if (InterlockedCompareExchangePointer(&m->h, new_h, h) != h) {
+ created = 0;
+ CloseHandle(new_h);
+ }
+ }
+ if (!created)
+ WaitForSingleObject(m->h, INFINITE);
+ return 0;
+}
+
+static inline int
+heim_mutex_unlock(heim_mutex_t *m)
+{
+ if (ReleaseSemaphore(m->h, 1, NULL) == FALSE)
+ return EPERM;
+ return 0;
+}
+
+static inline int
+heim_mutex_destroy(heim_mutex_t *m)
+{
+ HANDLE h;
+
+ h = InterlockedCompareExchangePointer(&m->h, INVALID_HANDLE_VALUE, m->h);
+ if (h != INVALID_HANDLE_VALUE)
+ CloseHandle(h);
+ return 0;
+}
+
+#define HEIMDAL_MUTEX heim_mutex_t
+#define HEIMDAL_MUTEX_INITIALIZER { INVALID_HANDLE_VALUE }
+#define HEIMDAL_MUTEX_init(m) heim_mutex_init((m))
+#define HEIMDAL_MUTEX_lock(m) heim_mutex_lock((m))
+#define HEIMDAL_MUTEX_unlock(m) heim_mutex_unlock((m))
+#define HEIMDAL_MUTEX_destroy(m) heim_mutex_destroy((m))
+
+typedef struct heim_rwlock {
+ SRWLOCK lock;
+ int exclusive;
+} heim_rwlock_t;
+
+static inline int
+heim_rwlock_init(heim_rwlock_t *l)
+{
+ InitializeSRWLock(&l->lock);
+ l->exclusive = 0;
+ return 0;
+}
+
+static inline int
+heim_rwlock_rdlock(heim_rwlock_t *l)
+{
+ AcquireSRWLockShared(&l->lock);
+ return 0;
+}
+
+static inline int
+heim_rwlock_wrlock(heim_rwlock_t *l)
+{
+ AcquireSRWLockExclusive(&l->lock);
+ l->exclusive = 1;
+ return 0;
+}
+
+static inline int
+heim_rwlock_tryrdlock(heim_rwlock_t *l)
+{
+ if (TryAcquireSRWLockShared(&l->lock))
+ return 0;
+ return EBUSY;
+}
+
+static inline int
+heim_rwlock_trywrlock(heim_rwlock_t *l)
+{
+ if (TryAcquireSRWLockExclusive(&l->lock))
+ return 0;
+ return EBUSY;
+}
+
+static inline int
+heim_rwlock_unlock(heim_rwlock_t *l)
+{
+ if (l->exclusive) {
+ l->exclusive = 0;
+ ReleaseSRWLockExclusive(&(l)->lock);
+ } else {
+ ReleaseSRWLockShared(&(l)->lock);
+ }
+ return 0;
+}
+
+static inline int
+heim_rwlock_destroy(heim_rwlock_t *l)
+{
+ /* SRW locks cannot be destroyed so re-initialize */
+ InitializeSRWLock(&l->lock);
+ l->exclusive = 0;
+ return 0;
+}
+
+#define HEIMDAL_RWLOCK heim_rwlock_t
+#define HEIMDAL_RWLOCK_INITIALIZER {SRWLOCK_INIT, 0}
+#define HEIMDAL_RWLOCK_init(l) heim_rwlock_init((l))
+#define HEIMDAL_RWLOCK_rdlock(l) heim_rwlock_rdlock((l))
+#define HEIMDAL_RWLOCK_wrlock(l) heim_rwlock_wrlock((l))
+#define HEIMDAL_RWLOCK_tryrdlock(l) heim_rwlock_tryrdlock((l))
+#define HEIMDAL_RWLOCK_trywrlock(l) heim_rwlock_trywrlock((l))
+#define HEIMDAL_RWLOCK_unlock(l) heim_rwlock_unlock((l))
+#define HEIMDAL_RWLOCK_destroy(l) heim_rwlock_destroy((l))
+
+#define HEIMDAL_thread_key unsigned long
+#define HEIM_PRIV_thread_key HEIMDAL_thread_key
+#define HEIMDAL_key_create(k,d,r) do { r = heim_w32_key_create(k,d); } while(0)
+#define HEIMDAL_setspecific(k,s,r) do { r = heim_w32_setspecific(k,s); } while(0)
+#define HEIMDAL_getspecific(k) (heim_w32_getspecific(k))
+#define HEIMDAL_key_delete(k) (heim_w32_delete_key(k))
+
+#define HEIMDAL_THREAD_ID DWORD
+#define HEIMDAL_THREAD_create(t,f,a) \
+ ((CreateThread(0, 0, (f), (a), 0, (t)) == INVALID_HANDLE_VALUE) ? EINVAL : 0)
+
+#elif defined(HEIMDAL_DEBUG_THREADS)
+
+/* no threads support, just do consistency checks */
+#include <stdlib.h>
+
+#define HEIMDAL_MUTEX int
+#define HEIMDAL_MUTEX_INITIALIZER 0
+#define HEIMDAL_MUTEX_init(m) do { (*(m)) = 0; } while(0)
+#define HEIMDAL_MUTEX_lock(m) do { if ((*(m))++ != 0) abort(); } while(0)
+#define HEIMDAL_MUTEX_unlock(m) do { if ((*(m))-- != 1) abort(); } while(0)
+#define HEIMDAL_MUTEX_destroy(m) do {if ((*(m)) != 0) abort(); } while(0)
+
+#define HEIMDAL_RWLOCK rwlock_t int
+#define HEIMDAL_RWLOCK_INITIALIZER 0
+#define HEIMDAL_RWLOCK_init(l) do { } while(0)
+#define HEIMDAL_RWLOCK_rdlock(l) do { } while(0)
+#define HEIMDAL_RWLOCK_wrlock(l) do { } while(0)
+#define HEIMDAL_RWLOCK_tryrdlock(l) do { } while(0)
+#define HEIMDAL_RWLOCK_trywrlock(l) do { } while(0)
+#define HEIMDAL_RWLOCK_unlock(l) do { } while(0)
+#define HEIMDAL_RWLOCK_destroy(l) do { } while(0)
+
+#define HEIMDAL_internal_thread_key 1
+
+#define HEIMDAL_THREAD_ID int
+#define HEIMDAL_THREAD_create(t,f,a) abort()
+
+#else /* no thread support, no debug case */
+
+#define HEIMDAL_MUTEX int
+#define HEIMDAL_MUTEX_INITIALIZER 0
+#define HEIMDAL_MUTEX_init(m) do { (void)(m); } while(0)
+#define HEIMDAL_MUTEX_lock(m) do { (void)(m); } while(0)
+#define HEIMDAL_MUTEX_unlock(m) do { (void)(m); } while(0)
+#define HEIMDAL_MUTEX_destroy(m) do { (void)(m); } while(0)
+
+#define HEIMDAL_RWLOCK rwlock_t int
+#define HEIMDAL_RWLOCK_INITIALIZER 0
+#define HEIMDAL_RWLOCK_init(l) do { } while(0)
+#define HEIMDAL_RWLOCK_rdlock(l) do { } while(0)
+#define HEIMDAL_RWLOCK_wrlock(l) do { } while(0)
+#define HEIMDAL_RWLOCK_tryrdlock(l) do { } while(0)
+#define HEIMDAL_RWLOCK_trywrlock(l) do { } while(0)
+#define HEIMDAL_RWLOCK_unlock(l) do { } while(0)
+#define HEIMDAL_RWLOCK_destroy(l) do { } while(0)
+
+#define HEIMDAL_THREAD_ID int
+#define HEIMDAL_THREAD_create(t,f,a) abort()
+
+#define HEIMDAL_internal_thread_key 1
+
+#endif /* no thread support */
+
+#ifdef HEIMDAL_internal_thread_key
+
+typedef struct heim_thread_key {
+ void *value;
+ void (*destructor)(void *);
+} heim_thread_key;
+
+#define HEIMDAL_thread_key heim_thread_key
+#define HEIMDAL_key_create(k,d,r) \
+ do { (k)->value = NULL; (k)->destructor = (d); r = 0; } while(0)
+#define HEIMDAL_setspecific(k,s,r) do { (k).value = s ; r = 0; } while(0)
+#define HEIMDAL_getspecific(k) ((k).value)
+#define HEIMDAL_key_delete(k) do { (*(k).destructor)((k).value); } while(0)
+
+#undef HEIMDAL_internal_thread_key
+#endif /* HEIMDAL_internal_thread_key */
+
+int heim_w32_key_create(HEIM_PRIV_thread_key *, void (*)(void *));
+int heim_w32_delete_key(HEIM_PRIV_thread_key);
+int heim_w32_setspecific(HEIM_PRIV_thread_key, void *);
+void *heim_w32_getspecific(HEIM_PRIV_thread_key);
+
+#endif /* HEIM_THREADS_H */
diff --git a/third_party/heimdal/include/heimqueue.h b/third_party/heimdal/include/heimqueue.h
new file mode 100644
index 0000000..5e922cf
--- /dev/null
+++ b/third_party/heimdal/include/heimqueue.h
@@ -0,0 +1,270 @@
+/* $NetBSD: queue.h,v 1.38 2004/04/18 14:12:05 lukem Exp $ */
+/* $Id$ */
+
+/*
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)queue.h 8.5 (Berkeley) 8/20/94
+ */
+
+#ifndef _HEIM_QUEUE_H_
+#define _HEIM_QUEUE_H_
+
+/*
+ * Singly-linked List definitions.
+ */
+#define HEIM_SLIST_HEAD(name, type) \
+struct name { \
+ struct type *slh_first; /* first element */ \
+}
+
+#define HEIM_SLIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#define HEIM_SLIST_ENTRY(type) \
+struct { \
+ struct type *sle_next; /* next element */ \
+}
+
+/*
+ * Singly-linked List functions.
+ */
+#define HEIM_SLIST_INIT(head) do { \
+ (head)->slh_first = NULL; \
+} while (/*CONSTCOND*/0)
+
+#define HEIM_SLIST_INSERT_AFTER(slistelm, elm, field) do { \
+ (elm)->field.sle_next = (slistelm)->field.sle_next; \
+ (slistelm)->field.sle_next = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define HEIM_SLIST_INSERT_HEAD(head, elm, field) do { \
+ (elm)->field.sle_next = (head)->slh_first; \
+ (head)->slh_first = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define HEIM_SLIST_REMOVE_HEAD(head, field) do { \
+ (head)->slh_first = (head)->slh_first->field.sle_next; \
+} while (/*CONSTCOND*/0)
+
+#define HEIM_SLIST_REMOVE(head, elm, type, field) do { \
+ if ((head)->slh_first == (elm)) { \
+ HEIM_SLIST_REMOVE_HEAD((head), field); \
+ } \
+ else { \
+ struct type *curelm = (head)->slh_first; \
+ while(curelm->field.sle_next != (elm)) \
+ curelm = curelm->field.sle_next; \
+ curelm->field.sle_next = \
+ curelm->field.sle_next->field.sle_next; \
+ } \
+} while (/*CONSTCOND*/0)
+
+#define HEIM_SLIST_FOREACH(var, head, field) \
+ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
+/*
+ * Singly-linked List access methods.
+ */
+#define HEIM_SLIST_EMPTY(head) ((head)->slh_first == NULL)
+#define HEIM_SLIST_FIRST(head) ((head)->slh_first)
+#define HEIM_SLIST_NEXT(elm, field) ((elm)->field.sle_next)
+
+/*
+ * Singly-linked List atomic functions.
+ */
+#include "heimbase.h"
+
+#define HEIM_SLIST_ATOMIC_HEAD(name, type) \
+struct name { \
+ heim_base_atomic(struct type *) slh_first; /* first element */ \
+}
+
+#define HEIM_SLIST_ATOMIC_ENTRY(type) \
+struct { \
+ heim_base_atomic(struct type *) sle_next; /* next element */ \
+}
+
+#define HEIM_SLIST_ATOMIC_INSERT_HEAD(head, elm, field) do { \
+ (elm)->field.sle_next = \
+ heim_base_exchange_pointer(&(head)->slh_first, (elm)); \
+} while (/*CONSTCOND*/0)
+
+#define HEIM_SLIST_ATOMIC_FOREACH(var, head, field) \
+ for ((var) = heim_base_atomic_load(&(head)->slh_first); \
+ (var) != NULL; \
+ (var) = heim_base_atomic_load(&(var)->field.sle_next))
+/*
+ * Tail queue definitions.
+ */
+#define HEIM_TAILQ_HEAD(name, type) \
+struct name { \
+ struct type *tqh_first; /* first element */ \
+ struct type **tqh_last; /* addr of last next element */ \
+}
+
+#define HEIM_TAILQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).tqh_first }
+#define HEIM_TAILQ_ENTRY(type) \
+struct { \
+ struct type *tqe_next; /* next element */ \
+ struct type **tqe_prev; /* address of previous next element */ \
+}
+
+/*
+ * Tail queue functions.
+ */
+#if defined(_KERNEL) && defined(QUEUEDEBUG)
+#define QUEUEDEBUG_HEIM_TAILQ_INSERT_HEAD(head, elm, field) \
+ if ((head)->tqh_first && \
+ (head)->tqh_first->field.tqe_prev != &(head)->tqh_first) \
+ panic("HEIM_TAILQ_INSERT_HEAD %p %s:%d", (head), __FILE__, __LINE__);
+#define QUEUEDEBUG_HEIM_TAILQ_INSERT_TAIL(head, elm, field) \
+ if (*(head)->tqh_last != NULL) \
+ panic("HEIM_TAILQ_INSERT_TAIL %p %s:%d", (head), __FILE__, __LINE__);
+#define QUEUEDEBUG_HEIM_TAILQ_OP(elm, field) \
+ if ((elm)->field.tqe_next && \
+ (elm)->field.tqe_next->field.tqe_prev != \
+ &(elm)->field.tqe_next) \
+ panic("HEIM_TAILQ_* forw %p %s:%d", (elm), __FILE__, __LINE__);\
+ if (*(elm)->field.tqe_prev != (elm)) \
+ panic("HEIM_TAILQ_* back %p %s:%d", (elm), __FILE__, __LINE__);
+#define QUEUEDEBUG_HEIM_TAILQ_PREREMOVE(head, elm, field) \
+ if ((elm)->field.tqe_next == NULL && \
+ (head)->tqh_last != &(elm)->field.tqe_next) \
+ panic("HEIM_TAILQ_PREREMOVE head %p elm %p %s:%d", \
+ (head), (elm), __FILE__, __LINE__);
+#define QUEUEDEBUG_HEIM_TAILQ_POSTREMOVE(elm, field) \
+ (elm)->field.tqe_next = (void *)1L; \
+ (elm)->field.tqe_prev = (void *)1L;
+#else
+#define QUEUEDEBUG_HEIM_TAILQ_INSERT_HEAD(head, elm, field)
+#define QUEUEDEBUG_HEIM_TAILQ_INSERT_TAIL(head, elm, field)
+#define QUEUEDEBUG_HEIM_TAILQ_OP(elm, field)
+#define QUEUEDEBUG_HEIM_TAILQ_PREREMOVE(head, elm, field)
+#define QUEUEDEBUG_HEIM_TAILQ_POSTREMOVE(elm, field)
+#endif
+
+#define HEIM_TAILQ_INIT(head) do { \
+ (head)->tqh_first = NULL; \
+ (head)->tqh_last = &(head)->tqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define HEIM_TAILQ_INSERT_HEAD(head, elm, field) do { \
+ QUEUEDEBUG_HEIM_TAILQ_INSERT_HEAD((head), (elm), field) \
+ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
+ (head)->tqh_first->field.tqe_prev = \
+ &(elm)->field.tqe_next; \
+ else \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+ (head)->tqh_first = (elm); \
+ (elm)->field.tqe_prev = &(head)->tqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define HEIM_TAILQ_INSERT_TAIL(head, elm, field) do { \
+ QUEUEDEBUG_HEIM_TAILQ_INSERT_TAIL((head), (elm), field) \
+ (elm)->field.tqe_next = NULL; \
+ (elm)->field.tqe_prev = (head)->tqh_last; \
+ *(head)->tqh_last = (elm); \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define HEIM_TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ QUEUEDEBUG_HEIM_TAILQ_OP((listelm), field) \
+ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
+ (elm)->field.tqe_next->field.tqe_prev = \
+ &(elm)->field.tqe_next; \
+ else \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+ (listelm)->field.tqe_next = (elm); \
+ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define HEIM_TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
+ QUEUEDEBUG_HEIM_TAILQ_OP((listelm), field) \
+ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
+ (elm)->field.tqe_next = (listelm); \
+ *(listelm)->field.tqe_prev = (elm); \
+ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define HEIM_TAILQ_REMOVE(head, elm, field) do { \
+ QUEUEDEBUG_HEIM_TAILQ_PREREMOVE((head), (elm), field) \
+ QUEUEDEBUG_HEIM_TAILQ_OP((elm), field) \
+ if (((elm)->field.tqe_next) != NULL) \
+ (elm)->field.tqe_next->field.tqe_prev = \
+ (elm)->field.tqe_prev; \
+ else \
+ (head)->tqh_last = (elm)->field.tqe_prev; \
+ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
+ QUEUEDEBUG_HEIM_TAILQ_POSTREMOVE((elm), field); \
+} while (/*CONSTCOND*/0)
+
+#define HEIM_TAILQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->tqh_first); \
+ (var); \
+ (var) = ((var)->field.tqe_next))
+
+#define HEIM_TAILQ_FOREACH_SAFE(var, head, field, next) \
+ for ((var) = ((head)->tqh_first); \
+ (var) != NULL && ((next) = HEIM_TAILQ_NEXT(var, field), 1); \
+ (var) = (next))
+
+#define HEIM_TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
+ (var); \
+ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
+#define HEIM_TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \
+ for ((var) = HEIM_TAILQ_LAST((head), headname); \
+ (var) && ((prev) = HEIM_TAILQ_PREV((var), headname, field), 1);\
+ (var) = (prev))
+
+#define HEIM_TAILQ_CONCAT(head1, head2, field) do { \
+ if (!HEIM_TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
+ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
+ (head1)->tqh_last = (head2)->tqh_last; \
+ HEIM_TAILQ_INIT((head2)); \
+ } \
+} while (/*CONSTCOND*/0)
+
+/*
+ * Tail queue access methods.
+ */
+#define HEIM_TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
+#define HEIM_TAILQ_FIRST(head) ((head)->tqh_first)
+#define HEIM_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#define HEIM_TAILQ_LAST(head, headname) \
+ (*(((struct headname *)((head)->tqh_last))->tqh_last))
+#define HEIM_TAILQ_PREV(elm, headname, field) \
+ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+
+#endif /* !_HEIM_QUEUE_H_ */
diff --git a/third_party/heimdal/include/kadm5/Makefile.am b/third_party/heimdal/include/kadm5/Makefile.am
new file mode 100644
index 0000000..d0ce25d
--- /dev/null
+++ b/third_party/heimdal/include/kadm5/Makefile.am
@@ -0,0 +1,8 @@
+# $Id$
+
+include $(top_srcdir)/Makefile.am.common
+
+CLEANFILES = admin.h kadm5_err.h private.h
+CLEANFILES += kadm5-private.h kadm5-protos.h kadm5-pwcheck.h
+
+EXTRA_DIST = NTMakefile
diff --git a/third_party/heimdal/include/kadm5/NTMakefile b/third_party/heimdal/include/kadm5/NTMakefile
new file mode 100644
index 0000000..26fc8d0
--- /dev/null
+++ b/third_party/heimdal/include/kadm5/NTMakefile
@@ -0,0 +1,34 @@
+########################################################################
+#
+# Copyright (c) 2009, Secure Endpoints Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+RELDIR=include\kadm5
+
+!include ../../windows/NTMakefile.w32
diff --git a/third_party/heimdal/include/krb5-types.cross b/third_party/heimdal/include/krb5-types.cross
new file mode 100644
index 0000000..4dc5c6a
--- /dev/null
+++ b/third_party/heimdal/include/krb5-types.cross
@@ -0,0 +1,67 @@
+/*
+ * generic krb5-types.h for cross compiling, assume system is posix/sus
+ */
+
+#ifndef __krb5_types_h__
+#define __krb5_types_h__
+
+#include <inttypes.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+typedef socklen_t krb5_socklen_t;
+#include <unistd.h>
+typedef ssize_t krb5_ssize_t;
+
+#if !defined(__has_extension)
+#define __has_extension(x) 0
+#endif
+
+#define KRB5TYPES_REQUIRE_GNUC(m,n,p) \
+ (((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100) + __GNUC_PATCHLEVEL__) >= \
+ (((m) * 10000) + ((n) * 100) + (p)))
+
+
+#ifndef HEIMDAL_DEPRECATED
+#if __has_extension(deprecated) || KRB5TYPES_REQUIRE_GNUC(3,1,0)
+#define HEIMDAL_DEPRECATED __attribute__ ((__deprecated__))
+#elif defined(_MSC_VER) && (_MSC_VER>1200)
+#define HEIMDAL_DEPRECATED __declspec(deprecated)
+#else
+#define HEIMDAL_DEPRECATED
+#endif
+#endif
+
+#ifndef HEIMDAL_PRINTF_ATTRIBUTE
+#if __has_extension(format) || KRB5TYPES_REQUIRE_GNUC(3,1,0)
+#define HEIMDAL_PRINTF_ATTRIBUTE(x) __attribute__ ((__format__ x))
+#else
+#define HEIMDAL_PRINTF_ATTRIBUTE(x)
+#endif
+#endif
+
+#ifndef HEIMDAL_NORETURN_ATTRIBUTE
+#if __has_extension(noreturn) || KRB5TYPES_REQUIRE_GNUC(3,1,0)
+#define HEIMDAL_NORETURN_ATTRIBUTE __attribute__ ((__noreturn__))
+#else
+#define HEIMDAL_NORETURN_ATTRIBUTE
+#endif
+#endif
+
+#ifndef HEIMDAL_UNUSED_ATTRIBUTE
+#if __has_extension(unused) || KRB5TYPES_REQUIRE_GNUC(3,1,0)
+#define HEIMDAL_UNUSED_ATTRIBUTE __attribute__ ((__unused__))
+#else
+#define HEIMDAL_UNUSED_ATTRIBUTE
+#endif
+#endif
+
+#ifndef HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE
+#if __has_extension(__warn_unused_result__) || KRB5TYPES_REQUIRE_GNUC(3,3,0)
+#define HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE __attribute__ ((__warn_unused_result__))
+#endif
+#endif
+
+typedef int krb5_socket_t;
+
+#endif /* __krb5_types_h__ */