[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Sun Nov 14 19:10:01 MST 2010


The branch, master has been updated
       via  02d3203 auth/gensec Handle incorrect username or password in Kerberos client code
       via  be8526a s4-kdc update startup routines after heimdal update
       via  bbfaa9b s4-kdc Remove use of heimdal private headers in kpasswd server.
       via  6a27fbb heimdal Extra files required for merge up to current heimdal
       via  192a555 heimdal regenate lex and yacc files
       via  f20cf61 Add attribute macros for Heimdal to use
       via  1342185 s4:heimdal: import lorikeet-heimdal-201011102149 (commit 5734d03c20e104c8f45533d07f2a2cbbd3224f29)
      from  13fd22f s4/dns: Build as shared module.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 02d320394fbe485ec706601c3edda7d90c8222da
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Nov 15 12:10:33 2010 +1100

    auth/gensec Handle incorrect username or password in Kerberos client code
    
    Andrew Bartlett
    
    Autobuild-User: Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date: Mon Nov 15 02:09:40 UTC 2010 on sn-devel-104

commit be8526a0a1dbc070ce14414b0ab132816ddd20f6
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Nov 15 09:08:43 2010 +1100

    s4-kdc update startup routines after heimdal update
    
    We should check the errors from krb5_kdc_windc_init and we now need to
    additionally run krb5_kdc_pkinit_config()
    
    Andrew Bartlett

commit bbfaa9bbdfc7f3c360a2d79124122a360aa9f493
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Nov 12 15:37:07 2010 +1100

    s4-kdc Remove use of heimdal private headers in kpasswd server.
    
    This remains an abuse, because it relies on setting into the krb5_principal
    structure, but at least it causes less trouble for the server.
    
    Andrew Bartlett

commit 6a27fbbfc4c51ae1635b8a5fa51c470ebc9f01e2
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Nov 12 15:27:43 2010 +1100

    heimdal Extra files required for merge up to current heimdal

commit 192a555c9ab425fa8e18ee5bed84a8c2fd527200
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Nov 12 13:15:57 2010 +1100

    heimdal regenate lex and yacc files

commit f20cf610809d74aff58a3711a0405f243da5dce4
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Nov 12 13:14:00 2010 +1100

    Add attribute macros for Heimdal to use
    
    Heimdal uses HEIMDAL_NORETURN_ATTRIBUTE and HEIMDAL_PRINTF_ATTRIBUTE,
    and we need to provide a link between these and Samba's function
    attribute handling.
    
    Andrew Bartlett

commit 1342185e333cb8139b7a70b7fe43571bcc2716a7
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Nov 11 11:27:33 2010 +1100

    s4:heimdal: import lorikeet-heimdal-201011102149 (commit 5734d03c20e104c8f45533d07f2a2cbbd3224f29)

-----------------------------------------------------------------------

Summary of changes:
 lib/util/attr.h                                    |   12 +
 source4/auth/gensec/gensec_gssapi.c                |    2 +
 source4/auth/gensec/gensec_krb5.c                  |    1 +
 source4/heimdal/base/array.c                       |  234 ++
 source4/heimdal/base/baselocl.h                    |   90 +
 source4/heimdal/base/bool.c                        |   58 +
 source4/heimdal/base/dict.c                        |  282 ++
 source4/heimdal/base/heimbase.c                    |  559 +++
 source4/heimdal/base/heimbase.h                    |  173 +
 source4/heimdal/base/heimbasepriv.h                |   91 +
 source4/heimdal/base/heimqueue.h                   |  167 +
 source4/heimdal/base/null.c                        |   52 +
 source4/heimdal/base/number.c                      |  127 +
 source4/heimdal/base/string.c                      |  146 +
 source4/heimdal/kdc/default_config.c               |   44 +-
 source4/heimdal/kuser/kinit.c                      |    5 +-
 source4/heimdal/lib/asn1/asn1parse.c               | 4149 +++++++-------------
 source4/heimdal/lib/asn1/asn1parse.h               |  329 +--
 source4/heimdal/lib/asn1/asn1parse.y               |   28 +-
 source4/heimdal/lib/asn1/gen_decode.c              |    8 +-
 source4/heimdal/lib/asn1/lex.c                     |   16 +-
 source4/heimdal/lib/asn1/lex.h                     |    2 +-
 source4/heimdal/lib/asn1/lex.l                     |   10 +-
 source4/heimdal/lib/asn1/symbol.c                  |    2 +-
 source4/heimdal/lib/com_err/lex.c                  |   12 +-
 source4/heimdal/lib/com_err/lex.h                  |    2 +-
 source4/heimdal/lib/com_err/lex.l                  |    4 +-
 source4/heimdal/lib/com_err/parse.c                | 2033 +++--------
 source4/heimdal/lib/com_err/parse.h                |   92 +-
 source4/heimdal/lib/com_err/parse.y                |    2 +-
 source4/heimdal/lib/gssapi/krb5/init_sec_context.c |   27 +-
 source4/heimdal/lib/hcrypto/dh-imath.c             |  254 --
 source4/heimdal/lib/hcrypto/dh-ltm.c               |   41 +-
 source4/heimdal/lib/hcrypto/dh.c                   |    8 +-
 source4/heimdal/lib/hcrypto/dh.h                   |    2 -
 source4/heimdal/lib/hcrypto/engine.c               |   20 -
 source4/heimdal/lib/hcrypto/imath/LICENSE          |   21 -
 source4/heimdal/lib/hcrypto/imath/imath.c          | 3353 ----------------
 source4/heimdal/lib/hcrypto/imath/imath.h          |  231 --
 source4/heimdal/lib/hcrypto/imath/iprime.c         |  189 -
 source4/heimdal/lib/hcrypto/imath/iprime.h         |   51 -
 source4/heimdal/lib/hcrypto/rsa-imath.c            |  688 ----
 source4/heimdal/lib/hcrypto/rsa.c                  |   17 +-
 source4/heimdal/lib/hcrypto/rsa.h                  |    2 -
 source4/heimdal/lib/hcrypto/sha.h                  |    6 +
 source4/heimdal/lib/hcrypto/sha512.c               |  108 +-
 source4/heimdal/lib/hx509/cms.c                    |   14 +-
 source4/heimdal/lib/hx509/collector.c              |    1 +
 source4/heimdal/lib/hx509/crypto.c                 |  103 +-
 source4/heimdal/lib/hx509/hx509.h                  |    8 +
 source4/heimdal/lib/hx509/hx509_err.et             |    1 +
 source4/heimdal/lib/hx509/ks_file.c                |    3 +-
 source4/heimdal/lib/hx509/ks_p12.c                 |    1 +
 source4/heimdal/lib/hx509/lex.yy.c                 | 1923 +++++++++
 source4/heimdal/lib/hx509/sel-gram.c               | 2178 +++--------
 source4/heimdal/lib/hx509/sel-gram.h               |   95 +-
 source4/heimdal/lib/hx509/sel-lex.c                |    8 +-
 source4/heimdal/lib/krb5/context.c                 |   26 +-
 source4/heimdal/lib/krb5/crypto-aes.c              |  170 +
 source4/heimdal/lib/krb5/crypto-algs.c             |   87 +
 source4/heimdal/lib/krb5/crypto-arcfour.c          |  325 ++
 source4/heimdal/lib/krb5/crypto-des-common.c       |  152 +
 source4/heimdal/lib/krb5/crypto-des.c              |  375 ++
 source4/heimdal/lib/krb5/crypto-des3.c             |  226 ++
 source4/heimdal/lib/krb5/crypto-evp.c              |  182 +
 source4/heimdal/lib/krb5/crypto-null.c             |   97 +
 source4/heimdal/lib/krb5/crypto-pk.c               |  292 ++
 source4/heimdal/lib/krb5/crypto-rand.c             |  109 +
 source4/heimdal/lib/krb5/crypto-stubs.c            |  102 +
 source4/heimdal/lib/krb5/crypto.c                  | 2720 +-------------
 source4/heimdal/lib/krb5/crypto.h                  |  182 +
 source4/heimdal/lib/krb5/data.c                    |   19 +
 source4/heimdal/lib/krb5/get_cred.c                |   96 +-
 source4/heimdal/lib/krb5/krb5_locl.h               |    5 +
 source4/heimdal/lib/krb5/misc.c                    |    7 +
 source4/heimdal/lib/krb5/mit_glue.c                |    3 +-
 source4/heimdal/lib/krb5/pac.c                     |  157 +-
 source4/heimdal/lib/krb5/plugin.c                  |  257 ++
 source4/heimdal/lib/krb5/salt-aes.c                |  103 +
 source4/heimdal/lib/krb5/salt-arcfour.c            |  112 +
 source4/heimdal/lib/krb5/salt-des.c                |  224 ++
 source4/heimdal/lib/krb5/salt-des3.c               |  150 +
 source4/heimdal/lib/krb5/salt.c                    |  304 ++
 source4/heimdal/lib/krb5/store-int.c               |   58 +
 source4/heimdal/lib/krb5/store.c                   |   24 -
 source4/heimdal/lib/ntlm/heimntlm.h                |   21 +-
 source4/heimdal/lib/ntlm/ntlm.c                    |  707 +++-
 source4/heimdal/lib/ntlm/ntlm_err.et               |   24 +
 source4/heimdal_build/config.h                     |    4 +-
 source4/heimdal_build/kpasswdd-glue.h              |    6 -
 source4/heimdal_build/wscript_build                |   42 +-
 source4/kdc/kdc.c                                  |   14 +-
 source4/kdc/kpasswdd.c                             |   19 +-
 93 files changed, 11014 insertions(+), 14472 deletions(-)
 create mode 100644 source4/heimdal/base/array.c
 create mode 100644 source4/heimdal/base/baselocl.h
 create mode 100644 source4/heimdal/base/bool.c
 create mode 100644 source4/heimdal/base/dict.c
 create mode 100644 source4/heimdal/base/heimbase.c
 create mode 100644 source4/heimdal/base/heimbase.h
 create mode 100644 source4/heimdal/base/heimbasepriv.h
 create mode 100644 source4/heimdal/base/heimqueue.h
 create mode 100644 source4/heimdal/base/null.c
 create mode 100644 source4/heimdal/base/number.c
 create mode 100644 source4/heimdal/base/string.c
 delete mode 100644 source4/heimdal/lib/hcrypto/dh-imath.c
 delete mode 100644 source4/heimdal/lib/hcrypto/imath/LICENSE
 delete mode 100644 source4/heimdal/lib/hcrypto/imath/imath.c
 delete mode 100644 source4/heimdal/lib/hcrypto/imath/imath.h
 delete mode 100644 source4/heimdal/lib/hcrypto/imath/iprime.c
 delete mode 100644 source4/heimdal/lib/hcrypto/imath/iprime.h
 delete mode 100644 source4/heimdal/lib/hcrypto/rsa-imath.c
 create mode 100644 source4/heimdal/lib/hx509/lex.yy.c
 create mode 100644 source4/heimdal/lib/krb5/crypto-aes.c
 create mode 100644 source4/heimdal/lib/krb5/crypto-algs.c
 create mode 100644 source4/heimdal/lib/krb5/crypto-arcfour.c
 create mode 100644 source4/heimdal/lib/krb5/crypto-des-common.c
 create mode 100644 source4/heimdal/lib/krb5/crypto-des.c
 create mode 100644 source4/heimdal/lib/krb5/crypto-des3.c
 create mode 100644 source4/heimdal/lib/krb5/crypto-evp.c
 create mode 100644 source4/heimdal/lib/krb5/crypto-null.c
 create mode 100644 source4/heimdal/lib/krb5/crypto-pk.c
 create mode 100644 source4/heimdal/lib/krb5/crypto-rand.c
 create mode 100644 source4/heimdal/lib/krb5/crypto-stubs.c
 create mode 100644 source4/heimdal/lib/krb5/crypto.h
 create mode 100644 source4/heimdal/lib/krb5/salt-aes.c
 create mode 100644 source4/heimdal/lib/krb5/salt-arcfour.c
 create mode 100644 source4/heimdal/lib/krb5/salt-des.c
 create mode 100644 source4/heimdal/lib/krb5/salt-des3.c
 create mode 100644 source4/heimdal/lib/krb5/salt.c
 create mode 100644 source4/heimdal/lib/krb5/store-int.c
 create mode 100644 source4/heimdal/lib/ntlm/ntlm_err.et
 delete mode 100644 source4/heimdal_build/kpasswdd-glue.h


Changeset truncated at 500 lines:

diff --git a/lib/util/attr.h b/lib/util/attr.h
index 9b34645..a269061 100644
--- a/lib/util/attr.h
+++ b/lib/util/attr.h
@@ -81,4 +81,16 @@
 #endif
 #endif
 
+#ifndef FORMAT_ATTRIBUTE
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
+/** Use gcc attribute to check printf fns.  a1 is argument to format()
+ * in the above macro.  This is needed to support Heimdal's printf
+ * decorations. Note that some gcc 2.x versions don't handle this
+ * properly, and as such I've used the same minimum from heimdal: GCC 3.1 **/
+#define FORMAT_ATTRIBUTE(a) __attribute__ ((format a))
+#else
+#define FORMAT_ATTRIBUTE(a)
+#endif
+#endif
+
 #endif /* __UTIL_ATTR_H__ */
diff --git a/source4/auth/gensec/gensec_gssapi.c b/source4/auth/gensec/gensec_gssapi.c
index a03cf9e..1a2e03f 100644
--- a/source4/auth/gensec/gensec_gssapi.c
+++ b/source4/auth/gensec/gensec_gssapi.c
@@ -370,6 +370,8 @@ static NTSTATUS gensec_gssapi_client_start(struct gensec_security *gensec_securi
 	case 0:
 		break;
 	case KRB5KDC_ERR_PREAUTH_FAILED:
+	case KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN:
+		DEBUG(1, ("Wrong username or password: %s\n", error_string));
 		return NT_STATUS_LOGON_FAILURE;
 	case KRB5_KDC_UNREACH:
 		DEBUG(3, ("Cannot reach a KDC we require to contact %s : %s\n", gensec_gssapi_state->target_principal, error_string));
diff --git a/source4/auth/gensec/gensec_krb5.c b/source4/auth/gensec/gensec_krb5.c
index 345ef36..b0ab3f6 100644
--- a/source4/auth/gensec/gensec_krb5.c
+++ b/source4/auth/gensec/gensec_krb5.c
@@ -285,6 +285,7 @@ static NTSTATUS gensec_krb5_common_client_start(struct gensec_security *gensec_s
 	case 0:
 		break;
 	case KRB5KDC_ERR_PREAUTH_FAILED:
+	case KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN:
 		return NT_STATUS_LOGON_FAILURE;
 	case KRB5_KDC_UNREACH:
 		DEBUG(3, ("Cannot reach a KDC we require to contact %s: %s\n", principal, error_string));
diff --git a/source4/heimdal/base/array.c b/source4/heimdal/base/array.c
new file mode 100644
index 0000000..7b0d77b
--- /dev/null
+++ b/source4/heimdal/base/array.c
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2010 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.
+ */
+
+#include "baselocl.h"
+
+/*
+ *
+ */
+
+struct heim_array_data {
+    size_t len;
+    heim_object_t *val;
+};
+
+static void
+array_dealloc(heim_object_t ptr)
+{
+    heim_array_t array = ptr;
+    size_t n;
+    for (n = 0; n < array->len; n++)
+	heim_release(array->val[n]);
+    free(array->val);
+}
+
+struct heim_type_data array_object = {
+    HEIM_TID_ARRAY,
+    "dict-object",
+    NULL,
+    array_dealloc,
+    NULL,
+    NULL,
+    NULL
+};
+
+/**
+ * Allocate an array
+ *
+ * @return A new allocated array, free with heim_release()
+ */
+
+heim_array_t
+heim_array_create(void)
+{
+    heim_array_t array;
+
+    array = _heim_alloc_object(&array_object, sizeof(*array));
+    if (array == NULL)
+	return NULL;
+
+    array->val = NULL;
+    array->len = 0;
+
+    return array;
+}
+
+/**
+ * Get type id of an dict
+ *
+ * @return the type id
+ */
+
+heim_tid_t
+heim_array_get_type_id(void)
+{
+    return HEIM_TID_ARRAY;
+}
+
+/**
+ * Append object to array
+ *
+ * @param array array to add too
+ * @param object the object to add
+ *
+ * @return zero if added, errno otherwise
+ */
+
+int
+heim_array_append_value(heim_array_t array, heim_object_t object)
+{
+    heim_object_t *ptr;
+
+    ptr = realloc(array->val, (array->len + 1) * sizeof(array->val[0]));
+    if (ptr == NULL)
+	return ENOMEM;
+    array->val = ptr;
+    array->val[array->len++] = heim_retain(object);
+
+    return 0;
+}
+
+/**
+ * Iterate over all objects in array
+ *
+ * @param array array to iterate over
+ * @param fn function to call on each object
+ * @param ctx context passed to fn
+ */
+
+void
+heim_array_iterate_f(heim_array_t array, heim_array_iterator_f_t fn, void *ctx)
+{
+    size_t n;
+    for (n = 0; n < array->len; n++)
+	fn(array->val[n], ctx);
+}
+
+#ifdef __BLOCKS__
+/**
+ * Iterate over all objects in array
+ *
+ * @param array array to iterate over
+ * @param fn block to call on each object
+ */
+
+void
+heim_array_iterate(heim_array_t array, void (^fn)(heim_object_t))
+{
+    size_t n;
+    for (n = 0; n < array->len; n++)
+	fn(array->val[n]);
+}
+#endif
+
+/**
+ * Get length of array
+ *
+ * @param array array to get length of
+ *
+ * @return length of array
+ */
+
+size_t
+heim_array_get_length(heim_array_t array)
+{
+    return array->len;
+}
+
+/**
+ * Copy value of array
+ *
+ * @param array array copy object from
+ * @param idx index of object, 0 based, must be smaller then
+ *        heim_array_get_length()
+ *
+ * @return a retained copy of the object
+ */
+
+heim_object_t
+heim_array_copy_value(heim_array_t array, size_t idx)
+{
+    if (idx >= array->len)
+	heim_abort("index too large");
+    return heim_retain(array->val[idx]);
+}
+
+/**
+ * Delete value at idx
+ *
+ * @param array the array to modify
+ * @param idx the key to delete
+ */
+
+void
+heim_array_delete_value(heim_array_t array, size_t idx)
+{
+    heim_object_t obj;
+    if (idx >= array->len)
+	heim_abort("index too large");
+    obj = array->val[idx];
+
+    array->len--;
+
+    if (idx < array->len)
+	memmove(&array->val[idx], &array->val[idx + 1],
+		(array->len - idx) * sizeof(array->val[0]));
+
+    heim_release(obj);
+}
+
+#ifdef __BLOCKS__
+/**
+ * Get value at idx
+ *
+ * @param array the array to modify
+ * @param idx the key to delete
+ */
+
+void
+heim_array_filter(heim_array_t array, bool (^block)(heim_object_t))
+{
+    size_t n = 0;
+
+    while (n < array->len) {
+	if (block(array->val[n])) {
+	    heim_array_delete_value(array, n);
+	} else {
+	    n++;
+	}
+    }
+}
+
+#endif /* __BLOCKS__ */
diff --git a/source4/heimdal/base/baselocl.h b/source4/heimdal/base/baselocl.h
new file mode 100644
index 0000000..3932378
--- /dev/null
+++ b/source4/heimdal/base/baselocl.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2010 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.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <limits.h>
+#include <unistd.h>
+
+#include "config.h"
+
+#include "heimqueue.h"
+#include "heim_threads.h"
+#include "heimbase.h"
+#include "heimbasepriv.h"
+
+#ifdef HAVE_DISPATCH_DISPATCH_H
+#include <dispatch/dispatch.h>
+#endif
+
+#ifdef __GNUC__
+#define heim_base_atomic_inc(x) __sync_add_and_fetch((x), 1)
+#define heim_base_atomic_dec(x) __sync_sub_and_fetch((x), 1)
+#define heim_base_atomic_type	unsigned int
+#define heim_base_atomic_max    UINT_MAX
+
+#define heim_base_exchange_pointer(t,v) __sync_lock_test_and_set((t), (v))
+
+#elif 0 /* windows */
+
+#define heim_base_exchange_pointer(t,v) InterlockedExchangePointer((t),(v))
+
+#else
+#error "provide atomic integer operations for your compiler"
+#endif
+
+/* tagged strings/object/XXX */
+#define heim_base_is_tagged(x) (((uintptr_t)(x)) & 0x3)
+
+#define heim_base_is_tagged_string(x) ((((uintptr_t)(x)) & 0x3) == 2)
+#define heim_base_make_tagged_string_ptr(x) ((heim_object_t)(((uintptr_t)(x)) | 2))
+#define heim_base_tagged_string_ptr(x) ((char *)(((uintptr_t)(x)) & (~3)))
+
+
+#define heim_base_is_tagged_object(x) ((((uintptr_t)(x)) & 0x3) == 1)
+#define heim_base_make_tagged_object(x, tid) \
+    ((heim_object_t)((((uintptr_t)(x)) << 5) | ((tid) << 2) | 0x1))
+#define heim_base_tagged_object_tid(x) ((((uintptr_t)(x)) & 0x1f) >> 2)
+#define heim_base_tagged_object_value(x) (((uintptr_t)(x)) >> 5)
+
+/*
+ *
+ */
+
+#undef HEIMDAL_NORETURN_ATTRIBUTE
+#define HEIMDAL_NORETURN_ATTRIBUTE
+#undef HEIMDAL_PRINTF_ATTRIBUTE
+#define HEIMDAL_PRINTF_ATTRIBUTE(x)
diff --git a/source4/heimdal/base/bool.c b/source4/heimdal/base/bool.c
new file mode 100644
index 0000000..72edcc7
--- /dev/null
+++ b/source4/heimdal/base/bool.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2010 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.
+ */
+
+#include "baselocl.h"
+
+struct heim_type_data _heim_bool_object = {
+    HEIM_TID_BOOL,
+    "bool-object",
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL
+};
+
+heim_bool_t
+heim_bool_create(int val)
+{
+    return heim_base_make_tagged_object(!!val, HEIM_TID_BOOL);
+}
+
+int
+heim_bool_val(heim_bool_t ptr)
+{
+    return heim_base_tagged_object_value(ptr);
+}
diff --git a/source4/heimdal/base/dict.c b/source4/heimdal/base/dict.c
new file mode 100644
index 0000000..2eb57aa
--- /dev/null
+++ b/source4/heimdal/base/dict.c
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2002, 1997 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.
+ */
+
+#include "baselocl.h"
+
+struct hashentry {
+    struct hashentry **prev;
+    struct hashentry *next;
+    heim_object_t key;
+    heim_object_t value;
+};
+
+struct heim_dict_data {
+    size_t size;
+    struct hashentry **tab;
+};


-- 
Samba Shared Repository


More information about the samba-cvs mailing list