s4:heimdal: import lorikeet-heimdal-201012010201 (commit 81fe27bcc0148d410ca4617f8759...
authorAndrew Bartlett <abartlet@samba.org>
Mon, 29 Nov 2010 00:24:08 +0000 (11:24 +1100)
committerAndrew Tridgell <tridge@samba.org>
Wed, 1 Dec 2010 06:00:47 +0000 (17:00 +1100)
80 files changed:
source4/heimdal/base/baselocl.h
source4/heimdal/base/heimbase.c
source4/heimdal/cf/make-proto.pl
source4/heimdal/kdc/default_config.c
source4/heimdal/kdc/kaserver.c [deleted file]
source4/heimdal/kdc/misc.c
source4/heimdal/kdc/process.c
source4/heimdal/kuser/kinit.c
source4/heimdal/kuser/kuser_locl.h
source4/heimdal/lib/asn1/asn1parse.c
source4/heimdal/lib/asn1/asn1parse.y
source4/heimdal/lib/asn1/gen_template.c
source4/heimdal/lib/com_err/com_err.h
source4/heimdal/lib/com_err/com_right.h
source4/heimdal/lib/com_err/error.c
source4/heimdal/lib/com_err/lex.c
source4/heimdal/lib/com_err/lex.h
source4/heimdal/lib/com_err/lex.l
source4/heimdal/lib/com_err/parse.c
source4/heimdal/lib/com_err/parse.y
source4/heimdal/lib/gssapi/gssapi/gssapi.h
source4/heimdal/lib/gssapi/gssapi/gssapi_krb5.h
source4/heimdal/lib/gssapi/gssapi/gssapi_oid.h [new file with mode: 0644]
source4/heimdal/lib/gssapi/gssapi_mech.h
source4/heimdal/lib/gssapi/krb5/acquire_cred.c
source4/heimdal/lib/gssapi/krb5/external.c
source4/heimdal/lib/gssapi/krb5/set_cred_option.c
source4/heimdal/lib/gssapi/mech/gss_mech_switch.c
source4/heimdal/lib/gssapi/mech/gss_mo.c [new file with mode: 0644]
source4/heimdal/lib/gssapi/mech/gss_oid.c [new file with mode: 0644]
source4/heimdal/lib/gssapi/mech/gss_oid_equal.c
source4/heimdal/lib/gssapi/mech/gss_oid_to_str.c
source4/heimdal/lib/gssapi/mech/gss_wrap.c
source4/heimdal/lib/gssapi/mech/mech_locl.h
source4/heimdal/lib/gssapi/spnego/external.c
source4/heimdal/lib/hcrypto/rsa-ltm.c
source4/heimdal/lib/hcrypto/validate.c
source4/heimdal/lib/hdb/db.c
source4/heimdal/lib/hdb/hdb-keytab.c
source4/heimdal/lib/hdb/hdb.c
source4/heimdal/lib/hdb/hdb.h
source4/heimdal/lib/hdb/keytab.c
source4/heimdal/lib/hdb/ndbm.c
source4/heimdal/lib/hx509/sel-gram.c
source4/heimdal/lib/krb5/cache.c
source4/heimdal/lib/krb5/changepw.c
source4/heimdal/lib/krb5/config_file.c
source4/heimdal/lib/krb5/constants.c
source4/heimdal/lib/krb5/context.c
source4/heimdal/lib/krb5/convert_creds.c
source4/heimdal/lib/krb5/creds.c
source4/heimdal/lib/krb5/crypto.c
source4/heimdal/lib/krb5/error_string.c
source4/heimdal/lib/krb5/get_cred.c
source4/heimdal/lib/krb5/kcm.c
source4/heimdal/lib/krb5/keyblock.c
source4/heimdal/lib/krb5/krb5.h
source4/heimdal/lib/krb5/krb5_locl.h
source4/heimdal/lib/krb5/misc.c
source4/heimdal/lib/krb5/pac.c
source4/heimdal/lib/krb5/padata.c
source4/heimdal/lib/krb5/pcache.c
source4/heimdal/lib/krb5/pkinit.c
source4/heimdal/lib/krb5/plugin.c
source4/heimdal/lib/krb5/principal.c
source4/heimdal/lib/krb5/ticket.c
source4/heimdal/lib/krb5/v4_glue.c [deleted file]
source4/heimdal/lib/krb5/warn.c
source4/heimdal/lib/ntlm/ntlm.c
source4/heimdal/lib/roken/getarg.c
source4/heimdal/lib/roken/rand.c [new file with mode: 0644]
source4/heimdal/lib/roken/resolve.c
source4/heimdal/lib/roken/roken-common.h
source4/heimdal/lib/roken/roken.h.in
source4/heimdal/lib/roken/setprogname.c
source4/heimdal/lib/roken/socket.c
source4/heimdal_build/roken.h
source4/heimdal_build/wscript_build
source4/kdc/hdb-samba4.c
source4/kdc/kdc.c

index 06806d27626f676cfa167315a342c1856393a584..5f157264c186e1e48e35de0cf168e5c0fd5aada5 100644 (file)
  * 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"
 #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
 
 #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 */
index 137129abb2e99245a8c721c86017137242371e9c..b8d5d74a9aa605684dd19e90c0e320071fc98a66 100644 (file)
@@ -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();
 }
 
index 566534f2471ad10bd45b608d43809ed6b3b7f5bc..bc323b9433eb8e8c97a04d8fccf1914dd3030b5f 100644 (file)
@@ -180,6 +180,7 @@ sub foo {
     local ($arg) = @_;
     $_ = $arg;
     s/.*\/([^\/]*)/$1/;
+    s/.*\\([^\\]*)/$1/;
     s/[^a-zA-Z0-9]/_/g;
     "__" . $_ . "__";
 }
index 66108f4dec6e28443d43ee072b0ec2ce76110087..e26245323cbcd941a62b4489bcf8743dc748ea72 100644 (file)
@@ -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 (file)
index 827205a..0000000
+++ /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
-    krb5_store_stringz (sp, realm);
-#endif
-    krb5_store_stringz (sp, sname);
-    krb5_store_stringz (sp, sinstance);
-    krb5_storage_write (sp, ticket.data, ticket.length);
-    krb5_storage_write (sp, label, strlen(label));
-
-    /* pad to DES block */
-    memset (zero, 0, sizeof(zero));
-    pad = (8 - krb5_storage_seek (sp, 0, SEEK_CUR) % 8) % 8;
-    krb5_storage_write (sp, zero, pad);
-
-    krb5_storage_to_data (sp, &enc_data);
-    krb5_storage_free (sp);
-
-    if (enc_data.length > max_seq_len) {
-       krb5_data_free (&enc_data);
-       make_error_reply (hdr, KAANSWERTOOLONG, reply);
-       return 0;
-    }
-
-    /* encrypt it */
-    {
-        DES_key_schedule schedule;
-       DES_cblock deskey;
-       
-       memcpy (&deskey, key->keyvalue.data, sizeof(deskey));
-       DES_set_key_unchecked (&deskey, &schedule);
-       DES_pcbc_encrypt (enc_data.data,
-                         enc_data.data,
-                         enc_data.length,
-                         &schedule,
-                         &deskey,
-                         DES_ENCRYPT);
-       memset (&schedule, 0, sizeof(schedule));
-       memset (&deskey, 0, sizeof(deskey));
-    }
-
-    /* create the reply packet */
-    init_reply_header (hdr, &reply_hdr, HT_DATA, HF_LAST);
-    sp = krb5_storage_emem ();
-    ret = encode_rx_header (&reply_hdr, sp);
-    krb5_store_int32 (sp, max_seq_len);
-    krb5_store_xdr_data (sp, enc_data);
-    krb5_data_free (&enc_data);
-    krb5_storage_to_data (sp, reply);
-    krb5_storage_free (sp);
-    return 0;
-}
-
-static krb5_error_code
-unparse_auth_args (krb5_storage *sp,
-                  char **name,
-                  char **instance,
-                  time_t *start_time,
-                  time_t *end_time,
-                  krb5_data *request,
-                  int32_t *max_seq_len)
-{
-    krb5_data data;
-    int32_t tmp;
-
-    krb5_ret_xdr_data (sp, &data);
-    *name = malloc(data.length + 1);
-    if (*name == NULL)
-       return ENOMEM;
-    memcpy (*name, data.data, data.length);
-    (*name)[data.length] = '\0';
-    krb5_data_free (&data);
-
-    krb5_ret_xdr_data (sp, &data);
-    *instance = malloc(data.length + 1);
-    if (*instance == NULL) {
-       free (*name);
-       return ENOMEM;
-    }
-    memcpy (*instance, data.data, data.length);
-    (*instance)[data.length] = '\0';
-    krb5_data_free (&data);
-
-    krb5_ret_int32 (sp, &tmp);
-    *start_time = tmp;
-    krb5_ret_int32 (sp, &tmp);
-    *end_time = tmp;
-    krb5_ret_xdr_data (sp, request);
-    krb5_ret_int32 (sp, max_seq_len);
-    /* ignore the rest */
-    return 0;
-}
-
-static void
-do_authenticate (krb5_context context,
-                krb5_kdc_configuration *config,
-                struct rx_header *hdr,
-                krb5_storage *sp,
-                struct sockaddr_in *addr,
-                const char *from,
-                krb5_data *reply)
-{
-    krb5_error_code ret;
-    char *name = NULL;
-    char *instance = NULL;
-    time_t start_time;
-    time_t end_time;
-    krb5_data request;
-    int32_t max_seq_len;
-    hdb_entry_ex *client_entry = NULL;
-    hdb_entry_ex *server_entry = NULL;
-    Key *ckey = NULL;
-    Key *skey = NULL;
-    krb5_storage *reply_sp;
-    time_t max_life;
-    uint8_t life;
-    int32_t chal;
-    char client_name[256];
-    char server_name[256];
-       
-    krb5_data_zero (&request);
-
-    ret = unparse_auth_args (sp, &name, &instance, &start_time, &end_time,
-                            &request, &max_seq_len);
-    if (ret != 0 || request.length < 8) {
-       make_error_reply (hdr, KABADREQUEST, reply);
-       goto out;
-    }
-
-    snprintf (client_name, sizeof(client_name), "%s.%s@%s",
-             name, instance, config->v4_realm);
-    snprintf (server_name, sizeof(server_name), "%s.%s@%s",
-             "krbtgt", config->v4_realm, config->v4_realm);
-
-    kdc_log(context, config, 0, "AS-REQ (kaserver) %s from %s for %s",
-           client_name, from, server_name);
-
-    ret = _kdc_db_fetch4 (context, config, name, instance,
-                         config->v4_realm, HDB_F_GET_CLIENT,
-                         &client_entry);
-    if (ret) {
-       kdc_log(context, config, 0, "Client not found in database: %s: %s",
-               client_name, krb5_get_err_text(context, ret));
-       make_error_reply (hdr, KANOENT, reply);
-       goto out;
-    }
-
-    ret = _kdc_db_fetch4 (context, config, "krbtgt",
-                         config->v4_realm, config->v4_realm,
-                         HDB_F_GET_KRBTGT, &server_entry);
-    if (ret) {
-       kdc_log(context, config, 0, "Server not found in database: %s: %s",
-               server_name, krb5_get_err_text(context, ret));
-       make_error_reply (hdr, KANOENT, reply);
-       goto out;
-    }
-
-    ret = kdc_check_flags (context, config,
-                          client_entry, client_name,
-                          server_entry, server_name,
-                          TRUE);
-    if (ret) {
-       make_error_reply (hdr, KAPWEXPIRED, reply);
-       goto out;
-    }
-
-    /* find a DES key */
-    ret = _kdc_get_des_key(context, client_entry, FALSE, TRUE, &ckey);
-    if(ret){
-       kdc_log(context, config, 0, "no suitable DES key for client");
-       make_error_reply (hdr, KANOKEYS, reply);
-       goto out;
-    }
-
-    /* find a DES key */
-    ret = _kdc_get_des_key(context, server_entry, TRUE, TRUE, &skey);
-    if(ret){
-       kdc_log(context, config, 0, "no suitable DES key for server");
-       make_error_reply (hdr, KANOKEYS, reply);
-       goto out;
-    }
-
-    {
-       DES_cblock key;
-       DES_key_schedule schedule;
-       
-       /* try to decode the `request' */
-       memcpy (&key, ckey->key.keyvalue.data, sizeof(key));
-       DES_set_key_unchecked (&key, &schedule);
-       DES_pcbc_encrypt (request.data,
-                         request.data,
-                         request.length,
-                         &schedule,
-                         &key,
-                         DES_DECRYPT);
-       memset (&schedule, 0, sizeof(schedule));
-       memset (&key, 0, sizeof(key));
-    }
-
-    /* check for the magic label */
-    if (memcmp ((char *)request.data + 4, "gTGS", 4) != 0) {
-       kdc_log(context, config, 0, "preauth failed for %s", client_name);
-       make_error_reply (hdr, KABADREQUEST, reply);
-       goto out;
-    }
-
-    reply_sp = krb5_storage_from_mem (request.data, 4);
-    krb5_ret_int32 (reply_sp, &chal);
-    krb5_storage_free (reply_sp);
-
-    if (abs(chal - kdc_time) > context->max_skew) {
-       make_error_reply (hdr, KACLOCKSKEW, reply);
-       goto out;
-    }
-
-    /* life */
-    max_life = end_time - kdc_time;
-    /* end_time - kdc_time can sometimes be non-positive due to slight
-       time skew between client and server. Let's make sure it is postive */
-    if(max_life < 1)
-       max_life = 1;
-    if (client_entry->entry.max_life)
-       max_life = min(max_life, *client_entry->entry.max_life);
-    if (server_entry->entry.max_life)
-       max_life = min(max_life, *server_entry->entry.max_life);
-
-    life = krb_time_to_life(kdc_time, kdc_time + max_life);
-
-    create_reply_ticket (context,
-                        hdr, skey,
-                        name, instance, config->v4_realm,
-                        addr, life, server_entry->entry.kvno,
-                        max_seq_len,
-                        "krbtgt", config->v4_realm,
-                        chal + 1, "tgsT",
-                        &ckey->key, reply);
-
- out:
-    if (request.length) {
-       memset (request.data, 0, request.length);
-       krb5_data_free (&request);
-    }
-    if (name)
-       free (name);
-    if (instance)
-       free (instance);
-    if (client_entry)
-       _kdc_free_ent (context, client_entry);
-    if (server_entry)
-       _kdc_free_ent (context, server_entry);
-}
-
-static krb5_error_code
-unparse_getticket_args (krb5_storage *sp,
-                       int *kvno,
-                       char **auth_domain,
-                       krb5_data *ticket,
-                       char **name,
-                       char **instance,
-                       krb5_data *times,
-                       int32_t *max_seq_len)
-{
-    krb5_data data;
-    int32_t tmp;
-
-    krb5_ret_int32 (sp, &tmp);
-    *kvno = tmp;
-
-    krb5_ret_xdr_data (sp, &data);
-    *auth_domain = malloc(data.length + 1);
-    if (*auth_domain == NULL)
-       return ENOMEM;
-    memcpy (*auth_domain, data.data, data.length);
-    (*auth_domain)[data.length] = '\0';
-    krb5_data_free (&data);
-
-    krb5_ret_xdr_data (sp, ticket);
-
-    krb5_ret_xdr_data (sp, &data);
-    *name = malloc(data.length + 1);
-    if (*name == NULL) {
-       free (*auth_domain);
-       return ENOMEM;
-    }
-    memcpy (*name, data.data, data.length);
-    (*name)[data.length] = '\0';
-    krb5_data_free (&data);
-
-    krb5_ret_xdr_data (sp, &data);
-    *instance = malloc(data.length + 1);
-    if (*instance == NULL) {
-       free (*auth_domain);
-       free (*name);
-       return ENOMEM;
-    }
-    memcpy (*instance, data.data, data.length);
-    (*instance)[data.length] = '\0';
-    krb5_data_free (&data);
-
-    krb5_ret_xdr_data (sp, times);
-
-    krb5_ret_int32 (sp, max_seq_len);
-    /* ignore the rest */
-    return 0;
-}
-
-static void
-do_getticket (krb5_context context,
-             krb5_kdc_configuration *config,
-             struct rx_header *hdr,
-             krb5_storage *sp,
-             struct sockaddr_in *addr,
-             const char *from,
-             krb5_data *reply)
-{
-    krb5_error_code ret;
-    int kvno;
-    char *auth_domain = NULL;
-    krb5_data aticket;
-    char *name = NULL;
-    char *instance = NULL;
-    krb5_data times;
-    int32_t max_seq_len;
-    hdb_entry_ex *server_entry = NULL;
-    hdb_entry_ex *client_entry = NULL;
-    hdb_entry_ex *krbtgt_entry = NULL;
-    Key *kkey = NULL;
-    Key *skey = NULL;
-    DES_cblock key;
-    DES_key_schedule schedule;
-    DES_cblock session;
-    time_t max_life;
-    int8_t life;
-    time_t start_time, end_time;
-    char server_name[256];
-    char client_name[256];
-    struct _krb5_krb_auth_data ad;
-
-    krb5_data_zero (&aticket);
-    krb5_data_zero (&times);
-
-    memset(&ad, 0, sizeof(ad));
-
-    unparse_getticket_args (sp, &kvno, &auth_domain, &aticket,
-                           &name, &instance, &times, &max_seq_len);
-    if (times.length < 8) {
-       make_error_reply (hdr, KABADREQUEST, reply);
-       goto out;
-       
-    }
-
-    snprintf (server_name, sizeof(server_name),
-             "%s.%s@%s", name, instance, config->v4_realm);
-
-    ret = _kdc_db_fetch4 (context, config, name, instance,
-                         config->v4_realm, HDB_F_GET_SERVER, &server_entry);
-    if (ret) {
-       kdc_log(context, config, 0, "Server not found in database: %s: %s",
-               server_name, krb5_get_err_text(context, ret));
-       make_error_reply (hdr, KANOENT, reply);
-       goto out;
-    }
-
-    ret = _kdc_db_fetch4 (context, config, "krbtgt",
-                    config->v4_realm, config->v4_realm, HDB_F_GET_KRBTGT, &krbtgt_entry);
-    if (ret) {
-       kdc_log(context, config, 0,
-               "Server not found in database: %s.%s@%s: %s",
-               "krbtgt", config->v4_realm,  config->v4_realm,
-               krb5_get_err_text(context, ret));
-       make_error_reply (hdr, KANOENT, reply);
-       goto out;
-    }
-
-    /* find a DES key */
-    ret = _kdc_get_des_key(context, krbtgt_entry, TRUE, TRUE, &kkey);
-    if(ret){
-       kdc_log(context, config, 0, "no suitable DES key for krbtgt");
-       make_error_reply (hdr, KANOKEYS, reply);
-       goto out;
-    }
-
-    /* find a DES key */
-    ret = _kdc_get_des_key(context, server_entry, TRUE, TRUE, &skey);
-    if(ret){
-       kdc_log(context, config, 0, "no suitable DES key for server");
-       make_error_reply (hdr, KANOKEYS, reply);
-       goto out;
-    }
-
-    /* decrypt the incoming ticket */
-    memcpy (&key, kkey->key.keyvalue.data, sizeof(key));
-
-    /* unpack the ticket */
-    {
-       char *sname = NULL;
-       char *sinstance = NULL;
-
-       ret = _krb5_krb_decomp_ticket(context, &aticket, &kkey->key,
-                                     config->v4_realm, &sname,
-                                     &sinstance, &ad);
-       if (ret) {
-           const char *msg = krb5_get_error_message(context, ret);
-           kdc_log(context, config, 0,
-                   "kaserver: decomp failed for %s.%s with %s %d",
-                   msg, sname, sinstance, ret);
-           krb5_free_error_message(context, msg);
-           make_error_reply (hdr, KABADTICKET, reply);
-           goto out;
-       }
-
-       if (strcmp (sname, "krbtgt") != 0
-           || strcmp (sinstance, config->v4_realm) != 0) {
-           kdc_log(context, config, 0, "no TGT: %s.%s for %s.%s@%s",
-                   sname, sinstance,
-                   ad.pname, ad.pinst, ad.prealm);
-           make_error_reply (hdr, KABADTICKET, reply);
-           free(sname);
-           free(sinstance);
-           goto out;
-       }
-       free(sname);
-       free(sinstance);
-
-       if (kdc_time > _krb5_krb_life_to_time(ad.time_sec, ad.life)) {
-           kdc_log(context, config, 0, "TGT expired: %s.%s@%s",
-                   ad.pname, ad.pinst, ad.prealm);
-           make_error_reply (hdr, KABADTICKET, reply);
-           goto out;
-       }
-    }
-
-    snprintf (client_name, sizeof(client_name),
-             "%s.%s@%s", ad.pname, ad.pinst, ad.prealm);
-
-    kdc_log(context, config, 0, "TGS-REQ (kaserver) %s from %s for %s",
-           client_name, from, server_name);
-
-    ret = _kdc_db_fetch4 (context, config,
-                         ad.pname, ad.pinst, ad.prealm, HDB_F_GET_CLIENT,
-                         &client_entry);
-    if(ret && ret != HDB_ERR_NOENTRY) {
-       kdc_log(context, config, 0,
-               "Client not found in database: (krb4) %s: %s",
-               client_name, krb5_get_err_text(context, ret));
-       make_error_reply (hdr, KANOENT, reply);
-       goto out;
-    }
-    if (client_entry == NULL && strcmp(ad.prealm, config->v4_realm) == 0) {
-       kdc_log(context, config, 0,
-               "Local client not found in database: (krb4) "
-               "%s", client_name);
-       make_error_reply (hdr, KANOENT, reply);
-       goto out;
-    }
-
-    ret = kdc_check_flags (context, config,
-                          client_entry, client_name,
-                          server_entry, server_name,
-                          FALSE);
-    if (ret) {
-       make_error_reply (hdr, KAPWEXPIRED, reply);
-       goto out;
-    }
-
-    /* decrypt the times */
-    memcpy(&session, ad.session.keyvalue.data, sizeof(session));
-    DES_set_key_unchecked (&session, &schedule);
-    DES_ecb_encrypt (times.data,
-                    times.data,
-                    &schedule,
-                    DES_DECRYPT);
-    memset (&schedule, 0, sizeof(schedule));
-    memset (&session, 0, sizeof(session));
-
-    /* and extract them */
-    {
-       krb5_storage *tsp;
-       int32_t tmp;
-
-       tsp = krb5_storage_from_mem (times.data, times.length);
-       krb5_ret_int32 (tsp, &tmp);
-       start_time = tmp;
-       krb5_ret_int32 (tsp, &tmp);
-       end_time = tmp;
-       krb5_storage_free (tsp);
-    }
-
-    /* life */
-    max_life = end_time - kdc_time;
-    /* end_time - kdc_time can sometimes be non-positive due to slight
-       time skew between client and server. Let's make sure it is postive */
-    if(max_life < 1)
-       max_life = 1;
-    if (krbtgt_entry->entry.max_life)
-       max_life = min(max_life, *krbtgt_entry->entry.max_life);
-    if (server_entry->entry.max_life)
-       max_life = min(max_life, *server_entry->entry.max_life);
-    /* if this is a cross realm request, the client_entry will likely
-       be NULL */
-    if (client_entry && client_entry->entry.max_life)
-       max_life = min(max_life, *client_entry->entry.max_life);
-
-    life = _krb5_krb_time_to_life(kdc_time, kdc_time + max_life);
-
-    create_reply_ticket (context,
-                        hdr, skey,
-                        ad.pname, ad.pinst, ad.prealm,
-                        addr, life, server_entry->entry.kvno,
-                        max_seq_len,
-                        name, instance,
-                        0, "gtkt",
-                        &ad.session, reply);
-
- out:
-    _krb5_krb_free_auth_data(context, &ad);
-    if (aticket.length) {
-       memset (aticket.data, 0, aticket.length);
-       krb5_data_free (&aticket);
-    }
-    if (times.length) {
-       memset (times.data, 0, times.length);
-       krb5_data_free (&times);
-    }
-    if (auth_domain)
-       free (auth_domain);
-    if (name)
-       free (name);
-    if (instance)
-       free (instance);
-    if (krbtgt_entry)
-       _kdc_free_ent (context, krbtgt_entry);
-    if (server_entry)
-       _kdc_free_ent (context, server_entry);
-}
-
-krb5_error_code
-_kdc_do_kaserver(krb5_context context,
-                krb5_kdc_configuration *config,
-                unsigned char *buf,
-                size_t len,
-                krb5_data *reply,
-                const char *from,
-                struct sockaddr_in *addr)
-{
-    krb5_error_code ret = 0;
-    struct rx_header hdr;
-    uint32_t op;
-    krb5_storage *sp;
-
-    if (len < RX_HEADER_SIZE)
-       return -1;
-    sp = krb5_storage_from_mem (buf, len);
-
-    ret = decode_rx_header (sp, &hdr);
-    if (ret)
-       goto out;
-    buf += RX_HEADER_SIZE;
-    len -= RX_HEADER_SIZE;
-
-    switch (hdr.type) {
-    case HT_DATA :
-       break;
-    case HT_ACK :
-    case HT_BUSY :
-    case HT_ABORT :
-    case HT_ACKALL :
-    case HT_CHAL :
-    case HT_RESP :
-    case HT_DEBUG :
-    default:
-       /* drop */
-       goto out;
-    }
-
-
-    if (hdr.serviceid != KA_AUTHENTICATION_SERVICE
-       && hdr.serviceid != KA_TICKET_GRANTING_SERVICE) {
-       ret = -1;
-       goto out;
-    }
-
-    ret = krb5_ret_uint32(sp, &op);
-    if (ret)
-       goto out;
-    switch (op) {
-    case AUTHENTICATE :
-    case AUTHENTICATE_V2 :
-       do_authenticate (context, config, &hdr, sp, addr, from, reply);
-       break;
-    case GETTICKET :
-       do_getticket (context, config, &hdr, sp, addr, from, reply);
-       break;
-    case AUTHENTICATE_OLD :
-    case CHANGEPASSWORD :
-    case GETTICKET_OLD :
-    case SETPASSWORD :
-    case SETFIELDS :
-    case CREATEUSER :
-    case DELETEUSER :
-    case GETENTRY :
-    case LISTENTRY :
-    case GETSTATS :
-    case DEBUG :
-    case GETPASSWORD :
-    case GETRANDOMKEY :
-    default :
-       make_error_reply (&hdr, RXGEN_OPCODE, reply);
-       break;
-    }
-
-out:
-    krb5_storage_free (sp);
-    return ret;
-}
-
-#endif /* KRB4 */
index 2e95ad2832ba6723a230212e701785bc95422d5a..297fa3824b72e88a7bbd418e54cfbea084178615 100644 (file)
@@ -91,21 +91,12 @@ _kdc_db_fetch(krb5_context context,
            continue;
        }
 
-       if (config->db[i]->hdb_fetch_kvno) {
-               ret = config->db[i]->hdb_fetch_kvno(context,
-                                                   config->db[i],
-                                                   principal,
-                                                   flags | HDB_F_DECRYPT,
-                                                   kvno,
-                                                   ent);
-       } else {
-               flags &= ~HDB_F_KVNO_SPECIFIED;
-               ret = config->db[i]->hdb_fetch(context,
-                                              config->db[i],
-                                              principal,
-                                              flags | HDB_F_DECRYPT,
-                                              ent);
-       }
+       ret = config->db[i]->hdb_fetch_kvno(context,
+                                           config->db[i],
+                                           principal,
+                                           flags | HDB_F_DECRYPT,
+                                           kvno,
+                                           ent);
 
        krb5_free_principal(context, enterprise_principal);
 
index d3557ee6c9e45af0733ba5006d73f0c09bfcd251..42266003312e5d214d0d77b556bf46214af69cc8 100644 (file)
@@ -161,78 +161,6 @@ kdc_kx509(krb5_context context,
 #endif
 
 
-#ifdef KRB4
-
-static krb5_error_code 
-kdc_524(krb5_context context,
-       krb5_kdc_configuration *config,
-       krb5_data *req_buffer,
-       krb5_data *reply,
-       const char *from,
-       struct sockaddr *addr,
-       int datagram_reply,
-       int *claim)
-{
-    krb5_error_code ret;
-    Ticket ticket;
-    size_t len;
-
-    ret = decode_Ticket(req_buffer->data, req_buffer->length, &ticket, &len);
-    if (ret)
-       return ret;
-
-    *claim = 1;
-
-    ret = _kdc_do_524(context, config, &ticket, reply, from, addr);
-    free_Ticket(&ticket);
-    return ret;
-}
-
-static krb5_error_code 
-kdc_krb4(krb5_context context,
-        krb5_kdc_configuration *config,
-        krb5_data *req_buffer,
-        krb5_data *reply,
-        const char *from,
-        struct sockaddr *addr,
-        int datagram_reply,
-        int *claim)
-{
-    if (_kdc_maybe_version4(req_buffer->data, req_buffer->length) == 0)
-       return -1;
-
-    *claim = 1;
-
-    return _kdc_do_version4(context, config, 
-                          req_buffer->data, req_buffer->length, 
-                          reply, from,
-                          (struct sockaddr_in*)addr);
-}
-
-static krb5_error_code 
-kdc_kaserver(krb5_context context,
-            krb5_kdc_configuration *config,
-            krb5_data *req_buffer,
-            krb5_data *reply,
-            const char *from,
-            struct sockaddr *addr,
-            int datagram_reply,
-            int *claim)
-{
-    if (config->enable_kaserver == 0)
-       return -1;
-
-    *claim = 1;
-
-    return _kdc_do_kaserver(context, config, 
-                           req_buffer->data, req_buffer->length, 
-                           reply, from,
-                           (struct sockaddr_in*)addr);
-}
-
-#endif /* KRB4 */
-
-
 static struct krb5_kdc_service services[] =  {
     { KS_KRB5,         kdc_as_req },
     { KS_KRB5,         kdc_tgs_req },
@@ -241,11 +169,6 @@ static struct krb5_kdc_service services[] =  {
 #endif
 #ifdef KX509
     { 0,               kdc_kx509 },
-#endif
-#ifdef KRB4
-    { 0,               kdc_524 },
-    { KS_NO_LENGTH,    kdc_krb4 },
-    { 0,               kdc_kaserver },
 #endif
     { 0, NULL }
 };
index 11e364980dc5e5a6cf73e058195735c722474fe9..846232a4f293c6e32c5efae790c191c9337c0ec0 100644 (file)
 #include <Security/Security.h>
 #endif
 
-struct krb5_dh_moduli;
-struct AlgorithmIdentifier;
-struct _krb5_krb_auth_data;
-struct hx509_certs_data;
-#include <krb5-private.h>
-
 #ifndef NO_NTLM
 #include "heimntlm.h"
 #endif
@@ -457,7 +451,7 @@ get_new_tickets(krb5_context context,
        if (ret)
            krb5_err(context, 1, ret, "krb5_get_init_creds_opt_set_pkinit");
        if (ent_user_id)
-           _krb5_get_init_creds_opt_set_pkinit_user_certs(context, opt, ent_user_id);
+           krb5_get_init_creds_opt_set_pkinit_user_certs(context, opt, ent_user_id);
     }
 
     if (addrs_flag != -1)
@@ -768,9 +762,9 @@ main (int argc, char **argv)
        parseflags |= KRB5_PRINCIPAL_PARSE_ENTERPRISE;
 
     if (pk_enterprise_flag) {
-       ret = _krb5_pk_enterprise_cert(context, pk_user_id,
-                                      argv[0], &principal,
-                                      &ent_user_id);
+       ret = krb5_pk_enterprise_cert(context, pk_user_id,
+                                     argv[0], &principal,
+                                     &ent_user_id);
        if (ret)
            krb5_err(context, 1, ret, "krb5_pk_enterprise_certs");
 
index 1bf682b1d0fb8fe44d61fa180a7196a751e54019..82e6eb2e22b9136fe08877ad846561719e94b0af 100644 (file)
@@ -84,6 +84,8 @@
 #endif
 #include "crypto-headers.h" /* for UI_UTIL_read_pw_string */
 
+#include <rtbl.h>
+
 #ifdef HAVE_LOCALE_H
 #include <locale.h>
 #endif
 #define textdomain(package)
 #endif
 
+extern krb5_context kcc_context;
 
 #endif /* __KUSER_LOCL_H__ */
index 9e4174a153516119c4a91c84776e4998b3cdfa88..18bbcdd39cf05fa999e1f40afe778e227a1a7b31 100644 (file)
@@ -8,17 +8,29 @@ static const char yysccsid[] = "@(#)yaccpar   1.9 (Berkeley) 02/21/93";
 #define YYBYACC 1
 #define YYMAJOR 1
 #define YYMINOR 9
-#define YYPATCH 20070509
+#define YYPATCH 20100216
 
-#define YYEMPTY (-1)
-#define yyclearin    (yychar = YYEMPTY)
-#define yyerrok      (yyerrflag = 0)
-#define YYRECOVERING (yyerrflag != 0)
+#define YYEMPTY        (-1)
+#define yyclearin      (yychar = YYEMPTY)
+#define yyerrok        (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
 
-extern int yyparse(void);
-
-static int yygrowstack(void);
 #define YYPREFIX "yy"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+#ifdef YYPARSE_PARAM_TYPE
+#define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+#else
+#define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+#endif
+#else
+#define YYPARSE_DECL() yyparse(void)
+#endif /* YYPARSE_PARAM */
+
+extern int YYPARSE_DECL();
+
 #line 39 ""
 
 #include <config.h>
@@ -46,7 +58,11 @@ struct string_list {
     struct string_list *next;
 };
 
-#line 67 ""
+/* Declarations for Bison */
+#define YYMALLOC malloc
+#define YYFREE   free
+
+#line 71 ""
 typedef union {
     int constant;
     struct value *value;
@@ -61,7 +77,7 @@ typedef union {
     struct memhead *members;
     struct constraint_spec *constraint_spec;
 } YYSTYPE;
-#line 65 ""
+#line 80 ""
 #define kw_ABSENT 257
 #define kw_ABSTRACT_SYNTAX 258
 #define kw_ALL 259
@@ -150,7 +166,7 @@ typedef union {
 #define STRING 342
 #define NUMBER 343
 #define YYERRCODE 256
-short yylhs[] = {                                        -1,
+static const short yylhs[] = {                           -1,
     0,   56,   56,   56,   56,   57,   57,   58,   58,   60,
    60,   62,   62,   63,   63,   64,   59,   59,   59,   61,
    61,   65,   65,   50,   50,   66,   14,   14,   14,   15,
@@ -166,7 +182,7 @@ short yylhs[] = {                                        -1,
    46,   46,    4,    4,    5,    5,    5,    5,    5,   12,
    11,   13,    9,    7,    7,    6,    1,   10,    8,
 };
-short yylen[] = {                                         2,
+static const short yylen[] = {                            2,
     9,    2,    2,    2,    0,    2,    0,    3,    0,    3,
     0,    1,    0,    1,    2,    4,    3,    2,    0,    1,
     2,    1,    1,    3,    1,    3,    1,    1,    1,    1,
@@ -182,7 +198,7 @@ short yylen[] = {                                         2,
     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
     1,    1,    1,    1,    1,    1,    1,    1,    1,
 };
-short yydefred[] = {                                      0,
+static const short yydefred[] = {                         0,
     0,    0,    0,  115,    0,    0,  122,    0,    0,    0,
     0,  117,  119,    0,    0,    0,    0,    0,    4,    2,
     3,    0,    0,  120,    6,    0,    0,    0,    0,    0,
@@ -206,7 +222,7 @@ short yydefred[] = {                                      0,
    54,   53,    0,    0,    0,    0,    0,   83,    0,  113,
    55,   47,   46,   45,   85,    0,  114,   84,
 };
-short yydgoto[] = {                                       2,
+static const short yydgoto[] = {                          2,
   140,  116,  122,  141,  142,  143,  144,  145,  146,  147,
   148,  149,  150,   75,   76,   77,   78,   79,   80,   81,
    82,   83,   84,   85,   86,   87,   88,   89,   90,   91,
@@ -215,7 +231,7 @@ short yydgoto[] = {                                       2,
   119,  166,  167,  168,  169,   17,   23,   29,   30,   36,
    44,   40,   41,   42,   45,   46,   47,
 };
-short yysindex[] = {                                   -295,
+static const short yysindex[] = {                      -295,
   -74,    0, -289,    0, -216,   23,    0,  -61, -289, -221,
  -277,    0,    0, -259, -257, -256, -214,   31,    0,    0,
     0, -220, -264,    0,    0, -187, -206, -232, -201, -213,
@@ -239,7 +255,7 @@ short yysindex[] = {                                   -295,
     0,    0,  105,  106,  107,   24, -115,    0,  109,    0,
     0,    0,    0,    0,    0,   -4,    0,    0,
 };
-short yyrindex[] = {                                      0,
+static const short yyrindex[] = {                         0,
  -123,    0,   28,    0,    0, -110,    0,    0,   28, -245,
     0,    0,    0,    0,    0,    0, -183,    0,    0,    0,
     0,    0,    0,    0,    0,    0, -248,    0,    0, -182,
@@ -263,7 +279,7 @@ short yyrindex[] = {                                      0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,
 };
-short yygindex[] = {                                      0,
+static const short yygindex[] = {                         0,
   -14,    0,    0,  -95,    0,    0,    0,    0,    0,    0,
     0,    0,    0,  -31,    0,    0,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
@@ -273,7 +289,7 @@ short yygindex[] = {                                      0,
   128,    0,    0,  133,    0,    0,    0,
 };
 #define YYTABLESIZE 509
-short yytable[] = {                                      58,
+static const short yytable[] = {                         58,
    58,  108,  118,   58,   63,   63,    3,  184,   63,  116,
    49,  111,  118,   49,  121,   70,  108,   25,   70,  155,
    86,  162,    4,   86,  159,   67,   31,  102,   67,    9,
@@ -326,7 +342,7 @@ short yytable[] = {                                      58,
     0,    0,    0,    0,    0,   92,    0,    0,    0,   92,
    92,   92,    0,   92,    0,    0,    0,    0,   92,
 };
-short yycheck[] = {                                      40,
+static const short yycheck[] = {                         40,
    41,   44,   40,   44,   40,   41,  123,   41,   44,   59,
    41,  123,   40,   44,  125,   41,  123,   59,   44,  125,
    41,  117,    1,   44,  125,   41,  259,   40,   44,  278,
@@ -385,7 +401,8 @@ short yycheck[] = {                                      40,
 #endif
 #define YYMAXTOKEN 343
 #if YYDEBUG
-char *yyname[] = {
+static const char *yyname[] = {
+
 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,0,0,0,0,0,
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'",0,0,0,0,0,0,0,0,
@@ -411,7 +428,7 @@ char *yyname[] = {
 "kw_VideotexString","kw_VisibleString","kw_WITH","RANGE","EEQUAL","ELLIPSIS",
 "IDENTIFIER","referencename","STRING","NUMBER",
 };
-char *yyrule[] = {
+static const char *yyrule[] = {
 "$accept : ModuleDefinition",
 "ModuleDefinition : IDENTIFIER objid_opt kw_DEFINITIONS TagDefault ExtensionDefault EEQUAL kw_BEGIN ModuleBody kw_END",
 "TagDefault : kw_EXPLICIT kw_TAGS",
@@ -552,6 +569,7 @@ char *yyrule[] = {
 "SignedNumber : NUMBER",
 "NullValue : kw_NULL",
 "ObjectIdentifierValue : objid",
+
 };
 #endif
 #if YYDEBUG
@@ -575,19 +593,26 @@ char *yyrule[] = {
 
 int      yydebug;
 int      yynerrs;
+
+typedef struct {
+    unsigned stacksize;
+    short    *s_base;
+    short    *s_mark;
+    short    *s_last;
+    YYSTYPE  *l_base;
+    YYSTYPE  *l_mark;
+} YYSTACKDATA;
+
+#define YYPURE 0
+
 int      yyerrflag;
 int      yychar;
-short   *yyssp;
-YYSTYPE *yyvsp;
 YYSTYPE  yyval;
 YYSTYPE  yylval;
 
 /* variables for the parser stack */
-static short   *yyss;
-static short   *yysslim;
-static YYSTYPE *yyvs;
-static int      yystacksize;
-#line 941 ""
+static YYSTACKDATA yystack;
+#line 945 ""
 
 void
 yyerror (const char *s)
@@ -681,53 +706,68 @@ fix_labels(Symbol *s)
     fix_labels2(s->type, p);
     free(p);
 }
-#line 685 ""
+#line 709 ""
 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(void)
+static int yygrowstack(YYSTACKDATA *data)
 {
-    int newsize, i;
+    int i;
+    unsigned newsize;
     short *newss;
     YYSTYPE *newvs;
 
-    if ((newsize = yystacksize) == 0)
+    if ((newsize = data->stacksize) == 0)
         newsize = YYINITSTACKSIZE;
     else if (newsize >= YYMAXDEPTH)
         return -1;
     else if ((newsize *= 2) > YYMAXDEPTH)
         newsize = YYMAXDEPTH;
 
-    i = yyssp - yyss;
-    newss = (yyss != 0)
-          ? (short *)realloc(yyss, newsize * sizeof(*newss))
+    i = data->s_mark - data->s_base;
+    newss = (data->s_base != 0)
+          ? (short *)realloc(data->s_base, newsize * sizeof(*newss))
           : (short *)malloc(newsize * sizeof(*newss));
     if (newss == 0)
         return -1;
 
-    yyss  = newss;
-    yyssp = newss + i;
-    newvs = (yyvs != 0)
-          ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs))
+    data->s_base  = newss;
+    data->s_mark = newss + i;
+
+    newvs = (data->l_base != 0)
+          ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs))
           : (YYSTYPE *)malloc(newsize * sizeof(*newvs));
     if (newvs == 0)
         return -1;
 
-    yyvs = newvs;
-    yyvsp = newvs + i;
-    yystacksize = newsize;
-    yysslim = yyss + newsize - 1;
+    data->l_base = newvs;
+    data->l_mark = newvs + i;
+
+    data->stacksize = newsize;
+    data->s_last = data->s_base + newsize - 1;
     return 0;
 }
 
-#define YYABORT goto yyabort
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+    free(data->s_base);
+    free(data->l_base);
+    memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT  goto yyabort
 #define YYREJECT goto yyabort
 #define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
+#define YYERROR  goto yyerrlab
+
 int
-yyparse(void)
+YYPARSE_DECL()
 {
-    register int yym, yyn, yystate;
+    int yym, yyn, yystate;
 #if YYDEBUG
-    register const char *yys;
+    const char *yys;
 
     if ((yys = getenv("YYDEBUG")) != 0)
     {
@@ -740,11 +780,17 @@ yyparse(void)
     yynerrs = 0;
     yyerrflag = 0;
     yychar = YYEMPTY;
+    yystate = 0;
+
+#if YYPURE
+    memset(&yystack, 0, sizeof(yystack));
+#endif
 
-    if (yyss == NULL && yygrowstack()) goto yyoverflow;
-    yyssp = yyss;
-    yyvsp = yyvs;
-    *yyssp = yystate = 0;
+    if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
+    yystack.s_mark = yystack.s_base;
+    yystack.l_mark = yystack.l_base;
+    yystate = 0;
+    *yystack.s_mark = 0;
 
 yyloop:
     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
@@ -770,12 +816,13 @@ yyloop:
             printf("%sdebug: state %d, shifting to state %d\n",
                     YYPREFIX, yystate, yytable[yyn]);
 #endif
-        if (yyssp >= yysslim && yygrowstack())
+        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
         {
             goto yyoverflow;
         }
-        *++yyssp = yystate = yytable[yyn];
-        *++yyvsp = yylval;
+        yystate = yytable[yyn];
+        *++yystack.s_mark = yytable[yyn];
+        *++yystack.l_mark = yylval;
         yychar = YYEMPTY;
         if (yyerrflag > 0)  --yyerrflag;
         goto yyloop;
@@ -790,9 +837,7 @@ yyloop:
 
     yyerror("syntax error");
 
-#ifdef lint
     goto yyerrlab;
-#endif
 
 yyerrlab:
     ++yynerrs;
@@ -803,20 +848,21 @@ yyinrecovery:
         yyerrflag = 3;
         for (;;)
         {
-            if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
+            if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
             {
 #if YYDEBUG
                 if (yydebug)
                     printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
 #endif
-                if (yyssp >= yysslim && yygrowstack())
+                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
                 {
                     goto yyoverflow;
                 }
-                *++yyssp = yystate = yytable[yyn];
-                *++yyvsp = yylval;
+                yystate = yytable[yyn];
+                *++yystack.s_mark = yytable[yyn];
+                *++yystack.l_mark = yylval;
                 goto yyloop;
             }
             else
@@ -824,11 +870,11 @@ yyinrecovery:
 #if YYDEBUG
                 if (yydebug)
                     printf("%sdebug: error recovery discarding state %d\n",
-                            YYPREFIX, *yyssp);
+                            YYPREFIX, *yystack.s_mark);
 #endif
-                if (yyssp <= yyss) goto yyabort;
-                --yyssp;
-                --yyvsp;
+                if (yystack.s_mark <= yystack.s_base) goto yyabort;
+                --yystack.s_mark;
+                --yystack.l_mark;
             }
         }
     }
@@ -857,190 +903,190 @@ yyreduce:
 #endif
     yym = yylen[yyn];
     if (yym)
-        yyval = yyvsp[1-yym];
+        yyval = yystack.l_mark[1-yym];
     else
         memset(&yyval, 0, sizeof yyval);
     switch (yyn)
     {
 case 1:
-#line 237 ""
-{
+#line 241 ""
+       {
                        checkundefined();
                }
 break;
 case 3:
-#line 244 ""
-{ lex_error_message("implicit tagging is not supported"); }
+#line 248 ""
+       { lex_error_message("implicit tagging is not supported"); }
 break;
 case 4:
-#line 246 ""
-{ lex_error_message("automatic tagging is not supported"); }
+#line 250 ""
+       { lex_error_message("automatic tagging is not supported"); }
 break;
 case 6:
-#line 251 ""
-{ lex_error_message("no extensibility options supported"); }
+#line 255 ""
+       { lex_error_message("no extensibility options supported"); }
 break;
 case 16:
-#line 272 ""
-{
+#line 276 ""
+       {
                    struct string_list *sl;
-                   for(sl = yyvsp[-3].sl; sl != NULL; sl = sl->next) {
+                   for(sl = yystack.l_mark[-3].sl; sl != NULL; sl = sl->next) {
                        Symbol *s = addsym(sl->string);
                        s->stype = Stype;
                        gen_template_import(s);
                    }
-                   add_import(yyvsp[-1].name);
+                   add_import(yystack.l_mark[-1].name);
                }
 break;
 case 17:
-#line 284 ""
-{
+#line 288 ""
+       {
                    struct string_list *sl;
-                   for(sl = yyvsp[-1].sl; sl != NULL; sl = sl->next)
+                   for(sl = yystack.l_mark[-1].sl; sl != NULL; sl = sl->next)
                        add_export(sl->string);
                }
 break;
 case 24:
-#line 302 ""
-{
+#line 306 ""
+       {
                    yyval.sl = emalloc(sizeof(*yyval.sl));
-                   yyval.sl->string = yyvsp[-2].name;
-                   yyval.sl->next = yyvsp[0].sl;
+                   yyval.sl->string = yystack.l_mark[-2].name;
+                   yyval.sl->next = yystack.l_mark[0].sl;
                }
 break;
 case 25:
-#line 308 ""
-{
+#line 312 ""
+       {
                    yyval.sl = emalloc(sizeof(*yyval.sl));
-                   yyval.sl->string = yyvsp[0].name;
+                   yyval.sl->string = yystack.l_mark[0].name;
                    yyval.sl->next = NULL;
                }
 break;
 case 26:
-#line 316 ""
-{
-                   Symbol *s = addsym (yyvsp[-2].name);
+#line 320 ""
+       {
+                   Symbol *s = addsym (yystack.l_mark[-2].name);
                    s->stype = Stype;
-                   s->type = yyvsp[0].type;
+                   s->type = yystack.l_mark[0].type;
                    fix_labels(s);
                    generate_type (s);
                }
 break;
 case 44:
-#line 347 ""
-{
+#line 351 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_Boolean,
                                     TE_EXPLICIT, new_type(TBoolean));
                }
 break;
 case 45:
-#line 354 ""
-{
-                   if(yyvsp[-3].value->type != integervalue)
+#line 358 ""
+       {
+                   if(yystack.l_mark[-3].value->type != integervalue)
                        lex_error_message("Non-integer used in first part of range");
-                   if(yyvsp[-3].value->type != integervalue)
+                   if(yystack.l_mark[-3].value->type != integervalue)
                        lex_error_message("Non-integer in second part of range");
                    yyval.range = ecalloc(1, sizeof(*yyval.range));
-                   yyval.range->min = yyvsp[-3].value->u.integervalue;
-                   yyval.range->max = yyvsp[-1].value->u.integervalue;
+                   yyval.range->min = yystack.l_mark[-3].value->u.integervalue;
+                   yyval.range->max = yystack.l_mark[-1].value->u.integervalue;
                }
 break;
 case 46:
-#line 364 ""
-{
-                   if(yyvsp[-3].value->type != integervalue)
+#line 368 ""
+       {
+                   if(yystack.l_mark[-3].value->type != integervalue)
                        lex_error_message("Non-integer in first part of range");
                    yyval.range = ecalloc(1, sizeof(*yyval.range));
-                   yyval.range->min = yyvsp[-3].value->u.integervalue;
-                   yyval.range->max = yyvsp[-3].value->u.integervalue - 1;
+                   yyval.range->min = yystack.l_mark[-3].value->u.integervalue;
+                   yyval.range->max = yystack.l_mark[-3].value->u.integervalue - 1;
                }
 break;
 case 47:
-#line 372 ""
-{
-                   if(yyvsp[-1].value->type != integervalue)
+#line 376 ""
+       {
+                   if(yystack.l_mark[-1].value->type != integervalue)
                        lex_error_message("Non-integer in second part of range");
                    yyval.range = ecalloc(1, sizeof(*yyval.range));
-                   yyval.range->min = yyvsp[-1].value->u.integervalue + 2;
-                   yyval.range->max = yyvsp[-1].value->u.integervalue;
+                   yyval.range->min = yystack.l_mark[-1].value->u.integervalue + 2;
+                   yyval.range->max = yystack.l_mark[-1].value->u.integervalue;
                }
 break;
 case 48:
-#line 380 ""
-{
-                   if(yyvsp[-1].value->type != integervalue)
+#line 384 ""
+       {
+                   if(yystack.l_mark[-1].value->type != integervalue)
                        lex_error_message("Non-integer used in limit");
                    yyval.range = ecalloc(1, sizeof(*yyval.range));
-                   yyval.range->min = yyvsp[-1].value->u.integervalue;
-                   yyval.range->max = yyvsp[-1].value->u.integervalue;
+                   yyval.range->min = yystack.l_mark[-1].value->u.integervalue;
+                   yyval.range->max = yystack.l_mark[-1].value->u.integervalue;
                }
 break;
 case 49:
-#line 391 ""
-{
+#line 395 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_Integer,
                                     TE_EXPLICIT, new_type(TInteger));
                }
 break;
 case 50:
-#line 396 ""
-{
+#line 400 ""
+       {
                        yyval.type = new_type(TInteger);
-                       yyval.type->range = yyvsp[0].range;
+                       yyval.type->range = yystack.l_mark[0].range;
                        yyval.type = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, yyval.type);
                }
 break;
 case 51:
-#line 402 ""
-{
+#line 406 ""
+       {
                  yyval.type = new_type(TInteger);
-                 yyval.type->members = yyvsp[-1].members;
+                 yyval.type->members = yystack.l_mark[-1].members;
                  yyval.type = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, yyval.type);
                }
 break;
 case 52:
-#line 410 ""
-{
+#line 414 ""
+       {
                        yyval.members = emalloc(sizeof(*yyval.members));
                        ASN1_TAILQ_INIT(yyval.members);
-                       ASN1_TAILQ_INSERT_HEAD(yyval.members, yyvsp[0].member, members);
+                       ASN1_TAILQ_INSERT_HEAD(yyval.members, yystack.l_mark[0].member, members);
                }
 break;
 case 53:
-#line 416 ""
-{
-                       ASN1_TAILQ_INSERT_TAIL(yyvsp[-2].members, yyvsp[0].member, members);
-                       yyval.members = yyvsp[-2].members;
+#line 420 ""
+       {
+                       ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
+                       yyval.members = yystack.l_mark[-2].members;
                }
 break;
 case 54:
-#line 421 ""
-{ yyval.members = yyvsp[-2].members; }
+#line 425 ""
+       { yyval.members = yystack.l_mark[-2].members; }
 break;
 case 55:
-#line 425 ""
-{
+#line 429 ""
+       {
                        yyval.member = emalloc(sizeof(*yyval.member));
-                       yyval.member->name = yyvsp[-3].name;
-                       yyval.member->gen_name = estrdup(yyvsp[-3].name);
+                       yyval.member->name = yystack.l_mark[-3].name;
+                       yyval.member->gen_name = estrdup(yystack.l_mark[-3].name);
                        output_name (yyval.member->gen_name);
-                       yyval.member->val = yyvsp[-1].constant;
+                       yyval.member->val = yystack.l_mark[-1].constant;
                        yyval.member->optional = 0;
                        yyval.member->ellipsis = 0;
                        yyval.member->type = NULL;
                }
 break;
 case 56:
-#line 438 ""
-{
+#line 442 ""
+       {
                  yyval.type = new_type(TInteger);
-                 yyval.type->members = yyvsp[-1].members;
+                 yyval.type->members = yystack.l_mark[-1].members;
                  yyval.type = new_tag(ASN1_C_UNIV, UT_Enumerated, TE_EXPLICIT, yyval.type);
                }
 break;
 case 58:
-#line 449 ""
-{
+#line 453 ""
+       {
                  yyval.type = new_type(TBitString);
                  yyval.type->members = emalloc(sizeof(*yyval.type->members));
                  ASN1_TAILQ_INIT(yyval.type->members);
@@ -1048,128 +1094,128 @@ case 58:
                }
 break;
 case 59:
-#line 456 ""
-{
+#line 460 ""
+       {
                  yyval.type = new_type(TBitString);
-                 yyval.type->members = yyvsp[-1].members;
+                 yyval.type->members = yystack.l_mark[-1].members;
                  yyval.type = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, yyval.type);
                }
 break;
 case 60:
-#line 464 ""
-{
+#line 468 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_OID,
                                     TE_EXPLICIT, new_type(TOID));
                }
 break;
 case 61:
-#line 470 ""
-{
+#line 474 ""
+       {
                    Type *t = new_type(TOctetString);
-                   t->range = yyvsp[0].range;
+                   t->range = yystack.l_mark[0].range;
                    yyval.type = new_tag(ASN1_C_UNIV, UT_OctetString,
                                 TE_EXPLICIT, t);
                }
 break;
 case 62:
-#line 479 ""
-{
+#line 483 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_Null,
                                     TE_EXPLICIT, new_type(TNull));
                }
 break;
 case 63:
-#line 486 ""
-{ yyval.range = NULL; }
+#line 490 ""
+       { yyval.range = NULL; }
 break;
 case 64:
-#line 488 ""
-{ yyval.range = yyvsp[0].range; }
+#line 492 ""
+       { yyval.range = yystack.l_mark[0].range; }
 break;
 case 65:
-#line 493 ""
-{
+#line 497 ""
+       {
                  yyval.type = new_type(TSequence);
-                 yyval.type->members = yyvsp[-1].members;
+                 yyval.type->members = yystack.l_mark[-1].members;
                  yyval.type = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, yyval.type);
                }
 break;
 case 66:
-#line 499 ""
-{
+#line 503 ""
+       {
                  yyval.type = new_type(TSequence);
                  yyval.type->members = NULL;
                  yyval.type = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, yyval.type);
                }
 break;
 case 67:
-#line 507 ""
-{
+#line 511 ""
+       {
                  yyval.type = new_type(TSequenceOf);
-                 yyval.type->range = yyvsp[-2].range;
-                 yyval.type->subtype = yyvsp[0].type;
+                 yyval.type->range = yystack.l_mark[-2].range;
+                 yyval.type->subtype = yystack.l_mark[0].type;
                  yyval.type = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, yyval.type);
                }
 break;
 case 68:
-#line 516 ""
-{
+#line 520 ""
+       {
                  yyval.type = new_type(TSet);
-                 yyval.type->members = yyvsp[-1].members;
+                 yyval.type->members = yystack.l_mark[-1].members;
                  yyval.type = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, yyval.type);
                }
 break;
 case 69:
-#line 522 ""
-{
+#line 526 ""
+       {
                  yyval.type = new_type(TSet);
                  yyval.type->members = NULL;
                  yyval.type = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, yyval.type);
                }
 break;
 case 70:
-#line 530 ""
-{
+#line 534 ""
+       {
                  yyval.type = new_type(TSetOf);
-                 yyval.type->subtype = yyvsp[0].type;
+                 yyval.type->subtype = yystack.l_mark[0].type;
                  yyval.type = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, yyval.type);
                }
 break;
 case 71:
-#line 538 ""
-{
+#line 542 ""
+       {
                  yyval.type = new_type(TChoice);
-                 yyval.type->members = yyvsp[-1].members;
+                 yyval.type->members = yystack.l_mark[-1].members;
                }
 break;
 case 74:
-#line 549 ""
-{
-                 Symbol *s = addsym(yyvsp[0].name);
+#line 553 ""
+       {
+                 Symbol *s = addsym(yystack.l_mark[0].name);
                  yyval.type = new_type(TType);
                  if(s->stype != Stype && s->stype != SUndefined)
-                   lex_error_message ("%s is not a type\n", yyvsp[0].name);
+                   lex_error_message ("%s is not a type\n", yystack.l_mark[0].name);
                  else
                    yyval.type->symbol = s;
                }
 break;
 case 75:
-#line 560 ""
-{
+#line 564 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,
                                     TE_EXPLICIT, new_type(TGeneralizedTime));
                }
 break;
 case 76:
-#line 565 ""
-{
+#line 569 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_UTCTime,
                                     TE_EXPLICIT, new_type(TUTCTime));
                }
 break;
 case 77:
-#line 572 ""
-{
+#line 576 ""
+       {
                    /* if (Constraint.type == contentConstrant) {
                       assert(Constraint.u.constraint.type == octetstring|bitstring-w/o-NamedBitList); // remember to check type reference too
                       if (Constraint.u.constraint.type) {
@@ -1183,301 +1229,301 @@ case 77:
                }
 break;
 case 78:
-#line 588 ""
-{
-                   yyval.constraint_spec = yyvsp[-1].constraint_spec;
+#line 592 ""
+       {
+                   yyval.constraint_spec = yystack.l_mark[-1].constraint_spec;
                }
 break;
 case 82:
-#line 601 ""
-{
+#line 605 ""
+       {
                    yyval.constraint_spec = new_constraint_spec(CT_CONTENTS);
-                   yyval.constraint_spec->u.content.type = yyvsp[0].type;
+                   yyval.constraint_spec->u.content.type = yystack.l_mark[0].type;
                    yyval.constraint_spec->u.content.encoding = NULL;
                }
 break;
 case 83:
-#line 607 ""
-{
-                   if (yyvsp[0].value->type != objectidentifiervalue)
+#line 611 ""
+       {
+                   if (yystack.l_mark[0].value->type != objectidentifiervalue)
                        lex_error_message("Non-OID used in ENCODED BY constraint");
                    yyval.constraint_spec = new_constraint_spec(CT_CONTENTS);
                    yyval.constraint_spec->u.content.type = NULL;
-                   yyval.constraint_spec->u.content.encoding = yyvsp[0].value;
+                   yyval.constraint_spec->u.content.encoding = yystack.l_mark[0].value;
                }
 break;
 case 84:
-#line 615 ""
-{
-                   if (yyvsp[0].value->type != objectidentifiervalue)
+#line 619 ""
+       {
+                   if (yystack.l_mark[0].value->type != objectidentifiervalue)
                        lex_error_message("Non-OID used in ENCODED BY constraint");
                    yyval.constraint_spec = new_constraint_spec(CT_CONTENTS);
-                   yyval.constraint_spec->u.content.type = yyvsp[-3].type;
-                   yyval.constraint_spec->u.content.encoding = yyvsp[0].value;
+                   yyval.constraint_spec->u.content.type = yystack.l_mark[-3].type;
+                   yyval.constraint_spec->u.content.encoding = yystack.l_mark[0].value;
                }
 break;
 case 85:
-#line 625 ""
-{
+#line 629 ""
+       {
                    yyval.constraint_spec = new_constraint_spec(CT_USER);
                }
 break;
 case 86:
-#line 631 ""
-{
+#line 635 ""
+       {
                        yyval.type = new_type(TTag);
-                       yyval.type->tag = yyvsp[-2].tag;
-                       yyval.type->tag.tagenv = yyvsp[-1].constant;
-                       if(yyvsp[0].type->type == TTag && yyvsp[-1].constant == TE_IMPLICIT) {
-                               yyval.type->subtype = yyvsp[0].type->subtype;
-                               free(yyvsp[0].type);
+                       yyval.type->tag = yystack.l_mark[-2].tag;
+                       yyval.type->tag.tagenv = yystack.l_mark[-1].constant;
+                       if(yystack.l_mark[0].type->type == TTag && yystack.l_mark[-1].constant == TE_IMPLICIT) {
+                               yyval.type->subtype = yystack.l_mark[0].type->subtype;
+                               free(yystack.l_mark[0].type);
                        } else
-                               yyval.type->subtype = yyvsp[0].type;
+                               yyval.type->subtype = yystack.l_mark[0].type;
                }
 break;
 case 87:
-#line 644 ""
-{
-                       yyval.tag.tagclass = yyvsp[-2].constant;
-                       yyval.tag.tagvalue = yyvsp[-1].constant;
+#line 648 ""
+       {
+                       yyval.tag.tagclass = yystack.l_mark[-2].constant;
+                       yyval.tag.tagvalue = yystack.l_mark[-1].constant;
                        yyval.tag.tagenv = TE_EXPLICIT;
                }
 break;
 case 88:
-#line 652 ""
-{
+#line 656 ""
+       {
                        yyval.constant = ASN1_C_CONTEXT;
                }
 break;
 case 89:
-#line 656 ""
-{
+#line 660 ""
+       {
                        yyval.constant = ASN1_C_UNIV;
                }
 break;
 case 90:
-#line 660 ""
-{
+#line 664 ""
+       {
                        yyval.constant = ASN1_C_APPL;
                }
 break;
 case 91:
-#line 664 ""
-{
+#line 668 ""
+       {
                        yyval.constant = ASN1_C_PRIVATE;
                }
 break;
 case 92:
-#line 670 ""
-{
+#line 674 ""
+       {
                        yyval.constant = TE_EXPLICIT;
                }
 break;
 case 93:
-#line 674 ""
-{
+#line 678 ""
+       {
                        yyval.constant = TE_EXPLICIT;
                }
 break;
 case 94:
-#line 678 ""
-{
+#line 682 ""
+       {
                        yyval.constant = TE_IMPLICIT;
                }
 break;
 case 95:
-#line 685 ""
-{
+#line 689 ""
+       {
                        Symbol *s;
-                       s = addsym (yyvsp[-3].name);
+                       s = addsym (yystack.l_mark[-3].name);
 
                        s->stype = SValue;
-                       s->value = yyvsp[0].value;
+                       s->value = yystack.l_mark[0].value;
                        generate_constant (s);
                }
 break;
 case 97:
-#line 699 ""
-{
+#line 703 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_GeneralString,
                                     TE_EXPLICIT, new_type(TGeneralString));
                }
 break;
 case 98:
-#line 704 ""
-{
+#line 708 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_TeletexString,
                                     TE_EXPLICIT, new_type(TTeletexString));
                }
 break;
 case 99:
-#line 709 ""
-{
+#line 713 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_UTF8String,
                                     TE_EXPLICIT, new_type(TUTF8String));
                }
 break;
 case 100:
-#line 714 ""
-{
+#line 718 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_PrintableString,
                                     TE_EXPLICIT, new_type(TPrintableString));
                }
 break;
 case 101:
-#line 719 ""
-{
+#line 723 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_VisibleString,
                                     TE_EXPLICIT, new_type(TVisibleString));
                }
 break;
 case 102:
-#line 724 ""
-{
+#line 728 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_IA5String,
                                     TE_EXPLICIT, new_type(TIA5String));
                }
 break;
 case 103:
-#line 729 ""
-{
+#line 733 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_BMPString,
                                     TE_EXPLICIT, new_type(TBMPString));
                }
 break;
 case 104:
-#line 734 ""
-{
+#line 738 ""
+       {
                        yyval.type = new_tag(ASN1_C_UNIV, UT_UniversalString,
                                     TE_EXPLICIT, new_type(TUniversalString));
                }
 break;
 case 105:
-#line 742 ""
-{
+#line 746 ""
+       {
                        yyval.members = emalloc(sizeof(*yyval.members));
                        ASN1_TAILQ_INIT(yyval.members);
-                       ASN1_TAILQ_INSERT_HEAD(yyval.members, yyvsp[0].member, members);
+                       ASN1_TAILQ_INSERT_HEAD(yyval.members, yystack.l_mark[0].member, members);
                }
 break;
 case 106:
-#line 748 ""
-{
-                       ASN1_TAILQ_INSERT_TAIL(yyvsp[-2].members, yyvsp[0].member, members);
-                       yyval.members = yyvsp[-2].members;
+#line 752 ""
+       {
+                       ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
+                       yyval.members = yystack.l_mark[-2].members;
                }
 break;
 case 107:
-#line 753 ""
-{
+#line 757 ""
+       {
                        struct member *m = ecalloc(1, sizeof(*m));
                        m->name = estrdup("...");
                        m->gen_name = estrdup("asn1_ellipsis");
                        m->ellipsis = 1;
-                       ASN1_TAILQ_INSERT_TAIL(yyvsp[-2].members, m, members);
-                       yyval.members = yyvsp[-2].members;
+                       ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, m, members);
+                       yyval.members = yystack.l_mark[-2].members;
                }
 break;
 case 108:
-#line 764 ""
-{
+#line 768 ""
+       {
                  yyval.member = emalloc(sizeof(*yyval.member));
-                 yyval.member->name = yyvsp[-1].name;
-                 yyval.member->gen_name = estrdup(yyvsp[-1].name);
+                 yyval.member->name = yystack.l_mark[-1].name;
+                 yyval.member->gen_name = estrdup(yystack.l_mark[-1].name);
                  output_name (yyval.member->gen_name);
-                 yyval.member->type = yyvsp[0].type;
+                 yyval.member->type = yystack.l_mark[0].type;
                  yyval.member->ellipsis = 0;
                }
 break;
 case 109:
-#line 775 ""
-{
-                       yyval.member = yyvsp[0].member;
+#line 779 ""
+       {
+                       yyval.member = yystack.l_mark[0].member;
                        yyval.member->optional = 0;
                        yyval.member->defval = NULL;
                }
 break;
 case 110:
-#line 781 ""
-{
-                       yyval.member = yyvsp[-1].member;
+#line 785 ""
+       {
+                       yyval.member = yystack.l_mark[-1].member;
                        yyval.member->optional = 1;
                        yyval.member->defval = NULL;
                }
 break;
 case 111:
-#line 787 ""
-{
-                       yyval.member = yyvsp[-2].member;
+#line 791 ""
+       {
+                       yyval.member = yystack.l_mark[-2].member;
                        yyval.member->optional = 0;
-                       yyval.member->defval = yyvsp[0].value;
+                       yyval.member->defval = yystack.l_mark[0].value;
                }
 break;
 case 112:
-#line 795 ""
-{
+#line 799 ""
+       {
                        yyval.members = emalloc(sizeof(*yyval.members));
                        ASN1_TAILQ_INIT(yyval.members);
-                       ASN1_TAILQ_INSERT_HEAD(yyval.members, yyvsp[0].member, members);
+                       ASN1_TAILQ_INSERT_HEAD(yyval.members, yystack.l_mark[0].member, members);
                }
 break;
 case 113:
-#line 801 ""
-{
-                       ASN1_TAILQ_INSERT_TAIL(yyvsp[-2].members, yyvsp[0].member, members);
-                       yyval.members = yyvsp[-2].members;
+#line 805 ""
+       {
+                       ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
+                       yyval.members = yystack.l_mark[-2].members;
                }
 break;
 case 114:
-#line 808 ""
-{
+#line 812 ""
+       {
                  yyval.member = emalloc(sizeof(*yyval.member));
-                 yyval.member->name = yyvsp[-3].name;
-                 yyval.member->gen_name = estrdup(yyvsp[-3].name);
+                 yyval.member->name = yystack.l_mark[-3].name;
+                 yyval.member->gen_name = estrdup(yystack.l_mark[-3].name);
                  output_name (yyval.member->gen_name);
-                 yyval.member->val = yyvsp[-1].constant;
+                 yyval.member->val = yystack.l_mark[-1].constant;
                  yyval.member->optional = 0;
                  yyval.member->ellipsis = 0;
                  yyval.member->type = NULL;
                }
 break;
 case 116:
-#line 821 ""
-{ yyval.objid = NULL; }
+#line 825 ""
+       { yyval.objid = NULL; }
 break;
 case 117:
-#line 825 ""
-{
-                       yyval.objid = yyvsp[-1].objid;
+#line 829 ""
+       {
+                       yyval.objid = yystack.l_mark[-1].objid;
                }
 break;
 case 118:
-#line 831 ""
-{
+#line 835 ""
+       {
                        yyval.objid = NULL;
                }
 break;
 case 119:
-#line 835 ""
-{
-                       if (yyvsp[0].objid) {
-                               yyval.objid = yyvsp[0].objid;
-                               add_oid_to_tail(yyvsp[0].objid, yyvsp[-1].objid);
+#line 839 ""
+       {
+                       if (yystack.l_mark[0].objid) {
+                               yyval.objid = yystack.l_mark[0].objid;
+                               add_oid_to_tail(yystack.l_mark[0].objid, yystack.l_mark[-1].objid);
                        } else {
-                               yyval.objid = yyvsp[-1].objid;
+                               yyval.objid = yystack.l_mark[-1].objid;
                        }
                }
 break;
 case 120:
-#line 846 ""
-{
-                       yyval.objid = new_objid(yyvsp[-3].name, yyvsp[-1].constant);
+#line 850 ""
+       {
+                       yyval.objid = new_objid(yystack.l_mark[-3].name, yystack.l_mark[-1].constant);
                }
 break;
 case 121:
-#line 850 ""
-{
-                   Symbol *s = addsym(yyvsp[0].name);
+#line 854 ""
+       {
+                   Symbol *s = addsym(yystack.l_mark[0].name);
                    if(s->stype != SValue ||
                       s->value->type != objectidentifiervalue) {
                        lex_error_message("%s is not an object identifier\n",
@@ -1488,15 +1534,15 @@ case 121:
                }
 break;
 case 122:
-#line 861 ""
-{
-                   yyval.objid = new_objid(NULL, yyvsp[0].constant);
+#line 865 ""
+       {
+                   yyval.objid = new_objid(NULL, yystack.l_mark[0].constant);
                }
 break;
 case 132:
-#line 884 ""
-{
-                       Symbol *s = addsym(yyvsp[0].name);
+#line 888 ""
+       {
+                       Symbol *s = addsym(yystack.l_mark[0].name);
                        if(s->stype != SValue)
                                lex_error_message ("%s is not a value\n",
                                                s->name);
@@ -1505,55 +1551,55 @@ case 132:
                }
 break;
 case 133:
-#line 895 ""
-{
+#line 899 ""
+       {
                        yyval.value = emalloc(sizeof(*yyval.value));
                        yyval.value->type = stringvalue;
-                       yyval.value->u.stringvalue = yyvsp[0].name;
+                       yyval.value->u.stringvalue = yystack.l_mark[0].name;
                }
 break;
 case 134:
-#line 903 ""
-{
+#line 907 ""
+       {
                        yyval.value = emalloc(sizeof(*yyval.value));
                        yyval.value->type = booleanvalue;
                        yyval.value->u.booleanvalue = 0;
                }
 break;
 case 135:
-#line 909 ""
-{
+#line 913 ""
+       {
                        yyval.value = emalloc(sizeof(*yyval.value));
                        yyval.value->type = booleanvalue;
                        yyval.value->u.booleanvalue = 0;
                }
 break;
 case 136:
-#line 917 ""
-{
+#line 921 ""
+       {
                        yyval.value = emalloc(sizeof(*yyval.value));
                        yyval.value->type = integervalue;
-                       yyval.value->u.integervalue = yyvsp[0].constant;
+                       yyval.value->u.integervalue = yystack.l_mark[0].constant;
                }
 break;
 case 138:
-#line 928 ""
-{
+#line 932 ""
+       {
                }
 break;
 case 139:
-#line 933 ""
-{
+#line 937 ""
+       {
                        yyval.value = emalloc(sizeof(*yyval.value));
                        yyval.value->type = objectidentifiervalue;
-                       yyval.value->u.objectidentifiervalue = yyvsp[0].objid;
+                       yyval.value->u.objectidentifiervalue = yystack.l_mark[0].objid;
                }
 break;
-#line 1553 ""
+#line 1598 ""
     }
-    yyssp -= yym;
-    yystate = *yyssp;
-    yyvsp -= yym;
+    yystack.s_mark -= yym;
+    yystate = *yystack.s_mark;
+    yystack.l_mark -= yym;
     yym = yylhs[yyn];
     if (yystate == 0 && yym == 0)
     {
@@ -1563,8 +1609,8 @@ break;
  state %d\n", YYPREFIX, YYFINAL);
 #endif
         yystate = YYFINAL;
-        *++yyssp = YYFINAL;
-        *++yyvsp = yyval;
+        *++yystack.s_mark = YYFINAL;
+        *++yystack.l_mark = yyval;
         if (yychar < 0)
         {
             if ((yychar = yylex()) < 0) yychar = 0;
@@ -1590,22 +1636,24 @@ break;
 #if YYDEBUG
     if (yydebug)
         printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
 #endif
-    if (yyssp >= yysslim && yygrowstack())
+    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
     {
         goto yyoverflow;
     }
-    *++yyssp = yystate;
-    *++yyvsp = yyval;
+    *++yystack.s_mark = (short) yystate;
+    *++yystack.l_mark = yyval;
     goto yyloop;
 
 yyoverflow:
     yyerror("yacc stack overflow");
 
 yyabort:
+    yyfreestack(&yystack);
     return (1);
 
 yyaccept:
+    yyfreestack(&yystack);
     return (0);
 }
index dad7f67a20229e870752ed9c6163913b2f92c655..a7a8f31827a653ca8d86e24a155a0e543af61b35 100644 (file)
@@ -62,6 +62,10 @@ struct string_list {
     struct string_list *next;
 };
 
+/* Declarations for Bison */
+#define YYMALLOC malloc
+#define YYFREE   free
+
 %}
 
 %union {
index 9e09eb2d8db1f50d221b9036f540ee5590183ac1..791fb910f9a07454f7dd0666a93c0ea72dd2ac1a 100644 (file)
@@ -58,8 +58,10 @@ integer_symbol(const char *basename, const Type *t)
        return "unsigned";
     else if (t->range->min == 0 && t->range->max == INT_MAX)
        return "unsigned";
-    else
+    else {
        abort();
+        UNREACHABLE(return NULL);
+    }
 }
 
 static const char *
index 1fcfe7f7aa93218bfa5d48442a680c6f95c11320..5b8b7e28f77858c5dc7a934254c2d1a53a4f0cf7 100644 (file)
 #define __attribute__(X)
 #endif
 
-#ifndef KRB5_LIB
-#ifndef KRB5_LIB_FUNCTION
-#if defined(_WIN32)
-#define KRB5_LIB_FUNCTION __declspec(dllimport)
-#define KRB5_LIB_CALL __stdcall
-#define KRB5_LIB_VARIABLE __declspec(dllimport)
-#else
-#define KRB5_LIB_FUNCTION
-#define KRB5_LIB_CALL
-#define KRB5_LIB_VARIABLE
-#endif
-#endif
-#endif
-
-#ifdef _WIN32
-#define KRB5_CALLCONV __stdcall
-#else
-#define KRB5_CALLCONV
-#endif
-
 typedef void (KRB5_CALLCONV *errf) (const char *, long, const char *, va_list);
 
 KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
index e13855abad07270ac471e7a795aec306dd02d17a..b0857d283acf20686de91134e953fa735dc06e58 100644 (file)
 #ifndef __COM_RIGHT_H__
 #define __COM_RIGHT_H__
 
+#ifndef KRB5_LIB
+#ifndef KRB5_LIB_FUNCTION
+#if defined(_WIN32)
+#define KRB5_LIB_FUNCTION __declspec(dllimport)
+#define KRB5_LIB_CALL __stdcall
+#define KRB5_LIB_VARIABLE __declspec(dllimport)
+#else
+#define KRB5_LIB_FUNCTION
+#define KRB5_LIB_CALL
+#define KRB5_LIB_VARIABLE
+#endif
+#endif
+#endif
+
+#ifdef _WIN32
+#define KRB5_CALLCONV __stdcall
+#else
+#define KRB5_CALLCONV
+#endif
+
 #ifdef __STDC__
 #include <stdarg.h>
 #endif
@@ -51,9 +71,16 @@ struct et_list {
 };
 extern struct et_list *_et_list;
 
-const char *com_right (struct et_list *list, long code);
-const char *com_right_r (struct et_list *list, long code, char *, size_t);
-void initialize_error_table_r (struct et_list **, const char **, int, long);
-void free_error_table (struct et_list *);
+KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
+com_right (struct et_list *list, long code);
+
+KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
+com_right_r (struct et_list *list, long code, char *, size_t);
+
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
+initialize_error_table_r (struct et_list **, const char **, int, long);
+
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
+free_error_table (struct et_list *);
 
 #endif /* __COM_RIGHT_H__ */
index 854a4b66cb64ffce2f9e7109147cbf95a4a8f1be..0e49a94104911319ec26529370e427af4ff3944e 100644 (file)
@@ -46,7 +46,7 @@
 #define dgettext(d,s) (s)
 #endif
 
-const char *
+KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
 com_right(struct et_list *list, long code)
 {
     struct et_list *p;
@@ -56,7 +56,7 @@ com_right(struct et_list *list, long code)
     return NULL;
 }
 
-const char *
+KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
 com_right_r(struct et_list *list, long code, char *str, size_t len)
 {
     struct et_list *p;
@@ -79,7 +79,7 @@ struct foobar {
     struct error_table et;
 };
 
-void
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
 initialize_error_table_r(struct et_list **list,
                         const char **messages,
                         int num_errors,
@@ -103,7 +103,7 @@ initialize_error_table_r(struct et_list **list,
 }
                        
 
-void
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
 free_error_table(struct et_list *et)
 {
     while(et){
index bf33e3ad0e8ec2ebbe48042b28cc3bfa9716dc43..f107bba5bd586934e41072bd8925aa9b6bea09ad 100644 (file)
@@ -586,8 +586,6 @@ extern int yywrap (void );
 #endif
 #endif
 
-    static void yyunput (int c,char *buf_ptr  );
-    
 #ifndef yytext_ptr
 static void yy_flex_strncpy (char *,yyconst char *,int );
 #endif
@@ -709,9 +707,9 @@ YY_DECL
        register char *yy_cp, *yy_bp;
        register int yy_act;
     
-#line 57 "lex.l"
+#line 58 "lex.l"
 
-#line 714 ""
+#line 712 ""
 
        if ( !(yy_init) )
                {
@@ -796,86 +794,86 @@ do_action:        /* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 58 "lex.l"
+#line 59 "lex.l"
 { return ET; }
        YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 59 "lex.l"
+#line 60 "lex.l"
 { return ET; }
        YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 60 "lex.l"
+#line 61 "lex.l"
 { return EC; }
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 61 "lex.l"
+#line 62 "lex.l"
 { return EC; }
        YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 62 "lex.l"
+#line 63 "lex.l"
 { return PREFIX; }
        YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 63 "lex.l"
+#line 64 "lex.l"
 { return INDEX; }
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 64 "lex.l"
+#line 65 "lex.l"
 { return ID; }
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 65 "lex.l"
+#line 66 "lex.l"
 { return END; }
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 66 "lex.l"
+#line 67 "lex.l"
 { yylval.number = atoi(yytext); return NUMBER; }
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 67 "lex.l"
+#line 68 "lex.l"
 ;
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 68 "lex.l"
+#line 69 "lex.l"
 ;
        YY_BREAK
 case 12:
 /* rule 12 can match eol */
 YY_RULE_SETUP
-#line 69 "lex.l"
+#line 70 "lex.l"
 { lineno++; }
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 70 "lex.l"
+#line 71 "lex.l"
 { return getstring(); }
        YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 71 "lex.l"
+#line 72 "lex.l"
 { yylval.string = strdup(yytext); return STRING; }
        YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 72 "lex.l"
+#line 73 "lex.l"
 { return *yytext; }
        YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 73 "lex.l"
+#line 74 "lex.l"
 ECHO;
        YY_BREAK
-#line 878 ""
+#line 876 ""
 case YY_STATE_EOF(INITIAL):
        yyterminate();
 
@@ -1204,43 +1202,6 @@ static int yy_get_next_buffer (void)
        return yy_is_jam ? 0 : yy_current_state;
 }
 
-    static void yyunput (int c, register char * yy_bp )
-{
-       register char *yy_cp;
-    
-    yy_cp = (yy_c_buf_p);
-
-       /* undo effects of setting up yytext */
-       *yy_cp = (yy_hold_char);
-
-       if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
-               { /* need to shift things up to make room */
-               /* +2 for EOB chars. */
-               register int number_to_move = (yy_n_chars) + 2;
-               register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
-                                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
-               register char *source =
-                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
-
-               while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-                       *--dest = *--source;
-
-               yy_cp += (int) (dest - source);
-               yy_bp += (int) (dest - source);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
-                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
-
-               if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
-                       YY_FATAL_ERROR( "flex scanner push-back overflow" );
-               }
-
-       *--yy_cp = (char) c;
-
-       (yytext_ptr) = yy_bp;
-       (yy_hold_char) = *yy_cp;
-       (yy_c_buf_p) = yy_cp;
-}
-
 #ifndef YY_NO_INPUT
 #ifdef __cplusplus
     static int yyinput (void)
@@ -1873,7 +1834,7 @@ void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 73 "lex.l"
+#line 74 "lex.l"
 
 
 
@@ -1899,7 +1860,7 @@ getstring(void)
            continue;
        }
        if(c == '\n'){
-           error_message("unterminated string");
+           lex_error_message("unterminated string");
            lineno++;
            break;
        }
@@ -1919,7 +1880,7 @@ getstring(void)
 }
 
 void
-error_message (const char *format, ...)
+lex_error_message (const char *format, ...)
 {
      va_list args;
 
index 76f3e2b2a5db60ee4398f39db13dc3959e0ac511..6c9be77ddfc786aa470dc66e809589703e7cd1c4 100644 (file)
@@ -33,7 +33,7 @@
 
 /* $Id$ */
 
-void error_message (const char *, ...)
+void lex_error_message (const char *, ...)
 __attribute__ ((format (printf, 1, 2)));
 
 int yylex(void);
index b68814b21caa0993ae4b45acc31efb7118091543..ac660a1d8ca24ecabd3d40883b6e29443584a1dc 100644 (file)
@@ -53,6 +53,7 @@ static int getstring(void);
 
 %}
 
+%option nounput
 
 %%
 et                     { return ET; }
@@ -94,7 +95,7 @@ getstring(void)
            continue;
        }
        if(c == '\n'){
-           error_message("unterminated string");
+           lex_error_message("unterminated string");
            lineno++;
            break;
        }
@@ -114,7 +115,7 @@ getstring(void)
 }
 
 void
-error_message (const char *format, ...)
+lex_error_message (const char *format, ...)
 {
      va_list args;
 
index a4266133035483c524c5f9d3553c0ad044e03729..b2b0fc10905b26dbb3875abb19a62ea6bc816a92 100644 (file)
@@ -8,17 +8,29 @@ static const char yysccsid[] = "@(#)yaccpar   1.9 (Berkeley) 02/21/93";
 #define YYBYACC 1
 #define YYMAJOR 1
 #define YYMINOR 9
-#define YYPATCH 20070509
+#define YYPATCH 20100216
 
-#define YYEMPTY (-1)
-#define yyclearin    (yychar = YYEMPTY)
-#define yyerrok      (yyerrflag = 0)
-#define YYRECOVERING (yyerrflag != 0)
+#define YYEMPTY        (-1)
+#define yyclearin      (yychar = YYEMPTY)
+#define yyerrok        (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
 
-extern int yyparse(void);
-
-static int yygrowstack(void);
 #define YYPREFIX "yy"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+#ifdef YYPARSE_PARAM_TYPE
+#define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+#else
+#define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+#endif
+#else
+#define YYPARSE_DECL() yyparse(void)
+#endif /* YYPARSE_PARAM */
+
+extern int YYPARSE_DECL();
+
 #line 2 ""
 /*
  * Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
@@ -67,12 +79,15 @@ extern char *yytext;
 #define alloca(x) malloc(x)
 #endif
 
-#line 51 ""
+#define YYMALLOC malloc
+#define YYFREE free
+
+#line 54 ""
 typedef union {
   char *string;
   int number;
 } YYSTYPE;
-#line 76 ""
+#line 90 ""
 #define ET 257
 #define INDEX 258
 #define PREFIX 259
@@ -82,37 +97,37 @@ typedef union {
 #define STRING 263
 #define NUMBER 264
 #define YYERRCODE 256
-short yylhs[] = {                                        -1,
+static const short yylhs[] = {                           -1,
     0,    0,    1,    1,    3,    4,    4,    2,    2,    5,
     5,    5,    5,    5,
 };
-short yylen[] = {                                         2,
+static const short yylen[] = {                            2,
     0,    2,    2,    1,    2,    2,    3,    1,    2,    2,
     2,    1,    4,    1,
 };
-short yydefred[] = {                                      0,
+static const short yydefred[] = {                         0,
     0,    0,    0,    0,    0,    4,    0,    5,    0,    0,
     0,   14,    0,    8,    3,    7,   10,   11,    0,    9,
     0,   13,
 };
-short yydgoto[] = {                                       3,
+static const short yydgoto[] = {                          3,
     4,   13,    5,    6,   14,
 };
-short yysindex[] = {                                   -247,
+static const short yysindex[] = {                      -247,
  -263, -258,    0, -256, -245,    0, -250,    0, -249, -246,
  -244,    0, -256,    0,    0,    0,    0,    0,  -28,    0,
  -243,    0,
 };
-short yyrindex[] = {                                     18,
+static const short yyrindex[] = {                        18,
     0,    0,    0,    0,    0,    0, -251,    0,    0,    1,
     0,    0,   21,    0,    0,    0,    0,    0,    0,    0,
     0,    0,
 };
-short yygindex[] = {                                      0,
+static const short yygindex[] = {                         0,
     0,    0,    0,   17,   10,
 };
 #define YYTABLESIZE 263
-short yytable[] = {                                       7,
+static const short yytable[] = {                          7,
    12,    9,   10,   11,    8,   12,    6,    6,    6,    1,
     6,    1,   16,    2,   17,   21,   18,    1,   19,   22,
     2,   15,   20,    0,    0,    0,    0,    0,    0,    0,
@@ -141,7 +156,7 @@ short yytable[] = {                                       7,
     0,    0,    0,    0,    0,    0,    0,    0,   12,   12,
    12,    0,   12,
 };
-short yycheck[] = {                                     263,
+static const short yycheck[] = {                        263,
     0,  258,  259,  260,  263,  262,  258,  259,  260,  257,
   262,  257,  263,  261,  264,   44,  263,    0,  263,  263,
     0,    5,   13,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
@@ -176,7 +191,8 @@ short yycheck[] = {                                     263,
 #endif
 #define YYMAXTOKEN 264
 #if YYDEBUG
-char *yyname[] = {
+static const char *yyname[] = {
+
 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0,0,0,0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -186,7 +202,7 @@ char *yyname[] = {
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"ET","INDEX","PREFIX","EC",
 "ID","END","STRING","NUMBER",
 };
-char *yyrule[] = {
+static const char *yyrule[] = {
 "$accept : file",
 "file :",
 "file : header statements",
@@ -202,6 +218,7 @@ char *yyrule[] = {
 "statement : PREFIX",
 "statement : EC STRING ',' STRING",
 "statement : END",
+
 };
 #endif
 #if YYDEBUG
@@ -225,19 +242,26 @@ char *yyrule[] = {
 
 int      yydebug;
 int      yynerrs;
+
+typedef struct {
+    unsigned stacksize;
+    short    *s_base;
+    short    *s_mark;
+    short    *s_last;
+    YYSTYPE  *l_base;
+    YYSTYPE  *l_mark;
+} YYSTACKDATA;
+
+#define YYPURE 0
+
 int      yyerrflag;
 int      yychar;
-short   *yyssp;
-YYSTYPE *yyvsp;
 YYSTYPE  yyval;
 YYSTYPE  yylval;
 
 /* variables for the parser stack */
-static short   *yyss;
-static short   *yysslim;
-static YYSTYPE *yyvs;
-static int      yystacksize;
-#line 141 ""
+static YYSTACKDATA yystack;
+#line 144 ""
 
 static long
 name2number(const char *str)
@@ -267,55 +291,70 @@ name2number(const char *str)
 void
 yyerror (char *s)
 {
-     error_message ("%s\n", s);
+     lex_error_message ("%s\n", s);
 }
-#line 273 ""
+#line 296 ""
 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(void)
+static int yygrowstack(YYSTACKDATA *data)
 {
-    int newsize, i;
+    int i;
+    unsigned newsize;
     short *newss;
     YYSTYPE *newvs;
 
-    if ((newsize = yystacksize) == 0)
+    if ((newsize = data->stacksize) == 0)
         newsize = YYINITSTACKSIZE;
     else if (newsize >= YYMAXDEPTH)
         return -1;
     else if ((newsize *= 2) > YYMAXDEPTH)
         newsize = YYMAXDEPTH;
 
-    i = yyssp - yyss;
-    newss = (yyss != 0)
-          ? (short *)realloc(yyss, newsize * sizeof(*newss))
+    i = data->s_mark - data->s_base;
+    newss = (data->s_base != 0)
+          ? (short *)realloc(data->s_base, newsize * sizeof(*newss))
           : (short *)malloc(newsize * sizeof(*newss));
     if (newss == 0)
         return -1;
 
-    yyss  = newss;
-    yyssp = newss + i;
-    newvs = (yyvs != 0)
-          ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs))
+    data->s_base  = newss;
+    data->s_mark = newss + i;
+
+    newvs = (data->l_base != 0)
+          ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs))
           : (YYSTYPE *)malloc(newsize * sizeof(*newvs));
     if (newvs == 0)
         return -1;
 
-    yyvs = newvs;
-    yyvsp = newvs + i;
-    yystacksize = newsize;
-    yysslim = yyss + newsize - 1;
+    data->l_base = newvs;
+    data->l_mark = newvs + i;
+
+    data->stacksize = newsize;
+    data->s_last = data->s_base + newsize - 1;
     return 0;
 }
 
-#define YYABORT goto yyabort
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+    free(data->s_base);
+    free(data->l_base);
+    memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT  goto yyabort
 #define YYREJECT goto yyabort
 #define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
+#define YYERROR  goto yyerrlab
+
 int
-yyparse(void)
+YYPARSE_DECL()
 {
-    register int yym, yyn, yystate;
+    int yym, yyn, yystate;
 #if YYDEBUG
-    register const char *yys;
+    const char *yys;
 
     if ((yys = getenv("YYDEBUG")) != 0)
     {
@@ -328,11 +367,17 @@ yyparse(void)
     yynerrs = 0;
     yyerrflag = 0;
     yychar = YYEMPTY;
+    yystate = 0;
 
-    if (yyss == NULL && yygrowstack()) goto yyoverflow;
-    yyssp = yyss;
-    yyvsp = yyvs;
-    *yyssp = yystate = 0;
+#if YYPURE
+    memset(&yystack, 0, sizeof(yystack));
+#endif
+
+    if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
+    yystack.s_mark = yystack.s_base;
+    yystack.l_mark = yystack.l_base;
+    yystate = 0;
+    *yystack.s_mark = 0;
 
 yyloop:
     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
@@ -358,12 +403,13 @@ yyloop:
             printf("%sdebug: state %d, shifting to state %d\n",
                     YYPREFIX, yystate, yytable[yyn]);
 #endif
-        if (yyssp >= yysslim && yygrowstack())
+        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
         {
             goto yyoverflow;
         }
-        *++yyssp = yystate = yytable[yyn];
-        *++yyvsp = yylval;
+        yystate = yytable[yyn];
+        *++yystack.s_mark = yytable[yyn];
+        *++yystack.l_mark = yylval;
         yychar = YYEMPTY;
         if (yyerrflag > 0)  --yyerrflag;
         goto yyloop;
@@ -378,9 +424,7 @@ yyloop:
 
     yyerror("syntax error");
 
-#ifdef lint
     goto yyerrlab;
-#endif
 
 yyerrlab:
     ++yynerrs;
@@ -391,20 +435,21 @@ yyinrecovery:
         yyerrflag = 3;
         for (;;)
         {
-            if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
+            if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
             {
 #if YYDEBUG
                 if (yydebug)
                     printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
 #endif
-                if (yyssp >= yysslim && yygrowstack())
+                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
                 {
                     goto yyoverflow;
                 }
-                *++yyssp = yystate = yytable[yyn];
-                *++yyvsp = yylval;
+                yystate = yytable[yyn];
+                *++yystack.s_mark = yytable[yyn];
+                *++yystack.l_mark = yylval;
                 goto yyloop;
             }
             else
@@ -412,11 +457,11 @@ yyinrecovery:
 #if YYDEBUG
                 if (yydebug)
                     printf("%sdebug: error recovery discarding state %d\n",
-                            YYPREFIX, *yyssp);
+                            YYPREFIX, *yystack.s_mark);
 #endif
-                if (yyssp <= yyss) goto yyabort;
-                --yyssp;
-                --yyvsp;
+                if (yystack.s_mark <= yystack.s_base) goto yyabort;
+                --yystack.s_mark;
+                --yystack.l_mark;
             }
         }
     }
@@ -445,53 +490,53 @@ yyreduce:
 #endif
     yym = yylen[yyn];
     if (yym)
-        yyval = yyvsp[1-yym];
+        yyval = yystack.l_mark[1-yym];
     else
         memset(&yyval, 0, sizeof yyval);
     switch (yyn)
     {
 case 5:
-#line 71 ""
-{
-                   id_str = yyvsp[0].string;
+#line 74 ""
+       {
+                   id_str = yystack.l_mark[0].string;
                }
 break;
 case 6:
-#line 77 ""
-{
-                   base_id = name2number(yyvsp[0].string);
-                   strlcpy(name, yyvsp[0].string, sizeof(name));
-                   free(yyvsp[0].string);
+#line 80 ""
+       {
+                   base_id = name2number(yystack.l_mark[0].string);
+                   strlcpy(name, yystack.l_mark[0].string, sizeof(name));
+                   free(yystack.l_mark[0].string);
                }
 break;
 case 7:
-#line 83 ""
-{
-                   base_id = name2number(yyvsp[-1].string);
-                   strlcpy(name, yyvsp[0].string, sizeof(name));
-                   free(yyvsp[-1].string);
-                   free(yyvsp[0].string);
+#line 86 ""
+       {
+                   base_id = name2number(yystack.l_mark[-1].string);
+                   strlcpy(name, yystack.l_mark[0].string, sizeof(name));
+                   free(yystack.l_mark[-1].string);
+                   free(yystack.l_mark[0].string);
                }
 break;
 case 10:
-#line 96 ""
-{
-                       number = yyvsp[0].number;
+#line 99 ""
+       {
+                       number = yystack.l_mark[0].number;
                }
 break;
 case 11:
-#line 100 ""
-{
+#line 103 ""
+       {
                    free(prefix);
-                   asprintf (&prefix, "%s_", yyvsp[0].string);
+                   asprintf (&prefix, "%s_", yystack.l_mark[0].string);
                    if (prefix == NULL)
                        errx(1, "malloc");
-                   free(yyvsp[0].string);
+                   free(yystack.l_mark[0].string);
                }
 break;
 case 12:
-#line 108 ""
-{
+#line 111 ""
+       {
                    prefix = realloc(prefix, 1);
                    if (prefix == NULL)
                        errx(1, "malloc");
@@ -499,8 +544,8 @@ case 12:
                }
 break;
 case 13:
-#line 115 ""
-{
+#line 118 ""
+       {
                    struct error_code *ec = malloc(sizeof(*ec));
                
                    if (ec == NULL)
@@ -509,28 +554,28 @@ case 13:
                    ec->next = NULL;
                    ec->number = number;
                    if(prefix && *prefix != '\0') {
-                       asprintf (&ec->name, "%s%s", prefix, yyvsp[-2].string);
+                       asprintf (&ec->name, "%s%s", prefix, yystack.l_mark[-2].string);
                        if (ec->name == NULL)
                            errx(1, "malloc");
-                       free(yyvsp[-2].string);
+                       free(yystack.l_mark[-2].string);
                    } else
-                       ec->name = yyvsp[-2].string;
-                   ec->string = yyvsp[0].string;
+                       ec->name = yystack.l_mark[-2].string;
+                   ec->string = yystack.l_mark[0].string;
                    APPEND(codes, ec);
                    number++;
                }
 break;
 case 14:
-#line 135 ""
-{
+#line 138 ""
+       {
                        YYACCEPT;
                }
 break;
-#line 530 ""
+#line 574 ""
     }
-    yyssp -= yym;
-    yystate = *yyssp;
-    yyvsp -= yym;
+    yystack.s_mark -= yym;
+    yystate = *yystack.s_mark;
+    yystack.l_mark -= yym;
     yym = yylhs[yyn];
     if (yystate == 0 && yym == 0)
     {
@@ -540,8 +585,8 @@ break;
  state %d\n", YYPREFIX, YYFINAL);
 #endif
         yystate = YYFINAL;
-        *++yyssp = YYFINAL;
-        *++yyvsp = yyval;
+        *++yystack.s_mark = YYFINAL;
+        *++yystack.l_mark = yyval;
         if (yychar < 0)
         {
             if ((yychar = yylex()) < 0) yychar = 0;
@@ -567,22 +612,24 @@ break;
 #if YYDEBUG
     if (yydebug)
         printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
 #endif
-    if (yyssp >= yysslim && yygrowstack())
+    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
     {
         goto yyoverflow;
     }
-    *++yyssp = yystate;
-    *++yyvsp = yyval;
+    *++yystack.s_mark = (short) yystate;
+    *++yystack.l_mark = yyval;
     goto yyloop;
 
 yyoverflow:
     yyerror("yacc stack overflow");
 
 yyabort:
+    yyfreestack(&yystack);
     return (1);
 
 yyaccept:
+    yyfreestack(&yystack);
     return (0);
 }
index d64681d90234dc0434426f2508a92e5ee15ddee0..f628e8804fbe9e2cc3b1299cfe0194b6a8ebc3b3 100644 (file)
@@ -46,6 +46,9 @@ extern char *yytext;
 #define alloca(x) malloc(x)
 #endif
 
+#define YYMALLOC malloc
+#define YYFREE free
+
 %}
 
 %union {
@@ -167,5 +170,5 @@ name2number(const char *str)
 void
 yyerror (char *s)
 {
-     error_message ("%s\n", s);
+     lex_error_message ("%s\n", s);
 }
index fa53a8a74cbf3c7eaf9996bec534d72e23687558..12833ebe149d4b1812001c0b42aa4bba16ff29e9 100644 (file)
@@ -90,29 +90,35 @@ typedef uint32_t gss_uint32;
 
 struct gss_name_t_desc_struct;
 typedef struct gss_name_t_desc_struct *gss_name_t;
+typedef const struct gss_name_t_desc_struct *gss_const_name_t;
 
 struct gss_ctx_id_t_desc_struct;
 typedef struct gss_ctx_id_t_desc_struct *gss_ctx_id_t;
+typedef const struct gss_ctx_id_t_desc_struct gss_const_ctx_id_t;
 
 typedef struct gss_OID_desc_struct {
       OM_uint32 length;
       void      *elements;
 } gss_OID_desc, *gss_OID;
+typedef const gss_OID_desc * gss_const_OID;
 
 typedef struct gss_OID_set_desc_struct  {
       size_t     count;
       gss_OID    elements;
 } gss_OID_set_desc, *gss_OID_set;
+typedef const gss_OID_set_desc * gss_const_OID_set;
 
 typedef int gss_cred_usage_t;
 
 struct gss_cred_id_t_desc_struct;
 typedef struct gss_cred_id_t_desc_struct *gss_cred_id_t;
+typedef const struct gss_cred_id_t_desc_struct *gss_const_cred_id_t;
 
 typedef struct gss_buffer_desc_struct {
       size_t length;
       void *value;
 } gss_buffer_desc, *gss_buffer_t;
+typedef const gss_buffer_desc * gss_const_buffer_t;
 
 typedef struct gss_channel_bindings_struct {
       OM_uint32 initiator_addrtype;
@@ -121,6 +127,7 @@ typedef struct gss_channel_bindings_struct {
       gss_buffer_desc acceptor_address;
       gss_buffer_desc application_data;
 } *gss_channel_bindings_t;
+typedef const struct gss_channel_bindings_struct *gss_const_channel_bindings_t;
 
 /* GGF extension data types */
 typedef struct gss_buffer_set_desc_struct {
@@ -138,6 +145,8 @@ typedef struct gss_iov_buffer_desc_struct {
  */
 typedef OM_uint32 gss_qop_t;
 
+
+
 /*
  * Flag bits for context-level services.
  */
@@ -261,6 +270,8 @@ typedef OM_uint32 gss_qop_t;
 
 GSSAPI_CPP_START
 
+#include <gssapi/gssapi_oid.h>
+
 /*
  * The implementation must reserve static storage for a
  * gss_OID_desc object containing the value
@@ -363,14 +374,6 @@ extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_nt_anonymous_oid_desc;
 extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_nt_export_name_oid_desc;
 #define GSS_C_NT_EXPORT_NAME (&__gss_c_nt_export_name_oid_desc) 
 
-/*
- * Digest mechanism
- */
-
-extern gss_OID_desc GSSAPI_LIB_VARIABLE __gss_sasl_digest_md5_mechanism_oid_desc;
-#define GSS_SASL_DIGEST_MD5_MECHANISM (&__gss_sasl_digest_md5_mechanism_oid_desc)
-
-
 /* Major status codes */
 
 #define GSS_S_COMPLETE 0
@@ -438,6 +441,7 @@ extern gss_OID_desc GSSAPI_LIB_VARIABLE __gss_sasl_digest_md5_mechanism_oid_desc
 #define GSS_S_UNAVAILABLE (16ul << GSS_C_ROUTINE_ERROR_OFFSET)
 #define GSS_S_DUPLICATE_ELEMENT (17ul << GSS_C_ROUTINE_ERROR_OFFSET)
 #define GSS_S_NAME_NOT_MN (18ul << GSS_C_ROUTINE_ERROR_OFFSET)
+#define GSS_S_BAD_MECH_ATTR (19ul << GSS_C_ROUTINE_ERROR_OFFSET)
 
 /*
  * Supplementary info bits:
@@ -756,7 +760,7 @@ gss_set_cred_option (OM_uint32 *minor_status,
                     const gss_buffer_t value);
 
 GSSAPI_LIB_FUNCTION int GSSAPI_LIB_CALL
-gss_oid_equal(const gss_OID a, const gss_OID b);
+gss_oid_equal(gss_const_OID a, gss_const_OID b);
 
 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
 gss_create_empty_buffer_set
@@ -929,6 +933,69 @@ gss_import_cred(OM_uint32 * /* minor_status */,
                gss_buffer_t /* cred_token */,
                gss_cred_id_t * /* cred_handle */);
 
+/*
+ * mech option
+ */
+
+GSSAPI_LIB_FUNCTION int GSSAPI_LIB_CALL
+gss_mo_set(gss_const_OID mech, gss_const_OID option,
+          int enable, gss_buffer_t value);
+
+GSSAPI_LIB_FUNCTION int GSSAPI_LIB_CALL
+gss_mo_get(gss_const_OID mech, gss_const_OID option, gss_buffer_t value);
+
+GSSAPI_LIB_FUNCTION void GSSAPI_LIB_CALL
+gss_mo_list(gss_const_OID mech, gss_OID_set *options);
+
+GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
+gss_mo_name(gss_const_OID mech, gss_const_OID options, gss_buffer_t name);
+
+/*
+ * SASL glue functions and mech inquire
+ */
+
+GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
+gss_inquire_saslname_for_mech(OM_uint32 *minor_status,
+                             const gss_OID desired_mech,
+                             gss_buffer_t sasl_mech_name,
+                             gss_buffer_t mech_name,
+                             gss_buffer_t mech_description);
+
+GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
+gss_inquire_mech_for_saslname(OM_uint32 *minor_status,
+                             const gss_buffer_t sasl_mech_name,
+                             gss_OID *mech_type);
+
+GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
+gss_indicate_mechs_by_attrs(OM_uint32 * minor_status,
+                           gss_const_OID_set desired_mech_attrs,
+                           gss_const_OID_set except_mech_attrs,
+                           gss_const_OID_set critical_mech_attrs,
+                           gss_OID_set *mechs);
+
+GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
+gss_inquire_attrs_for_mech(OM_uint32 * minor_status,
+                          gss_const_OID mech,
+                          gss_OID_set *mech_attr,
+                          gss_OID_set *known_mech_attrs);
+
+GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
+gss_display_mech_attr(OM_uint32 * minor_status,
+                     gss_const_OID mech_attr,
+                     gss_buffer_t name,
+                     gss_buffer_t short_desc,
+                     gss_buffer_t long_desc);
+
+
+/*
+ *
+ */
+
+GSSAPI_LIB_FUNCTION const char * GSSAPI_LIB_CALL
+gss_oid_to_name(gss_const_OID oid);
+
+GSSAPI_LIB_FUNCTION gss_OID GSSAPI_LIB_CALL
+gss_name_to_oid(const char *name);
 
 GSSAPI_CPP_END
 
index 28f9c3777b5a57bda3dd2ae2ad42576fdc5a4d46..2f605f5ee113a8525856e39754253847d3677e2c 100644 (file)
@@ -68,79 +68,6 @@ extern gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_mechanism_oid_desc;
 #define gss_mech_krb5 GSS_KRB5_MECHANISM
 #define gss_krb5_nt_general_name GSS_KRB5_NT_PRINCIPAL_NAME
 
-/* Extensions set contexts options */
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_copy_ccache_x_oid_desc;
-#define GSS_KRB5_COPY_CCACHE_X (&__gss_krb5_copy_ccache_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_compat_des3_mic_x_oid_desc;
-#define GSS_KRB5_COMPAT_DES3_MIC_X (&__gss_krb5_compat_des3_mic_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_register_acceptor_identity_x_oid_desc;
-#define GSS_KRB5_REGISTER_ACCEPTOR_IDENTITY_X (&__gss_krb5_register_acceptor_identity_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_set_dns_canonicalize_x_oid_desc;
-#define GSS_KRB5_SET_DNS_CANONICALIZE_X (&__gss_krb5_set_dns_canonicalize_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_send_to_kdc_x_oid_desc;
-#define GSS_KRB5_SEND_TO_KDC_X (&__gss_krb5_send_to_kdc_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_set_default_realm_x_oid_desc;
-#define GSS_KRB5_SET_DEFAULT_REALM_X (&__gss_krb5_set_default_realm_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_ccache_name_x_oid_desc;
-#define GSS_KRB5_CCACHE_NAME_X (&__gss_krb5_ccache_name_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_set_time_offset_x_oid_desc;
-#define GSS_KRB5_SET_TIME_OFFSET_X (&__gss_krb5_set_time_offset_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_time_offset_x_oid_desc;
-#define GSS_KRB5_GET_TIME_OFFSET_X (&__gss_krb5_get_time_offset_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_plugin_register_x_oid_desc;
-#define GSS_KRB5_PLUGIN_REGISTER_X (&__gss_krb5_plugin_register_x_oid_desc)
-
-/* Extensions inquire context */
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_tkt_flags_x_oid_desc;
-#define GSS_KRB5_GET_TKT_FLAGS_X (&__gss_krb5_get_tkt_flags_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_extract_authz_data_from_sec_context_x_oid_desc;
-#define GSS_KRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT_X (&__gss_krb5_extract_authz_data_from_sec_context_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_peer_has_updated_spnego_oid_desc;
-#define GSS_C_PEER_HAS_UPDATED_SPNEGO (&__gss_c_peer_has_updated_spnego_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_export_lucid_context_x_oid_desc;
-#define GSS_KRB5_EXPORT_LUCID_CONTEXT_X (&__gss_krb5_export_lucid_context_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_export_lucid_context_v1_x_oid_desc;
-#define GSS_KRB5_EXPORT_LUCID_CONTEXT_V1_X (&__gss_krb5_export_lucid_context_v1_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_subkey_x_oid_desc;
-#define GSS_KRB5_GET_SUBKEY_X (&__gss_krb5_get_subkey_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_initiator_subkey_x_oid_desc;
-#define GSS_KRB5_GET_INITIATOR_SUBKEY_X (&__gss_krb5_get_initiator_subkey_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_acceptor_subkey_x_oid_desc;
-#define GSS_KRB5_GET_ACCEPTOR_SUBKEY_X (&__gss_krb5_get_acceptor_subkey_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_authtime_x_oid_desc;
-#define GSS_KRB5_GET_AUTHTIME_X (&__gss_krb5_get_authtime_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_service_keyblock_x_oid_desc;
-#define GSS_KRB5_GET_SERVICE_KEYBLOCK_X (&__gss_krb5_get_service_keyblock_x_oid_desc)
-
-/* Extensions creds */
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_import_cred_x_oid_desc;
-#define GSS_KRB5_IMPORT_CRED_X (&__gss_krb5_import_cred_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_set_allowable_enctypes_x_oid_desc;
-#define GSS_KRB5_SET_ALLOWABLE_ENCTYPES_X (&__gss_krb5_set_allowable_enctypes_x_oid_desc)
-
-extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_cred_no_ci_flags_x_oid_desc;
-#define GSS_KRB5_CRED_NO_CI_FLAGS_X (&__gss_krb5_cred_no_ci_flags_x_oid_desc)
-
 /*
  * kerberos mechanism specific functions
  */
diff --git a/source4/heimdal/lib/gssapi/gssapi/gssapi_oid.h b/source4/heimdal/lib/gssapi/gssapi/gssapi_oid.h
new file mode 100644 (file)
index 0000000..af7a583
--- /dev/null
@@ -0,0 +1,231 @@
+/* Generated file */
+#ifndef GSSAPI_GSSAPI_OID
+#define GSSAPI_GSSAPI_OID 1
+
+ /* contact Love Hörnquist Åstrand <lha@h5l.org> for new oid arcs */
+ /*
+  * 1.2.752.43.13 Heimdal GSS-API Extentions
+  */
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_copy_ccache_x_oid_desc;
+#define GSS_KRB5_COPY_CCACHE_X (&__gss_krb5_copy_ccache_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_tkt_flags_x_oid_desc;
+#define GSS_KRB5_GET_TKT_FLAGS_X (&__gss_krb5_get_tkt_flags_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_extract_authz_data_from_sec_context_x_oid_desc;
+#define GSS_KRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT_X (&__gss_krb5_extract_authz_data_from_sec_context_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_compat_des3_mic_x_oid_desc;
+#define GSS_KRB5_COMPAT_DES3_MIC_X (&__gss_krb5_compat_des3_mic_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_register_acceptor_identity_x_oid_desc;
+#define GSS_KRB5_REGISTER_ACCEPTOR_IDENTITY_X (&__gss_krb5_register_acceptor_identity_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_export_lucid_context_x_oid_desc;
+#define GSS_KRB5_EXPORT_LUCID_CONTEXT_X (&__gss_krb5_export_lucid_context_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_export_lucid_context_v1_x_oid_desc;
+#define GSS_KRB5_EXPORT_LUCID_CONTEXT_V1_X (&__gss_krb5_export_lucid_context_v1_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_set_dns_canonicalize_x_oid_desc;
+#define GSS_KRB5_SET_DNS_CANONICALIZE_X (&__gss_krb5_set_dns_canonicalize_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_subkey_x_oid_desc;
+#define GSS_KRB5_GET_SUBKEY_X (&__gss_krb5_get_subkey_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_initiator_subkey_x_oid_desc;
+#define GSS_KRB5_GET_INITIATOR_SUBKEY_X (&__gss_krb5_get_initiator_subkey_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_acceptor_subkey_x_oid_desc;
+#define GSS_KRB5_GET_ACCEPTOR_SUBKEY_X (&__gss_krb5_get_acceptor_subkey_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_send_to_kdc_x_oid_desc;
+#define GSS_KRB5_SEND_TO_KDC_X (&__gss_krb5_send_to_kdc_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_authtime_x_oid_desc;
+#define GSS_KRB5_GET_AUTHTIME_X (&__gss_krb5_get_authtime_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_service_keyblock_x_oid_desc;
+#define GSS_KRB5_GET_SERVICE_KEYBLOCK_X (&__gss_krb5_get_service_keyblock_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_set_allowable_enctypes_x_oid_desc;
+#define GSS_KRB5_SET_ALLOWABLE_ENCTYPES_X (&__gss_krb5_set_allowable_enctypes_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_set_default_realm_x_oid_desc;
+#define GSS_KRB5_SET_DEFAULT_REALM_X (&__gss_krb5_set_default_realm_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_ccache_name_x_oid_desc;
+#define GSS_KRB5_CCACHE_NAME_X (&__gss_krb5_ccache_name_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_set_time_offset_x_oid_desc;
+#define GSS_KRB5_SET_TIME_OFFSET_X (&__gss_krb5_set_time_offset_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_get_time_offset_x_oid_desc;
+#define GSS_KRB5_GET_TIME_OFFSET_X (&__gss_krb5_get_time_offset_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_plugin_register_x_oid_desc;
+#define GSS_KRB5_PLUGIN_REGISTER_X (&__gss_krb5_plugin_register_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_ntlm_get_session_key_x_oid_desc;
+#define GSS_NTLM_GET_SESSION_KEY_X (&__gss_ntlm_get_session_key_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_nt_ntlm_oid_desc;
+#define GSS_C_NT_NTLM (&__gss_c_nt_ntlm_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_nt_dn_oid_desc;
+#define GSS_C_NT_DN (&__gss_c_nt_dn_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_nt_principal_name_referral_oid_desc;
+#define GSS_KRB5_NT_PRINCIPAL_NAME_REFERRAL (&__gss_krb5_nt_principal_name_referral_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ntlm_avguest_oid_desc;
+#define GSS_C_NTLM_AVGUEST (&__gss_c_ntlm_avguest_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ntlm_v1_oid_desc;
+#define GSS_C_NTLM_V1 (&__gss_c_ntlm_v1_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ntlm_v2_oid_desc;
+#define GSS_C_NTLM_V2 (&__gss_c_ntlm_v2_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ntlm_session_key_oid_desc;
+#define GSS_C_NTLM_SESSION_KEY (&__gss_c_ntlm_session_key_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ntlm_force_v1_oid_desc;
+#define GSS_C_NTLM_FORCE_V1 (&__gss_c_ntlm_force_v1_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_cred_no_ci_flags_x_oid_desc;
+#define GSS_KRB5_CRED_NO_CI_FLAGS_X (&__gss_krb5_cred_no_ci_flags_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_import_cred_x_oid_desc;
+#define GSS_KRB5_IMPORT_CRED_X (&__gss_krb5_import_cred_x_oid_desc)
+
+ /* glue for gss_inquire_saslname_for_mech */
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_sasl_mech_name_oid_desc;
+#define GSS_C_MA_SASL_MECH_NAME (&__gss_c_ma_sasl_mech_name_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_mech_name_oid_desc;
+#define GSS_C_MA_MECH_NAME (&__gss_c_ma_mech_name_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_mech_description_oid_desc;
+#define GSS_C_MA_MECH_DESCRIPTION (&__gss_c_ma_mech_description_oid_desc)
+
+/* Heimdal mechanisms - 1.2.752.43.14 */
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_sasl_digest_md5_mechanism_oid_desc;
+#define GSS_SASL_DIGEST_MD5_MECHANISM (&__gss_sasl_digest_md5_mechanism_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_netlogon_mechanism_oid_desc;
+#define GSS_NETLOGON_MECHANISM (&__gss_netlogon_mechanism_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_netlogon_set_session_key_x_oid_desc;
+#define GSS_NETLOGON_SET_SESSION_KEY_X (&__gss_netlogon_set_session_key_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_netlogon_set_sign_algorithm_x_oid_desc;
+#define GSS_NETLOGON_SET_SIGN_ALGORITHM_X (&__gss_netlogon_set_sign_algorithm_x_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_netlogon_nt_netbios_dns_name_oid_desc;
+#define GSS_NETLOGON_NT_NETBIOS_DNS_NAME (&__gss_netlogon_nt_netbios_dns_name_oid_desc)
+
+/*
+ * "Standard" mechs
+ */
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_krb5_mechanism_oid_desc;
+#define GSS_KRB5_MECHANISM (&__gss_krb5_mechanism_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_ntlm_mechanism_oid_desc;
+#define GSS_NTLM_MECHANISM (&__gss_ntlm_mechanism_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_spnego_mechanism_oid_desc;
+#define GSS_SPNEGO_MECHANISM (&__gss_spnego_mechanism_oid_desc)
+
+ /* From Luke Howard */
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_peer_has_updated_spnego_oid_desc;
+#define GSS_C_PEER_HAS_UPDATED_SPNEGO (&__gss_c_peer_has_updated_spnego_oid_desc)
+
+/*
+ * OID mappings with name and short description and and slightly longer description
+ */
+/*
+ * RFC5587
+ */
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_mech_concrete_oid_desc;
+#define GSS_C_MA_MECH_CONCRETE (&__gss_c_ma_mech_concrete_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_mech_pseudo_oid_desc;
+#define GSS_C_MA_MECH_PSEUDO (&__gss_c_ma_mech_pseudo_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_mech_composite_oid_desc;
+#define GSS_C_MA_MECH_COMPOSITE (&__gss_c_ma_mech_composite_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_mech_nego_oid_desc;
+#define GSS_C_MA_MECH_NEGO (&__gss_c_ma_mech_nego_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_mech_glue_oid_desc;
+#define GSS_C_MA_MECH_GLUE (&__gss_c_ma_mech_glue_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_not_mech_oid_desc;
+#define GSS_C_MA_NOT_MECH (&__gss_c_ma_not_mech_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_deprecated_oid_desc;
+#define GSS_C_MA_DEPRECATED (&__gss_c_ma_deprecated_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_not_dflt_mech_oid_desc;
+#define GSS_C_MA_NOT_DFLT_MECH (&__gss_c_ma_not_dflt_mech_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_itok_framed_oid_desc;
+#define GSS_C_MA_ITOK_FRAMED (&__gss_c_ma_itok_framed_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_auth_init_oid_desc;
+#define GSS_C_MA_AUTH_INIT (&__gss_c_ma_auth_init_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_auth_targ_oid_desc;
+#define GSS_C_MA_AUTH_TARG (&__gss_c_ma_auth_targ_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_auth_init_init_oid_desc;
+#define GSS_C_MA_AUTH_INIT_INIT (&__gss_c_ma_auth_init_init_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_auth_targ_init_oid_desc;
+#define GSS_C_MA_AUTH_TARG_INIT (&__gss_c_ma_auth_targ_init_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_auth_init_anon_oid_desc;
+#define GSS_C_MA_AUTH_INIT_ANON (&__gss_c_ma_auth_init_anon_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_auth_targ_anon_oid_desc;
+#define GSS_C_MA_AUTH_TARG_ANON (&__gss_c_ma_auth_targ_anon_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_deleg_cred_oid_desc;
+#define GSS_C_MA_DELEG_CRED (&__gss_c_ma_deleg_cred_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_integ_prot_oid_desc;
+#define GSS_C_MA_INTEG_PROT (&__gss_c_ma_integ_prot_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_conf_prot_oid_desc;
+#define GSS_C_MA_CONF_PROT (&__gss_c_ma_conf_prot_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_mic_oid_desc;
+#define GSS_C_MA_MIC (&__gss_c_ma_mic_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_wrap_oid_desc;
+#define GSS_C_MA_WRAP (&__gss_c_ma_wrap_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_prot_ready_oid_desc;
+#define GSS_C_MA_PROT_READY (&__gss_c_ma_prot_ready_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_replay_det_oid_desc;
+#define GSS_C_MA_REPLAY_DET (&__gss_c_ma_replay_det_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_oos_det_oid_desc;
+#define GSS_C_MA_OOS_DET (&__gss_c_ma_oos_det_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_cbindings_oid_desc;
+#define GSS_C_MA_CBINDINGS (&__gss_c_ma_cbindings_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_pfs_oid_desc;
+#define GSS_C_MA_PFS (&__gss_c_ma_pfs_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_compress_oid_desc;
+#define GSS_C_MA_COMPRESS (&__gss_c_ma_compress_oid_desc)
+
+extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_ma_ctx_trans_oid_desc;
+#define GSS_C_MA_CTX_TRANS (&__gss_c_ma_ctx_trans_oid_desc)
+
+#endif /* GSSAPI_GSSAPI_OID */
index 93b7bf72d79030c6a36f3708fb9b25e62e12d794..b06e60a82f3efcce365241e30352a08c0ef1d3f3 100644 (file)
@@ -354,7 +354,60 @@ _gss_import_cred_t(OM_uint32 * minor_status,
                   gss_cred_id_t * cred_handle);
 
 
-#define GMI_VERSION 2
+typedef OM_uint32 GSSAPI_CALLCONV
+_gss_acquire_cred_ex_t(void * /* status */,
+                      const gss_name_t /* desired_name */,
+                      OM_uint32 /* flags */,
+                      OM_uint32 /* time_req */,
+                      gss_cred_usage_t /* cred_usage */,
+                      void * /* identity */,
+                      void * /* ctx */,
+                      void (* /*complete */)(void *, OM_uint32, void *, gss_cred_id_t, OM_uint32));
+
+typedef void GSSAPI_CALLCONV
+_gss_iter_creds_t(OM_uint32 /* flags */,
+                 void * /* userctx */,
+                 void (* /*cred_iter */ )(void *, gss_OID, gss_cred_id_t));
+
+typedef OM_uint32 GSSAPI_CALLCONV
+_gss_destroy_cred_t(OM_uint32 * /* minor_status */,
+                   gss_cred_id_t * /* cred */);
+
+typedef OM_uint32 GSSAPI_CALLCONV
+_gss_cred_hold_t(OM_uint32 * /* minor_status */,
+                gss_cred_id_t /* cred */);
+
+typedef OM_uint32 GSSAPI_CALLCONV
+_gss_cred_unhold_t(OM_uint32 * /* minor_status */,
+                  gss_cred_id_t /* cred */);
+
+typedef OM_uint32 GSSAPI_CALLCONV
+_gss_cred_label_set_t(OM_uint32 * /* minor_status */,
+                     gss_cred_id_t /* cred */,
+                     const char * /* label */,
+                     gss_buffer_t /* value */);
+
+typedef OM_uint32 GSSAPI_CALLCONV
+_gss_cred_label_get_t(OM_uint32 * /* minor_status */,
+                     gss_cred_id_t /* cred */,
+                     const char * /* label */,
+                     gss_buffer_t /* value */);
+
+typedef struct gss_mo_desc_struct gss_mo_desc;
+
+struct gss_mo_desc_struct {
+    gss_OID option;
+    OM_uint32 flags;
+#define GSS_MO_MA              1
+#define GSS_MO_MA_CRITICAL     2
+    const char *name;
+    void *ctx;
+    int (*get)(gss_const_OID, gss_mo_desc *, gss_buffer_t);
+    int (*set)(gss_const_OID, gss_mo_desc *, int, gss_buffer_t);
+};
+
+
+#define GMI_VERSION 4
 
 /* gm_flags */
 #define GM_USE_MG_CRED         1       /* uses mech glue credentials */
@@ -405,10 +458,19 @@ typedef struct gssapi_mech_interface_desc {
        _gss_store_cred_t               *gm_store_cred;
        _gss_export_cred_t              *gm_export_cred;
        _gss_import_cred_t              *gm_import_cred;
+       _gss_acquire_cred_ex_t          *gm_acquire_cred_ex;
+       _gss_iter_creds_t               *gm_iter_creds;
+       _gss_destroy_cred_t             *gm_destroy_cred;
+       _gss_cred_hold_t                *gm_cred_hold;
+       _gss_cred_unhold_t              *gm_cred_unhold;
+       _gss_cred_label_get_t           *gm_cred_label_get;
+       _gss_cred_label_set_t           *gm_cred_label_set;
+        gss_mo_desc                    *gm_mo;
+        size_t                          gm_mo_num;
 } gssapi_mech_interface_desc, *gssapi_mech_interface;
 
 gssapi_mech_interface
-__gss_get_mechanism(gss_OID /* oid */);
+__gss_get_mechanism(gss_const_OID /* oid */);
 
 gssapi_mech_interface __gss_spnego_initialize(void);
 gssapi_mech_interface __gss_krb5_initialize(void);
@@ -416,4 +478,18 @@ gssapi_mech_interface __gss_ntlm_initialize(void);
 
 void           gss_mg_collect_error(gss_OID, OM_uint32, OM_uint32);
 
+int _gss_mo_get_option_1(gss_const_OID, gss_mo_desc *, gss_buffer_t);
+int _gss_mo_get_option_0(gss_const_OID, gss_mo_desc *, gss_buffer_t);
+int _gss_mo_get_ctx_as_string(gss_const_OID, gss_mo_desc *, gss_buffer_t);
+
+struct _gss_oid_name_table {
+    gss_OID oid;
+    const char *name;
+    const char *short_desc;
+    const char *long_desc;
+};
+
+extern struct _gss_oid_name_table _gss_ont_mech[];
+extern struct _gss_oid_name_table _gss_ont_ma[];
+
 #endif /* GSSAPI_MECH_H */
index 584ce7711aeca971a69a2dd10d6ef7ea8e5b8d13..d0042e874b53fcbd5752693952a32b015da0b6ca 100644 (file)
@@ -40,7 +40,7 @@ __gsskrb5_ccache_lifetime(OM_uint32 *minor_status,
                          krb5_principal principal,
                          OM_uint32 *lifetime)
 {
-    krb5_creds in_cred, *out_cred;
+    krb5_creds in_cred, out_cred;
     krb5_const_realm realm;
     krb5_error_code kret;
 
@@ -61,16 +61,16 @@ __gsskrb5_ccache_lifetime(OM_uint32 *minor_status,
        return GSS_S_FAILURE;
     }
 
-    kret = krb5_get_credentials(context, 0,
-                               id, &in_cred, &out_cred);
+    kret = krb5_cc_retrieve_cred(context, id, 0, &in_cred, &out_cred);
     krb5_free_principal(context, in_cred.server);
     if (kret) {
-       *minor_status = kret;
-       return GSS_S_FAILURE;
+       *minor_status = 0;
+       *lifetime = 0;
+       return GSS_S_COMPLETE;
     }
 
-    *lifetime = out_cred->times.endtime;
-    krb5_free_creds(context, out_cred);
+    *lifetime = out_cred.times.endtime;
+    krb5_free_cred_contents(context, &out_cred);
 
     return GSS_S_COMPLETE;
 }
index ef33c5575a28f8a73476169141a184752ec4d8b1..d6f14a48f7c7f01a3c1e2d7dcdfc13349aa80160 100644 (file)
@@ -152,47 +152,6 @@ gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_export_name_oid_desc =
 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_nt_principal_name_oid_desc =
     {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01") };
 
-/*
- *   This name form shall be represented by the Object Identifier {iso(1)
- *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
- *   generic(1) user_name(1)}.  The recommended symbolic name for this
- *   type is "GSS_KRB5_NT_USER_NAME".
- */
-
-/*
- *   This name form shall be represented by the Object Identifier {iso(1)
- *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
- *   generic(1) machine_uid_name(2)}.  The recommended symbolic name for
- *   this type is "GSS_KRB5_NT_MACHINE_UID_NAME".
- */
-
-/*
- *   This name form shall be represented by the Object Identifier {iso(1)
- *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
- *   generic(1) string_uid_name(3)}.  The recommended symbolic name for
- *   this type is "GSS_KRB5_NT_STRING_UID_NAME".
- */
-
-/*
- *   To support ongoing experimentation, testing, and evolution of the
- *   specification, the Kerberos V5 GSS-API mechanism as defined in this
- *   and any successor memos will be identified with the following Object
- *   Identifier, as defined in RFC-1510, until the specification is
- *   advanced to the level of Proposed Standard RFC:
- *
- *   {iso(1), org(3), dod(5), internet(1), security(5), kerberosv5(2)}
- *
- *   Upon advancement to the level of Proposed Standard RFC, the Kerberos
- *   V5 GSS-API mechanism will be identified by an Object Identifier
- *   having the value:
- *
- *   {iso(1) member-body(2) United States(840) mit(113554) infosys(1)
- *   gssapi(2) krb5(2)}
- */
-
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_mechanism_oid_desc =
-    {9, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02") };
-
 /*
  * draft-ietf-cat-iakerb-09, IAKERB:
  *   The mechanism ID for IAKERB proxy GSS-API Kerberos, in accordance
@@ -212,105 +171,101 @@ gss_OID_desc GSSAPI_LIB_VARIABLE  __gss_iakerb_proxy_mechanism_oid_desc =
 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_iakerb_min_msg_mechanism_oid_desc =
     {7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x02") };
 
-/*
- *
- */
-
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_peer_has_updated_spnego_oid_desc =
-    {9, (void *)"\x2b\x06\x01\x04\x01\xa9\x4a\x13\x05"};
-
-/*
- * 1.2.752.43.13 Heimdal GSS-API Extentions
- */
-
-/* 1.2.752.43.13.1 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_copy_ccache_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x01")};
-
-/* 1.2.752.43.13.2 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_tkt_flags_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x02")};
-
-/* 1.2.752.43.13.3 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_extract_authz_data_from_sec_context_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x03")};
-
-/* 1.2.752.43.13.4 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_compat_des3_mic_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x04")};
-
-/* 1.2.752.43.13.5 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_register_acceptor_identity_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x05")};
-
-/* 1.2.752.43.13.6 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_export_lucid_context_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x06")};
-
-/* 1.2.752.43.13.6.1 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_export_lucid_context_v1_x_oid_desc =
-    {7, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x06\x01")};
-
-/* 1.2.752.43.13.7 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_set_dns_canonicalize_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x07")};
-
-/* 1.2.752.43.13.8 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_subkey_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x08")};
-
-/* 1.2.752.43.13.9 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_initiator_subkey_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x09")};
-
-/* 1.2.752.43.13.10 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_acceptor_subkey_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x0a")};
-
-/* 1.2.752.43.13.11 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_send_to_kdc_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x0b")};
-
-/* 1.2.752.43.13.12 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_authtime_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x0c")};
-
-/* 1.2.752.43.13.13 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_service_keyblock_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x0d")};
-
-/* 1.2.752.43.13.14 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_set_allowable_enctypes_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x0e")};
-
-/* 1.2.752.43.13.15 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_set_default_realm_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x0f")};
-
-/* 1.2.752.43.13.16 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_ccache_name_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x10")};
-
-/* 1.2.752.43.13.17 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_set_time_offset_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x11")};
-
-/* 1.2.752.43.13.18 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_time_offset_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x12")};
-
-/* 1.2.752.43.13.19 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_plugin_register_x_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x13")};
-
-/* 1.2.752.43.14.1 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_sasl_digest_md5_mechanism_oid_desc =
-    {6, rk_UNCONST("\x2a\x85\x70\x2b\x0e\x01") };
-
 /*
  * Context for krb5 calls.
  */
 
+static gss_mo_desc krb5_mo[] = {
+    {
+       GSS_C_MA_SASL_MECH_NAME,
+       GSS_MO_MA,
+       "SASL mech name",
+       "GS2-KRB5",
+       _gss_mo_get_ctx_as_string,
+       NULL
+    },
+    {
+       GSS_C_MA_MECH_NAME,
+       GSS_MO_MA,
+       "Mechanism name",
+       "KRB5",
+       _gss_mo_get_ctx_as_string,
+       NULL
+    },
+    {
+       GSS_C_MA_MECH_DESCRIPTION,
+       GSS_MO_MA,
+       "Mechanism description",
+       "Heimdal Kerberos 5 mech",
+       _gss_mo_get_ctx_as_string,
+       NULL
+    },
+    {
+       GSS_C_MA_MECH_CONCRETE,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_ITOK_FRAMED,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_AUTH_INIT,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_AUTH_TARG,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_AUTH_INIT_ANON,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_DELEG_CRED,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_INTEG_PROT,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_CONF_PROT,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_MIC,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_WRAP,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_PROT_READY,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_REPLAY_DET,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_OOS_DET,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_CBINDINGS,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_PFS,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_CTX_TRANS,
+       GSS_MO_MA
+    }
+};
+
 /*
  *
  */
@@ -359,7 +314,16 @@ static gssapi_mech_interface_desc krb5_mech = {
     _gk_wrap_iov_length,
     _gsskrb5_store_cred,
     _gsskrb5_export_cred,
-    _gsskrb5_import_cred
+    _gsskrb5_import_cred,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    krb5_mo,
+    sizeof(krb5_mo) / sizeof(krb5_mo[0])
 };
 
 gssapi_mech_interface
index d6255bacb5eee1f5a01662ca49a1fc7eaab2ed6f..5ff6172fb92da53e1ae123ee83e2a482a1109695 100644 (file)
 
 #include "gsskrb5_locl.h"
 
-/* 1.2.752.43.13.17 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_cred_no_ci_flags_x_oid_desc =
-{6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x11")};
-
-/* 1.2.752.43.13.18 */
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_import_cred_x_oid_desc =
-{6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x12")};
-
-
 static OM_uint32
 import_cred(OM_uint32 *minor_status,
            krb5_context context,
index 5fc41d9954cd201db93cc0c065579cdf1f42b373..b1368db91ca25d7170f2c7544467343d938c77b9 100644 (file)
@@ -353,7 +353,7 @@ _gss_load_mech(void)
 }
 
 gssapi_mech_interface
-__gss_get_mechanism(gss_OID mech)
+__gss_get_mechanism(gss_const_OID mech)
 {
         struct _gss_mech_switch        *m;
 
diff --git a/source4/heimdal/lib/gssapi/mech/gss_mo.c b/source4/heimdal/lib/gssapi/mech/gss_mo.c
new file mode 100644 (file)
index 0000000..354229f
--- /dev/null
@@ -0,0 +1,464 @@
+/*
+ * 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 "mech_locl.h"
+
+static int
+get_option_def(int def, gss_const_OID mech, gss_mo_desc *mo, gss_buffer_t value)
+{
+    return def;
+}
+
+
+int
+_gss_mo_get_option_1(gss_const_OID mech, gss_mo_desc *mo, gss_buffer_t value)
+{
+    return get_option_def(1, mech, mo, value);
+}
+
+int
+_gss_mo_get_option_0(gss_const_OID mech, gss_mo_desc *mo, gss_buffer_t value)
+{
+    return get_option_def(0, mech, mo, value);
+}
+
+int
+_gss_mo_get_ctx_as_string(gss_const_OID mech, gss_mo_desc *mo, gss_buffer_t value)
+{
+    if (value) {
+       value->value = strdup((char *)mo->ctx);
+       if (value->value == NULL)
+           return 1;
+       value->length = strlen((char *)mo->ctx);
+    }
+    return 0;
+}
+
+GSSAPI_LIB_FUNCTION int GSSAPI_LIB_CALL
+gss_mo_set(gss_const_OID mech, gss_const_OID option,
+          int enable, gss_buffer_t value)
+{
+    gssapi_mech_interface m;
+    size_t n;
+
+    if ((m = __gss_get_mechanism(mech)) == NULL)
+       return GSS_S_BAD_MECH;
+
+    for (n = 0; n < m->gm_mo_num; n++)
+       if (gss_oid_equal(option, m->gm_mo[n].option) && m->gm_mo[n].set)
+           return m->gm_mo[n].set(mech, &m->gm_mo[n], enable, value);
+    return 0;
+}
+
+GSSAPI_LIB_FUNCTION int GSSAPI_LIB_CALL
+gss_mo_get(gss_const_OID mech, gss_const_OID option, gss_buffer_t value)
+{
+    gssapi_mech_interface m;
+    size_t n;
+
+    _mg_buffer_zero(value);
+
+    if ((m = __gss_get_mechanism(mech)) == NULL)
+       return 0;
+
+    for (n = 0; n < m->gm_mo_num; n++)
+       if (gss_oid_equal(option, m->gm_mo[n].option) && m->gm_mo[n].get)
+           return m->gm_mo[n].get(mech, &m->gm_mo[n], value);
+
+    return 0;
+}
+
+static void
+add_all_mo(gssapi_mech_interface m, gss_OID_set *options, OM_uint32 mask)
+{
+    OM_uint32 minor;
+    size_t n;
+
+    for (n = 0; n < m->gm_mo_num; n++)
+       if ((m->gm_mo[n].flags & mask) == mask)
+           gss_add_oid_set_member(&minor, m->gm_mo[n].option, options);
+}
+
+GSSAPI_LIB_FUNCTION void GSSAPI_LIB_CALL
+gss_mo_list(gss_const_OID mech, gss_OID_set *options)
+{
+    gssapi_mech_interface m;
+    OM_uint32 major, minor;
+
+    if (options == NULL)
+       return;
+
+    *options = GSS_C_NO_OID_SET;
+
+    if ((m = __gss_get_mechanism(mech)) == NULL)
+       return;
+
+    major = gss_create_empty_oid_set(&minor, options);
+    if (major != GSS_S_COMPLETE)
+       return;
+
+    add_all_mo(m, options, 0);
+}
+
+GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
+gss_mo_name(gss_const_OID mech, gss_const_OID option, gss_buffer_t name)
+{
+    gssapi_mech_interface m;
+    size_t n;
+
+    if (name == NULL)
+       return GSS_S_BAD_NAME;
+
+    if ((m = __gss_get_mechanism(mech)) == NULL)
+       return GSS_S_BAD_MECH;
+
+    for (n = 0; n < m->gm_mo_num; n++) {
+       if (gss_oid_equal(option, m->gm_mo[n].option)) {
+           /*
+            * If ther is no name, its because its a GSS_C_MA and there is already a table for that.
+            */
+           if (m->gm_mo[n].name) {
+               name->value = strdup(m->gm_mo[n].name);
+               if (name->value == NULL)
+                   return GSS_S_BAD_NAME;
+               name->length = strlen(m->gm_mo[n].name);
+               return GSS_S_COMPLETE;
+           } else {
+               OM_uint32 junk;
+               return gss_display_mech_attr(&junk, option,
+                                            NULL, name, NULL);
+           }
+       }
+    }
+    return GSS_S_BAD_NAME;
+}
+
+/*
+ * Helper function to allow NULL name
+ */
+
+static OM_uint32
+mo_value(const gss_const_OID mech, gss_const_OID option, gss_buffer_t name)
+{
+    if (name == NULL)
+       return GSS_S_COMPLETE;
+
+    if (gss_mo_get(mech, option, name) != 0 && name->length == 0)
+       return GSS_S_FAILURE;
+
+    return GSS_S_COMPLETE;
+}
+
+/**
+ * Returns differnt protocol names and description of the mechanism.
+ *
+ * @param minor_status minor status code
+ * @param desired_mech mech list query
+ * @param sasl_mech_name SASL GS2 protocol name
+ * @param mech_name gssapi protocol name
+ * @param mech_description description of gssapi mech
+ *
+ * @return returns GSS_S_COMPLETE or a error code.
+ *
+ * @ingroup gssapi
+ */
+
+GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
+gss_inquire_saslname_for_mech(OM_uint32 *minor_status,
+                             const gss_OID desired_mech,
+                             gss_buffer_t sasl_mech_name,
+                             gss_buffer_t mech_name,
+                             gss_buffer_t mech_description)
+{
+    OM_uint32 major;
+
+    _mg_buffer_zero(sasl_mech_name);
+    _mg_buffer_zero(mech_name);
+    _mg_buffer_zero(mech_description);
+
+    if (minor_status)
+       *minor_status = 0;
+
+    if (desired_mech == NULL)
+       return GSS_S_BAD_MECH;
+
+    major = mo_value(desired_mech, GSS_C_MA_SASL_MECH_NAME, sasl_mech_name);
+    if (major) return major;
+
+    major = mo_value(desired_mech, GSS_C_MA_MECH_NAME, mech_name);
+    if (major) return major;
+
+    major = mo_value(desired_mech, GSS_C_MA_MECH_DESCRIPTION, mech_description);
+    if (major) return major;
+
+    return GSS_S_COMPLETE;
+}
+
+/**
+ * Find a mech for a sasl name
+ *
+ * @param minor_status minor status code
+ * @param sasl_mech_name
+ * @param mech_type
+ *
+ * @return returns GSS_S_COMPLETE or an error code.
+ */
+
+GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
+gss_inquire_mech_for_saslname(OM_uint32 *minor_status,
+                             const gss_buffer_t sasl_mech_name,
+                             gss_OID *mech_type)
+{
+    struct _gss_mech_switch *m;
+    gss_buffer_desc name;
+    OM_uint32 major;
+
+    _gss_load_mech();
+
+    *mech_type = NULL;
+
+    SLIST_FOREACH(m, &_gss_mechs, gm_link) {
+
+       major = mo_value(&m->gm_mech_oid, GSS_C_MA_SASL_MECH_NAME, &name);
+       if (major)
+           continue;
+       if (name.length == sasl_mech_name->length &&
+           memcmp(name.value, sasl_mech_name->value, name.length) == 0) {
+           gss_release_buffer(&major, &name);
+           *mech_type = &m->gm_mech_oid;
+           return 0;
+       }
+       gss_release_buffer(&major, &name);
+    }
+
+    return GSS_S_BAD_MECH;
+}
+
+/**
+ * Return set of mechanism that fullfill the criteria
+ *
+ * @param minor_status minor status code
+ * @param desired_mech_attrs
+ * @param except_mech_attrs
+ * @param critical_mech_attrs
+ * @param mechs returned mechs, free with gss_release_oid_set().
+ *
+ * @return returns GSS_S_COMPLETE or an error code.
+ */
+
+GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
+gss_indicate_mechs_by_attrs(OM_uint32 * minor_status,
+                           gss_const_OID_set desired_mech_attrs,
+                           gss_const_OID_set except_mech_attrs,
+                           gss_const_OID_set critical_mech_attrs,
+                           gss_OID_set *mechs)
+{
+    struct _gss_mech_switch *ms;
+    OM_uint32 major;
+    size_t n, m;
+
+    major = gss_create_empty_oid_set(minor_status, mechs);
+    if (major)
+       return major;
+
+    _gss_load_mech();
+
+    SLIST_FOREACH(ms, &_gss_mechs, gm_link) {
+       gssapi_mech_interface mi = &ms->gm_mech;
+
+       if (desired_mech_attrs) {
+           for (n = 0; n < desired_mech_attrs->count; n++) {
+               for (m = 0; m < mi->gm_mo_num; m++)
+                   if (gss_oid_equal(mi->gm_mo[m].option, &desired_mech_attrs->elements[n]))
+                       break;
+               if (m == mi->gm_mo_num)
+                   goto next;
+           }
+       }
+
+       if (except_mech_attrs) {
+           for (n = 0; n < desired_mech_attrs->count; n++) {
+               for (m = 0; m < mi->gm_mo_num; m++) {
+                   if (gss_oid_equal(mi->gm_mo[m].option, &desired_mech_attrs->elements[n]))
+                       goto next;
+               }
+           }
+       }
+
+       if (critical_mech_attrs) {
+           for (n = 0; n < desired_mech_attrs->count; n++) {
+               for (m = 0; m < mi->gm_mo_num; m++) {
+                   if (mi->gm_mo[m].flags & GSS_MO_MA_CRITICAL)
+                       continue;
+                   if (gss_oid_equal(mi->gm_mo[m].option, &desired_mech_attrs->elements[n]))
+                       break;
+               }
+               if (m == mi->gm_mo_num)
+                   goto next;
+           }
+       }
+
+
+    next:
+       do { } while(0);
+    }
+
+
+    return GSS_S_FAILURE;
+}
+
+/**
+ * List support attributes for a mech and/or all mechanisms.
+ *
+ * @param minor_status minor status code
+ * @param mech given together with mech_attr will return the list of
+ *        attributes for mechanism, can optionally be GSS_C_NO_OID.
+ * @param mech_attr see mech parameter, can optionally be NULL,
+ *        release with gss_release_oid_set().
+ * @param known_mech_attrs all attributes for mechanisms supported,
+ *        release with gss_release_oid_set().
+ *
+ * @ingroup gssapi
+ */
+
+GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
+gss_inquire_attrs_for_mech(OM_uint32 * minor_status,
+                          gss_const_OID mech,
+                          gss_OID_set *mech_attr,
+                          gss_OID_set *known_mech_attrs)
+{
+    OM_uint32 major, junk;
+
+    if (mech_attr && mech) {
+       gssapi_mech_interface m;
+
+       if ((m = __gss_get_mechanism(mech)) == NULL) {
+           *minor_status = 0;
+           return GSS_S_BAD_MECH;
+       }
+
+       major = gss_create_empty_oid_set(minor_status, mech_attr);
+       if (major != GSS_S_COMPLETE)
+           return major;
+
+       add_all_mo(m, mech_attr, GSS_MO_MA);
+    }
+
+    if (known_mech_attrs) {
+       struct _gss_mech_switch *m;
+
+       major = gss_create_empty_oid_set(minor_status, known_mech_attrs);
+       if (major) {
+           if (mech_attr)
+               gss_release_oid_set(&junk, mech_attr);
+           return major;
+       }
+
+       _gss_load_mech();
+
+       SLIST_FOREACH(m, &_gss_mechs, gm_link)
+           add_all_mo(&m->gm_mech, known_mech_attrs, GSS_MO_MA);
+    }
+
+
+    return GSS_S_COMPLETE;
+}
+
+/**
+ * Return names and descriptions of mech attributes
+ *
+ * @param minor_status minor status code
+ * @param mech_attr
+ * @param name
+ * @param short_desc
+ * @param long_desc
+ *
+ * @return returns GSS_S_COMPLETE or an error code.
+ */
+
+GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
+gss_display_mech_attr(OM_uint32 * minor_status,
+                     gss_const_OID mech_attr,
+                     gss_buffer_t name,
+                     gss_buffer_t short_desc,
+                     gss_buffer_t long_desc)
+{
+    struct _gss_oid_name_table *ma = NULL;
+    OM_uint32 major;
+    size_t n;
+
+    _mg_buffer_zero(name);
+    _mg_buffer_zero(short_desc);
+    _mg_buffer_zero(long_desc);
+
+    if (minor_status)
+       *minor_status = 0;
+
+    for (n = 0; ma == NULL && _gss_ont_ma[n].oid; n++)
+       if (gss_oid_equal(mech_attr, _gss_ont_ma[n].oid))
+           ma = &_gss_ont_ma[n];
+
+    if (ma == NULL)
+       return GSS_S_BAD_MECH_ATTR;
+
+    if (name) {
+       gss_buffer_desc n;
+       n.value = rk_UNCONST(ma->name);
+       n.length = strlen(ma->name);
+       major = _gss_copy_buffer(minor_status, &n, name);
+       if (major != GSS_S_COMPLETE)
+           return major;
+    }
+
+    if (short_desc) {
+       gss_buffer_desc n;
+       n.value = rk_UNCONST(ma->short_desc);
+       n.length = strlen(ma->short_desc);
+       major = _gss_copy_buffer(minor_status, &n, short_desc);
+       if (major != GSS_S_COMPLETE)
+           return major;
+    }
+
+    if (long_desc) {
+       gss_buffer_desc n;
+       n.value = rk_UNCONST(ma->long_desc);
+       n.length = strlen(ma->long_desc);
+       major = _gss_copy_buffer(minor_status, &n, long_desc);
+       if (major != GSS_S_COMPLETE)
+           return major;
+    }
+
+    return GSS_S_COMPLETE;
+}
diff --git a/source4/heimdal/lib/gssapi/mech/gss_oid.c b/source4/heimdal/lib/gssapi/mech/gss_oid.c
new file mode 100644 (file)
index 0000000..0bd016c
--- /dev/null
@@ -0,0 +1,253 @@
+/* Generated file */
+#include "mech_locl.h"
+
+/* GSS_KRB5_COPY_CCACHE_X - 1.2.752.43.13.1 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_copy_ccache_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x01" };
+
+/* GSS_KRB5_GET_TKT_FLAGS_X - 1.2.752.43.13.2 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_tkt_flags_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x02" };
+
+/* GSS_KRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT_X - 1.2.752.43.13.3 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_extract_authz_data_from_sec_context_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x03" };
+
+/* GSS_KRB5_COMPAT_DES3_MIC_X - 1.2.752.43.13.4 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_compat_des3_mic_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x04" };
+
+/* GSS_KRB5_REGISTER_ACCEPTOR_IDENTITY_X - 1.2.752.43.13.5 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_register_acceptor_identity_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x05" };
+
+/* GSS_KRB5_EXPORT_LUCID_CONTEXT_X - 1.2.752.43.13.6 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_export_lucid_context_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x06" };
+
+/* GSS_KRB5_EXPORT_LUCID_CONTEXT_V1_X - 1.2.752.43.13.6.1 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_export_lucid_context_v1_x_oid_desc = { 7, "\x2a\x85\x70\x2b\x0d\x06\x01" };
+
+/* GSS_KRB5_SET_DNS_CANONICALIZE_X - 1.2.752.43.13.7 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_set_dns_canonicalize_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x07" };
+
+/* GSS_KRB5_GET_SUBKEY_X - 1.2.752.43.13.8 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_subkey_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x08" };
+
+/* GSS_KRB5_GET_INITIATOR_SUBKEY_X - 1.2.752.43.13.9 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_initiator_subkey_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x09" };
+
+/* GSS_KRB5_GET_ACCEPTOR_SUBKEY_X - 1.2.752.43.13.10 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_acceptor_subkey_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x0a" };
+
+/* GSS_KRB5_SEND_TO_KDC_X - 1.2.752.43.13.11 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_send_to_kdc_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x0b" };
+
+/* GSS_KRB5_GET_AUTHTIME_X - 1.2.752.43.13.12 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_authtime_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x0c" };
+
+/* GSS_KRB5_GET_SERVICE_KEYBLOCK_X - 1.2.752.43.13.13 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_service_keyblock_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x0d" };
+
+/* GSS_KRB5_SET_ALLOWABLE_ENCTYPES_X - 1.2.752.43.13.14 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_set_allowable_enctypes_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x0e" };
+
+/* GSS_KRB5_SET_DEFAULT_REALM_X - 1.2.752.43.13.15 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_set_default_realm_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x0f" };
+
+/* GSS_KRB5_CCACHE_NAME_X - 1.2.752.43.13.16 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_ccache_name_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x10" };
+
+/* GSS_KRB5_SET_TIME_OFFSET_X - 1.2.752.43.13.17 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_set_time_offset_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x11" };
+
+/* GSS_KRB5_GET_TIME_OFFSET_X - 1.2.752.43.13.18 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_get_time_offset_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x12" };
+
+/* GSS_KRB5_PLUGIN_REGISTER_X - 1.2.752.43.13.19 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_plugin_register_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x13" };
+
+/* GSS_NTLM_GET_SESSION_KEY_X - 1.2.752.43.13.20 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_ntlm_get_session_key_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x14" };
+
+/* GSS_C_NT_NTLM - 1.2.752.43.13.21 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_ntlm_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x15" };
+
+/* GSS_C_NT_DN - 1.2.752.43.13.22 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_dn_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x16" };
+
+/* GSS_KRB5_NT_PRINCIPAL_NAME_REFERRAL - 1.2.752.43.13.23 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_nt_principal_name_referral_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x17" };
+
+/* GSS_C_NTLM_AVGUEST - 1.2.752.43.13.24 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ntlm_avguest_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x18" };
+
+/* GSS_C_NTLM_V1 - 1.2.752.43.13.25 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ntlm_v1_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x19" };
+
+/* GSS_C_NTLM_V2 - 1.2.752.43.13.26 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ntlm_v2_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x1a" };
+
+/* GSS_C_NTLM_SESSION_KEY - 1.2.752.43.13.27 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ntlm_session_key_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x1b" };
+
+/* GSS_C_NTLM_FORCE_V1 - 1.2.752.43.13.28 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ntlm_force_v1_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x1c" };
+
+/* GSS_KRB5_CRED_NO_CI_FLAGS_X - 1.2.752.43.13.29 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_cred_no_ci_flags_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x1d" };
+
+/* GSS_KRB5_IMPORT_CRED_X - 1.2.752.43.13.30 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_import_cred_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x1e" };
+
+/* GSS_C_MA_SASL_MECH_NAME - 1.2.752.43.13.100 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_sasl_mech_name_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x64" };
+
+/* GSS_C_MA_MECH_NAME - 1.2.752.43.13.101 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_mech_name_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x65" };
+
+/* GSS_C_MA_MECH_DESCRIPTION - 1.2.752.43.13.102 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_mech_description_oid_desc = { 6, "\x2a\x85\x70\x2b\x0d\x66" };
+
+/* GSS_SASL_DIGEST_MD5_MECHANISM - 1.2.752.43.14.1 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_sasl_digest_md5_mechanism_oid_desc = { 6, "\x2a\x85\x70\x2b\x0e\x01" };
+
+/* GSS_NETLOGON_MECHANISM - 1.2.752.43.14.2 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_netlogon_mechanism_oid_desc = { 6, "\x2a\x85\x70\x2b\x0e\x02" };
+
+/* GSS_NETLOGON_SET_SESSION_KEY_X - 1.2.752.43.14.3 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_netlogon_set_session_key_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0e\x03" };
+
+/* GSS_NETLOGON_SET_SIGN_ALGORITHM_X - 1.2.752.43.14.4 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_netlogon_set_sign_algorithm_x_oid_desc = { 6, "\x2a\x85\x70\x2b\x0e\x04" };
+
+/* GSS_NETLOGON_NT_NETBIOS_DNS_NAME - 1.2.752.43.14.5 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_netlogon_nt_netbios_dns_name_oid_desc = { 6, "\x2a\x85\x70\x2b\x0e\x05" };
+
+/* GSS_KRB5_MECHANISM - 1.2.840.113554.1.2.2 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_mechanism_oid_desc = { 9, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02" };
+
+/* GSS_NTLM_MECHANISM - 1.3.6.1.4.1.311.2.2.10 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_ntlm_mechanism_oid_desc = { 10, "\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a" };
+
+/* GSS_SPNEGO_MECHANISM - 1.3.6.1.5.5.2 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_spnego_mechanism_oid_desc = { 6, "\x2b\x06\x01\x05\x05\x02" };
+
+/* GSS_C_PEER_HAS_UPDATED_SPNEGO - 1.3.6.1.4.1.9513.19.5 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_peer_has_updated_spnego_oid_desc = { 9, "\x2b\x06\x01\x04\x01\xca\x29\x13\x05" };
+
+/* GSS_C_MA_MECH_CONCRETE - 1.3.6.1.5.5.13.1 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_mech_concrete_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x01" };
+
+/* GSS_C_MA_MECH_PSEUDO - 1.3.6.1.5.5.13.2 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_mech_pseudo_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x02" };
+
+/* GSS_C_MA_MECH_COMPOSITE - 1.3.6.1.5.5.13.3 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_mech_composite_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x03" };
+
+/* GSS_C_MA_MECH_NEGO - 1.3.6.1.5.5.13.4 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_mech_nego_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x04" };
+
+/* GSS_C_MA_MECH_GLUE - 1.3.6.1.5.5.13.5 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_mech_glue_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x05" };
+
+/* GSS_C_MA_NOT_MECH - 1.3.6.1.5.5.13.6 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_not_mech_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x06" };
+
+/* GSS_C_MA_DEPRECATED - 1.3.6.1.5.5.13.7 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_deprecated_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x07" };
+
+/* GSS_C_MA_NOT_DFLT_MECH - 1.3.6.1.5.5.13.8 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_not_dflt_mech_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x08" };
+
+/* GSS_C_MA_ITOK_FRAMED - 1.3.6.1.5.5.13.9 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_itok_framed_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x09" };
+
+/* GSS_C_MA_AUTH_INIT - 1.3.6.1.5.5.13.10 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_auth_init_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x0a" };
+
+/* GSS_C_MA_AUTH_TARG - 1.3.6.1.5.5.13.11 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_auth_targ_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x0b" };
+
+/* GSS_C_MA_AUTH_INIT_INIT - 1.3.6.1.5.5.13.12 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_auth_init_init_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x0c" };
+
+/* GSS_C_MA_AUTH_TARG_INIT - 1.3.6.1.5.5.13.13 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_auth_targ_init_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x0d" };
+
+/* GSS_C_MA_AUTH_INIT_ANON - 1.3.6.1.5.5.13.14 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_auth_init_anon_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x0e" };
+
+/* GSS_C_MA_AUTH_TARG_ANON - 1.3.6.1.5.5.13.15 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_auth_targ_anon_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x0f" };
+
+/* GSS_C_MA_DELEG_CRED - 1.3.6.1.5.5.13.16 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_deleg_cred_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x10" };
+
+/* GSS_C_MA_INTEG_PROT - 1.3.6.1.5.5.13.17 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_integ_prot_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x11" };
+
+/* GSS_C_MA_CONF_PROT - 1.3.6.1.5.5.13.18 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_conf_prot_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x12" };
+
+/* GSS_C_MA_MIC - 1.3.6.1.5.5.13.19 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_mic_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x13" };
+
+/* GSS_C_MA_WRAP - 1.3.6.1.5.5.13.20 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_wrap_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x14" };
+
+/* GSS_C_MA_PROT_READY - 1.3.6.1.5.5.13.21 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_prot_ready_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x15" };
+
+/* GSS_C_MA_REPLAY_DET - 1.3.6.1.5.5.13.22 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_replay_det_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x16" };
+
+/* GSS_C_MA_OOS_DET - 1.3.6.1.5.5.13.23 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_oos_det_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x17" };
+
+/* GSS_C_MA_CBINDINGS - 1.3.6.1.5.5.13.24 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_cbindings_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x18" };
+
+/* GSS_C_MA_PFS - 1.3.6.1.5.5.13.25 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_pfs_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x19" };
+
+/* GSS_C_MA_COMPRESS - 1.3.6.1.5.5.13.26 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_compress_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x1a" };
+
+/* GSS_C_MA_CTX_TRANS - 1.3.6.1.5.5.13.27 */
+gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_ma_ctx_trans_oid_desc = { 7, "\x2b\x06\x01\x05\x05\x0d\x1b" };
+
+struct _gss_oid_name_table _gss_ont_ma[] = {
+  { GSS_C_MA_COMPRESS, "GSS_C_MA_COMPRESS", "compress", "" },
+  { GSS_C_MA_AUTH_TARG_INIT, "GSS_C_MA_AUTH_TARG_INIT", "auth-targ-princ-initial", "" },
+  { GSS_C_MA_CBINDINGS, "GSS_C_MA_CBINDINGS", "channel-bindings", "" },
+  { GSS_C_MA_WRAP, "GSS_C_MA_WRAP", "wrap", "" },
+  { GSS_C_MA_ITOK_FRAMED, "GSS_C_MA_ITOK_FRAMED", "initial-is-framed", "" },
+  { GSS_C_MA_MECH_NEGO, "GSS_C_MA_MECH_NEGO", "mech-negotiation-mech", "" },
+  { GSS_C_MA_MECH_COMPOSITE, "GSS_C_MA_MECH_COMPOSITE", "composite-mech", "" },
+  { GSS_C_MA_REPLAY_DET, "GSS_C_MA_REPLAY_DET", "replay-detection", "" },
+  { GSS_C_MA_AUTH_INIT_ANON, "GSS_C_MA_AUTH_INIT_ANON", "auth-init-princ-anon", "" },
+  { GSS_C_MA_PROT_READY, "GSS_C_MA_PROT_READY", "prot-ready", "" },
+  { GSS_C_MA_AUTH_INIT, "GSS_C_MA_AUTH_INIT", "auth-init-princ", "" },
+  { GSS_C_MA_PFS, "GSS_C_MA_PFS", "pfs", "" },
+  { GSS_C_MA_CONF_PROT, "GSS_C_MA_CONF_PROT", "conf-prot", "" },
+  { GSS_C_MA_MECH_PSEUDO, "GSS_C_MA_MECH_PSEUDO", "pseudo-mech", "" },
+  { GSS_C_MA_AUTH_TARG, "GSS_C_MA_AUTH_TARG", "auth-targ-princ", "" },
+  { GSS_C_MA_MECH_NAME, "GSS_C_MA_MECH_NAME", "GSS mech name", "The name of the GSS-API mechanism" },
+  { GSS_C_MA_NOT_MECH, "GSS_C_MA_NOT_MECH", "not-mech", "" },
+  { GSS_C_MA_MIC, "GSS_C_MA_MIC", "mic", "" },
+  { GSS_C_MA_DEPRECATED, "GSS_C_MA_DEPRECATED", "mech-deprecated", "" },
+  { GSS_C_MA_MECH_GLUE, "GSS_C_MA_MECH_GLUE", "mech-glue", "" },
+  { GSS_C_MA_DELEG_CRED, "GSS_C_MA_DELEG_CRED", "deleg-cred", "" },
+  { GSS_C_MA_NOT_DFLT_MECH, "GSS_C_MA_NOT_DFLT_MECH", "mech-not-default", "" },
+  { GSS_C_MA_AUTH_TARG_ANON, "GSS_C_MA_AUTH_TARG_ANON", "auth-targ-princ-anon", "" },
+  { GSS_C_MA_INTEG_PROT, "GSS_C_MA_INTEG_PROT", "integ-prot", "" },
+  { GSS_C_MA_CTX_TRANS, "GSS_C_MA_CTX_TRANS", "context-transfer", "" },
+  { GSS_C_MA_MECH_DESCRIPTION, "GSS_C_MA_MECH_DESCRIPTION", "Mech description", "The long description of the mechanism" },
+  { GSS_C_MA_OOS_DET, "GSS_C_MA_OOS_DET", "oos-detection", "" },
+  { GSS_C_MA_AUTH_INIT_INIT, "GSS_C_MA_AUTH_INIT_INIT", "auth-init-princ-initial", "" },
+  { GSS_C_MA_MECH_CONCRETE, "GSS_C_MA_MECH_CONCRETE", "concrete-mech", "Indicates that a mech is neither a pseudo-mechanism nor a composite mechanism" },
+  { GSS_C_MA_SASL_MECH_NAME, "GSS_C_MA_SASL_MECH_NAME", "SASL mechanism name", "The name of the SASL mechanism" },
+  { NULL }
+};
+
+struct _gss_oid_name_table _gss_ont_mech[] = {
+  { GSS_KRB5_MECHANISM, "GSS_KRB5_MECHANISM", "Kerberos 5", "Heimdal Kerberos 5 mechanism" },
+  { GSS_SPNEGO_MECHANISM, "GSS_SPNEGO_MECHANISM", "SPNEGO", "Heimdal SPNEGO mechanism" },
+  { GSS_NTLM_MECHANISM, "GSS_NTLM_MECHANISM", "NTLM", "Heimdal NTLM mechanism" },
+  { NULL }
+};
index 3e641350892a162800cec577a3aea5c63343ac1f..7d6ded39e479744226c0beab0cb8defdd3ddf530 100644 (file)
@@ -48,7 +48,7 @@
  */
 
 GSSAPI_LIB_FUNCTION int GSSAPI_LIB_CALL
-gss_oid_equal(const gss_OID a, const gss_OID b)
+gss_oid_equal(gss_const_OID a, gss_const_OID b)
 {
     if (a == b && a != GSS_C_NO_OID)
        return 1;
index d8e188da0827fe8adf97cabcfdeef61f3d2e3068..a1d776877245868034fa173d52f7305024d367a1 100644 (file)
@@ -65,3 +65,34 @@ gss_oid_to_str(OM_uint32 *minor_status, gss_OID oid, gss_buffer_t oid_str)
     *minor_status = 0;
     return GSS_S_COMPLETE;
 }
+
+GSSAPI_LIB_FUNCTION const char * GSSAPI_LIB_CALL
+gss_oid_to_name(gss_const_OID oid)
+{
+    size_t i;
+
+    for (i = 0; _gss_ont_mech[i].oid; i++) {
+       if (gss_oid_equal(oid, _gss_ont_mech[i].oid))
+           return _gss_ont_mech[i].name;
+    }
+    return NULL;
+}
+
+GSSAPI_LIB_FUNCTION gss_OID GSSAPI_LIB_CALL
+gss_name_to_oid(const char *name)
+{
+    size_t i, partial = (size_t)-1;
+
+    for (i = 0; _gss_ont_mech[i].oid; i++) {
+       if (strcasecmp(name, _gss_ont_mech[i].short_desc) == 0)
+           return _gss_ont_mech[i].oid;
+       if (strncasecmp(name, _gss_ont_mech[i].short_desc, strlen(name)) == 0) {
+           if (partial != (size_t)-1)
+               return NULL;
+           partial = i;
+       }
+    }
+    if (partial != (size_t)-1)
+       return _gss_ont_mech[partial].oid;
+    return NULL;
+}
index dcbb4fcdfee30eeb54f89c3696c4779b71a569ef..d9864b36ccb44abe99767783acf7bf79c51f310d 100644 (file)
 
 #include "mech_locl.h"
 
+/**
+ * Wrap a message using either confidentiality (encryption +
+ * signature) or sealing (signature).
+ *
+ * @param minor_status minor status code.
+ * @param context_handle context handle.
+ * @param conf_req_flag if non zero, confidentiality is requestd.
+ * @param qop_req type of protection needed, in most cases it GSS_C_QOP_DEFAULT should be passed in.
+ * @param input_message_buffer messages to wrap
+ * @param conf_state returns non zero if confidentiality was honoured.
+ * @param output_message_buffer the resulting buffer, release with gss_release_buffer().
+ *
+ * @ingroup gssapi
+ */
+
 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
 gss_wrap(OM_uint32 *minor_status,
     const gss_ctx_id_t context_handle,
index 17721fd3ce6ed2b966085c7316e8fa92545ea2f5..cb10c23c38b3ddea54cf89186501cc72270e9107 100644 (file)
 #include "utils.h"
 
 #define _mg_buffer_zero(buffer) \
-       do { (buffer)->value = NULL; (buffer)->length = 0; } while(0)
+       do {                                    \
+               if (buffer) {                   \
+                       (buffer)->value = NULL; \
+                       (buffer)->length = 0;   \
+                }                              \
+       } while(0)
+
+#define _mg_oid_set_zero(oid_set) \
+       do {                                            \
+               if (oid_set) {                          \
+                       (oid_set)->elements = NULL;     \
+                       (oid_set)->count = 0;           \
+                }                                      \
+       } while(0)
index d21e4dc7feb41f4756452e948e72a76b9b0517a7..505475415010359c726b09ed0dff9132bb7c6e14 100644 (file)
  *  iso.org.dod.internet.security.mechanism.snego (1.3.6.1.5.5.2).
  */
 
+static gss_mo_desc spnego_mo[] = {
+    {
+       GSS_C_MA_SASL_MECH_NAME,
+       GSS_MO_MA,
+       "SASL mech name",
+       "SPNEGO",
+       _gss_mo_get_ctx_as_string,
+       NULL
+    },
+    {
+       GSS_C_MA_MECH_NAME,
+       GSS_MO_MA,
+       "Mechanism name",
+       "SPNEGO",
+       _gss_mo_get_ctx_as_string,
+       NULL
+    },
+    {
+       GSS_C_MA_MECH_DESCRIPTION,
+       GSS_MO_MA,
+       "Mechanism description",
+       "Heimdal SPNEGO Mechanism",
+       _gss_mo_get_ctx_as_string,
+       NULL
+    },
+    {
+       GSS_C_MA_MECH_NEGO,
+       GSS_MO_MA
+    },
+    {
+       GSS_C_MA_MECH_PSEUDO,
+       GSS_MO_MA
+    }
+};
+
 static gssapi_mech_interface_desc spnego_mech = {
     GMI_VERSION,
     "spnego",
@@ -84,7 +119,16 @@ static gssapi_mech_interface_desc spnego_mech = {
     _gss_spnego_wrap_iov_length,
     NULL,
     _gss_spnego_export_cred,
-    _gss_spnego_import_cred
+    _gss_spnego_import_cred,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    spnego_mo,
+    sizeof(spnego_mo) / sizeof(spnego_mo[0])
 };
 
 gssapi_mech_interface
@@ -92,6 +136,3 @@ __gss_spnego_initialize(void)
 {
        return &spnego_mech;
 }
-
-gss_OID_desc GSSAPI_LIB_VARIABLE __gss_spnego_mechanism_oid_desc =
-    {6, (void *)"\x2b\x06\x01\x05\x05\x02"};
index f4828104b651c1af9742d291b2ae9a0ab94949c5..6ef4a83c519f6f732c7ffcf52957c7eb607e74b0 100644 (file)
@@ -385,8 +385,7 @@ ltm_rsa_private_decrypt(int flen, const unsigned char* from,
                        unsigned char* to, RSA* rsa, int padding)
 {
     unsigned char *ptr;
-    int res;
-    size_t size;
+    int res, size;
     mp_int in, out, n, e, b, bi;
     int blinding = (rsa->flags & RSA_FLAG_NO_BLINDING) == 0;
     int do_unblind = 0;
index 3ed358df6627f34eb8a2e917d68f9c8b579facca..f6f8be70303e88dc141644b951c2ccb4bad33f71 100644 (file)
@@ -38,7 +38,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <getarg.h>
 #include <roken.h>
 
 #include <evp.h>
index 9de0a04a1fadf881f71e408414c0d9c855315b15..69940edf89dc7e5e054e8e38bf2f194731a2bb8f 100644 (file)
@@ -318,7 +318,7 @@ hdb_db_create(krb5_context context, HDB **db,
     (*db)->hdb_capability_flags = HDB_CAP_F_HANDLE_ENTERPRISE_PRINCIPAL;
     (*db)->hdb_open = DB_open;
     (*db)->hdb_close = DB_close;
-    (*db)->hdb_fetch = _hdb_fetch;
+    (*db)->hdb_fetch_kvno = _hdb_fetch_kvno;
     (*db)->hdb_store = _hdb_store;
     (*db)->hdb_remove = _hdb_remove;
     (*db)->hdb_firstkey = DB_firstkey;
index 393981e47d845d079b74123490171f14f4573d62..c1bad867960118b50aa88c74ff772c13913bb166 100644 (file)
@@ -118,7 +118,7 @@ hkt_open(krb5_context context, HDB * db, int flags, mode_t mode)
 
 static krb5_error_code
 hkt_fetch_kvno(krb5_context context, HDB * db, krb5_const_principal principal,
-              unsigned flags, unsigned kvno, hdb_entry_ex * entry)
+              unsigned flags, krb5_kvno kvno, hdb_entry_ex * entry)
 {
     hdb_keytab k = (hdb_keytab)db->hdb_db;
     krb5_error_code ret;
@@ -170,13 +170,6 @@ hkt_fetch_kvno(krb5_context context, HDB * db, krb5_const_principal principal,
     return ret;
 }
 
-static krb5_error_code
-hkt_fetch(krb5_context context, HDB * db, krb5_const_principal principal,
-         unsigned flags, hdb_entry_ex * entry)
-{
-       return hkt_fetch_kvno(context, db, principal, flags & ~HDB_F_KVNO_SPECIFIED, 0, entry);
-}
-
 static krb5_error_code
 hkt_store(krb5_context context, HDB * db, unsigned flags,
          hdb_entry_ex * entry)
@@ -221,7 +214,6 @@ hdb_keytab_create(krb5_context context, HDB ** db, const char *arg)
     (*db)->hdb_openp = 0;
     (*db)->hdb_open = hkt_open;
     (*db)->hdb_close = hkt_close;
-    (*db)->hdb_fetch = hkt_fetch;
     (*db)->hdb_fetch_kvno = hkt_fetch_kvno;
     (*db)->hdb_store = hkt_store;
     (*db)->hdb_remove = NULL;
index 97de91893378e9a4e5d120d8edee2a1d738d5a6c..2c1de8b3d7464e385bbf867bd14880c69ca36c0d 100644 (file)
@@ -318,7 +318,7 @@ find_dynamic_method (krb5_context context,
     if (asprintf(&symbol, "hdb_%s_interface", prefix) == -1)
        krb5_errx(context, 1, "out of memory");
        
-    mso = dlsym(dl, symbol);
+    mso = (struct hdb_so_method *) dlsym(dl, symbol);
     if (mso == NULL) {
        krb5_warnx(context, "error finding symbol %s in %s: %s\n",
                   symbol, path, dlerror());
index bcd190caa3162e13aff23b511347e8585eb66405..1b0468a481f1793fa8d783de6bc83962dfa17af4 100644 (file)
@@ -71,6 +71,13 @@ enum hdb_lockop{ HDB_RLOCK, HDB_WLOCK };
 
 typedef struct hdb_master_key_data *hdb_master_key;
 
+/**
+ * hdb_entry_ex is a wrapper structure around the hdb_entry structure
+ * that allows backends to keep a pointer to the backing store, ie in
+ * ->hdb_fetch_kvno(), so that we the kadmin/kpasswd backend gets around to
+ * ->hdb_store(), the backend doesn't need to lookup the entry again.
+ */
+
 typedef struct hdb_entry_ex {
     void *ctx;
     hdb_entry entry;
@@ -116,15 +123,6 @@ typedef struct HDB{
      * Free an entry after use.
      */
     void           (*hdb_free)(krb5_context, struct HDB*, hdb_entry_ex*);
-    /**
-     * Fetch an entry from the backend
-     *
-     * Fetch an entry from the backend, flags are what type of entry
-     * should be fetch: client, server, krbtgt.
-     */
-    krb5_error_code (*hdb_fetch)(krb5_context, struct HDB*,
-                                krb5_const_principal, unsigned, 
-                                hdb_entry_ex*);
     /**
      * Fetch an entry from the backend
      *
@@ -133,7 +131,7 @@ typedef struct HDB{
      * knvo (if specified and flags HDB_F_KVNO_SPECIFIED set) is the kvno to get
      */
     krb5_error_code (*hdb_fetch_kvno)(krb5_context, struct HDB*,
-                                     krb5_const_principal, unsigned, unsigned,
+                                     krb5_const_principal, unsigned, krb5_kvno,
                                      hdb_entry_ex*);
     /**
      * Store an entry to database
@@ -222,7 +220,7 @@ typedef struct HDB{
      * all other operations, increasing the kvno, and update
      * modification timestamp.
      * 
-     * The backen need to call _kadm5_set_keys() and perform password
+     * The backend needs to call _kadm5_set_keys() and perform password
      * quality checks.
      */
     krb5_error_code (*hdb_password)(krb5_context, struct HDB*, hdb_entry_ex*, const char *, int);
@@ -238,7 +236,7 @@ typedef struct HDB{
      */
     krb5_error_code (*hdb_auth_status)(krb5_context, struct HDB *, hdb_entry_ex *, int);
     /**
-     * Check is delegation is allowed.
+     * Check if delegation is allowed.
      */
     krb5_error_code (*hdb_check_constrained_delegation)(krb5_context, struct HDB *, hdb_entry_ex *, krb5_const_principal);
 
index b8cc0d47ee85ba7536688c315fddc3b336cb6b3c..05b78dafc5bfc06d923f70cad7704035767eb712 100644 (file)
@@ -211,17 +211,10 @@ hdb_get_entry(krb5_context context,
        goto out2;
     }
     
-    if (*db->hdb_fetch_kvno) {
-           ret = (*db->hdb_fetch_kvno)(context, db, principal,
-                                       HDB_F_DECRYPT|HDB_F_KVNO_SPECIFIED|
-                                       HDB_F_GET_CLIENT|HDB_F_GET_SERVER|HDB_F_GET_KRBTGT,
-                                       kvno, &ent);
-    } else {
-           ret = (*db->hdb_fetch)(context, db, principal,
-                                  HDB_F_DECRYPT|
-                                  HDB_F_GET_CLIENT|HDB_F_GET_SERVER|HDB_F_GET_KRBTGT,
-                                  &ent);
-    }
+    ret = (*db->hdb_fetch_kvno)(context, db, principal,
+                               HDB_F_DECRYPT|HDB_F_KVNO_SPECIFIED|
+                               HDB_F_GET_CLIENT|HDB_F_GET_SERVER|HDB_F_GET_KRBTGT,
+                               kvno, &ent);
 
     if(ret == HDB_ERR_NOENTRY) {
        ret = KRB5_KT_NOTFOUND;
index 2a57d2ac27dd0a3a3454dd0e4c91731f1c5ea35a..5b2c07e5f6446459a60f9d13bc8002fec645185c 100644 (file)
@@ -370,7 +370,7 @@ hdb_ndbm_create(krb5_context context, HDB **db,
     (*db)->hdb_capability_flags = HDB_CAP_F_HANDLE_ENTERPRISE_PRINCIPAL;
     (*db)->hdb_open = NDBM_open;
     (*db)->hdb_close = NDBM_close;
-    (*db)->hdb_fetch = _hdb_fetch;
+    (*db)->hdb_fetch_kvno = _hdb_fetch_kvno;
     (*db)->hdb_store = _hdb_store;
     (*db)->hdb_remove = _hdb_remove;
     (*db)->hdb_firstkey = NDBM_firstkey;
index 8612b172daca8f01f02c50c65a710b3254e7b820..5e705f19fd3039327cb769627fbe1a6154a00d4b 100644 (file)
@@ -8,17 +8,29 @@ static const char yysccsid[] = "@(#)yaccpar   1.9 (Berkeley) 02/21/93";
 #define YYBYACC 1
 #define YYMAJOR 1
 #define YYMINOR 9
-#define YYPATCH 20070509
+#define YYPATCH 20100216
 
-#define YYEMPTY (-1)
-#define yyclearin    (yychar = YYEMPTY)
-#define yyerrok      (yyerrflag = 0)
-#define YYRECOVERING (yyerrflag != 0)
+#define YYEMPTY        (-1)
+#define yyclearin      (yychar = YYEMPTY)
+#define yyerrok        (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
 
-extern int yyparse(void);
-
-static int yygrowstack(void);
 #define YYPREFIX "yy"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+#ifdef YYPARSE_PARAM_TYPE
+#define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+#else
+#define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+#endif
+#else
+#define YYPARSE_DECL() yyparse(void)
+#endif /* YYPARSE_PARAM */
+
+extern int YYPARSE_DECL();
+
 #line 35 ""
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -33,7 +45,7 @@ typedef union {
     char *string;
     struct hx_expr *expr;
 } YYSTYPE;
-#line 37 ""
+#line 48 ""
 #define kw_TRUE 257
 #define kw_FALSE 258
 #define kw_AND 259
@@ -44,45 +56,45 @@ typedef union {
 #define STRING 264
 #define IDENTIFIER 265
 #define YYERRCODE 256
-short yylhs[] = {                                        -1,
+static const short yylhs[] = {                           -1,
     0,    1,    1,    1,    1,    1,    1,    1,    4,    4,
     2,    2,    2,    2,    2,    3,    3,    3,    3,    5,
     6,    7,    8,    9,    9,
 };
-short yylen[] = {                                         2,
+static const short yylen[] = {                            2,
     1,    1,    1,    2,    3,    3,    3,    1,    1,    3,
     4,    4,    3,    5,    3,    1,    1,    1,    1,    1,
     1,    4,    4,    3,    1,
 };
-short yydefred[] = {                                      0,
+static const short yydefred[] = {                         0,
     2,    3,   20,   21,    0,    0,    0,    0,    0,    0,
     8,    0,   16,   17,   18,   19,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    7,    0,
     0,    0,    0,    0,   15,   13,    0,    0,    0,   22,
     0,   23,    0,   12,   11,   10,   24,   14,
 };
-short yydgoto[] = {                                       9,
+static const short yydgoto[] = {                          9,
    10,   11,   12,   28,   13,   14,   15,   16,   31,
 };
-short yysindex[] = {                                    -33,
+static const short yysindex[] = {                       -33,
     0,    0,    0,    0,  -23,  -33,  -33, -105,    0, -247,
     0,  -28,    0,    0,    0,    0,  -36, -247,  -39, -244,
   -33,  -33,  -26,  -36,  -38,  -37,  -22,  -16,    0,  -19,
   -97, -247, -247,  -36,    0,    0,  -36,  -36,  -36,    0,
  -244,    0,   -9,    0,    0,    0,    0,    0,
 };
-short yyrindex[] = {                                      0,
+static const short yyrindex[] = {                         0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,   36,
     0,    0,    0,    0,    0,    0,    0,    3,    0,    0,
     0,    0,    0,    0,    0,    0,   -4,    0,    0,  -87,
     0,    6,    8,    0,    0,    0,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,
 };
-short yygindex[] = {                                      0,
+static const short yygindex[] = {                         0,
    13,    0,   -8,  -24,    0,    0,    0,   16,   -1,
 };
 #define YYTABLESIZE 234
-short yytable[] = {                                       6,
+static const short yytable[] = {                          6,
     8,   29,    4,    8,   25,    5,    7,    6,   27,   43,
     8,   21,   22,   34,   46,   36,   17,   20,   18,   19,
    30,   39,   37,   38,   40,   27,   41,   42,   44,   45,
@@ -108,7 +120,7 @@ short yytable[] = {                                       6,
    22,    0,    0,    1,    2,    0,    3,    4,    5,    3,
     4,    5,   23,   24,
 };
-short yycheck[] = {                                      33,
+static const short yycheck[] = {                         33,
    37,   41,    0,   37,   33,    0,   40,    0,   17,   34,
    37,  259,  260,   40,   39,   24,   40,  123,    6,    7,
   265,   44,   61,   61,   41,   34,   46,  125,   37,   38,
@@ -140,7 +152,8 @@ short yycheck[] = {                                      33,
 #endif
 #define YYMAXTOKEN 265
 #if YYDEBUG
-char *yyname[] = {
+static const char *yyname[] = {
+
 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 "'!'",0,0,0,"'%'",0,0,"'('","')'",0,0,"','",0,"'.'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 "'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -151,7 +164,7 @@ char *yyname[] = {
 0,0,"kw_TRUE","kw_FALSE","kw_AND","kw_OR","kw_IN","kw_TAILMATCH","NUMBER",
 "STRING","IDENTIFIER",
 };
-char *yyrule[] = {
+static const char *yyrule[] = {
 "$accept : start",
 "start : expr",
 "expr : kw_TRUE",
@@ -178,6 +191,7 @@ char *yyrule[] = {
 "variable : '%' '{' variables '}'",
 "variables : IDENTIFIER '.' variables",
 "variables : IDENTIFIER",
+
 };
 #endif
 #if YYDEBUG
@@ -201,64 +215,86 @@ char *yyrule[] = {
 
 int      yydebug;
 int      yynerrs;
+
+typedef struct {
+    unsigned stacksize;
+    short    *s_base;
+    short    *s_mark;
+    short    *s_last;
+    YYSTYPE  *l_base;
+    YYSTYPE  *l_mark;
+} YYSTACKDATA;
+
+#define YYPURE 0
+
 int      yyerrflag;
 int      yychar;
-short   *yyssp;
-YYSTYPE *yyvsp;
 YYSTYPE  yyval;
 YYSTYPE  yylval;
 
 /* variables for the parser stack */
-static short   *yyss;
-static short   *yysslim;
-static YYSTYPE *yyvs;
-static int      yystacksize;
+static YYSTACKDATA yystack;
 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(void)
+static int yygrowstack(YYSTACKDATA *data)
 {
-    int newsize, i;
+    int i;
+    unsigned newsize;
     short *newss;
     YYSTYPE *newvs;
 
-    if ((newsize = yystacksize) == 0)
+    if ((newsize = data->stacksize) == 0)
         newsize = YYINITSTACKSIZE;
     else if (newsize >= YYMAXDEPTH)
         return -1;
     else if ((newsize *= 2) > YYMAXDEPTH)
         newsize = YYMAXDEPTH;
 
-    i = yyssp - yyss;
-    newss = (yyss != 0)
-          ? (short *)realloc(yyss, newsize * sizeof(*newss))
+    i = data->s_mark - data->s_base;
+    newss = (data->s_base != 0)
+          ? (short *)realloc(data->s_base, newsize * sizeof(*newss))
           : (short *)malloc(newsize * sizeof(*newss));
     if (newss == 0)
         return -1;
 
-    yyss  = newss;
-    yyssp = newss + i;
-    newvs = (yyvs != 0)
-          ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs))
+    data->s_base  = newss;
+    data->s_mark = newss + i;
+
+    newvs = (data->l_base != 0)
+          ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs))
           : (YYSTYPE *)malloc(newsize * sizeof(*newvs));
     if (newvs == 0)
         return -1;
 
-    yyvs = newvs;
-    yyvsp = newvs + i;
-    yystacksize = newsize;
-    yysslim = yyss + newsize - 1;
+    data->l_base = newvs;
+    data->l_mark = newvs + i;
+
+    data->stacksize = newsize;
+    data->s_last = data->s_base + newsize - 1;
     return 0;
 }
 
-#define YYABORT goto yyabort
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+    free(data->s_base);
+    free(data->l_base);
+    memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT  goto yyabort
 #define YYREJECT goto yyabort
 #define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
+#define YYERROR  goto yyerrlab
+
 int
-yyparse(void)
+YYPARSE_DECL()
 {
-    register int yym, yyn, yystate;
+    int yym, yyn, yystate;
 #if YYDEBUG
-    register const char *yys;
+    const char *yys;
 
     if ((yys = getenv("YYDEBUG")) != 0)
     {
@@ -271,11 +307,17 @@ yyparse(void)
     yynerrs = 0;
     yyerrflag = 0;
     yychar = YYEMPTY;
+    yystate = 0;
 
-    if (yyss == NULL && yygrowstack()) goto yyoverflow;
-    yyssp = yyss;
-    yyvsp = yyvs;
-    *yyssp = yystate = 0;
+#if YYPURE
+    memset(&yystack, 0, sizeof(yystack));
+#endif
+
+    if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
+    yystack.s_mark = yystack.s_base;
+    yystack.l_mark = yystack.l_base;
+    yystate = 0;
+    *yystack.s_mark = 0;
 
 yyloop:
     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
@@ -301,12 +343,13 @@ yyloop:
             printf("%sdebug: state %d, shifting to state %d\n",
                     YYPREFIX, yystate, yytable[yyn]);
 #endif
-        if (yyssp >= yysslim && yygrowstack())
+        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
         {
             goto yyoverflow;
         }
-        *++yyssp = yystate = yytable[yyn];
-        *++yyvsp = yylval;
+        yystate = yytable[yyn];
+        *++yystack.s_mark = yytable[yyn];
+        *++yystack.l_mark = yylval;
         yychar = YYEMPTY;
         if (yyerrflag > 0)  --yyerrflag;
         goto yyloop;
@@ -321,9 +364,7 @@ yyloop:
 
     yyerror("syntax error");
 
-#ifdef lint
     goto yyerrlab;
-#endif
 
 yyerrlab:
     ++yynerrs;
@@ -334,20 +375,21 @@ yyinrecovery:
         yyerrflag = 3;
         for (;;)
         {
-            if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
+            if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
             {
 #if YYDEBUG
                 if (yydebug)
                     printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
 #endif
-                if (yyssp >= yysslim && yygrowstack())
+                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
                 {
                     goto yyoverflow;
                 }
-                *++yyssp = yystate = yytable[yyn];
-                *++yyvsp = yylval;
+                yystate = yytable[yyn];
+                *++yystack.s_mark = yytable[yyn];
+                *++yystack.l_mark = yylval;
                 goto yyloop;
             }
             else
@@ -355,11 +397,11 @@ yyinrecovery:
 #if YYDEBUG
                 if (yydebug)
                     printf("%sdebug: error recovery discarding state %d\n",
-                            YYPREFIX, *yyssp);
+                            YYPREFIX, *yystack.s_mark);
 #endif
-                if (yyssp <= yyss) goto yyabort;
-                --yyssp;
-                --yyvsp;
+                if (yystack.s_mark <= yystack.s_base) goto yyabort;
+                --yystack.s_mark;
+                --yystack.l_mark;
             }
         }
     }
@@ -388,119 +430,119 @@ yyreduce:
 #endif
     yym = yylen[yyn];
     if (yym)
-        yyval = yyvsp[1-yym];
+        yyval = yystack.l_mark[1-yym];
     else
         memset(&yyval, 0, sizeof yyval);
     switch (yyn)
     {
 case 1:
 #line 73 ""
-{ _hx509_expr_input.expr = yyvsp[0].expr; }
+       { _hx509_expr_input.expr = yystack.l_mark[0].expr; }
 break;
 case 2:
 #line 75 ""
-{ yyval.expr = _hx509_make_expr(op_TRUE, NULL, NULL); }
+       { yyval.expr = _hx509_make_expr(op_TRUE, NULL, NULL); }
 break;
 case 3:
 #line 76 ""
-{ yyval.expr = _hx509_make_expr(op_FALSE, NULL, NULL); }
+       { yyval.expr = _hx509_make_expr(op_FALSE, NULL, NULL); }
 break;
 case 4:
 #line 77 ""
-{ yyval.expr = _hx509_make_expr(op_NOT, yyvsp[0].expr, NULL); }
+       { yyval.expr = _hx509_make_expr(op_NOT, yystack.l_mark[0].expr, NULL); }
 break;
 case 5:
 #line 78 ""
-{ yyval.expr = _hx509_make_expr(op_AND, yyvsp[-2].expr, yyvsp[0].expr); }
+       { yyval.expr = _hx509_make_expr(op_AND, yystack.l_mark[-2].expr, yystack.l_mark[0].expr); }
 break;
 case 6:
 #line 79 ""
-{ yyval.expr = _hx509_make_expr(op_OR, yyvsp[-2].expr, yyvsp[0].expr); }
+       { yyval.expr = _hx509_make_expr(op_OR, yystack.l_mark[-2].expr, yystack.l_mark[0].expr); }
 break;
 case 7:
 #line 80 ""
-{ yyval.expr = yyvsp[-1].expr; }
+       { yyval.expr = yystack.l_mark[-1].expr; }
 break;
 case 8:
 #line 81 ""
-{ yyval.expr = _hx509_make_expr(op_COMP, yyvsp[0].expr, NULL); }
+       { yyval.expr = _hx509_make_expr(op_COMP, yystack.l_mark[0].expr, NULL); }
 break;
 case 9:
 #line 84 ""
-{ yyval.expr = _hx509_make_expr(expr_WORDS, yyvsp[0].expr, NULL); }
+       { yyval.expr = _hx509_make_expr(expr_WORDS, yystack.l_mark[0].expr, NULL); }
 break;
 case 10:
 #line 85 ""
-{ yyval.expr = _hx509_make_expr(expr_WORDS, yyvsp[-2].expr, yyvsp[0].expr); }
+       { yyval.expr = _hx509_make_expr(expr_WORDS, yystack.l_mark[-2].expr, yystack.l_mark[0].expr); }
 break;
 case 11:
 #line 88 ""
-{ yyval.expr = _hx509_make_expr(comp_EQ, yyvsp[-3].expr, yyvsp[0].expr); }
+       { yyval.expr = _hx509_make_expr(comp_EQ, yystack.l_mark[-3].expr, yystack.l_mark[0].expr); }
 break;
 case 12:
 #line 89 ""
-{ yyval.expr = _hx509_make_expr(comp_NE, yyvsp[-3].expr, yyvsp[0].expr); }
+       { yyval.expr = _hx509_make_expr(comp_NE, yystack.l_mark[-3].expr, yystack.l_mark[0].expr); }
 break;
 case 13:
 #line 90 ""
-{ yyval.expr = _hx509_make_expr(comp_TAILEQ, yyvsp[-2].expr, yyvsp[0].expr); }
+       { yyval.expr = _hx509_make_expr(comp_TAILEQ, yystack.l_mark[-2].expr, yystack.l_mark[0].expr); }
 break;
 case 14:
 #line 91 ""
-{ yyval.expr = _hx509_make_expr(comp_IN, yyvsp[-4].expr, yyvsp[-1].expr); }
+       { yyval.expr = _hx509_make_expr(comp_IN, yystack.l_mark[-4].expr, yystack.l_mark[-1].expr); }
 break;
 case 15:
 #line 92 ""
-{ yyval.expr = _hx509_make_expr(comp_IN, yyvsp[-2].expr, yyvsp[0].expr); }
+       { yyval.expr = _hx509_make_expr(comp_IN, yystack.l_mark[-2].expr, yystack.l_mark[0].expr); }
 break;
 case 16:
 #line 95 ""
-{ yyval.expr = yyvsp[0].expr; }
+       { yyval.expr = yystack.l_mark[0].expr; }
 break;
 case 17:
 #line 96 ""
-{ yyval.expr = yyvsp[0].expr; }
+       { yyval.expr = yystack.l_mark[0].expr; }
 break;
 case 18:
 #line 97 ""
-{ yyval.expr = yyvsp[0].expr; }
+       { yyval.expr = yystack.l_mark[0].expr; }
 break;
 case 19:
 #line 98 ""
-{ yyval.expr = yyvsp[0].expr; }
+       { yyval.expr = yystack.l_mark[0].expr; }
 break;
 case 20:
 #line 101 ""
-{ yyval.expr = _hx509_make_expr(expr_NUMBER, yyvsp[0].string, NULL); }
+       { yyval.expr = _hx509_make_expr(expr_NUMBER, yystack.l_mark[0].string, NULL); }
 break;
 case 21:
 #line 102 ""
-{ yyval.expr = _hx509_make_expr(expr_STRING, yyvsp[0].string, NULL); }
+       { yyval.expr = _hx509_make_expr(expr_STRING, yystack.l_mark[0].string, NULL); }
 break;
 case 22:
 #line 104 ""
-{
-                       yyval.expr = _hx509_make_expr(expr_FUNCTION, yyvsp[-3].string, yyvsp[-1].expr); }
+       {
+                       yyval.expr = _hx509_make_expr(expr_FUNCTION, yystack.l_mark[-3].string, yystack.l_mark[-1].expr); }
 break;
 case 23:
 #line 107 ""
-{ yyval.expr = yyvsp[-1].expr; }
+       { yyval.expr = yystack.l_mark[-1].expr; }
 break;
 case 24:
 #line 110 ""
-{
-                       yyval.expr = _hx509_make_expr(expr_VAR, yyvsp[-2].string, yyvsp[0].expr); }
+       {
+                       yyval.expr = _hx509_make_expr(expr_VAR, yystack.l_mark[-2].string, yystack.l_mark[0].expr); }
 break;
 case 25:
 #line 112 ""
-{
-                       yyval.expr = _hx509_make_expr(expr_VAR, yyvsp[0].string, NULL); }
+       {
+                       yyval.expr = _hx509_make_expr(expr_VAR, yystack.l_mark[0].string, NULL); }
 break;
-#line 500 ""
+#line 541 ""
     }
-    yyssp -= yym;
-    yystate = *yyssp;
-    yyvsp -= yym;
+    yystack.s_mark -= yym;
+    yystate = *yystack.s_mark;
+    yystack.l_mark -= yym;
     yym = yylhs[yyn];
     if (yystate == 0 && yym == 0)
     {
@@ -510,8 +552,8 @@ break;
  state %d\n", YYPREFIX, YYFINAL);
 #endif
         yystate = YYFINAL;
-        *++yyssp = YYFINAL;
-        *++yyvsp = yyval;
+        *++yystack.s_mark = YYFINAL;
+        *++yystack.l_mark = yyval;
         if (yychar < 0)
         {
             if ((yychar = yylex()) < 0) yychar = 0;
@@ -537,22 +579,24 @@ break;
 #if YYDEBUG
     if (yydebug)
         printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
 #endif
-    if (yyssp >= yysslim && yygrowstack())
+    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
     {
         goto yyoverflow;
     }
-    *++yyssp = yystate;
-    *++yyvsp = yyval;
+    *++yystack.s_mark = (short) yystate;
+    *++yystack.l_mark = yyval;
     goto yyloop;
 
 yyoverflow:
     yyerror("yacc stack overflow");
 
 yyabort:
+    yyfreestack(&yystack);
     return (1);
 
 yyaccept:
+    yyfreestack(&yystack);
     return (0);
 }
index 32a131b07c5115fe65359344471a40e3dc96a03b..211642e5682c4302b655d68d9c631c84066519cc 100644 (file)
@@ -134,7 +134,7 @@ krb5_cc_register(krb5_context context,
        }
     }
     if(i == context->num_cc_ops) {
-       const krb5_cc_ops **o = realloc(context->cc_ops,
+       const krb5_cc_ops **o = realloc(rk_UNCONST(context->cc_ops),
                                        (context->num_cc_ops + 1) *
                                        sizeof(context->cc_ops[0]));
        if(o == NULL) {
@@ -397,7 +397,7 @@ krb5_cc_get_full_name(krb5_context context,
  */
 
 
-const krb5_cc_ops *
+KRB5_LIB_FUNCTION const krb5_cc_ops * KRB5_LIB_CALL
 krb5_cc_get_ops(krb5_context context, krb5_ccache id)
 {
     return id->ops;
@@ -461,7 +461,7 @@ environment_changed(krb5_context context)
  * @ingroup krb5_ccache
  */
 
-krb5_error_code KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_cc_switch(krb5_context context, krb5_ccache id)
 {
 
@@ -477,7 +477,7 @@ krb5_cc_switch(krb5_context context, krb5_ccache id)
  * @ingroup krb5_ccache
  */
 
-krb5_boolean KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL
 krb5_cc_support_switch(krb5_context context, const char *type)
 {
     const krb5_cc_ops *ops;
@@ -512,6 +512,12 @@ krb5_cc_set_default_name(krb5_context context, const char *name)
                context->default_cc_name_env = strdup(e);
            }
        }
+
+#ifdef _WIN32
+        if (e == NULL) {
+            e = p = _krb5_get_default_cc_name_from_registry();
+        }
+#endif
        if (e == NULL) {
            e = krb5_config_get_string(context, NULL, "libdefaults",
                                       "default_cc_name", NULL);
@@ -967,7 +973,7 @@ krb5_cc_clear_mcred(krb5_creds *mcred)
  */
 
 
-const krb5_cc_ops *
+KRB5_LIB_FUNCTION const krb5_cc_ops * KRB5_LIB_CALL
 krb5_cc_get_prefix_ops(krb5_context context, const char *prefix)
 {
     char *p, *p1;
@@ -1183,7 +1189,7 @@ krb5_cc_cache_match (krb5_context context,
  * @ingroup krb5_ccache
  */
 
-krb5_error_code
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_cc_move(krb5_context context, krb5_ccache from, krb5_ccache to)
 {
     krb5_error_code ret;
@@ -1658,7 +1664,7 @@ krb5_cc_get_lifetime(krb5_context context, krb5_ccache id, time_t *t)
  * @ingroup krb5_ccache
  */
 
-krb5_error_code
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_cc_set_kdc_offset(krb5_context context, krb5_ccache id, krb5_deltat offset)
 {
     if (id->ops->set_kdc_offset == NULL) {
@@ -1683,7 +1689,7 @@ krb5_cc_set_kdc_offset(krb5_context context, krb5_ccache id, krb5_deltat offset)
  * @ingroup krb5_ccache
  */
 
-krb5_error_code
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_cc_get_kdc_offset(krb5_context context, krb5_ccache id, krb5_deltat *offset)
 {
     if (id->ops->get_kdc_offset == NULL) {
@@ -1692,3 +1698,30 @@ krb5_cc_get_kdc_offset(krb5_context context, krb5_ccache id, krb5_deltat *offset
     }
     return (*id->ops->get_kdc_offset)(context, id, offset);
 }
+
+
+#ifdef _WIN32
+
+char *
+_krb5_get_default_cc_name_from_registry()
+{
+    HKEY hk_k5 = 0;
+    LONG code;
+    char * ccname = NULL;
+
+    code = RegOpenKeyEx(HKEY_CURRENT_USER,
+                        "Software\\MIT\\Kerberos5",
+                        0, KEY_READ, &hk_k5);
+
+    if (code != ERROR_SUCCESS)
+        return NULL;
+
+    ccname = _krb5_parse_reg_value_as_string(NULL, hk_k5, "ccname",
+                                             REG_NONE, 0);
+
+    RegCloseKey(hk_k5);
+
+    return ccname;
+}
+
+#endif
index a962f06f5f9733b3807da6ef7e937dd43749595d..22a7c87ef3e78f2390904afdf085de3db09c720d 100644 (file)
@@ -72,7 +72,7 @@ chgpw_send_request (krb5_context context,
                    krb5_creds *creds,
                    krb5_principal targprinc,
                    int is_stream,
-                   int sock,
+                   rk_socket_t sock,
                    const char *passwd,
                    const char *host)
 {
@@ -141,8 +141,8 @@ chgpw_send_request (krb5_context context,
     iov[2].iov_base    = krb_priv_data.data;
     iov[2].iov_len     = krb_priv_data.length;
 
-    if (sendmsg (sock, &msghdr, 0) < 0) {
-       ret = errno;
+    if (rk_IS_SOCKET_ERROR( sendmsg (sock, &msghdr, 0) )) {
+       ret = rk_SOCK_ERRNO;
        krb5_set_error_message(context, ret, "sendmsg %s: %s",
                               host, strerror(ret));
     }
@@ -164,7 +164,7 @@ setpw_send_request (krb5_context context,
                    krb5_creds *creds,
                    krb5_principal targprinc,
                    int is_stream,
-                   int sock,
+                   rk_socket_t sock,
                    const char *passwd,
                    const char *host)
 {
@@ -251,8 +251,8 @@ setpw_send_request (krb5_context context,
     iov[2].iov_base    = krb_priv_data.data;
     iov[2].iov_len     = krb_priv_data.length;
 
-    if (sendmsg (sock, &msghdr, 0) < 0) {
-       ret = errno;
+    if (rk_IS_SOCKET_ERROR( sendmsg (sock, &msghdr, 0) )) {
+       ret = rk_SOCK_ERRNO;
        krb5_set_error_message(context, ret, "sendmsg %s: %s",
                               host, strerror(ret));
     }
@@ -268,7 +268,7 @@ static krb5_error_code
 process_reply (krb5_context context,
               krb5_auth_context auth_context,
               int is_stream,
-              int sock,
+              rk_socket_t sock,
               int *result_code,
               krb5_data *result_code_string,
               krb5_data *result_string,
@@ -288,8 +288,8 @@ process_reply (krb5_context context,
 
            ret = recvfrom (sock, reply + len, sizeof(reply) - len,
                            0, NULL, NULL);
-           if (ret < 0) {
-               save_errno = errno;
+           if (rk_IS_SOCKET_ERROR(ret)) {
+               save_errno = rk_SOCK_ERRNO;
                krb5_set_error_message(context, save_errno,
                                       "recvfrom %s: %s",
                                       host, strerror(save_errno));
@@ -316,8 +316,8 @@ process_reply (krb5_context context,
        }
     } else {
        ret = recvfrom (sock, reply, sizeof(reply), 0, NULL, NULL);
-       if (ret < 0) {
-           save_errno = errno;
+       if (rk_IS_SOCKET_ERROR(ret)) {
+           save_errno = rk_SOCK_ERRNO;
            krb5_set_error_message(context, save_errno,
                                   "recvfrom %s: %s",
                                   host, strerror(save_errno));
@@ -464,13 +464,13 @@ typedef krb5_error_code (*kpwd_send_request) (krb5_context,
                                              krb5_creds *,
                                              krb5_principal,
                                              int,
-                                             int,
+                                             rk_socket_t,
                                              const char *,
                                              const char *);
 typedef krb5_error_code (*kpwd_process_reply) (krb5_context,
                                               krb5_auth_context,
                                               int,
-                                              int,
+                                              rk_socket_t,
                                               int *,
                                               krb5_data *,
                                               krb5_data *,
@@ -517,7 +517,7 @@ change_password_loop (krb5_context  context,
     krb5_auth_context auth_context = NULL;
     krb5_krbhst_handle handle = NULL;
     krb5_krbhst_info *hi;
-    int sock;
+    rk_socket_t sock;
     unsigned int i;
     int done = 0;
     krb5_realm realm;
@@ -565,20 +565,20 @@ change_password_loop (krb5_context        context,
            int replied = 0;
 
            sock = socket (a->ai_family, a->ai_socktype | SOCK_CLOEXEC, a->ai_protocol);
-           if (sock < 0)
+           if (rk_IS_BAD_SOCKET(sock))
                continue;
            rk_cloexec(sock);
 
            ret = connect(sock, a->ai_addr, a->ai_addrlen);
-           if (ret < 0) {
-               close (sock);
+           if (rk_IS_SOCKET_ERROR(ret)) {
+               rk_closesocket (sock);
                goto out;
            }
 
            ret = krb5_auth_con_genaddrs (context, auth_context, sock,
                                          KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR);
            if (ret) {
-               close (sock);
+               rk_closesocket (sock);
                goto out;
            }
 
@@ -598,7 +598,7 @@ change_password_loop (krb5_context  context,
                                             newpw,
                                             hi->hostname);
                    if (ret) {
-                       close(sock);
+                       rk_closesocket(sock);
                        goto out;
                    }
                }
@@ -608,7 +608,7 @@ change_password_loop (krb5_context  context,
                    ret = ERANGE;
                    krb5_set_error_message(context, ret,
                                           "fd %d too large", sock);
-                   close (sock);
+                   rk_closesocket (sock);
                    goto out;
                }
 #endif
@@ -619,8 +619,8 @@ change_password_loop (krb5_context  context,
                tv.tv_sec  = 1 + (1 << i);
 
                ret = select (sock + 1, &fdset, NULL, NULL, &tv);
-               if (ret < 0 && errno != EINTR) {
-                   close(sock);
+               if (rk_IS_SOCKET_ERROR(ret) && rk_SOCK_ERRNO != EINTR) {
+                   rk_closesocket(sock);
                    goto out;
                }
                if (ret == 1) {
@@ -640,7 +640,7 @@ change_password_loop (krb5_context  context,
                    ret = KRB5_KDC_UNREACH;
                }
            }
-           close (sock);
+           rk_closesocket (sock);
        }
     }
 
index 5840b8d9bd7d52335952578685cfa3e399dbb3f4..d08c5b58515fa0a06816b8a2352c1daff00db2cf 100644 (file)
@@ -84,8 +84,8 @@ static krb5_error_code parse_list(struct fileptr *f, unsigned *lineno,
                                  krb5_config_binding **parent,
                                  const char **err_message);
 
-static krb5_config_section *
-get_entry(krb5_config_section **parent, const char *name, int type)
+krb5_config_section *
+_krb5_config_get_entry(krb5_config_section **parent, const char *name, int type)
 {
     krb5_config_section **q;
 
@@ -135,7 +135,7 @@ parse_section(char *p, krb5_config_section **s, krb5_config_section **parent,
        return KRB5_CONFIG_BADFORMAT;
     }
     *p1 = '\0';
-    tmp = get_entry(parent, p + 1, krb5_config_list);
+    tmp = _krb5_config_get_entry(parent, p + 1, krb5_config_list);
     if(tmp == NULL) {
        *err_message = "out of memory";
        return KRB5_CONFIG_BADFORMAT;
@@ -154,7 +154,7 @@ static krb5_error_code
 parse_list(struct fileptr *f, unsigned *lineno, krb5_config_binding **parent,
           const char **err_message)
 {
-    char buf[BUFSIZ];
+    char buf[KRB5_BUFSIZ];
     krb5_error_code ret;
     krb5_config_binding *b = NULL;
     unsigned beg_lineno = *lineno;
@@ -216,14 +216,14 @@ parse_binding(struct fileptr *f, unsigned *lineno, char *p,
        ++p;
     *p2 = '\0';
     if (*p == '{') {
-       tmp = get_entry(parent, p1, krb5_config_list);
+       tmp = _krb5_config_get_entry(parent, p1, krb5_config_list);
        if (tmp == NULL) {
            *err_message = "out of memory";
            return KRB5_CONFIG_BADFORMAT;
        }
        ret = parse_list (f, lineno, &tmp->u.list, err_message);
     } else {
-       tmp = get_entry(parent, p1, krb5_config_string);
+       tmp = _krb5_config_get_entry(parent, p1, krb5_config_string);
        if (tmp == NULL) {
            *err_message = "out of memory";
            return KRB5_CONFIG_BADFORMAT;
@@ -282,10 +282,10 @@ convert_content(const void *key, const void *value, void *context)
        return;
 
     if (CFGetTypeID(value) == CFStringGetTypeID()) {
-       tmp = get_entry(parent, k, krb5_config_string);
+       tmp = _krb5_config_get_entry(parent, k, krb5_config_string);
        tmp->u.string = cfstring2cstring(value);
     } else if (CFGetTypeID(value) == CFDictionaryGetTypeID()) {
-       tmp = get_entry(parent, k, krb5_config_list);
+       tmp = _krb5_config_get_entry(parent, k, krb5_config_list);
        CFDictionaryApplyFunction(value, convert_content, &tmp->u.list);
     } else {
        /* log */
@@ -352,7 +352,7 @@ krb5_config_parse_debug (struct fileptr *f,
 {
     krb5_config_section *s = NULL;
     krb5_config_binding *b = NULL;
-    char buf[BUFSIZ];
+    char buf[KRB5_BUFSIZ];
     krb5_error_code ret;
 
     while (config_fgets(buf, sizeof(buf), f) != NULL) {
@@ -864,6 +864,55 @@ krb5_config_get_string_default (krb5_context context,
     return ret;
 }
 
+static char *
+next_component_string(char * begin, char * delims, char **state)
+{
+    char * end;
+
+    if (begin == NULL)
+        begin = *state;
+
+    if (*begin == '\0')
+        return NULL;
+
+    end = begin;
+    while (*end == '"') {
+        char * t;
+        while ((t = strchr(end + 1, '"')) != NULL && *(t - 1) == '\\') {
+            --t;
+            memmove(t, t + 1, strlen(t));
+            end = t;
+        }
+
+        if (t)
+            end = ++t;
+        else
+            end += strlen(end);
+    }
+
+    if (*end != '\0') {
+        size_t pos;
+
+        pos = strcspn(end, delims);
+        end = end + pos;
+    }
+
+    if (*end != '\0') {
+        *end = '\0';
+        *state = end + 1;
+        if (*begin == '"' && *(end - 1) == '"' && begin + 1 < end) {
+            begin++; *(end - 1) = '\0';
+        }
+        return begin;
+    }
+
+    *state = end;
+    if (*begin == '"' && *(end - 1) == '"' && begin + 1 < end) {
+        begin++; *(end - 1) = '\0';
+    }
+    return begin;
+}
+
 /**
  * Get a list of configuration strings, free the result with
  * krb5_config_free_strings().
@@ -894,7 +943,7 @@ krb5_config_vget_strings(krb5_context context,
        char *s;
        if(tmp == NULL)
            goto cleanup;
-       s = strtok_r(tmp, " \t", &pos);
+       s = next_component_string(tmp, " \t", &pos);
        while(s){
            char **tmp2 = realloc(strings, (nstr + 1) * sizeof(*strings));
            if(tmp2 == NULL)
@@ -904,7 +953,7 @@ krb5_config_vget_strings(krb5_context context,
            nstr++;
            if(strings[nstr-1] == NULL)
                goto cleanup;
-           s = strtok_r(NULL, " \t", &pos);
+           s = next_component_string(NULL, " \t", &pos);
        }
        free(tmp);
     }
@@ -1259,7 +1308,7 @@ krb5_config_get_int (krb5_context context,
  */
 
 KRB5_DEPRECATED
-krb5_error_code KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_config_parse_string_multi(krb5_context context,
                               const char *string,
                               krb5_config_section **res)
index 6223fb5d6b493b1861f3026f2fbb54693049a0fa..bbb4832657fbcf7cc4c8efb3b6d69f04aa17b6f2 100644 (file)
 
 KRB5_LIB_VARIABLE const char *krb5_config_file =
 #ifdef __APPLE__
-"~/Library/Preferences/com.apple.Kerberos.plist:"
-"/Library/Preferences/com.apple.Kerberos.plist:"
-"~/Library/Preferences/edu.mit.Kerberos:"
-"/Library/Preferences/edu.mit.Kerberos:"
+"~/Library/Preferences/com.apple.Kerberos.plist" PATH_SEP
+"/Library/Preferences/com.apple.Kerberos.plist" PATH_SEP
+"~/Library/Preferences/edu.mit.Kerberos" PATH_SEP
+"/Library/Preferences/edu.mit.Kerberos" PATH_SEP
 #endif /* __APPLE__ */
-"~/.krb5/config:"
+"~/.krb5/config" PATH_SEP
 SYSCONFDIR "/krb5.conf"
-#ifndef _WIN32
-":/etc/krb5.conf"
+#ifdef _WIN32
+PATH_SEP "%{COMMON_APPDATA}/Kerberos/krb5.conf"
+PATH_SEP "%{WINDOWS}/krb5.ini"
+#else
+PATH_SEP "/etc/krb5.conf"
 #endif
 ;
 
index 100eb1237d889dcd096da2f789bc040a0b7e6ece..d4e48d26c7671776f2b614f00a72ea1e2275f984 100644 (file)
@@ -269,7 +269,7 @@ cc_ops_copy(krb5_context context, const krb5_context src_context)
        return KRB5_CC_NOMEM;
     }
 
-    memcpy(cc_ops, src_context->cc_ops,
+    memcpy(rk_UNCONST(cc_ops), src_context->cc_ops,
           sizeof(cc_ops[0]) * src_context->num_cc_ops);
     context->cc_ops = cc_ops;
     context->num_cc_ops = src_context->num_cc_ops;
@@ -559,7 +559,7 @@ krb5_free_context(krb5_context context)
     krb5_free_host_realm (context, context->default_realms);
     krb5_config_file_free (context, context->cf);
     free_error_table (context->et_list);
-    free(context->cc_ops);
+    free(rk_UNCONST(context->cc_ops));
     free(context->kt_types);
     krb5_clear_error_message(context);
     if(context->warn_dest != NULL)
@@ -616,6 +616,11 @@ krb5_set_config_files(krb5_context context, char **filenames)
     if(tmp == NULL)
        return ENXIO;
 #endif
+
+#ifdef _WIN32
+    _krb5_load_config_from_registry(context, &tmp);
+#endif
+
     krb5_config_file_free(context, context->cf);
     context->cf = tmp;
     ret = init_context_from_config_file(context);
@@ -668,7 +673,7 @@ krb5_prepend_config_files(const char *filelist, char **pq, char ***ret_pp)
     while(1) {
        ssize_t l;
        q = p;
-       l = strsep_copy(&q, ":", NULL, 0);
+       l = strsep_copy(&q, PATH_SEP, NULL, 0);
        if(l == -1)
            break;
        fn = malloc(l + 1);
@@ -676,7 +681,7 @@ krb5_prepend_config_files(const char *filelist, char **pq, char ***ret_pp)
            krb5_free_config_files(pp);
            return ENOMEM;
        }
-       (void)strsep_copy(&p, ":", fn, l + 1);
+       (void)strsep_copy(&p, PATH_SEP, fn, l + 1);
        ret = add_file(&pp, &len, fn);
        if (ret) {
            krb5_free_config_files(pp);
@@ -736,6 +741,45 @@ krb5_prepend_config_files_default(const char *filelist, char ***pfilenames)
     return 0;
 }
 
+#ifdef _WIN32
+
+/**
+ * Checks the registry for configuration file location
+ *
+ * Kerberos for Windows and other legacy Kerberos applications expect
+ * to find the configuration file location in the
+ * SOFTWARE\MIT\Kerberos registry key under the value "config".
+ */
+char *
+_krb5_get_default_config_config_files_from_registry()
+{
+    static const char * KeyName = "Software\\MIT\\Kerberos";
+    char *config_file = NULL;
+    LONG rcode;
+    HKEY key;
+
+    rcode = RegOpenKeyEx(HKEY_CURRENT_USER, KeyName, 0, KEY_READ, &key);
+    if (rcode == ERROR_SUCCESS) {
+        config_file = _krb5_parse_reg_value_as_multi_string(NULL, key, "config",
+                                                            REG_NONE, 0, PATH_SEP);
+        RegCloseKey(key);
+    }
+
+    if (config_file)
+        return config_file;
+
+    rcode = RegOpenKeyEx(HKEY_LOCAL_MACHINE, KeyName, 0, KEY_READ, &key);
+    if (rcode == ERROR_SUCCESS) {
+        config_file = _krb5_parse_reg_value_as_multi_string(NULL, key, "config",
+                                                            REG_NONE, 0, PATH_SEP);
+        RegCloseKey(key);
+    }
+
+    return config_file;
+}
+
+#endif
+
 /**
  * Get the global configuration list.
  *
@@ -756,6 +800,22 @@ krb5_get_default_config_files(char ***pfilenames)
         return EINVAL;
     if(!issuid())
        files = getenv("KRB5_CONFIG");
+
+#ifdef _WIN32
+    if (files == NULL) {
+        char * reg_files;
+        reg_files = _krb5_get_default_config_config_files_from_registry();
+        if (reg_files != NULL) {
+            krb5_error_code code;
+
+            code = krb5_prepend_config_files(reg_files, NULL, pfilenames);
+            free(reg_files);
+
+            return code;
+        }
+    }
+#endif
+
     if (files == NULL)
        files = krb5_config_file;
 
@@ -1425,7 +1485,7 @@ _krb5_homedir_access(krb5_context context)
  * @ingroup krb5
  */
 
-krb5_boolean
+KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL
 krb5_set_home_dir_access(krb5_context context, krb5_boolean allow)
 {
     krb5_boolean old;
index aff843e78584b0472972624d2008251dea438ba0..e700425ffe8ae19adf6408b6b822ab3f99120718 100644 (file)
  * SUCH DAMAGE.
  */
 
+#define KRB5_DEPRECATED
+
 #include "krb5_locl.h"
 #include "krb5-v4compat.h"
 
 #ifndef HEIMDAL_SMALLER
 
-static krb5_error_code
-check_ticket_flags(TicketFlags f)
-{
-    return 0; /* maybe add some more tests here? */
-}
-
 /**
  * Convert the v5 credentials in in_cred to v4-dito in v4creds.  This
  * is done by sending them to the 524 function in the KDC.  If
@@ -58,91 +54,16 @@ check_ticket_flags(TicketFlags f)
  * @ingroup krb5_v4compat
  */
 
+KRB5_DEPRECATED
 KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb524_convert_creds_kdc(krb5_context context,
                         krb5_creds *in_cred,
                         struct credentials *v4creds)
 {
-    krb5_error_code ret;
-    krb5_data reply;
-    krb5_storage *sp;
-    int32_t tmp;
-    krb5_data ticket;
-    char realm[REALM_SZ];
-    krb5_creds *v5_creds = in_cred;
-
-    ret = check_ticket_flags(v5_creds->flags.b);
-    if(ret)
-       goto out2;
-
-    {
-       krb5_krbhst_handle handle;
-
-       ret = krb5_krbhst_init(context,
-                              krb5_principal_get_realm(context,
-                                                       v5_creds->server),
-                              KRB5_KRBHST_KRB524,
-                              &handle);
-       if (ret)
-           goto out2;
-
-       ret = krb5_sendto (context,
-                          &v5_creds->ticket,
-                          handle,
-                          &reply);
-       krb5_krbhst_free(context, handle);
-       if (ret)
-           goto out2;
-    }
-    sp = krb5_storage_from_mem(reply.data, reply.length);
-    if(sp == NULL) {
-       ret = ENOMEM;
-       krb5_set_error_message (context, ENOMEM, N_("malloc: out of memory", ""));
-       goto out2;
-    }
-    krb5_ret_int32(sp, &tmp);
-    ret = tmp;
-    if(ret == 0) {
-       memset(v4creds, 0, sizeof(*v4creds));
-       ret = krb5_ret_int32(sp, &tmp);
-       if(ret)
-           goto out;
-       v4creds->kvno = tmp;
-       ret = krb5_ret_data(sp, &ticket);
-       if(ret)
-           goto out;
-       v4creds->ticket_st.length = ticket.length;
-       memcpy(v4creds->ticket_st.dat, ticket.data, ticket.length);
-       krb5_data_free(&ticket);
-       ret = krb5_524_conv_principal(context,
-                                     v5_creds->server,
-                                     v4creds->service,
-                                     v4creds->instance,
-                                     v4creds->realm);
-       if(ret)
-           goto out;
-       v4creds->issue_date = v5_creds->times.starttime;
-       v4creds->lifetime = _krb5_krb_time_to_life(v4creds->issue_date,
-                                                  v5_creds->times.endtime);
-       ret = krb5_524_conv_principal(context, v5_creds->client,
-                                     v4creds->pname,
-                                     v4creds->pinst,
-                                     realm);
-       if(ret)
-           goto out;
-       memcpy(v4creds->session, v5_creds->session.keyvalue.data, 8);
-    } else {
-       krb5_prepend_error_message(context, ret,
-                                  N_("converting credentials",
-                                     "already localized"));
-    }
-out:
-    krb5_storage_free(sp);
-    krb5_data_free(&reply);
-out2:
-    if (v5_creds != in_cred)
-       krb5_free_creds (context, v5_creds);
-    return ret;
+    memset(v4creds, 0, sizeof(*v4creds));
+    krb5_set_error_message(context, EINVAL,
+                          N_("krb524_convert_creds_kdc not supported", ""));
+    return EINVAL;
 }
 
 /**
@@ -160,48 +81,17 @@ out2:
  * @ingroup krb5_v4compat
  */
 
+KRB5_DEPRECATED
 KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb524_convert_creds_kdc_ccache(krb5_context context,
                                krb5_ccache ccache,
                                krb5_creds *in_cred,
                                struct credentials *v4creds)
 {
-    krb5_error_code ret;
-    krb5_creds *v5_creds = in_cred;
-    krb5_keytype keytype;
-
-    keytype = v5_creds->session.keytype;
-
-    if (keytype != ENCTYPE_DES_CBC_CRC) {
-       /* MIT krb524d doesn't like nothing but des-cbc-crc tickets,
-           so go get one */
-       krb5_creds template;
-
-       memset (&template, 0, sizeof(template));
-       template.session.keytype = ENCTYPE_DES_CBC_CRC;
-       ret = krb5_copy_principal (context, in_cred->client, &template.client);
-       if (ret) {
-           krb5_free_cred_contents (context, &template);
-           return ret;
-       }
-       ret = krb5_copy_principal (context, in_cred->server, &template.server);
-       if (ret) {
-           krb5_free_cred_contents (context, &template);
-           return ret;
-       }
-
-       ret = krb5_get_credentials (context, 0, ccache,
-                                   &template, &v5_creds);
-       krb5_free_cred_contents (context, &template);
-       if (ret)
-           return ret;
-    }
-
-    ret = krb524_convert_creds_kdc(context, v5_creds, v4creds);
-
-    if (v5_creds != in_cred)
-       krb5_free_creds (context, v5_creds);
-    return ret;
+    memset(v4creds, 0, sizeof(*v4creds));
+    krb5_set_error_message(context, EINVAL,
+                          N_("krb524_convert_creds_kdc_ccache not supported", ""));
+    return EINVAL;
 }
 
 #endif
index fd277148d55153aa9556e3ca37b489740e9216da..69aacdc032f364c833a65e16c996baa7904473cf 100644 (file)
@@ -278,7 +278,7 @@ krb5_compare_creds(krb5_context context, krb5_flags whichfields,
  * @ingroup krb5
  */
 
-unsigned long
+KRB5_LIB_FUNCTION unsigned long KRB5_LIB_CALL
 krb5_creds_get_ticket_flags(krb5_creds *creds)
 {
     return TicketFlags2int(creds->flags.b);
index f0b0692bc04b01773ac9341755b49b88d1b159d1..aa417e15eb5b0cd4ae7c91b9ba049901992c26c5 100644 (file)
@@ -476,7 +476,7 @@ verify_checksum(krb5_context context,
            krb5_set_error_message(context, ret, 
                                   N_("Decrypt integrity check failed for checksum "
                                      "type %s, key type %s", ""),
-                                  ct->name, crypto->et->name);
+                                  ct->name, (crypto != NULL)? crypto->et->name : "(none)");
        return ret;
     }
 
@@ -2315,7 +2315,7 @@ wrapped_length_dervied (krb5_context context,
  * Return the size of an encrypted packet of length `data_len'
  */
 
-size_t
+KRB5_LIB_FUNCTION size_t KRB5_LIB_CALL
 krb5_get_wrapped_length (krb5_context context,
                         krb5_crypto  crypto,
                         size_t       data_len)
@@ -2361,7 +2361,7 @@ crypto_overhead_dervied (krb5_context context,
     return res;
 }
 
-size_t
+KRB5_LIB_FUNCTION size_t KRB5_LIB_CALL
 krb5_crypto_overhead (krb5_context context, krb5_crypto crypto)
 {
     if (derived_crypto (context, crypto))
index 237d346f4dcda072da7673130604066bbea7956b..dc2d4586a06ff9df0c4b2054a8a3c84a6ffb18c9 100644 (file)
@@ -122,7 +122,7 @@ krb5_vset_error_message (krb5_context context, krb5_error_code ret,
  * @ingroup krb5_error
  */
 
-void KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
 krb5_prepend_error_message(krb5_context context, krb5_error_code ret,
                           const char *fmt, ...)
     __attribute__ ((format (printf, 3, 4)))
@@ -145,7 +145,7 @@ krb5_prepend_error_message(krb5_context context, krb5_error_code ret,
  * @ingroup krb5_error
  */
 
-void KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
 krb5_vprepend_error_message(krb5_context context, krb5_error_code ret,
                            const char *fmt, va_list args)
     __attribute__ ((format (printf, 3, 0)))
index 901182192d03f7068bcbbd7d9ea0fbf22482cf9f..e06d4a12bedc8e7909678d4f073bac22f85fa566 100644 (file)
@@ -768,7 +768,8 @@ get_cred_kdc_capath_worker(krb5_context context,
        ret = find_cred(context, ccache, tmp_creds.server,
                        *ret_tgts, &tgts);
        if(ret == 0){
-           if (strcmp(try_realm, client_realm) != 0)
+           /* only allow implicit ok_as_delegate if the realm is the clients realm */
+           if (strcmp(try_realm, client_realm) != 0 || strcmp(try_realm, server_realm) != 0)
                ok_as_delegate = tgts.flags.b.ok_as_delegate;
 
            *out_creds = calloc(1, sizeof(**out_creds));
index 80a72ecbf7ccd9de630441ab1659352ddcd57d2f..1fe15d806413c4bd4095262acbe742e9365ec5ac 100644 (file)
@@ -97,7 +97,7 @@ kcm_send_request(krb5_context context,
     return ret;
 }
 
-krb5_error_code
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_kcm_storage_request(krb5_context context,
                         uint16_t opcode,
                         krb5_storage **storage_p)
@@ -164,7 +164,7 @@ kcm_alloc(krb5_context context, const char *name, krb5_ccache *id)
     return 0;
 }
 
-krb5_error_code KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_kcm_call(krb5_context context,
              krb5_storage *request,
              krb5_storage **response_p,
index 2d57e301d5da7a40961880a60dbb9c28b5540eea..f34a5c4f90cd2a48e8c7ac6429668d19869d6f28 100644 (file)
@@ -155,7 +155,7 @@ krb5_copy_keyblock (krb5_context context,
  * @ingroup krb5_crypto
  */
 
-krb5_enctype
+KRB5_LIB_FUNCTION krb5_enctype KRB5_LIB_CALL
 krb5_keyblock_get_enctype(const krb5_keyblock *block)
 {
     return block->keytype;
index 8f4210e19b01e90bbf3b3bc269d42cedfc11ca58..dd579f973bd63bb90c53940a8ef75564f3bd2b14 100644 (file)
@@ -80,7 +80,7 @@ typedef int krb5_boolean;
 
 typedef int32_t krb5_error_code;
 
-typedef int krb5_kvno;
+typedef int32_t krb5_kvno;
 
 typedef uint32_t krb5_flags;
 
@@ -847,6 +847,8 @@ typedef krb5_error_code
  *
  */
 
+struct hx509_certs_data;
+
 #include <krb5-protos.h>
 
 /* variables */
index d8d038e7bbc7a77db91b78cafea66069da9e0f0f..bdd725e9ea4a8f161a8691b12c57661b82f1ebc3 100644 (file)
@@ -188,6 +188,10 @@ struct _krb5_krb_auth_data;
 #define ALLOC(X, N) (X) = calloc((N), sizeof(*(X)))
 #define ALLOC_SEQ(X, N) do { (X)->len = (N); ALLOC((X)->val, (N)); } while(0)
 
+#ifndef PATH_SEP
+#define PATH_SEP ":"
+#endif
+
 /* should this be public? */
 #define KEYTAB_DEFAULT "FILE:" SYSCONFDIR "/krb5.keytab"
 #define KEYTAB_DEFAULT_MODIFY "FILE:" SYSCONFDIR "/krb5.keytab"
@@ -208,7 +212,7 @@ struct _krb5_krb_auth_data;
 #endif
 
 
-#define KRB5_BUFSIZ 1024
+#define KRB5_BUFSIZ 2048
 
 typedef enum {
     KRB5_INIT_CREDS_TRISTATE_UNSET = 0,
index 733d20f174829b0aef11746d23433aed1dce4f07..f90624cfca0bf6d460a496ff264855f1f4260352 100644 (file)
@@ -84,7 +84,7 @@ out:
 }
 
 krb5_error_code
-_krb5_enomem(krb5_context context)
+krb5_enomem(krb5_context context)
 {
     krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
     return ENOMEM;
index d50052c8bcb3c5499e3b106d4a3b26c8a68630b4..db2428f95b5ebb305abc32ee710642aad9ba51ce 100644 (file)
@@ -116,7 +116,7 @@ HMAC_MD5_any_checksum(krb5_context context,
  *
  */
 
-krb5_error_code
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_pac_parse(krb5_context context, const void *ptr, size_t len,
               krb5_pac *pac)
 {
@@ -127,13 +127,13 @@ krb5_pac_parse(krb5_context context, const void *ptr, size_t len,
 
     p = calloc(1, sizeof(*p));
     if (p == NULL) {
-       ret = _krb5_enomem(context);
+       ret = krb5_enomem(context);
        goto out;
     }
 
     sp = krb5_storage_from_readonly_mem(ptr, len);
     if (sp == NULL) {
-       ret = _krb5_enomem(context);
+       ret = krb5_enomem(context);
        goto out;
     }
     krb5_storage_set_flags(sp, KRB5_STORAGE_BYTEORDER_LE);
@@ -156,7 +156,7 @@ krb5_pac_parse(krb5_context context, const void *ptr, size_t len,
     p->pac = calloc(1,
                    sizeof(*p->pac) + (sizeof(p->pac->buffers[0]) * (tmp - 1)));
     if (p->pac == NULL) {
-       ret = _krb5_enomem(context);
+       ret = krb5_enomem(context);
        goto out;
     }
 
@@ -258,7 +258,7 @@ out:
     return ret;
 }
 
-krb5_error_code
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_pac_init(krb5_context context, krb5_pac *pac)
 {
     krb5_error_code ret;
@@ -266,27 +266,27 @@ krb5_pac_init(krb5_context context, krb5_pac *pac)
 
     p = calloc(1, sizeof(*p));
     if (p == NULL) {
-       return _krb5_enomem(context);
+       return krb5_enomem(context);
     }
 
     p->pac = calloc(1, sizeof(*p->pac));
     if (p->pac == NULL) {
        free(p);
-       return _krb5_enomem(context);
+       return krb5_enomem(context);
     }
 
     ret = krb5_data_alloc(&p->data, PACTYPE_SIZE);
     if (ret) {
        free (p->pac);
        free(p);
-       return _krb5_enomem(context);
+       return krb5_enomem(context);
     }
 
     *pac = p;
     return 0;
 }
 
-krb5_error_code
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_pac_add_buffer(krb5_context context, krb5_pac p,
                    uint32_t type, const krb5_data *data)
 {
@@ -300,7 +300,7 @@ krb5_pac_add_buffer(krb5_context context, krb5_pac p,
     ptr = realloc(p->pac,
                  sizeof(*p->pac) + (sizeof(p->pac->buffers[0]) * len));
     if (ptr == NULL)
-       return _krb5_enomem(context);
+       return krb5_enomem(context);
 
     p->pac = ptr;
 
@@ -367,7 +367,7 @@ krb5_pac_add_buffer(krb5_context context, krb5_pac p,
  * @ingroup krb5_pac
  */
 
-krb5_error_code
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_pac_get_buffer(krb5_context context, krb5_pac p,
                    uint32_t type, krb5_data *data)
 {
@@ -397,7 +397,7 @@ krb5_pac_get_buffer(krb5_context context, krb5_pac p,
  *
  */
 
-krb5_error_code
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_pac_get_types(krb5_context context,
                   krb5_pac p,
                   size_t *len,
@@ -408,7 +408,7 @@ krb5_pac_get_types(krb5_context context,
     *types = calloc(p->pac->numbuffers, sizeof(*types));
     if (*types == NULL) {
        *len = 0;
-       return _krb5_enomem(context);
+       return krb5_enomem(context);
     }
     for (i = 0; i < p->pac->numbuffers; i++)
        (*types)[i] = p->pac->buffers[i].type;
@@ -421,7 +421,7 @@ krb5_pac_get_types(krb5_context context,
  *
  */
 
-void
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
 krb5_pac_free(krb5_context context, krb5_pac pac)
 {
     krb5_data_free(&pac->data);
@@ -450,7 +450,7 @@ verify_checksum(krb5_context context,
     sp = krb5_storage_from_mem((char *)data->data + sig->offset_lo,
                               sig->buffersize);
     if (sp == NULL)
-       return _krb5_enomem(context);
+       return krb5_enomem(context);
 
     krb5_storage_set_flags(sp, KRB5_STORAGE_BYTEORDER_LE);
 
@@ -460,7 +460,7 @@ verify_checksum(krb5_context context,
        sig->buffersize - krb5_storage_seek(sp, 0, SEEK_CUR);
     cksum.checksum.data = malloc(cksum.checksum.length);
     if (cksum.checksum.data == NULL) {
-       ret = _krb5_enomem(context);
+       ret = krb5_enomem(context);
        goto out;
     }
     ret = krb5_storage_read(sp, cksum.checksum.data, cksum.checksum.length);
@@ -604,7 +604,7 @@ verify_logonname(krb5_context context,
     sp = krb5_storage_from_readonly_mem((const char *)data->data + logon_name->offset_lo,
                                        logon_name->buffersize);
     if (sp == NULL)
-       return _krb5_enomem(context);
+       return krb5_enomem(context);
 
     krb5_storage_set_flags(sp, KRB5_STORAGE_BYTEORDER_LE);
 
@@ -631,7 +631,7 @@ verify_logonname(krb5_context context,
     s = malloc(len);
     if (s == NULL) {
        krb5_storage_free(sp);
-       return _krb5_enomem(context);
+       return krb5_enomem(context);
     }
     ret = krb5_storage_read(sp, s, len);
     if (ret != len) {
@@ -648,7 +648,7 @@ verify_logonname(krb5_context context,
 
        ucs2 = malloc(sizeof(ucs2[0]) * ucs2len);
        if (ucs2 == NULL)
-           return _krb5_enomem(context);
+           return krb5_enomem(context);
 
        ret = wind_ucs2read(s, len, &flags, ucs2, &ucs2len);
        free(s);
@@ -667,7 +667,7 @@ verify_logonname(krb5_context context,
        s = malloc(u8len);
        if (s == NULL) {
            free(ucs2);
-           return _krb5_enomem(context);
+           return krb5_enomem(context);
        }
        ret = wind_ucs2utf8(ucs2, ucs2len, s, &u8len);
        free(ucs2);
@@ -714,7 +714,7 @@ build_logon_name(krb5_context context,
 
     sp = krb5_storage_emem();
     if (sp == NULL)
-       return _krb5_enomem(context);
+       return krb5_enomem(context);
 
     krb5_storage_set_flags(sp, KRB5_STORAGE_BYTEORDER_LE);
 
@@ -733,7 +733,7 @@ build_logon_name(krb5_context context,
 #if 1 /* cheat for now */
     s2 = malloc(len * 2);
     if (s2 == NULL) {
-       ret = _krb5_enomem(context);
+       ret = krb5_enomem(context);
        free(s);
        goto out;
     }
@@ -749,7 +749,7 @@ build_logon_name(krb5_context context,
     ret = krb5_storage_write(sp, s2, len * 2);
     free(s2);
     if (ret != len * 2) {
-       ret = _krb5_enomem(context);
+       ret = krb5_enomem(context);
        goto out;
     }
     ret = krb5_storage_to_data(sp, logon);
@@ -780,7 +780,7 @@ out:
  * @ingroup krb5_pac
  */
 
-krb5_error_code
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_pac_verify(krb5_context context,
                const krb5_pac pac,
                time_t authtime,
@@ -877,7 +877,7 @@ fill_zeros(krb5_context context, krb5_storage *sp, size_t len)
            l = sizeof(zeros);
        sret = krb5_storage_write(sp, zeros, l);
        if (sret <= 0)
-           return _krb5_enomem(context);
+           return krb5_enomem(context);
 
        len -= sret;
     }
@@ -949,7 +949,7 @@ _krb5_pac_sign(krb5_context context,
 
        ptr = realloc(p->pac, sizeof(*p->pac) + (sizeof(p->pac->buffers[0]) * (p->pac->numbuffers + num - 1)));
        if (ptr == NULL)
-           return _krb5_enomem(context);
+           return krb5_enomem(context);
 
        p->pac = ptr;
 
@@ -986,14 +986,14 @@ _krb5_pac_sign(krb5_context context,
     /* Encode PAC */
     sp = krb5_storage_emem();
     if (sp == NULL)
-       return _krb5_enomem(context);
+       return krb5_enomem(context);
 
     krb5_storage_set_flags(sp, KRB5_STORAGE_BYTEORDER_LE);
 
     spdata = krb5_storage_emem();
     if (spdata == NULL) {
        krb5_storage_free(sp);
-       return _krb5_enomem(context);
+       return krb5_enomem(context);
     }
     krb5_storage_set_flags(spdata, KRB5_STORAGE_BYTEORDER_LE);
 
@@ -1031,7 +1031,7 @@ _krb5_pac_sign(krb5_context context,
 
            sret = krb5_storage_write(spdata, ptr, len);
            if (sret != len) {
-               ret = _krb5_enomem(context);
+               ret = krb5_enomem(context);
                goto out;
            }
            /* XXX if not aligned, fill_zeros */
@@ -1068,14 +1068,14 @@ _krb5_pac_sign(krb5_context context,
     ret = krb5_storage_write(sp, d.data, d.length);
     if (ret != d.length) {
        krb5_data_free(&d);
-       ret = _krb5_enomem(context);
+       ret = krb5_enomem(context);
        goto out;
     }
     krb5_data_free(&d);
 
     ret = krb5_storage_to_data(sp, &d);
     if (ret) {
-       ret = _krb5_enomem(context);
+       ret = krb5_enomem(context);
        goto out;
     }
 
index 283a857df5fd1e48c2948de35720c4fd16ca7104..98420a733200ac36811bc2f30b2caa724d4c0778 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "krb5_locl.h"
 
-PA_DATA *
+KRB5_LIB_FUNCTION PA_DATA * KRB5_LIB_CALL
 krb5_find_padata(PA_DATA *val, unsigned len, int type, int *idx)
 {
     for(; *idx < len; (*idx)++)
index e7f7a61ec48a5f88da5a1c7fb1610a1e2ff28574..23d5389a607d82f7be4d9fdbae4cc8887235d640 100644 (file)
@@ -54,7 +54,7 @@ _krb5_load_ccache_plugins(krb5_context context)
 
         ccops = _krb5_plugin_get_symbol(p);
         if (ccops != NULL && ccops->version == KRB5_CC_OPS_VERSION) {
-            c_load = krb5_cc_register(context, ccops, FALSE);
+            c_load = krb5_cc_register(context, ccops, TRUE);
             if (c_load != 0)
                 code = c_load;
         }
index 92c1200f0645da99debf64d9d682bd6c09b99cda..1bf922baf67905ca44cd5dac3cdc71d3c3c36fd5 100644 (file)
@@ -2455,9 +2455,9 @@ krb5_get_init_creds_opt_set_pkinit(krb5_context context,
 }
 
 krb5_error_code KRB5_LIB_FUNCTION
-_krb5_get_init_creds_opt_set_pkinit_user_certs(krb5_context context,
-                                              krb5_get_init_creds_opt *opt,
-                                              struct hx509_certs_data *certs)
+krb5_get_init_creds_opt_set_pkinit_user_certs(krb5_context context,
+                                             krb5_get_init_creds_opt *opt,
+                                             struct hx509_certs_data *certs)
 {
 #ifdef PKINIT
     if (opt->opt_private == NULL) {
@@ -2529,11 +2529,11 @@ find_ms_san(hx509_context context, hx509_cert cert, void *ctx)
  */
 
 KRB5_LIB_FUNCTION krb5_error_code  KRB5_LIB_CALL
-_krb5_pk_enterprise_cert(krb5_context context,
-                        const char *user_id,
-                        krb5_const_realm realm,
-                        krb5_principal *principal,
-                        struct hx509_certs_data **res)
+krb5_pk_enterprise_cert(krb5_context context,
+                       const char *user_id,
+                       krb5_const_realm realm,
+                       krb5_principal *principal,
+                       struct hx509_certs_data **res)
 {
 #ifdef PKINIT
     krb5_error_code ret;
index 89be46c1aed838334cf1d6230164e409db4bf80f..8aff72ec85c48842b4fb19c352d1cccf7b733ee9 100644 (file)
@@ -135,7 +135,7 @@ loadlib(krb5_context context, char *path)
  * @ingroup krb5_support
  */
 
-krb5_error_code
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_plugin_register(krb5_context context,
                     enum krb5_plugin_type type,
                     const char *name,
@@ -179,6 +179,43 @@ krb5_plugin_register(krb5_context context,
     return 0;
 }
 
+static int
+is_valid_plugin_filename(const char * n)
+{
+    if (n[0] == '.' && (n[1] == '\0' || (n[1] == '.' && n[2] == '\0')))
+        return 0;
+
+#ifdef _WIN32
+    /* On Windows, we only attempt to load .dll files as plug-ins. */
+    {
+        const char * ext;
+
+        ext = strrchr(n, '.');
+        if (ext == NULL)
+            return 0;
+
+        return !stricmp(ext, ".dll");
+    }
+#endif
+
+    return 1;
+}
+
+static void
+trim_trailing_slash(char * path)
+{
+    size_t l;
+
+    l = strlen(path);
+    while (l > 0 && (path[l - 1] == '/'
+#ifdef BACKSLASH_PATH_DELIM
+                     || path[l - 1] == '\\'
+#endif
+               )) {
+        path[--l] = '\0';
+    }
+}
+
 static krb5_error_code
 load_plugins(krb5_context context)
 {
@@ -201,28 +238,27 @@ load_plugins(krb5_context context)
        dirs = rk_UNCONST(sysplugin_dirs);
 
     for (di = dirs; *di != NULL; di++) {
+        char * dir = *di;
+
 #ifdef KRB5_USE_PATH_TOKENS
-       {
-           char * dir = NULL;
+        if (_krb5_expand_path_tokens(context, *di, &dir))
+            goto next_dir;
+#endif
 
-           if (_krb5_expand_path_tokens(context, *di, &dir))
-               continue;
-           d = opendir(dir);
+        trim_trailing_slash(dir);
+
+        d = opendir(dir);
 
-           free(dir);
-       }
-#else
-       d = opendir(*di);
-#endif
        if (d == NULL)
-           continue;
+           goto next_dir;
+
        rk_cloexec_dir(d);
 
        while ((entry = readdir(d)) != NULL) {
            char *n = entry->d_name;
 
            /* skip . and .. */
-           if (n[0] == '.' && (n[1] == '\0' || (n[1] == '.' && n[2] == '\0')))
+            if (!is_valid_plugin_filename(n))
                continue;
 
            path = NULL;
@@ -231,11 +267,11 @@ load_plugins(krb5_context context)
            { /* support loading bundles on MacOS */
                size_t len = strlen(n);
                if (len > 7 && strcmp(&n[len - 7],  ".bundle") == 0)
-                   ret = asprintf(&path, "%s/%s/Contents/MacOS/%.*s", *di, n, (int)(len - 7), n);
+                   ret = asprintf(&path, "%s/%s/Contents/MacOS/%.*s", dir, n, (int)(len - 7), n);
            }
 #endif
            if (ret < 0 || path == NULL)
-               ret = asprintf(&path, "%s/%s", *di, n);
+               ret = asprintf(&path, "%s/%s", dir, n);
 
            if (ret < 0 || path == NULL) {
                ret = ENOMEM;
@@ -254,6 +290,10 @@ load_plugins(krb5_context context)
            }
        }
        closedir(d);
+
+    next_dir:
+        if (dir != *di)
+            free(dir);
     }
     if (dirs != rk_UNCONST(sysplugin_dirs))
        krb5_config_free_strings(dirs);
index 8e6341fd62e87540fa0dfba8aba01447149da812..42169fc2f92e17c6e6c863cf14cfffe786901f2b 100644 (file)
@@ -721,7 +721,7 @@ krb5_build_principal(krb5_context context,
  * @ingroup krb5_principal
  */
 
-krb5_error_code KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_make_principal(krb5_context context,
                    krb5_principal *principal,
                    krb5_const_realm realm,
@@ -1013,437 +1013,6 @@ krb5_principal_match(krb5_context context,
     return TRUE;
 }
 
-#if defined(KRB4) || !defined(HEIMDAL_SMALLER)
-
-static struct v4_name_convert {
-    const char *from;
-    const char *to;
-} default_v4_name_convert[] = {
-    { "ftp",   "ftp" },
-    { "hprop", "hprop" },
-    { "pop",   "pop" },
-    { "imap",  "imap" },
-    { "rcmd",  "host" },
-    { "smtp",  "smtp" },
-    { NULL, NULL }
-};
-
-#endif
-
-#ifdef KRB4
-
-/*
- * return the converted instance name of `name' in `realm'.
- * look in the configuration file and then in the default set above.
- * return NULL if no conversion is appropriate.
- */
-
-static const char*
-get_name_conversion(krb5_context context, const char *realm, const char *name)
-{
-    struct v4_name_convert *q;
-    const char *p;
-
-    p = krb5_config_get_string(context, NULL, "realms", realm,
-                              "v4_name_convert", "host", name, NULL);
-    if(p == NULL)
-       p = krb5_config_get_string(context, NULL, "libdefaults",
-                                  "v4_name_convert", "host", name, NULL);
-    if(p)
-       return p;
-
-    /* XXX should be possible to override default list */
-    p = krb5_config_get_string(context, NULL,
-                              "realms",
-                              realm,
-                              "v4_name_convert",
-                              "plain",
-                              name,
-                              NULL);
-    if(p)
-       return NULL;
-    p = krb5_config_get_string(context, NULL,
-                              "libdefaults",
-                              "v4_name_convert",
-                              "plain",
-                              name,
-                              NULL);
-    if(p)
-       return NULL;
-    for(q = default_v4_name_convert; q->from; q++)
-       if(strcmp(q->from, name) == 0)
-           return q->to;
-    return NULL;
-}
-
-/*
- * convert the v4 principal `name.instance@realm' to a v5 principal in `princ'.
- * if `resolve', use DNS.
- * if `func', use that function for validating the conversion
- */
-
-KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
-krb5_425_conv_principal_ext2(krb5_context context,
-                            const char *name,
-                            const char *instance,
-                            const char *realm,
-                            krb5_boolean (*func)(krb5_context,
-                                                 void *, krb5_principal),
-                            void *funcctx,
-                            krb5_boolean resolve,
-                            krb5_principal *princ)
-{
-    const char *p;
-    krb5_error_code ret;
-    krb5_principal pr;
-    char host[MAXHOSTNAMELEN];
-    char local_hostname[MAXHOSTNAMELEN];
-
-    /* do the following: if the name is found in the
-       `v4_name_convert:host' part, is assumed to be a `host' type
-       principal, and the instance is looked up in the
-       `v4_instance_convert' part. if not found there the name is
-       (optionally) looked up as a hostname, and if that doesn't yield
-       anything, the `default_domain' is appended to the instance
-       */
-
-    if(instance == NULL)
-       goto no_host;
-    if(instance[0] == 0){
-       instance = NULL;
-       goto no_host;
-    }
-    p = get_name_conversion(context, realm, name);
-    if(p == NULL)
-       goto no_host;
-    name = p;
-    p = krb5_config_get_string(context, NULL, "realms", realm,
-                              "v4_instance_convert", instance, NULL);
-    if(p){
-       instance = p;
-       ret = krb5_make_principal(context, &pr, realm, name, instance, NULL);
-       if (ret)
-           return ret;
-       if(func == NULL || (*func)(context, funcctx, pr)){
-           *princ = pr;
-           return 0;
-       }
-       krb5_free_principal(context, pr);
-       *princ = NULL;
-       krb5_clear_error_message (context);
-       return HEIM_ERR_V4_PRINC_NO_CONV;
-    }
-    if(resolve){
-       krb5_boolean passed = FALSE;
-       char *inst = NULL;
-#ifdef USE_RESOLVER
-       struct rk_dns_reply *r;
-
-       r = rk_dns_lookup(instance, "aaaa");
-       if (r) {
-           if (r->head && r->head->type == rk_ns_t_aaaa) {
-               inst = strdup(r->head->domain);
-               passed = TRUE;
-           }
-           rk_dns_free_data(r);
-       } else {
-           r = rk_dns_lookup(instance, "a");
-           if (r) {
-               if(r->head && r->head->type == rk_ns_t_a) {
-                   inst = strdup(r->head->domain);
-                   passed = TRUE;
-               }
-               rk_dns_free_data(r);
-           }
-       }
-#else
-       struct addrinfo hints, *ai;
-       
-       memset (&hints, 0, sizeof(hints));
-       hints.ai_flags = AI_CANONNAME;
-       ret = getaddrinfo(instance, NULL, &hints, &ai);
-       if (ret == 0) {
-           const struct addrinfo *a;
-           for (a = ai; a != NULL; a = a->ai_next) {
-               if (a->ai_canonname != NULL) {
-                   inst = strdup (a->ai_canonname);
-                   passed = TRUE;
-                   break;
-               }
-           }
-           freeaddrinfo (ai);
-       }
-#endif
-       if (passed) {
-           if (inst == NULL) {
-               krb5_set_error_message(context, ENOMEM,
-                                      N_("malloc: out of memory", ""));
-               return ENOMEM;
-           }
-           strlwr(inst);
-           ret = krb5_make_principal(context, &pr, realm, name, inst,
-                                     NULL);
-           free (inst);
-           if(ret == 0) {
-               if(func == NULL || (*func)(context, funcctx, pr)){
-                   *princ = pr;
-                   return 0;
-               }
-               krb5_free_principal(context, pr);
-           }
-       }
-    }
-    if(func != NULL) {
-       snprintf(host, sizeof(host), "%s.%s", instance, realm);
-       strlwr(host);
-       ret = krb5_make_principal(context, &pr, realm, name, host, NULL);
-       if (ret)
-           return ret;
-       if((*func)(context, funcctx, pr)){
-           *princ = pr;
-           return 0;
-       }
-       krb5_free_principal(context, pr);
-    }
-
-    /*
-     * if the instance is the first component of the local hostname,
-     * the converted host should be the long hostname.
-     */
-
-    if (func == NULL &&
-        gethostname (local_hostname, sizeof(local_hostname)) == 0 &&
-        strncmp(instance, local_hostname, strlen(instance)) == 0 &&
-       local_hostname[strlen(instance)] == '.') {
-       strlcpy(host, local_hostname, sizeof(host));
-       goto local_host;
-    }
-
-    {
-       char **domains, **d;
-       domains = krb5_config_get_strings(context, NULL, "realms", realm,
-                                         "v4_domains", NULL);
-       for(d = domains; d && *d; d++){
-           snprintf(host, sizeof(host), "%s.%s", instance, *d);
-           ret = krb5_make_principal(context, &pr, realm, name, host, NULL);
-           if (ret) {
-               krb5_config_free_strings(domains);
-               return ret;
-           }
-           if(func == NULL || (*func)(context, funcctx, pr)){
-               *princ = pr;
-               krb5_config_free_strings(domains);
-               return 0;
-           }
-           krb5_free_principal(context, pr);
-       }
-       krb5_config_free_strings(domains);
-    }
-
-
-    p = krb5_config_get_string(context, NULL, "realms", realm,
-                              "default_domain", NULL);
-    if(p == NULL){
-       /* this should be an error, just faking a name is not good */
-       krb5_clear_error_message (context);
-       return HEIM_ERR_V4_PRINC_NO_CONV;
-    }
-       
-    if (*p == '.')
-       ++p;
-    snprintf(host, sizeof(host), "%s.%s", instance, p);
-local_host:
-    ret = krb5_make_principal(context, &pr, realm, name, host, NULL);
-    if (ret)
-       re