mac mini build broken was Re: [SCM] Samba Shared Repository - branch master updated

Matthieu Patou mat at samba.org
Fri Dec 3 02:40:08 MST 2010


Hi Love,

Thanks to help me to fix this

So the best that I can do so far is to provide you with make V=1 output:

[1686/2283] Compiling heimdal/lib/gssapi/mech/context.c
10:03:45 runner ccache gcc -fPIC -fno-common 
-DSTATIC_gssapi_MODULES=NULL -DSTATIC_gssapi_MODULES_PROTO -MD 
-Idefault/source4/heimdal_build -I../heimdal_build 
-Idefault/source4/heimdal/lib/gssapi -I../heimdal/lib/gssapi 
-Idefault/source4/heimdal/lib/gssapi/gssapi 
-I../heimdal/lib/gssapi/gssapi 
-Idefault/source4/heimdal/lib/gssapi/spnego 
-I../heimdal/lib/gssapi/spnego -Idefault/source4/heimdal/lib/gssapi/krb5 
-I../heimdal/lib/gssapi/krb5 -Idefault/source4/heimdal/lib/gssapi/mech 
-I../heimdal/lib/gssapi/mech -Idefault/source4 -I.. -Idefault/lib 
-I../../lib -Idefault/source4/lib -I../lib -Idefault/source4/include 
-I../include -Idefault -I../.. -Idefault/lib/socket_wrapper 
-I../../lib/socket_wrapper -Idefault/source4/heimdal/lib/krb5 
-I../heimdal/lib/krb5 -Idefault/source4/heimdal/lib/asn1 
-I../heimdal/lib/asn1 -Idefault/source4/heimdal/include 
-I../heimdal/include -Idefault/lib/replace -I../../lib/replace 
-Idefault/source4/heimdal/lib/roken -I../heimdal/lib/roken 
-Idefault/source4/heimdal/lib/wind -I../heimdal/lib/wind 
-Idefault/source4/heimdal/lib/hcrypto/libtommath 
-I../heimdal/lib/hcrypto/libtommath -Idefault/lib/util/charset 
-I../../lib/util/charset -Idefault/lib/nss_wrapper 
-I../../lib/nss_wrapper -Idefault/lib/talloc -I../../lib/talloc 
-Idefault/source4/heimdal/lib/hcrypto -I../heimdal/lib/hcrypto 
-Idefault/source4/heimdal/lib -I../heimdal/lib 
-Idefault/source4/heimdal/lib/com_err -I../heimdal/lib/com_err 
-Idefault/source4/heimdal/lib/hx509 -I../heimdal/lib/hx509 
-Idefault/source4/param -I../param -Idefault/lib/uid_wrapper 
-I../../lib/uid_wrapper -Idefault/lib/crypto -I../../lib/crypto 
-Idefault/source4/dynconfig -I../dynconfig 
-Idefault/source4/heimdal/base -I../heimdal/base -D_SAMBA_BUILD_=4 
-DHAVE_CONFIG_H=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 
../heimdal/lib/gssapi/mech/context.c -c -o 
default/source4/heimdal/lib/gssapi/mech/context_66.o
In file included from ../heimdal/lib/gssapi/mech/mech_locl.h:62,
                  from ../heimdal/lib/gssapi/mech/context.c:2:
../heimdal/lib/gssapi/mech/cred.h:31: error: parse error before 
'SLIST_ENTRY'
../heimdal/lib/gssapi/mech/cred.h:31: warning: no semicolon at end of 
struct or union
../heimdal/lib/gssapi/mech/cred.h:35: error: parse error before '}' token
In file included from ../heimdal/lib/gssapi/mech/mech_locl.h:63,
                  from ../heimdal/lib/gssapi/mech/context.c:2:
../heimdal/lib/gssapi/mech/mech_switch.h:33: error: parse error before 
'SLIST_ENTRY'
../heimdal/lib/gssapi/mech/mech_switch.h:33: warning: no semicolon at 
end of struct or union
../heimdal/lib/gssapi/mech/mech_switch.h:38: error: parse error before 
'}' token
In file included from ../heimdal/lib/gssapi/mech/mech_locl.h:64,
                  from ../heimdal/lib/gssapi/mech/context.c:2:
../heimdal/lib/gssapi/mech/name.h:31: error: parse error before 
'SLIST_ENTRY'
../heimdal/lib/gssapi/mech/name.h:31: warning: no semicolon at end of 
struct or union
../heimdal/lib/gssapi/mech/name.h:35: error: parse error before '}' token
Waf: Leaving directory `/Users/build/build_farm/samba_4_0_test/source4/bin'
Build failed:  -> task failed (err #1):
         {task: cc context.c -> context_66.o}
gmake: *** [all] Error 1


Hope this will be helpfull.

Matthieu.

On 02/12/2010 23:28, Love Hörnquist Åstrand wrote:
> Matthieu,
>
> SLIST_ENTRY should be defined by "mechqueue.h" or<sys/queue.h>, without cpp output it hard to determine what went wrong.
>
> Love
>
>
> 2 dec 2010 kl. 03.45 skrev Matthieu Patou:
>
>> Hi Andrews,
>>
>> I highly suspect the new import of heimdal to be the root cause of the breakage on mac mini can one of you look on it ?
>>
>> Thanks.
>>
>> Matthieu.
>> On 01/12/2010 09:49, Andrew Tridgell wrote:
>>> The branch, master has been updated
>>>         via  b7172e7 s4-drs: cope with invalid NTDS DNs from DsReplicaInfo()
>>>         via  00ecbdb wintest: cope with w2k3 form of dcdiag output
>>>         via  06fd5b7 wintest Move stopping of BIND into a new step
>>>         via  c5bea98 s4:heimdal: import lorikeet-heimdal-201012010201 (commit 81fe27bcc0148d410ca4617f8759b9df1a5e935c)
>>>        from  9c84f98 wintest: make command matching case insensitive by default
>>>
>>> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
>>>
>>>
>>> - Log -----------------------------------------------------------------
>>> commit b7172e7a71b152be687fe5045565c8cd99a73a18
>>> Author: Andrew Tridgell<tridge at samba.org>
>>> Date:   Wed Dec 1 16:40:17 2010 +1100
>>>
>>>      s4-drs: cope with invalid NTDS DNs from DsReplicaInfo()
>>>
>>>      w2k3 sometimes returns a deleted DN
>>>
>>>      Autobuild-User: Andrew Tridgell<tridge at samba.org>
>>>      Autobuild-Date: Wed Dec  1 07:48:19 CET 2010 on sn-devel-104
>>>
>>> commit 00ecbdbbd13ba191400c6f4185df2dd8e72d1459
>>> Author: Andrew Tridgell<tridge at samba.org>
>>> Date:   Wed Dec 1 16:34:16 2010 +1100
>>>
>>>      wintest: cope with w2k3 form of dcdiag output
>>>
>>> commit 06fd5b70037728800cfeb2d1989ad8e851f604df
>>> Author: Andrew Bartlett<abartlet at samba.org>
>>> Date:   Wed Dec 1 15:34:19 2010 +1100
>>>
>>>      wintest Move stopping of BIND into a new step
>>>
>>>      We must run this early, to ensure that BIND isn't alive to write to
>>>      the zone file after provision has cleaned it up.
>>>
>>>      Andrew Bartlett
>>>
>>> commit c5bea98ddb2f7967df572160f639da3cba381a87
>>> Author: Andrew Bartlett<abartlet at samba.org>
>>> Date:   Mon Nov 29 11:24:08 2010 +1100
>>>
>>>      s4:heimdal: import lorikeet-heimdal-201012010201 (commit 81fe27bcc0148d410ca4617f8759b9df1a5e935c)
>>>
>>> -----------------------------------------------------------------------
>>>
>>> Summary of changes:
>>>   source4/heimdal/base/baselocl.h                   |   52 +-
>>>   source4/heimdal/base/heimbase.c                   |   15 +-
>>>   source4/heimdal/cf/make-proto.pl                  |    1 +
>>>   source4/heimdal/kdc/default_config.c              |    3 +-
>>>   source4/heimdal/kdc/kaserver.c                    |  955 --------------------
>>>   source4/heimdal/kdc/misc.c                        |   21 +-
>>>   source4/heimdal/kdc/process.c                     |   77 --
>>>   source4/heimdal/kuser/kinit.c                     |   14 +-
>>>   source4/heimdal/kuser/kuser_locl.h                |    3 +
>>>   source4/heimdal/lib/asn1/asn1parse.c              |  724 +++++++++--------
>>>   source4/heimdal/lib/asn1/asn1parse.y              |    4 +
>>>   source4/heimdal/lib/asn1/gen_template.c           |    4 +-
>>>   source4/heimdal/lib/com_err/com_err.h             |   20 -
>>>   source4/heimdal/lib/com_err/com_right.h           |   35 +-
>>>   source4/heimdal/lib/com_err/error.c               |    8 +-
>>>   source4/heimdal/lib/com_err/lex.c                 |   83 +--
>>>   source4/heimdal/lib/com_err/lex.h                 |    2 +-
>>>   source4/heimdal/lib/com_err/lex.l                 |    5 +-
>>>   source4/heimdal/lib/com_err/parse.c               |  265 ++++---
>>>   source4/heimdal/lib/com_err/parse.y               |    5 +-
>>>   source4/heimdal/lib/gssapi/gssapi/gssapi.h        |   85 ++-
>>>   source4/heimdal/lib/gssapi/gssapi/gssapi_krb5.h   |   73 --
>>>   source4/heimdal/lib/gssapi/gssapi/gssapi_oid.h    |  231 +++++
>>>   source4/heimdal/lib/gssapi/gssapi_mech.h          |   80 ++-
>>>   source4/heimdal/lib/gssapi/krb5/acquire_cred.c    |   14 +-
>>>   source4/heimdal/lib/gssapi/krb5/external.c        |  238 +++---
>>>   source4/heimdal/lib/gssapi/krb5/set_cred_option.c |    9 -
>>>   source4/heimdal/lib/gssapi/mech/gss_mech_switch.c |    2 +-
>>>   source4/heimdal/lib/gssapi/mech/gss_mo.c          |  464 ++++++++++
>>>   source4/heimdal/lib/gssapi/mech/gss_oid.c         |  253 ++++++
>>>   source4/heimdal/lib/gssapi/mech/gss_oid_equal.c   |    2 +-
>>>   source4/heimdal/lib/gssapi/mech/gss_oid_to_str.c  |   31 +
>>>   source4/heimdal/lib/gssapi/mech/gss_wrap.c        |   15 +
>>>   source4/heimdal/lib/gssapi/mech/mech_locl.h       |   15 +-
>>>   source4/heimdal/lib/gssapi/spnego/external.c      |   49 +-
>>>   source4/heimdal/lib/hcrypto/rsa-ltm.c             |    3 +-
>>>   source4/heimdal/lib/hcrypto/validate.c            |    1 -
>>>   source4/heimdal/lib/hdb/db.c                      |    2 +-
>>>   source4/heimdal/lib/hdb/hdb-keytab.c              |   10 +-
>>>   source4/heimdal/lib/hdb/hdb.c                     |    2 +-
>>>   source4/heimdal/lib/hdb/hdb.h                     |   22 +-
>>>   source4/heimdal/lib/hdb/keytab.c                  |   15 +-
>>>   source4/heimdal/lib/hdb/ndbm.c                    |    2 +-
>>>   source4/heimdal/lib/hx509/sel-gram.c              |  248 ++++---
>>>   source4/heimdal/lib/krb5/cache.c                  |   49 +-
>>>   source4/heimdal/lib/krb5/changepw.c               |   46 +-
>>>   source4/heimdal/lib/krb5/config_file.c            |   73 ++-
>>>   source4/heimdal/lib/krb5/constants.c              |   17 +-
>>>   source4/heimdal/lib/krb5/context.c                |   70 ++-
>>>   source4/heimdal/lib/krb5/convert_creds.c          |  134 +---
>>>   source4/heimdal/lib/krb5/creds.c                  |    2 +-
>>>   source4/heimdal/lib/krb5/crypto.c                 |    6 +-
>>>   source4/heimdal/lib/krb5/error_string.c           |    4 +-
>>>   source4/heimdal/lib/krb5/get_cred.c               |    3 +-
>>>   source4/heimdal/lib/krb5/kcm.c                    |    4 +-
>>>   source4/heimdal/lib/krb5/keyblock.c               |    2 +-
>>>   source4/heimdal/lib/krb5/krb5.h                   |    4 +-
>>>   source4/heimdal/lib/krb5/krb5_locl.h              |    6 +-
>>>   source4/heimdal/lib/krb5/misc.c                   |    2 +-
>>>   source4/heimdal/lib/krb5/pac.c                    |   62 +-
>>>   source4/heimdal/lib/krb5/padata.c                 |    2 +-
>>>   source4/heimdal/lib/krb5/pcache.c                 |    2 +-
>>>   source4/heimdal/lib/krb5/pkinit.c                 |   16 +-
>>>   source4/heimdal/lib/krb5/plugin.c                 |   70 ++-
>>>   source4/heimdal/lib/krb5/principal.c              |  437 +----------
>>>   source4/heimdal/lib/krb5/ticket.c                 |    2 +-
>>>   source4/heimdal/lib/krb5/v4_glue.c                |  960 ---------------------
>>>   source4/heimdal/lib/krb5/warn.c                   |    8 +
>>>   source4/heimdal/lib/ntlm/ntlm.c                   |   18 +-
>>>   source4/heimdal/lib/roken/getarg.c                |   14 +-
>>>   source4/heimdal/lib/roken/{xfree.c =>   rand.c}     |   16 +-
>>>   source4/heimdal/lib/roken/resolve.c               |    8 +-
>>>   source4/heimdal/lib/roken/roken-common.h          |   12 +
>>>   source4/heimdal/lib/roken/roken.h.in              |   43 +-
>>>   source4/heimdal/lib/roken/setprogname.c           |   33 +
>>>   source4/heimdal/lib/roken/socket.c                |   39 +-
>>>   source4/heimdal_build/roken.h                     |    3 +
>>>   source4/heimdal_build/wscript_build               |    8 +-
>>>   source4/kdc/hdb-samba4.c                          |   16 -
>>>   source4/kdc/kdc.c                                 |   11 +-
>>>   source4/scripting/python/samba/netcmd/drs.py      |    7 +-
>>>   wintest/test-s4-howto.py                          |   44 +-
>>>   wintest/wintest.py                                |    8 +-
>>>   83 files changed, 2670 insertions(+), 3753 deletions(-)
>>>   delete mode 100644 source4/heimdal/kdc/kaserver.c
>>>   create mode 100644 source4/heimdal/lib/gssapi/gssapi/gssapi_oid.h
>>>   create mode 100644 source4/heimdal/lib/gssapi/mech/gss_mo.c
>>>   create mode 100644 source4/heimdal/lib/gssapi/mech/gss_oid.c
>>>   delete mode 100644 source4/heimdal/lib/krb5/v4_glue.c
>>>   copy source4/heimdal/lib/roken/{xfree.c =>   rand.c} (85%)
>>>
>>>
>>> Changeset truncated at 500 lines:
>>>
>>> diff --git a/source4/heimdal/base/baselocl.h b/source4/heimdal/base/baselocl.h
>>> index 06806d2..5f15726 100644
>>> --- a/source4/heimdal/base/baselocl.h
>>> +++ b/source4/heimdal/base/baselocl.h
>>> @@ -33,13 +33,17 @@
>>>    * SUCH DAMAGE.
>>>    */
>>>
>>> +#include "config.h"
>>> +
>>>   #include<stdio.h>
>>>   #include<stdlib.h>
>>> +#include<string.h>
>>>   #include<errno.h>
>>>   #include<limits.h>
>>> -#include<unistd.h>
>>>
>>> -#include "config.h"
>>> +#ifdef HAVE_UNISTD_H
>>> +#include<unistd.h>
>>> +#endif
>>>
>>>   #include "heimqueue.h"
>>>   #include "heim_threads.h"
>>> @@ -50,14 +54,8 @@
>>>   #include<dispatch/dispatch.h>
>>>   #endif
>>>
>>> -#if HEIM_BASE_NON_ATOMIC
>>> -/* non-atomic varients */
>>> -#define heim_base_atomic_inc(x) ++(*(x))
>>> -#define heim_base_atomic_dec(x) --(*(x))
>>> -#define heim_base_atomic_type	unsigned int
>>> -#define heim_base_atomic_max    UINT_MAX
>>> +#if defined(__GNUC__)&&   defined(HAVE___SYNC_ADD_AND_FETCH)
>>>
>>> -#elif defined(__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
>>> @@ -65,12 +63,44 @@
>>>
>>>   #define heim_base_exchange_pointer(t,v) __sync_lock_test_and_set((t), (v))
>>>
>>> -#elif 0 /* windows */
>>> +#elif defined(_WIN32)
>>> +
>>> +#define heim_base_atomic_inc(x) InterlockedIncrement(x)
>>> +#define heim_base_atomic_dec(x) InterlockedDecrement(x)
>>> +#define heim_base_atomic_type	LONG
>>> +#define heim_base_atomic_max    MAXLONG
>>>
>>>   #define heim_base_exchange_pointer(t,v) InterlockedExchangePointer((t),(v))
>>>
>>>   #else
>>> -#error "provide atomic integer operations for your compiler"
>>> +
>>> +#define HEIM_BASE_NEED_ATOMIC_MUTEX 1
>>> +extern HEIMDAL_MUTEX _heim_base_mutex;
>>> +
>>> +#define heim_base_atomic_type	unsigned int
>>> +
>>> +static inline heim_base_atomic_type
>>> +heim_base_atomic_inc(heim_base_atomic_type *x)
>>> +{
>>> +    heim_base_atomic_type t;
>>> +    HEIMDAL_MUTEX_lock(&_heim_base_mutex);
>>> +    t = ++(*x);
>>> +    HEIMDAL_MUTEX_unlock(&_heim_base_mutex);
>>> +    return t;
>>> +}
>>> +
>>> +static inline heim_base_atomic_type
>>> +heim_base_atomic_dec(heim_base_atomic_type *x)
>>> +{
>>> +    heim_base_atomic_type t;
>>> +    HEIMDAL_MUTEX_lock(&_heim_base_mutex);
>>> +    t = --(*x);
>>> +    HEIMDAL_MUTEX_unlock(&_heim_base_mutex);
>>> +    return t;
>>> +}
>>> +
>>> +#define heim_base_atomic_max    UINT_MAX
>>> +
>>>   #endif
>>>
>>>   /* tagged strings/object/XXX */
>>> diff --git a/source4/heimdal/base/heimbase.c b/source4/heimdal/base/heimbase.c
>>> index 137129a..b8d5d74 100644
>>> --- a/source4/heimdal/base/heimbase.c
>>> +++ b/source4/heimdal/base/heimbase.c
>>> @@ -60,6 +60,10 @@ struct heim_base_mem {
>>>   #define PTR2BASE(ptr) (((struct heim_base *)ptr) - 1)
>>>   #define BASE2PTR(ptr) ((void *)(((struct heim_base *)ptr) + 1))
>>>
>>> +#ifdef HEIM_BASE_NEED_ATOMIC_MUTEX
>>> +HEIMDAL_MUTEX _heim_base_mutex = HEIMDAL_MUTEX_INITIALIZER;
>>> +#endif
>>> +
>>>   /*
>>>    * Auto release structure
>>>    */
>>> @@ -334,6 +338,8 @@ heim_base_once_f(heim_base_once_t *once, void *ctx, void (*func)(void *))
>>>       } else {
>>>   	HEIMDAL_MUTEX_unlock(&mutex);
>>>   	while (1) {
>>> +	    struct timeval tv = { 0, 1000 };
>>> +	    select(0, NULL, NULL, NULL,&tv);
>>>   	    HEIMDAL_MUTEX_lock(&mutex);
>>>   	    if (*once == 2)
>>>   		break;
>>> @@ -364,13 +370,10 @@ heim_abort(const char *fmt, ...)
>>>   void
>>>   heim_abortv(const char *fmt, va_list ap)
>>>   {
>>> -    char *str = NULL;
>>> -    int ret;
>>> +    static char str[1024];
>>>
>>> -    ret = vasprintf(&str, fmt, ap);
>>> -    if (ret>   0&&   str) {
>>> -	syslog(LOG_ERR, "heim_abort: %s", str);
>>> -    }
>>> +    vsnprintf(str, sizeof(str), fmt, ap);
>>> +    syslog(LOG_ERR, "heim_abort: %s", str);
>>>       abort();
>>>   }
>>>
>>> diff --git a/source4/heimdal/cf/make-proto.pl b/source4/heimdal/cf/make-proto.pl
>>> index 566534f..bc323b9 100644
>>> --- a/source4/heimdal/cf/make-proto.pl
>>> +++ b/source4/heimdal/cf/make-proto.pl
>>> @@ -180,6 +180,7 @@ sub foo {
>>>       local ($arg) = @_;
>>>       $_ = $arg;
>>>       s/.*\/([^\/]*)/$1/;
>>> +    s/.*\\([^\\]*)/$1/;
>>>       s/[^a-zA-Z0-9]/_/g;
>>>       "__" . $_ . "__";
>>>   }
>>> diff --git a/source4/heimdal/kdc/default_config.c b/source4/heimdal/kdc/default_config.c
>>> index 66108f4..e262453 100644
>>> --- a/source4/heimdal/kdc/default_config.c
>>> +++ b/source4/heimdal/kdc/default_config.c
>>> @@ -296,7 +296,6 @@ krb5_kdc_pkinit_config(krb5_context context, krb5_kdc_configuration *config)
>>>
>>>       }
>>>
>>> -#endif /* PKINIT */
>>> -
>>>       return 0;
>>> +#endif /* PKINIT */
>>>   }
>>> diff --git a/source4/heimdal/kdc/kaserver.c b/source4/heimdal/kdc/kaserver.c
>>> deleted file mode 100644
>>> index 827205a..0000000
>>> --- a/source4/heimdal/kdc/kaserver.c
>>> +++ /dev/null
>>> @@ -1,955 +0,0 @@
>>> -/*
>>> - * Copyright (c) 1997 - 2005 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.
>>> - */
>>> -
>>> -#include "kdc_locl.h"
>>> -
>>> -#ifdef KRB4
>>> -
>>> -#include<krb5-v4compat.h>
>>> -#include<rx.h>
>>> -
>>> -#define KA_AUTHENTICATION_SERVICE 731
>>> -#define KA_TICKET_GRANTING_SERVICE 732
>>> -#define KA_MAINTENANCE_SERVICE 733
>>> -
>>> -#define AUTHENTICATE_OLD	 1
>>> -#define CHANGEPASSWORD		 2
>>> -#define GETTICKET_OLD		 3
>>> -#define SETPASSWORD		 4
>>> -#define SETFIELDS		 5
>>> -#define CREATEUSER		 6
>>> -#define DELETEUSER		 7
>>> -#define GETENTRY		 8
>>> -#define LISTENTRY		 9
>>> -#define GETSTATS		10
>>> -#define DEBUG			11
>>> -#define GETPASSWORD		12
>>> -#define GETRANDOMKEY		13
>>> -#define AUTHENTICATE		21
>>> -#define AUTHENTICATE_V2		22
>>> -#define GETTICKET		23
>>> -
>>> -/* XXX - Where do we get these? */
>>> -
>>> -#define RXGEN_OPCODE (-455)
>>> -
>>> -#define KADATABASEINCONSISTENT                   (180480L)
>>> -#define KAEXIST                                  (180481L)
>>> -#define KAIO                                     (180482L)
>>> -#define KACREATEFAIL                             (180483L)
>>> -#define KANOENT                                  (180484L)
>>> -#define KAEMPTY                                  (180485L)
>>> -#define KABADNAME                                (180486L)
>>> -#define KABADINDEX                               (180487L)
>>> -#define KANOAUTH                                 (180488L)
>>> -#define KAANSWERTOOLONG                          (180489L)
>>> -#define KABADREQUEST                             (180490L)
>>> -#define KAOLDINTERFACE                           (180491L)
>>> -#define KABADARGUMENT                            (180492L)
>>> -#define KABADCMD                                 (180493L)
>>> -#define KANOKEYS                                 (180494L)
>>> -#define KAREADPW                                 (180495L)
>>> -#define KABADKEY                                 (180496L)
>>> -#define KAUBIKINIT                               (180497L)
>>> -#define KAUBIKCALL                               (180498L)
>>> -#define KABADPROTOCOL                            (180499L)
>>> -#define KANOCELLS                                (180500L)
>>> -#define KANOCELL                                 (180501L)
>>> -#define KATOOMANYUBIKS                           (180502L)
>>> -#define KATOOMANYKEYS                            (180503L)
>>> -#define KABADTICKET                              (180504L)
>>> -#define KAUNKNOWNKEY                             (180505L)
>>> -#define KAKEYCACHEINVALID                        (180506L)
>>> -#define KABADSERVER                              (180507L)
>>> -#define KABADUSER                                (180508L)
>>> -#define KABADCPW                                 (180509L)
>>> -#define KABADCREATE                              (180510L)
>>> -#define KANOTICKET                               (180511L)
>>> -#define KAASSOCUSER                              (180512L)
>>> -#define KANOTSPECIAL                             (180513L)
>>> -#define KACLOCKSKEW                              (180514L)
>>> -#define KANORECURSE                              (180515L)
>>> -#define KARXFAIL                                 (180516L)
>>> -#define KANULLPASSWORD                           (180517L)
>>> -#define KAINTERNALERROR                          (180518L)
>>> -#define KAPWEXPIRED                              (180519L)
>>> -#define KAREUSED                                 (180520L)
>>> -#define KATOOSOON                                (180521L)
>>> -#define KALOCKED                                 (180522L)
>>> -
>>> -
>>> -static krb5_error_code
>>> -decode_rx_header (krb5_storage *sp,
>>> -		  struct rx_header *h)
>>> -{
>>> -    krb5_error_code ret;
>>> -
>>> -    ret = krb5_ret_uint32(sp,&h->epoch);
>>> -    if (ret) return ret;
>>> -    ret = krb5_ret_uint32(sp,&h->connid);
>>> -    if (ret) return ret;
>>> -    ret = krb5_ret_uint32(sp,&h->callid);
>>> -    if (ret) return ret;
>>> -    ret = krb5_ret_uint32(sp,&h->seqno);
>>> -    if (ret) return ret;
>>> -    ret = krb5_ret_uint32(sp,&h->serialno);
>>> -    if (ret) return ret;
>>> -    ret = krb5_ret_uint8(sp,&h->type);
>>> -    if (ret) return ret;
>>> -    ret = krb5_ret_uint8(sp,&h->flags);
>>> -    if (ret) return ret;
>>> -    ret = krb5_ret_uint8(sp,&h->status);
>>> -    if (ret) return ret;
>>> -    ret = krb5_ret_uint8(sp,&h->secindex);
>>> -    if (ret) return ret;
>>> -    ret = krb5_ret_uint16(sp,&h->reserved);
>>> -    if (ret) return ret;
>>> -    ret = krb5_ret_uint16(sp,&h->serviceid);
>>> -    if (ret) return ret;
>>> -
>>> -    return 0;
>>> -}
>>> -
>>> -static krb5_error_code
>>> -encode_rx_header (struct rx_header *h,
>>> -		  krb5_storage *sp)
>>> -{
>>> -    krb5_error_code ret;
>>> -
>>> -    ret = krb5_store_uint32(sp, h->epoch);
>>> -    if (ret) return ret;
>>> -    ret = krb5_store_uint32(sp, h->connid);
>>> -    if (ret) return ret;
>>> -    ret = krb5_store_uint32(sp, h->callid);
>>> -    if (ret) return ret;
>>> -    ret = krb5_store_uint32(sp, h->seqno);
>>> -    if (ret) return ret;
>>> -    ret = krb5_store_uint32(sp, h->serialno);
>>> -    if (ret) return ret;
>>> -    ret = krb5_store_uint8(sp,  h->type);
>>> -    if (ret) return ret;
>>> -    ret = krb5_store_uint8(sp,  h->flags);
>>> -    if (ret) return ret;
>>> -    ret = krb5_store_uint8(sp,  h->status);
>>> -    if (ret) return ret;
>>> -    ret = krb5_store_uint8(sp,  h->secindex);
>>> -    if (ret) return ret;
>>> -    ret = krb5_store_uint16(sp, h->reserved);
>>> -    if (ret) return ret;
>>> -    ret = krb5_store_uint16(sp, h->serviceid);
>>> -    if (ret) return ret;
>>> -
>>> -    return 0;
>>> -}
>>> -
>>> -static void
>>> -init_reply_header (struct rx_header *hdr,
>>> -		   struct rx_header *reply_hdr,
>>> -		   u_char type,
>>> -		   u_char flags)
>>> -{
>>> -    reply_hdr->epoch     = hdr->epoch;
>>> -    reply_hdr->connid    = hdr->connid;
>>> -    reply_hdr->callid    = hdr->callid;
>>> -    reply_hdr->seqno     = 1;
>>> -    reply_hdr->serialno  = 1;
>>> -    reply_hdr->type      = type;
>>> -    reply_hdr->flags     = flags;
>>> -    reply_hdr->status    = 0;
>>> -    reply_hdr->secindex  = 0;
>>> -    reply_hdr->reserved  = 0;
>>> -    reply_hdr->serviceid = hdr->serviceid;
>>> -}
>>> -
>>> -/*
>>> - * Create an error `reply´ using for the packet `hdr' with the error
>>> - * `error´ code.
>>> - */
>>> -static void
>>> -make_error_reply (struct rx_header *hdr,
>>> -		  uint32_t error,
>>> -		  krb5_data *reply)
>>> -
>>> -{
>>> -    struct rx_header reply_hdr;
>>> -    krb5_error_code ret;
>>> -    krb5_storage *sp;
>>> -
>>> -    init_reply_header (hdr,&reply_hdr, HT_ABORT, HF_LAST);
>>> -    sp = krb5_storage_emem();
>>> -    if (sp == NULL)
>>> -	return;
>>> -    ret = encode_rx_header (&reply_hdr, sp);
>>> -    if (ret)
>>> -	return;
>>> -    krb5_store_int32(sp, error);
>>> -    krb5_storage_to_data (sp, reply);
>>> -    krb5_storage_free (sp);
>>> -}
>>> -
>>> -static krb5_error_code
>>> -krb5_ret_xdr_data(krb5_storage *sp,
>>> -		  krb5_data *data)
>>> -{
>>> -    int ret;
>>> -    int size;
>>> -    ret = krb5_ret_int32(sp,&size);
>>> -    if(ret)
>>> -	return ret;
>>> -    if(size<   0)
>>> -	return ERANGE;
>>> -    data->length = size;
>>> -    if (size) {
>>> -	u_char foo[4];
>>> -	size_t pad = (4 - size % 4) % 4;
>>> -
>>> -	data->data = malloc(size);
>>> -	if (data->data == NULL)
>>> -	    return ENOMEM;
>>> -	ret = krb5_storage_read(sp, data->data, size);
>>> -	if(ret != size)
>>> -	    return (ret<   0)? errno : KRB5_CC_END;
>>> -	if (pad) {
>>> -	    ret = krb5_storage_read(sp, foo, pad);
>>> -	    if (ret != pad)
>>> -		return (ret<   0)? errno : KRB5_CC_END;
>>> -	}
>>> -    } else
>>> -	data->data = NULL;
>>> -    return 0;
>>> -}
>>> -
>>> -static krb5_error_code
>>> -krb5_store_xdr_data(krb5_storage *sp,
>>> -		    krb5_data data)
>>> -{
>>> -    u_char zero[4] = {0, 0, 0, 0};
>>> -    int ret;
>>> -    size_t pad;
>>> -
>>> -    ret = krb5_store_int32(sp, data.length);
>>> -    if(ret<   0)
>>> -	return ret;
>>> -    ret = krb5_storage_write(sp, data.data, data.length);
>>> -    if(ret != data.length){
>>> -	if(ret<   0)
>>> -	    return errno;
>>> -	return KRB5_CC_END;
>>> -    }
>>> -    pad = (4 - data.length % 4) % 4;
>>> -    if (pad) {
>>> -	ret = krb5_storage_write(sp, zero, pad);
>>> -	if (ret != pad) {
>>> -	    if (ret<   0)
>>> -		return errno;
>>> -	    return KRB5_CC_END;
>>> -	}
>>> -    }
>>> -    return 0;
>>> -}
>>> -
>>> -
>>> -static krb5_error_code
>>> -create_reply_ticket (krb5_context context,
>>> -		     struct rx_header *hdr,
>>> -		     Key *skey,
>>> -		     char *name, char *instance, char *realm,
>>> -		     struct sockaddr_in *addr,
>>> -		     int life,
>>> -		     int kvno,
>>> -		     int32_t max_seq_len,
>>> -		     const char *sname, const char *sinstance,
>>> -		     uint32_t challenge,
>>> -		     const char *label,
>>> -		     krb5_keyblock *key,
>>> -		     krb5_data *reply)
>>> -{
>>> -    krb5_error_code ret;
>>> -    krb5_data ticket;
>>> -    krb5_keyblock session;
>>> -    krb5_storage *sp;
>>> -    krb5_data enc_data;
>>> -    struct rx_header reply_hdr;
>>> -    char zero[8];
>>> -    size_t pad;
>>> -    unsigned fyrtiosjuelva;
>>> -
>>> -    /* create the ticket */
>>> -
>>> -    krb5_generate_random_keyblock(context, ETYPE_DES_PCBC_NONE,&session);
>>> -
>>> -    _krb5_krb_create_ticket(context,
>>> -			    0,
>>> -			    name,
>>> -			    instance,
>>> -			    realm,
>>> -			    addr->sin_addr.s_addr,
>>> -			&session,
>>> -			    life,
>>> -			    kdc_time,
>>> -			    sname,
>>> -			    sinstance,
>>> -			&skey->key,
>>> -			&ticket);
>>> -
>>> -    /* create the encrypted part of the reply */
>>> -    sp = krb5_storage_emem ();
>>> -    krb5_generate_random_block(&fyrtiosjuelva, sizeof(fyrtiosjuelva));
>>> -    fyrtiosjuelva&= 0xffffffff;
>>> -    krb5_store_int32 (sp, fyrtiosjuelva);
>>> -    krb5_store_int32 (sp, challenge);
>>> -    krb5_storage_write  (sp, session.keyvalue.data, 8);
>>> -    krb5_free_keyblock_contents(context,&session);
>>> -    krb5_store_int32 (sp, kdc_time);
>>> -    krb5_store_int32 (sp, kdc_time + _krb5_krb_life_to_time (0, life));
>>> -    krb5_store_int32 (sp, kvno);
>>> -    krb5_store_int32 (sp, ticket.length);
>>> -    krb5_store_stringz (sp, name);
>>> -    krb5_store_stringz (sp, instance);
>>> -#if 1 /* XXX - Why shouldn't the realm go here? */
>>> -    krb5_store_stringz (sp, "");
>>> -#else
>>>
>>>
>>
>> -- 
>> Matthieu Patou
>> Samba Team        http://samba.org
>> Private repo      http://git.samba.org/?p=mat/samba.git;a=summary
>>
>>


-- 
Matthieu Patou
Samba Team        http://samba.org
Private repo      http://git.samba.org/?p=mat/samba.git;a=summary




More information about the samba-technical mailing list