Fix handling of pa-data-type KRB5_PA_PAC_REQUEST (& KRB5_PA_S4U2SELF).
[obnox/wireshark/wip.git] / epan / dissectors / packet-kerberos.c
index 2b67a8268ebc04fc21bf41dc45eff60c4e3964e3..430e81745372c4825b3c8a1a0c398babcc841f1a 100644 (file)
  *
  * Some structures from RFC2630
  *
+ * Ted Percival ted[AT]midg3t.net
+ *     Support for PA-S4U2Self Kerberos packet type based on ASN.1 description
+ *     in Heimdal:
+ *     http://loka.it.su.se/source/xref/heimdal/heimdal/lib/asn1/k5.asn1
+ *
  * $Id$
  *
  * Wireshark - Network traffic analyzer
@@ -60,6 +65,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <glib.h>
 #include <ctype.h>
 
 #ifdef HAVE_LIBNETTLE
 #include <nettle/des.h>
 #include <nettle/cbc.h>
 #endif
-#include "crypt-md5.h"
+#include <epan/crypt/crypt-md5.h>
 #include <sys/stat.h>  /* For keyfile manipulation */
 #endif
 
-#include <glib.h>
-
 #include <epan/packet.h>
 
 #include <epan/strutil.h>
 
 #include <epan/conversation.h>
 #include <epan/emem.h>
+#include <epan/asn1.h>
+#include <epan/expert.h>
 #include <epan/dissectors/packet-kerberos.h>
 #include <epan/dissectors/packet-netbios.h>
 #include <epan/dissectors/packet-tcp.h>
 #include <epan/dissectors/packet-dcerpc.h>
 
 #include <epan/dissectors/packet-gssapi.h>
+#include <epan/dissectors/packet-smb-common.h>
+
+#include <wsutil/file_util.h>
 
 #define UDP_PORT_KERBEROS              88
 #define TCP_PORT_KERBEROS              88
@@ -114,6 +123,13 @@ static gint hf_krb_pac_signature_signature = -1;
 static gint hf_krb_pac_clientid = -1;
 static gint hf_krb_pac_namelen = -1;
 static gint hf_krb_pac_clientname = -1;
+static gint hf_krb_pac_upn_flags = -1;
+static gint hf_krb_pac_upn_upn_name = -1;
+static gint hf_krb_pac_upn_dns_name = -1;
+static gint hf_krb_pac_upn_dns_offset = -1;
+static gint hf_krb_pac_upn_dns_len = -1;
+static gint hf_krb_pac_upn_upn_offset = -1;
+static gint hf_krb_pac_upn_upn_len = -1;
 static gint hf_krb_w2k_pac_entries = -1;
 static gint hf_krb_w2k_pac_version = -1;
 static gint hf_krb_w2k_pac_type = -1;
@@ -135,7 +151,9 @@ static gint hf_krb_PAC_SERVER_CHECKSUM = -1;
 static gint hf_krb_PAC_PRIVSVR_CHECKSUM = -1;
 static gint hf_krb_PAC_CLIENT_INFO_TYPE = -1;
 static gint hf_krb_PAC_CONSTRAINED_DELEGATION = -1;
+static gint hf_krb_PAC_UPN_DNS_INFO = -1;
 static gint hf_krb_encrypted_PA_ENC_TIMESTAMP = -1;
+static gint hf_krb_encrypted_enc_authorization_data = -1;
 static gint hf_krb_encrypted_EncKrbCredPart = -1;
 static gint hf_krb_checksum_checksum = -1;
 static gint hf_krb_encrypted_PRIV = -1;
@@ -159,6 +177,7 @@ static gint hf_krb_cname = -1;
 static gint hf_krb_name_string = -1;
 static gint hf_krb_provsrv_location = -1;
 static gint hf_krb_e_text = -1;
+static gint hf_krb_s4u2self_auth = -1;
 static gint hf_krb_name_type = -1;
 static gint hf_krb_lr_type = -1;
 static gint hf_krb_from = -1;
@@ -195,6 +214,7 @@ static gint hf_krb_LastReqs = -1;
 static gint hf_krb_IF_RELEVANT = -1;
 static gint hf_krb_addr_type = -1;
 static gint hf_krb_address_ip = -1;
+static gint hf_krb_address_ipv6 = -1;
 static gint hf_krb_address_netbios = -1;
 static gint hf_krb_msg_type = -1;
 static gint hf_krb_pvno = -1;
@@ -224,7 +244,7 @@ static gint hf_krb_APOptions_mutual_required = -1;
 static gint hf_krb_TicketFlags = -1;
 static gint hf_krb_TicketFlags_forwardable = -1;
 static gint hf_krb_TicketFlags_forwarded = -1;
-static gint hf_krb_TicketFlags_proxyable = -1;
+static gint hf_krb_TicketFlags_proxiable = -1;
 static gint hf_krb_TicketFlags_proxy = -1;
 static gint hf_krb_TicketFlags_allow_postdate = -1;
 static gint hf_krb_TicketFlags_postdated = -1;
@@ -238,7 +258,7 @@ static gint hf_krb_TicketFlags_ok_as_delegate = -1;
 static gint hf_krb_KDCOptions = -1;
 static gint hf_krb_KDCOptions_forwardable = -1;
 static gint hf_krb_KDCOptions_forwarded = -1;
-static gint hf_krb_KDCOptions_proxyable = -1;
+static gint hf_krb_KDCOptions_proxiable = -1;
 static gint hf_krb_KDCOptions_proxy = -1;
 static gint hf_krb_KDCOptions_allow_postdate = -1;
 static gint hf_krb_KDCOptions_postdated = -1;
@@ -269,8 +289,13 @@ static gint hf_krb_gssapi_c_flag_replay = -1;
 static gint hf_krb_gssapi_c_flag_sequence = -1;
 static gint hf_krb_gssapi_c_flag_conf = -1;
 static gint hf_krb_gssapi_c_flag_integ = -1;
+static gint hf_krb_gssapi_c_flag_dce_style = -1;
 static gint hf_krb_smb_nt_status = -1;
 static gint hf_krb_smb_unknown = -1;
+static gint hf_krb_midl_blob_len = -1;
+static gint hf_krb_midl_fill_bytes = -1;
+static gint hf_krb_midl_version = -1;
+static gint hf_krb_midl_hdr_len = -1;
 
 static gint ett_krb_kerberos = -1;
 static gint ett_krb_TransitedEncoding = -1;
@@ -322,13 +347,16 @@ static gint ett_krb_CRED = -1;
 static gint ett_krb_PRIV = -1;
 static gint ett_krb_PRIV_enc = -1;
 static gint ett_krb_e_checksum = -1;
+static gint ett_krb_PAC_MIDL_BLOB = -1;
+static gint ett_krb_PAC_DREP = -1;
+static gint ett_krb_PAC_UPN_DNS_INFO = -1;
 
 guint32 krb5_errorcode;
 
 
-dissector_handle_t krb4_handle=NULL;
+static dissector_handle_t krb4_handle=NULL;
 
-static gboolean do_col_info;
+static gboolean gbl_do_col_info;
 
 
 static void
@@ -355,14 +383,57 @@ call_kerberos_callbacks(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
 #ifdef HAVE_KERBEROS
 
 /* Decrypt Kerberos blobs */
-static gboolean krb_decrypt = FALSE;
+gboolean krb_decrypt = FALSE;
 
 /* keytab filename */
 static const char *keytab_filename = "insert filename here";
 
+void read_keytab_file(const char *);
+
+void
+read_keytab_file_from_preferences(void)
+{
+       static char *last_keytab = NULL;
+
+       if (!krb_decrypt) {
+               return;
+       }
+
+       if (keytab_filename == NULL) {
+               return;
+       }
+
+       if (last_keytab && !strcmp(last_keytab, keytab_filename)) {
+               return;
+       }
+
+       if (last_keytab != NULL) {
+               g_free(last_keytab);
+               last_keytab = NULL;
+       }
+       last_keytab = g_strdup(keytab_filename);
+
+       read_keytab_file(last_keytab);
+}
+
+#elif defined(_WIN32)
+
+/*  Dummy version to allow us to put this function in libwireshark.def--even
+ *  on systems without KERBEROS.
+ */
+void
+read_keytab_file_from_preferences(void)
+{
+}
+
 #endif
 
 #if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
+#ifdef _WIN32
+/* prevent redefinition warnings in kfw-2.5\inc\win_mac.h */
+#undef HAVE_STDARG_H
+#undef HAVE_SYS_TYPES_H
+#endif
 #include <krb5.h>
 enc_key_t *enc_key_list=NULL;
 
@@ -374,10 +445,10 @@ add_encryption_key(packet_info *pinfo, int keytype, int keylength, const char *k
        if(pinfo->fd->flags.visited){
                return;
        }
-printf("added key in %d\n",pinfo->fd->num);
+printf("added key in %u    keytype:%d len:%d\n",pinfo->fd->num, keytype, keylength);
 
        new_key=g_malloc(sizeof(enc_key_t));
-       g_snprintf(new_key->key_origin, KRB_MAX_ORIG_LEN, "%s learnt from frame %d",origin,pinfo->fd->num);
+       g_snprintf(new_key->key_origin, KRB_MAX_ORIG_LEN, "%s learnt from frame %u",origin,pinfo->fd->num);
        new_key->next=enc_key_list;
        enc_key_list=new_key;
        new_key->keytype=keytype;
@@ -387,27 +458,45 @@ printf("added key in %d\n",pinfo->fd->num);
 }
 #endif /* HAVE_HEIMDAL_KERBEROS || HAVE_MIT_KERBEROS */
 
+#if defined(_WIN32) && !defined(HAVE_HEIMDAL_KERBEROS) && !defined(HAVE_MIT_KERBEROS) && !defined(HAVE_LIBNETTLE)
+void
+read_keytab_file(const char *filename _U_)
+{
+}
+#endif
 
 #ifdef HAVE_MIT_KERBEROS
 
-static void
-read_keytab_file(const char *filename, krb5_context *context)
+static krb5_context krb5_ctx;
+
+void
+read_keytab_file(const char *filename)
 {
        krb5_keytab keytab;
-       krb5_keytab_entry key;
        krb5_error_code ret;
+       krb5_keytab_entry key;
        krb5_kt_cursor cursor;
        enc_key_t *new_key;
+       static gboolean first_time=TRUE;
+
+       printf("read keytab file %s\n", filename);
+       if(first_time){
+               first_time=FALSE;
+               ret = krb5_init_context(&krb5_ctx);
+               if(ret && ret != KRB5_CONFIG_CANTOPEN){
+                       return;
+               }
+       }
 
        /* should use a file in the wireshark users dir */
-       ret = krb5_kt_resolve(*context, filename, &keytab);
+       ret = krb5_kt_resolve(krb5_ctx, filename, &keytab);
        if(ret){
                fprintf(stderr, "KERBEROS ERROR: Could not open keytab file :%s\n",filename);
 
                return;
        }
 
-       ret = krb5_kt_start_seq_get(*context, keytab, &cursor);
+       ret = krb5_kt_start_seq_get(krb5_ctx, keytab, &cursor);
        if(ret){
                fprintf(stderr, "KERBEROS ERROR: Could not read from keytab file :%s\n",filename);
                return;
@@ -416,7 +505,7 @@ read_keytab_file(const char *filename, krb5_context *context)
        do{
                new_key=g_malloc(sizeof(enc_key_t));
                new_key->next=enc_key_list;
-               ret = krb5_kt_next_entry(*context, keytab, &key, &cursor);
+               ret = krb5_kt_next_entry(krb5_ctx, keytab, &key, &cursor);
                if(ret==0){
                        int i;
                        char *pos;
@@ -440,9 +529,9 @@ read_keytab_file(const char *filename, krb5_context *context)
                }
        }while(ret==0);
 
-       ret = krb5_kt_end_seq_get(*context, keytab, &cursor);
+       ret = krb5_kt_end_seq_get(krb5_ctx, keytab, &cursor);
        if(ret){
-               krb5_kt_close(*context, keytab);
+               krb5_kt_close(krb5_ctx, keytab);
        }
 
 }
@@ -451,40 +540,36 @@ read_keytab_file(const char *filename, krb5_context *context)
 guint8 *
 decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
                        int usage,
-                       int length,
-                       const guint8 *cryptotext,
-                       int keytype)
+                       tvbuff_t *cryptotvb,
+                       int keytype,
+                       int *datalen)
 {
-       static int first_time=1;
-       static krb5_context context;
        krb5_error_code ret;
        enc_key_t *ek;
-       static krb5_data data = {0,0,NULL};
+       krb5_data data = {0,0,NULL};
        krb5_keytab_entry key;
+       int length = tvb_length(cryptotvb);
+       const guint8 *cryptotext = tvb_get_ptr(cryptotvb, 0, length);
 
-       /* dont do anything if we are not attempting to decrypt data */
-       if(!krb_decrypt){
+       /* don't do anything if we are not attempting to decrypt data */
+       if(!krb_decrypt || length < 1){
                return NULL;
        }
 
-       /* XXX we should only do this for first time, then store somewhere */
-       /* XXX We also need to re-read the keytab when the preference changes */
-
-       /* should this have a destroy context ?  MIT people would know */
-       if(first_time){
-               first_time=0;
-               ret = krb5_init_context(&context);
-               if(ret){
-                       return NULL;
-               }
-               read_keytab_file(keytab_filename, &context);
+       /* make sure we have all the data we need */
+       if (tvb_length(cryptotvb) < tvb_reported_length(cryptotvb)) {
+               return NULL;
        }
 
+       read_keytab_file_from_preferences();
+        data.data = g_malloc(length);
+       data.length = length;
+
        for(ek=enc_key_list;ek;ek=ek->next){
                krb5_enc_data input;
 
                /* shortcircuit and bail out if enctypes are not matching */
-               if(ek->keytype!=keytype){
+               if((keytype != -1) && (ek->keytype != keytype)) {
                        continue;
                }
 
@@ -492,45 +577,61 @@ decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
                input.ciphertext.length = length;
                input.ciphertext.data = (guint8 *)cryptotext;
 
-               data.length = length;
-               if(data.data){
-                       g_free(data.data);
-               }
-               data.data = g_malloc(length);
-
                key.key.enctype=ek->keytype;
                key.key.length=ek->keylength;
                key.key.contents=ek->keyvalue;
-               ret = krb5_c_decrypt(context, &(key.key), usage, 0, &input, &data);
-               if (ret == 0) {
-printf("woohoo decrypted keytype:%d in frame:%d\n", keytype, pinfo->fd->num);
+               ret = krb5_c_decrypt(krb5_ctx, &(key.key), usage, 0, &input, &data);
+               if(ret == 0){
+                       char *user_data;
+                        
+                        expert_add_info_format(pinfo, NULL, PI_SECURITY, PI_CHAT,
+                                               "Decrypted keytype %d in frame %u using %s",
+                                               ek->keytype, pinfo->fd->num, ek->key_origin);
+
                        proto_tree_add_text(tree, NULL, 0, 0, "[Decrypted using: %s]", ek->key_origin);
-                       return data.data;
+                       /* return a private g_malloced blob to the caller */
+                       user_data=data.data;
+                       if (datalen) {
+                               *datalen = data.length;
+                       }
+                       return user_data;
                }
        }
+       g_free(data.data);
 
        return NULL;
 }
 
 #elif defined(HAVE_HEIMDAL_KERBEROS)
-static void
-read_keytab_file(const char *filename, krb5_context *context)
+static krb5_context krb5_ctx;
+
+void
+read_keytab_file(const char *filename)
 {
        krb5_keytab keytab;
-       krb5_keytab_entry key;
        krb5_error_code ret;
+       krb5_keytab_entry key;
        krb5_kt_cursor cursor;
        enc_key_t *new_key;
+       static gboolean first_time=TRUE;
+
+       if(first_time){
+               first_time=FALSE;
+               ret = krb5_init_context(&krb5_ctx);
+               if(ret){
+                       return;
+               }
+       }
 
        /* should use a file in the wireshark users dir */
-       ret = krb5_kt_resolve(*context, filename, &keytab);
+       ret = krb5_kt_resolve(krb5_ctx, filename, &keytab);
        if(ret){
                fprintf(stderr, "KERBEROS ERROR: Could not open keytab file :%s\n",filename);
 
                return;
        }
 
-       ret = krb5_kt_start_seq_get(*context, keytab, &cursor);
+       ret = krb5_kt_start_seq_get(krb5_ctx, keytab, &cursor);
        if(ret){
                fprintf(stderr, "KERBEROS ERROR: Could not read from keytab file :%s\n",filename);
                return;
@@ -539,7 +640,7 @@ read_keytab_file(const char *filename, krb5_context *context)
        do{
                new_key=g_malloc(sizeof(enc_key_t));
                new_key->next=enc_key_list;
-               ret = krb5_kt_next_entry(*context, keytab, &key, &cursor);
+               ret = krb5_kt_next_entry(krb5_ctx, keytab, &key, &cursor);
                if(ret==0){
                        unsigned int i;
                        char *pos;
@@ -562,9 +663,9 @@ read_keytab_file(const char *filename, krb5_context *context)
                }
        }while(ret==0);
 
-       ret = krb5_kt_end_seq_get(*context, keytab, &cursor);
+       ret = krb5_kt_end_seq_get(krb5_ctx, keytab, &cursor);
        if(ret){
-               krb5_kt_close(*context, keytab);
+               krb5_kt_close(krb5_ctx, keytab);
        }
 
 }
@@ -573,48 +674,42 @@ read_keytab_file(const char *filename, krb5_context *context)
 guint8 *
 decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
                        int usage,
-                       int length,
-                       const guint8 *cryptotext,
-                       int keytype)
+                       tvbuff_t *cryptotvb,
+                       int keytype,
+                       int *datalen)
 {
-       static int first_time=1;
-       static krb5_context context;
        krb5_error_code ret;
        krb5_data data;
        enc_key_t *ek;
+       int length = tvb_length(cryptotvb);
+       const guint8 *cryptotext = tvb_get_ptr(cryptotvb, 0, length);
 
-       /* dont do anything if we are not attempting to decrypt data */
+       /* don't do anything if we are not attempting to decrypt data */
        if(!krb_decrypt){
                return NULL;
        }
 
-       /* XXX we should only do this for first time, then store somewhere */
-       /* XXX We also need to re-read the keytab when the preference changes */
-
-       /* should this have a destroy context ?  Heimdal people would know */
-       if(first_time){
-               first_time=0;
-               ret = krb5_init_context(&context);
-               if(ret){
-                       return NULL;
-               }
-               read_keytab_file(keytab_filename, &context);
+       /* make sure we have all the data we need */
+       if (tvb_length(cryptotvb) < tvb_reported_length(cryptotvb)) {
+               return NULL;
        }
 
+       read_keytab_file_from_preferences();
+
        for(ek=enc_key_list;ek;ek=ek->next){
                krb5_keytab_entry key;
                krb5_crypto crypto;
                guint8 *cryptocopy; /* workaround for pre-0.6.1 heimdal bug */
 
                /* shortcircuit and bail out if enctypes are not matching */
-               if(ek->keytype!=keytype){
+               if((keytype != -1) && (ek->keytype != keytype)) {
                        continue;
                }
 
                key.keyblock.keytype=ek->keytype;
                key.keyblock.keyvalue.length=ek->keylength;
                key.keyblock.keyvalue.data=ek->keyvalue;
-               ret = krb5_crypto_init(context, &(key.keyblock), 0, &crypto);
+               ret = krb5_crypto_init(krb5_ctx, &(key.keyblock), 0, &crypto);
                if(ret){
                        return NULL;
                }
@@ -625,20 +720,26 @@ decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
                  keys. So just give it a copy of the crypto data instead.
                  This has been seen for RC4-HMAC blobs.
                */
-               cryptocopy=g_malloc(length);
-               memcpy(cryptocopy, cryptotext, length);
-               ret = krb5_decrypt_ivec(context, crypto, usage,
+               cryptocopy=g_memdup(cryptotext, length);
+               ret = krb5_decrypt_ivec(krb5_ctx, crypto, usage,
                                cryptocopy, length,
                                &data,
                                NULL);
                g_free(cryptocopy);
-               if (ret == 0) {
-printf("woohoo decrypted keytype:%d in frame:%d\n", keytype, pinfo->fd->num);
+               if((ret == 0) && (length>0)){
+                       char *user_data;
+
+printf("woohoo decrypted keytype:%d in frame:%u\n", ek->keytype, pinfo->fd->num);
                        proto_tree_add_text(tree, NULL, 0, 0, "[Decrypted using: %s]", ek->key_origin);
-                       krb5_crypto_destroy(context, crypto);
-                       return data.data;
+                       krb5_crypto_destroy(krb5_ctx, crypto);
+                       /* return a private g_malloced blob to the caller */
+                       user_data=g_memdup(data.data, data.length);
+                       if (datalen) {
+                               *datalen = data.length;
+                       }
+                       return user_data;
                }
-               krb5_crypto_destroy(context, crypto);
+               krb5_crypto_destroy(krb5_ctx, crypto);
        }
        return NULL;
 }
@@ -666,15 +767,14 @@ add_encryption_key(packet_info *pinfo, int keytype, int keylength, const char *k
        if(pinfo->fd->flags.visited){
                return;
        }
-printf("added key in %d\n",pinfo->fd->num);
+printf("added key in %u\n",pinfo->fd->num);
 
        new_key = g_malloc(sizeof(service_key_t));
        new_key->kvno = 0;
        new_key->keytype = keytype;
        new_key->length = keylength;
-       new_key->contents = g_malloc(keylength);
-       memcpy(new_key->contents, keyvalue, keylength);
-       g_snprintf(new_key->origin, KRB_MAX_ORIG_LEN, "%s learnt from frame %d", origin, pinfo->fd->num);
+       new_key->contents = g_memdup(keyvalue, keylength);
+       g_snprintf(new_key->origin, KRB_MAX_ORIG_LEN, "%s learnt from frame %u", origin, pinfo->fd->num);
        service_key_list = g_slist_append(service_key_list, (gpointer) new_key);
 }
 
@@ -685,8 +785,10 @@ clear_keytab(void) {
 
        for(ske = service_key_list; ske != NULL; ske = g_slist_next(ske)){
                sk = (service_key_t *) ske->data;
-               if (sk && sk->contents) g_free(sk->contents);
-               if (sk) g_free(sk);
+               if (sk) {
+                       g_free(sk->contents);
+                       g_free(sk);
+               }
        }
        g_slist_free(service_key_list);
        service_key_list = NULL;
@@ -701,7 +803,7 @@ read_keytab_file(const char *service_key_file)
        unsigned char buf[SERVICE_KEY_SIZE];
        int newline_skip = 0, count = 0;
 
-       if (service_key_file != NULL && stat (service_key_file, &st) == 0) {
+       if (service_key_file != NULL && ws_stat (service_key_file, &st) == 0) {
 
                /* The service key file contains raw 192-bit (24 byte) 3DES keys.
                 * There can be zero, one (\n), or two (\r\n) characters between
@@ -719,7 +821,7 @@ read_keytab_file(const char *service_key_file)
                        }
                }
 
-               skf = eth_fopen(service_key_file, "rb");
+               skf = ws_fopen(service_key_file, "rb");
                if (! skf) return;
 
                while (fread(buf, SERVICE_KEY_SIZE, 1, skf) == 1) {
@@ -727,8 +829,7 @@ read_keytab_file(const char *service_key_file)
                        sk->kvno = buf[0] << 8 | buf[1];
                        sk->keytype = KEYTYPE_DES3_CBC_MD5;
                        sk->length = DES3_KEY_SIZE;
-                       sk->contents = g_malloc(DES3_KEY_SIZE);
-                       memcpy(sk->contents, buf + 2, DES3_KEY_SIZE);
+                       sk->contents = g_memdup(buf + 2, DES3_KEY_SIZE);
                        g_snprintf(sk->origin, KRB_MAX_ORIG_LEN, "3DES service key file, key #%d, offset %ld", count, ftell(skf));
                        service_key_list = g_slist_append(service_key_list, (gpointer) sk);
                        fseek(skf, newline_skip, SEEK_CUR);
@@ -744,9 +845,9 @@ g_warning("added key: %s", sk->origin);
 guint8 *
 decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
                        int _U_ usage,
-                       int length,
-                       const guint8 *cryptotext,
-                       int keytype)
+                       tvbuff_t *cryptotvb,
+                       int keytype,
+                       int *datalen)
 {
        tvbuff_t *encr_tvb;
        guint8 *decrypted_data = NULL, *plaintext = NULL;
@@ -765,19 +866,27 @@ decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
        GSList *ske;
        service_key_t *sk;
        struct des3_ctx ctx;
+       int length = tvb_length(cryptotvb);
+       const guint8 *cryptotext = tvb_get_ptr(cryptotvb, 0, length);
 
 
-       /* dont do anything if we are not attempting to decrypt data */
+       /* don't do anything if we are not attempting to decrypt data */
        if(!krb_decrypt){
                return NULL;
        }
 
+       /* make sure we have all the data we need */
+       if (tvb_length(cryptotvb) < tvb_reported_length(cryptotvb)) {
+               return NULL;
+       }
+
        if (keytype != KEYTYPE_DES3_CBC_MD5 || service_key_list == NULL) {
                return NULL;
        }
 
        decrypted_data = g_malloc(length);
        for(ske = service_key_list; ske != NULL; ske = g_slist_next(ske)){
+               gboolean do_continue = FALSE;
                sk = (service_key_t *) ske->data;
 
                des_fix_parity(DES3_KEY_SIZE, key, sk->contents);
@@ -798,14 +907,16 @@ decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
                 */
                TRY {
                        id_offset = get_ber_identifier(encr_tvb, CONFOUNDER_PLUS_CHECKSUM, &cls, &pc, &tag);
-                       offset = get_ber_length(tree, encr_tvb, id_offset, &item_len, &ind);
+                       offset = get_ber_length(encr_tvb, id_offset, &item_len, &ind);
                }
                CATCH (BoundsError) {
                        tvb_free(encr_tvb);
-                       continue;
+                       do_continue = TRUE;
                }
                ENDTRY;
 
+               if (do_continue) continue;
+
                data_len = item_len + offset - CONFOUNDER_PLUS_CHECKSUM;
                if ((int) item_len + offset > length) {
                        tvb_free(encr_tvb);
@@ -818,11 +929,14 @@ decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
                md5_finish(&md5s, digest);
 
                if (tvb_memeql (encr_tvb, 8, digest, 16) == 0) {
-g_warning("woohoo decrypted keytype:%d in frame:%d\n", keytype, pinfo->fd->num);
+g_warning("woohoo decrypted keytype:%d in frame:%u\n", keytype, pinfo->fd->num);
                        plaintext = g_malloc(data_len);
                        tvb_memcpy(encr_tvb, plaintext, CONFOUNDER_PLUS_CHECKSUM, data_len);
                        tvb_free(encr_tvb);
 
+                       if (datalen) {
+                               *datalen = data_len;
+                       }
                        g_free(decrypted_data);
                        return(plaintext);
                }
@@ -835,7 +949,7 @@ g_warning("woohoo decrypted keytype:%d in frame:%d\n", keytype, pinfo->fd->num);
 
 #endif /* HAVE_MIT_KERBEROS / HAVE_HEIMDAL_KERBEROS / HAVE_LIBNETTLE */
 
-
+#define        INET6_ADDRLEN   16
 
 /* TCP Record Mark */
 #define        KRB_RM_RESERVED 0x80000000L
@@ -915,7 +1029,7 @@ g_warning("woohoo decrypted keytype:%d in frame:%d\n", keytype, pinfo->fd->num);
 #define KRB5_CHKSUM_KRB_DES_MAC_K       5
 #define KRB5_CHKSUM_MD5                 7
 #define KRB5_CHKSUM_MD5_DES             8
-/* the following four comes from packetcable */
+/* the following four come from packetcable */
 #define KRB5_CHKSUM_MD5_DES3            9
 #define KRB5_CHKSUM_HMAC_SHA1_DES3_KD   12
 #define KRB5_CHKSUM_HMAC_SHA1_DES3      13
@@ -973,11 +1087,17 @@ g_warning("woohoo decrypted keytype:%d in frame:%d\n", keytype, pinfo->fd->num);
 #define KRB5_TD_REQ_NONCE              107
 #define KRB5_TD_REQ_SEQ                108
 /* preauthentication types >127 (i.e. negative ones) are app specific.
-   hopefully there will be no collissions here or we will have to
-   come up with something better
+   Hopefully there will be no collisions here or we will have to
+   come up with something better.
+   XXX: Although KRB5_PA_PAC_REQUEST is " >127 " and thus presumably
+         would be encoded as a negative number, various captures seen all
+         have this pa-data-type encoded as a positive number (0x0080).
+         We'll assume that KRB5_PA_S4U2SELF is also encoded as a positive number.
 */
-#define KRB5_PA_PAC_REQUEST            128     /* MS extension */
-#define KRB5_PA_PROV_SRV_LOCATION      255     /* packetcable stuff */
+#define KRB5_PA_PAC_REQUEST              128    /* (Microsoft extension) */
+#define KRB5_PA_S4U2SELF                 129    /* Impersonation (Microsoft extension) */
+
+#define KRB5_PA_PROV_SRV_LOCATION 0xffffffff    /* (gint32)0xFF) packetcable stuff */
 
 /* Principal name-type */
 #define KRB5_NT_UNKNOWN        0
@@ -1153,6 +1273,7 @@ static const value_string krb5_error_codes[] = {
 #define PAC_PRIVSVR_CHECKSUM   7
 #define PAC_CLIENT_INFO_TYPE   10
 #define PAC_CONSTRAINED_DELEGATION 11
+#define PAC_UPN_DNS_INFO        12
 static const value_string w2k_pac_types[] = {
     { PAC_LOGON_INFO           , "Logon Info" },
     { PAC_CREDENTIAL_TYPE      , "Credential Type" },
@@ -1160,6 +1281,7 @@ static const value_string w2k_pac_types[] = {
     { PAC_PRIVSVR_CHECKSUM     , "Privsvr Checksum" },
     { PAC_CLIENT_INFO_TYPE     , "Client Info Type" },
     { PAC_CONSTRAINED_DELEGATION, "Constrained Delegation" },
+    { PAC_UPN_DNS_INFO         , "UPN DNS Info" },
     { 0, NULL },
 };
 
@@ -1217,6 +1339,7 @@ static const value_string krb5_preauthentication_types[] = {
     { KRB5_TD_REQ_NONCE            , "TD-REQ-NONCE" },
     { KRB5_TD_REQ_SEQ              , "TD-REQ-SEQ" },
     { KRB5_PA_PAC_REQUEST          , "PA-PAC-REQUEST" },
+    { KRB5_PA_S4U2SELF             , "PA-S4U2SELF" },
     { KRB5_PA_PROV_SRV_LOCATION    , "PA-PROV-SRV-LOCATION" },
     { 0                            , NULL },
 };
@@ -1296,6 +1419,7 @@ static const value_string krb5_checksum_types[] = {
 #define KRB5_AD_SESAME                         65
 #define KRB5_AD_OSF_DCE_PKI_CERTID             66
 #define KRB5_AD_WIN2K_PAC                              128
+#define KRB5_AD_SIGNTICKET                     0xffffffef
 static const value_string krb5_ad_types[] = {
     { KRB5_AD_IF_RELEVANT                      , "AD-IF-RELEVANT" },
     { KRB5_AD_INTENDED_FOR_SERVER              , "AD-Intended-For-Server" },
@@ -1309,6 +1433,7 @@ static const value_string krb5_ad_types[] = {
     { KRB5_AD_SESAME                           , "AD-SESAME" },
     { KRB5_AD_OSF_DCE_PKI_CERTID               , "AD-OSF-DCE-PKI-CertID" },
     { KRB5_AD_WIN2K_PAC                                , "AD-Win2k-PAC" },
+    { KRB5_AD_SIGNTICKET                       , "AD-SignTicket" },
     { 0        , NULL },
 };
 
@@ -1354,24 +1479,24 @@ static const value_string krb5_msg_types[] = {
 
 
 
-static int dissect_krb5_application_choice(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_Application_1(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_Authenticator(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_EncTicketPart(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_EncAPRepPart(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_EncKrbPrivPart(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_EncKrbCredPart(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_EncKDCRepPart(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_KDC_REQ(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_KDC_REP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_AP_REQ(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_AP_REP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_SAFE(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_PRIV(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_CRED(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
-static int dissect_krb5_ERROR(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
+static int dissect_krb5_application_choice(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_Application_1(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_Authenticator(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_EncTicketPart(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_EncAPRepPart(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_EncKrbPrivPart(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_EncKrbCredPart(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_EncKDCRepPart(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_KDC_REQ(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_KDC_REP(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_AP_REQ(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_AP_REP(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_SAFE(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_PRIV(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_CRED(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
+static int dissect_krb5_ERROR(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
 
-static const ber_choice_t kerberos_applications_choice[] = {
+static const ber_old_choice_t kerberos_applications_choice[] = {
        { KRB5_MSG_TICKET,      BER_CLASS_APP,  KRB5_MSG_TICKET,        0, dissect_krb5_Application_1 },
        { KRB5_MSG_AUTHENTICATOR,       BER_CLASS_APP,  KRB5_MSG_AUTHENTICATOR, 0, dissect_krb5_Authenticator },
        { KRB5_MSG_ENC_TICKET_PART, BER_CLASS_APP,      KRB5_MSG_ENC_TICKET_PART, 0, dissect_krb5_EncTicketPart },
@@ -1395,9 +1520,9 @@ static const ber_choice_t kerberos_applications_choice[] = {
 
 
 static int
-dissect_krb5_application_choice(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_application_choice(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_choice(pinfo, tree, tvb, offset, kerberos_applications_choice, -1, -1, NULL);
+       offset=dissect_ber_old_choice(actx, tree, tvb, offset, kerberos_applications_choice, -1, -1, NULL);
        return offset;
 }
 
@@ -1417,9 +1542,9 @@ static int *APOptions_bits[] = {
   NULL
 };
 static int
-dissect_krb5_APOptions(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_APOptions(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_bitstring32(FALSE, pinfo, tree, tvb, offset, APOptions_bits, hf_krb_APOptions, ett_krb_AP_Options, NULL);
+       offset=dissect_ber_bitstring32(FALSE, actx, tree, tvb, offset, APOptions_bits, hf_krb_APOptions, ett_krb_AP_Options, NULL);
        return offset;
 }
 
@@ -1433,7 +1558,7 @@ static const true_false_string krb5_kdcoptions_forwarded = {
        "This ticket has been FORWARDED",
        "This is NOT a forwarded ticket"
 };
-static const true_false_string krb5_kdcoptions_proxyable = {
+static const true_false_string krb5_kdcoptions_proxiable = {
        "PROXIABLE tickets are allowed/requested",
        "Do NOT use proxiable tickets"
 };
@@ -1485,7 +1610,7 @@ static const true_false_string krb5_kdcoptions_validate = {
 static int* KDCOptions_bits[] = {
   &hf_krb_KDCOptions_forwardable,
   &hf_krb_KDCOptions_forwarded,
-  &hf_krb_KDCOptions_proxyable,
+  &hf_krb_KDCOptions_proxiable,
   &hf_krb_KDCOptions_proxy,
   &hf_krb_KDCOptions_allow_postdate,
   &hf_krb_KDCOptions_postdated,
@@ -1502,52 +1627,52 @@ static int* KDCOptions_bits[] = {
 };
 
 static int
-dissect_krb5_KDCOptions(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_KDCOptions(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_bitstring32(FALSE, pinfo, tree, tvb, offset, KDCOptions_bits, hf_krb_KDCOptions, ett_krb_KDC_Options, NULL);
+       offset=dissect_ber_bitstring32(FALSE, actx, tree, tvb, offset, KDCOptions_bits, hf_krb_KDCOptions, ett_krb_KDC_Options, NULL);
        return offset;
 }
 
 static int
-dissect_krb5_rtime(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_rtime(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_rtime);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_rtime);
        return offset;
 }
 
 int
-dissect_krb5_ctime(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_ctime(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_ctime);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_ctime);
        return offset;
 }
 static int
-dissect_krb5_cusec(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_cusec(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_cusec, NULL);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_cusec, NULL);
        return offset;
 }
 
 static int
-dissect_krb5_stime(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_stime(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_stime);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_stime);
        return offset;
 }
 static int
-dissect_krb5_susec(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_susec(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_susec, NULL);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_susec, NULL);
        return offset;
 }
 
 
 static int
-dissect_krb5_error_code(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_error_code(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_error_code, &krb5_errorcode);
-       if(krb5_errorcode && check_col(pinfo->cinfo, COL_INFO)) {
-               col_add_fstr(pinfo->cinfo, COL_INFO,
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_error_code, &krb5_errorcode);
+       if(krb5_errorcode && check_col(actx->pinfo->cinfo, COL_INFO)) {
+               col_add_fstr(actx->pinfo->cinfo, COL_INFO,
                        "KRB Error: %s",
                        val_to_str(krb5_errorcode, krb5_error_codes,
                        "Unknown error code %#x"));
@@ -1558,24 +1683,24 @@ dissect_krb5_error_code(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
 
 
 static int
-dissect_krb5_till(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_till(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_till);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_till);
        return offset;
 }
 static int
-dissect_krb5_from(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_from(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_from);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_from);
        return offset;
 }
 
 
 
 static int
-dissect_krb5_nonce(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_nonce(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_nonce, NULL);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_nonce, NULL);
        return offset;
 }
 
@@ -1584,11 +1709,11 @@ dissect_krb5_nonce(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs
  *          etype[8]             SEQUENCE OF INTEGER, -- EncryptionType,
  */
 static int
-dissect_krb5_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_etype(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        guint32 etype;
 
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_etype, &etype);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_etype, &etype);
        if(tree){
                proto_item_append_text(tree, " %s",
                        val_to_str(etype, krb5_encryption_types,
@@ -1596,21 +1721,21 @@ dissect_krb5_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs
        }
        return offset;
 }
-static ber_sequence_t etype_sequence_of[1] = {
+static ber_old_sequence_t etype_sequence_of[1] = {
   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_krb5_etype },
 };
 static int
-dissect_krb5_etype_sequence_of(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_etype_sequence_of(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence_of(FALSE, pinfo, tree, tvb, offset, etype_sequence_of, hf_krb_etypes, ett_krb_etypes);
+       offset=dissect_ber_old_sequence_of(FALSE, actx, tree, tvb, offset, etype_sequence_of, hf_krb_etypes, ett_krb_etypes);
 
        return offset;
 }
 static guint32 authenticator_etype;
 static int
-dissect_krb5_authenticator_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_authenticator_etype(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_etype, &authenticator_etype);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_etype, &authenticator_etype);
        if(tree){
                proto_item_append_text(tree, " %s",
                        val_to_str(authenticator_etype, krb5_encryption_types,
@@ -1620,9 +1745,9 @@ dissect_krb5_authenticator_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t
 }
 static guint32 Ticket_etype;
 static int
-dissect_krb5_Ticket_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_Ticket_etype(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_etype, &Ticket_etype);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_etype, &Ticket_etype);
        if(tree){
                proto_item_append_text(tree, " %s",
                        val_to_str(Ticket_etype, krb5_encryption_types,
@@ -1632,9 +1757,9 @@ dissect_krb5_Ticket_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, i
 }
 static guint32 AP_REP_etype;
 static int
-dissect_krb5_AP_REP_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_AP_REP_etype(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_etype, &AP_REP_etype);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_etype, &AP_REP_etype);
        if(tree){
                proto_item_append_text(tree, " %s",
                        val_to_str(AP_REP_etype, krb5_encryption_types,
@@ -1644,9 +1769,9 @@ dissect_krb5_AP_REP_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, i
 }
 static guint32 PA_ENC_TIMESTAMP_etype;
 static int
-dissect_krb5_PA_ENC_TIMESTAMP_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PA_ENC_TIMESTAMP_etype(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_etype, &PA_ENC_TIMESTAMP_etype);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_etype, &PA_ENC_TIMESTAMP_etype);
        if(tree){
                proto_item_append_text(tree, " %s",
                        val_to_str(PA_ENC_TIMESTAMP_etype, krb5_encryption_types,
@@ -1663,12 +1788,14 @@ dissect_krb5_PA_ENC_TIMESTAMP_etype(packet_info *pinfo, proto_tree *tree, tvbuff
  *  }
  */
 static guint32 addr_type;
-static int dissect_krb5_addr_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+static int dissect_krb5_addr_type(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_addr_type, &addr_type);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_addr_type, &addr_type);
        return offset;
 }
-static int dissect_krb5_address(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+
+#define ADDRESS_STR_BUFSIZ 256
+static int dissect_krb5_address(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        gint8 class;
        gboolean pc;
@@ -1678,16 +1805,15 @@ static int dissect_krb5_address(packet_info *pinfo, proto_tree *tree, tvbuff_t *
        proto_item *it=NULL;
 
        /* read header and len for the octet string */
-       offset=dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag);
-       offset=dissect_ber_length(pinfo, tree, tvb, offset, &len, NULL);
+       offset=dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag);
+       offset=dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, NULL);
 
-       address_str=ep_alloc(256);
-       address_str[0]=0;
-       address_str[255]=0;
+       address_str=ep_alloc(ADDRESS_STR_BUFSIZ);
+       address_str[0]='\0';
        switch(addr_type){
        case KRB5_ADDR_IPv4:
                it=proto_tree_add_item(tree, hf_krb_address_ip, tvb, offset, 4, FALSE);
-               g_snprintf(address_str,256,"%d.%d.%d.%d",tvb_get_guint8(tvb, offset),tvb_get_guint8(tvb, offset+1),tvb_get_guint8(tvb, offset+2),tvb_get_guint8(tvb, offset+3));
+               g_snprintf(address_str,ADDRESS_STR_BUFSIZ,"%d.%d.%d.%d",tvb_get_guint8(tvb, offset),tvb_get_guint8(tvb, offset+1),tvb_get_guint8(tvb, offset+2),tvb_get_guint8(tvb, offset+3));
                break;
        case KRB5_ADDR_NETBIOS:
                {
@@ -1696,12 +1822,16 @@ static int dissect_krb5_address(packet_info *pinfo, proto_tree *tree, tvbuff_t *
                int netbios_name_len = (NETBIOS_NAME_LEN - 1)*4 + 1;
 
                netbios_name_type = process_netbios_name(tvb_get_ptr(tvb, offset, 16), netbios_name, netbios_name_len);
-               g_snprintf(address_str, 255, "%s<%02x>", netbios_name, netbios_name_type);
+               g_snprintf(address_str, ADDRESS_STR_BUFSIZ, "%s<%02x>", netbios_name, netbios_name_type);
                it=proto_tree_add_string_format(tree, hf_krb_address_netbios, tvb, offset, 16, netbios_name, "NetBIOS Name: %s (%s)", address_str, netbios_name_type_descr(netbios_name_type));
                }
                break;
+       case KRB5_ADDR_IPv6:
+               it=proto_tree_add_item(tree, hf_krb_address_ipv6, tvb, offset, INET6_ADDRLEN, FALSE);
+               g_snprintf(address_str, ADDRESS_STR_BUFSIZ, "%s", ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset, INET6_ADDRLEN)));
+               break;
        default:
-               proto_tree_add_text(tree, tvb, offset, len, "KRB Address: I dont know how to parse this type of address yet");
+               proto_tree_add_text(tree, tvb, offset, len, "KRB Address: I don't know how to parse this type of address yet");
 
        }
 
@@ -1714,33 +1844,33 @@ static int dissect_krb5_address(packet_info *pinfo, proto_tree *tree, tvbuff_t *
        offset+=len;
        return offset;
 }
-static ber_sequence_t HostAddress_sequence[] = {
+static ber_old_sequence_t HostAddress_sequence[] = {
        { BER_CLASS_CON, 0, 0, dissect_krb5_addr_type },
        { BER_CLASS_CON, 1, 0, dissect_krb5_address },
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_HostAddress(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_HostAddress(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, HostAddress_sequence, hf_krb_HostAddress, ett_krb_HostAddress);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, HostAddress_sequence, hf_krb_HostAddress, ett_krb_HostAddress);
 
        return offset;
 }
 static int
-dissect_krb5_s_address(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_s_address(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, HostAddress_sequence, hf_krb_s_address, ett_krb_s_address);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, HostAddress_sequence, hf_krb_s_address, ett_krb_s_address);
 
        return offset;
 }
 
 static int
-dissect_krb5_r_address(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_r_address(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, HostAddress_sequence, hf_krb_r_address, ett_krb_r_address);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, HostAddress_sequence, hf_krb_r_address, ett_krb_r_address);
 
        return offset;
 }
@@ -1752,43 +1882,43 @@ dissect_krb5_r_address(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
  *  }
  *
  */
-static ber_sequence_t HostAddresses_sequence_of[1] = {
+static ber_old_sequence_t HostAddresses_sequence_of[1] = {
   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_krb5_HostAddress },
 };
 static int
-dissect_krb5_HostAddresses(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_HostAddresses(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence_of(FALSE, pinfo, tree, tvb, offset, HostAddresses_sequence_of, hf_krb_HostAddresses, ett_krb_HostAddresses);
+       offset=dissect_ber_old_sequence_of(FALSE, actx, tree, tvb, offset, HostAddresses_sequence_of, hf_krb_HostAddresses, ett_krb_HostAddresses);
 
        return offset;
 }
 
 
 /* sequence of tickets */
-static ber_sequence_t sequence_of_tickets[1] = {
+static ber_old_sequence_t sequence_of_tickets[1] = {
   { BER_CLASS_APP, 1, 0, dissect_krb5_Application_1},
 };
 static int
-dissect_krb5_sq_tickets(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_sq_tickets(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence_of(FALSE, pinfo, tree, tvb, offset, sequence_of_tickets, hf_krb_sq_tickets, ett_krb_sq_tickets);
+       offset=dissect_ber_old_sequence_of(FALSE, actx, tree, tvb, offset, sequence_of_tickets, hf_krb_sq_tickets, ett_krb_sq_tickets);
 
        return offset;
 }
 
 static int
-dissect_krb5_msg_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_msg_type(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        guint32 msgtype;
 
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_msg_type, &msgtype);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_msg_type, &msgtype);
 
-       if (do_col_info & check_col(pinfo->cinfo, COL_INFO)) {
-               col_add_str(pinfo->cinfo, COL_INFO,
+       if (gbl_do_col_info & check_col(actx->pinfo->cinfo, COL_INFO)) {
+               col_add_str(actx->pinfo->cinfo, COL_INFO,
                        val_to_str(msgtype, krb5_msg_types,
                        "Unknown msg type %#x"));
        }
-       do_col_info=FALSE;
+       gbl_do_col_info=FALSE;
 
        /* append the application type to the subtree */
        proto_item_append_text(tree, " %s", val_to_str(msgtype, krb5_msg_types, "Unknown:0x%x"));
@@ -1799,9 +1929,9 @@ dissect_krb5_msg_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int o
 
 
 static int
-dissect_krb5_pvno(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_pvno(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_pvno, NULL);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_pvno, NULL);
 
        return offset;
 }
@@ -1815,10 +1945,10 @@ dissect_krb5_pvno(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offse
  */
 guint32 name_type;
 static int
-dissect_krb5_name_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_name_type(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_name_type, &name_type);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_name_type, &name_type);
        if(tree){
                proto_item_append_text(tree, " (%s):",
                        val_to_str(name_type, krb5_princ_types,
@@ -1828,11 +1958,11 @@ dissect_krb5_name_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
 }
 static char name_string_separator;
 static int
-dissect_krb5_name_string(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_name_string(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        char name_string[256];
 
-       offset=dissect_ber_GeneralString(pinfo, tree, tvb, offset, hf_krb_name_string, name_string, 255);
+       offset=dissect_ber_GeneralString(actx, tree, tvb, offset, hf_krb_name_string, name_string, 255);
        if(tree){
                proto_item_append_text(tree, "%c%s", name_string_separator, name_string);
                name_string_separator='/';
@@ -1840,106 +1970,126 @@ dissect_krb5_name_string(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, in
 
        return offset;
 }
-static ber_sequence_t name_stringe_sequence_of[1] = {
+static ber_old_sequence_t name_stringe_sequence_of[1] = {
   { BER_CLASS_UNI, BER_UNI_TAG_GeneralString, BER_FLAGS_NOOWNTAG, dissect_krb5_name_string },
 };
 static int
-dissect_krb5_name_strings(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_name_strings(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        name_string_separator=' ';
-       offset=dissect_ber_sequence_of(FALSE, pinfo, tree, tvb, offset, name_stringe_sequence_of, -1, -1);
+       offset=dissect_ber_old_sequence_of(FALSE, actx, tree, tvb, offset, name_stringe_sequence_of, -1, -1);
 
        return offset;
 }
-static ber_sequence_t PrincipalName_sequence[] = {
+static ber_old_sequence_t PrincipalName_sequence[] = {
        { BER_CLASS_CON, 0, 0, dissect_krb5_name_type },
        { BER_CLASS_CON, 1, 0, dissect_krb5_name_strings },
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_sname(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_sname(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, PrincipalName_sequence, hf_krb_sname, ett_krb_sname);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, PrincipalName_sequence, hf_krb_sname, ett_krb_sname);
 
        return offset;
 }
 static int
-dissect_krb5_pname(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_pname(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, PrincipalName_sequence, hf_krb_pname, ett_krb_pname);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, PrincipalName_sequence, hf_krb_pname, ett_krb_pname);
 
        return offset;
 }
 int
-dissect_krb5_cname(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_cname(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, PrincipalName_sequence, hf_krb_cname, ett_krb_cname);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, PrincipalName_sequence, hf_krb_cname, ett_krb_cname);
 
        return offset;
 }
 
 
 int
-dissect_krb5_prealm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_prealm(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralString(pinfo, tree, tvb, offset, hf_krb_prealm, NULL, 0);
+       offset=dissect_ber_GeneralString(actx, tree, tvb, offset, hf_krb_prealm, NULL, 0);
        return offset;
 }
 
 int
-dissect_krb5_srealm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_srealm(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralString(pinfo, tree, tvb, offset, hf_krb_srealm, NULL, 0);
+       offset=dissect_ber_GeneralString(actx, tree, tvb, offset, hf_krb_srealm, NULL, 0);
        return offset;
 }
 
 int
-dissect_krb5_realm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_realm(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralString(pinfo, tree, tvb, offset, hf_krb_realm, NULL, 0);
+       offset=dissect_ber_GeneralString(actx, tree, tvb, offset, hf_krb_realm, NULL, 0);
        return offset;
 }
 
 static int
-dissect_krb5_crealm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_crealm(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralString(pinfo, tree, tvb, offset, hf_krb_crealm, NULL, 0);
+       offset=dissect_ber_GeneralString(actx, tree, tvb, offset, hf_krb_crealm, NULL, 0);
        return offset;
 }
 
 
 
 static int
-dissect_krb5_PA_PAC_REQUEST_flag(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PA_PAC_REQUEST_flag(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_boolean(FALSE, pinfo, tree, tvb, offset, hf_krb_PA_PAC_REQUEST_flag);
+       offset=dissect_ber_boolean(FALSE, actx, tree, tvb, offset, hf_krb_PA_PAC_REQUEST_flag, NULL);
        return offset;
 }
 
 
-static ber_sequence_t PA_PAC_REQUEST_sequence[] = {
+static ber_old_sequence_t PA_PAC_REQUEST_sequence[] = {
        { BER_CLASS_CON, 0, 0, dissect_krb5_PA_PAC_REQUEST_flag },
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_PA_PAC_REQUEST(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PA_PAC_REQUEST(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, PA_PAC_REQUEST_sequence, -1, -1);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, PA_PAC_REQUEST_sequence, -1, -1);
 
        return offset;
 }
 
+static int
+dissect_krb5_s4u2self_auth(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
+{
+       offset=dissect_ber_GeneralString(actx, tree, tvb, offset, hf_krb_s4u2self_auth, NULL, 0);
+       return offset;
+}
 
+static ber_old_sequence_t PA_S4U2SELF_sequence[] = {
+       { BER_CLASS_CON, 0, 0, dissect_krb5_cname },
+       { BER_CLASS_CON, 1, 0, dissect_krb5_realm },
+       { BER_CLASS_CON, 2, 0, dissect_krb5_Checksum },
+       { BER_CLASS_CON, 3, 0, dissect_krb5_s4u2self_auth },
+       { 0, 0, 0, NULL }
+};
+
+static int
+dissect_krb5_PA_S4U2SELF(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
+{
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, PA_S4U2SELF_sequence, -1, -1);
+       return offset;
+}
 
 
 static int
-dissect_krb5_PA_PROV_SRV_LOCATION(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PA_PROV_SRV_LOCATION(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralString(pinfo, tree, tvb, offset, hf_krb_provsrv_location, NULL, 0);
+       offset=dissect_ber_GeneralString(actx, tree, tvb, offset, hf_krb_provsrv_location, NULL, 0);
 
        return offset;
 }
@@ -1947,9 +2097,9 @@ dissect_krb5_PA_PROV_SRV_LOCATION(packet_info *pinfo, proto_tree *tree, tvbuff_t
 
 
 static int
-dissect_krb5_kvno(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_kvno(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_kvno, NULL);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_kvno, NULL);
 
        return offset;
 }
@@ -1957,9 +2107,9 @@ dissect_krb5_kvno(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offse
 
 
 static int
-dissect_krb5_seq_number(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_seq_number(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_seq_number, NULL);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_seq_number, NULL);
 
        return offset;
 }
@@ -1967,25 +2117,25 @@ dissect_krb5_seq_number(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
 
 
 static int
-dissect_krb5_patimestamp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_patimestamp(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_patimestamp);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_patimestamp);
        return offset;
 }
 #ifdef HAVE_KERBEROS
 static int
-dissect_krb5_pausec(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_pausec(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_pausec, NULL);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_pausec, NULL);
        return offset;
 }
-static const ber_sequence_t PA_ENC_TS_ENC_sequence[] = {
+static const ber_old_sequence_t PA_ENC_TS_ENC_sequence[] = {
        { BER_CLASS_CON, 0, 0, dissect_krb5_patimestamp },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_krb5_pausec },
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_decrypt_PA_ENC_TIMESTAMP (packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_decrypt_PA_ENC_TIMESTAMP (proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        guint8 *plaintext=NULL;
        int length;
@@ -1998,21 +2148,24 @@ dissect_krb5_decrypt_PA_ENC_TIMESTAMP (packet_info *pinfo, proto_tree *tree, tvb
         * == 1
         */
        if(!plaintext){
-               plaintext=decrypt_krb5_data(tree, pinfo, 1, length, tvb_get_ptr(tvb, offset, length), PA_ENC_TIMESTAMP_etype);
+               tvbuff_t *next_tvb;
+
+               next_tvb=tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset));
+               plaintext=decrypt_krb5_data(tree, actx->pinfo, 1, next_tvb, PA_ENC_TIMESTAMP_etype, NULL);
        }
 
        if(plaintext){
                tvbuff_t *next_tvb;
-               next_tvb = tvb_new_real_data (plaintext,
+               next_tvb = tvb_new_child_real_data(tvb, plaintext,
                                           length,
                                           length);
-               tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+               tvb_set_free_cb(next_tvb, g_free);
 
                /* Add the decrypted data to the data source list. */
-               add_new_data_source(pinfo, next_tvb, "Decrypted Krb5");
+               add_new_data_source(actx->pinfo, next_tvb, "Decrypted Krb5");
 
 
-               offset=dissect_ber_sequence(FALSE, pinfo, tree, next_tvb, 0, PA_ENC_TS_ENC_sequence, -1, -1);
+               offset=dissect_ber_old_sequence(FALSE, actx, tree, next_tvb, 0, PA_ENC_TS_ENC_sequence, -1, -1);
 
        }
        return offset;
@@ -2021,16 +2174,16 @@ dissect_krb5_decrypt_PA_ENC_TIMESTAMP (packet_info *pinfo, proto_tree *tree, tvb
 
 
 static int
-dissect_krb5_encrypted_PA_ENC_TIMESTAMP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_encrypted_PA_ENC_TIMESTAMP(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 #ifdef HAVE_KERBEROS
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_PA_ENC_TIMESTAMP, dissect_krb5_decrypt_PA_ENC_TIMESTAMP);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_PA_ENC_TIMESTAMP, dissect_krb5_decrypt_PA_ENC_TIMESTAMP);
 #else
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_PA_ENC_TIMESTAMP, NULL);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_PA_ENC_TIMESTAMP, NULL);
 #endif
        return offset;
 }
-static ber_sequence_t PA_ENC_TIMESTAMP_sequence[] = {
+static ber_old_sequence_t PA_ENC_TIMESTAMP_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_PA_ENC_TIMESTAMP_etype },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
@@ -2040,9 +2193,9 @@ static ber_sequence_t PA_ENC_TIMESTAMP_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_PA_ENC_TIMESTAMP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PA_ENC_TIMESTAMP(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, PA_ENC_TIMESTAMP_sequence, -1, -1);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, PA_ENC_TIMESTAMP_sequence, -1, -1);
 
        return offset;
 }
@@ -2050,27 +2203,27 @@ dissect_krb5_PA_ENC_TIMESTAMP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tv
 
 
 static int
-dissect_krb5_etype_info_salt(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_etype_info_salt(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_krb_etype_info_salt, NULL);
+       offset=dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_krb_etype_info_salt, NULL);
        return offset;
 }
 
 static int
-dissect_krb5_etype_info2_salt(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_etype_info2_salt(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralString(pinfo, tree, tvb, offset, hf_krb_etype_info2_salt, NULL, 0);
+       offset=dissect_ber_GeneralString(actx, tree, tvb, offset, hf_krb_etype_info2_salt, NULL, 0);
        return offset;
 }
 
 static int
-dissect_krb5_etype_info2_s2kparams(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_etype_info2_s2kparams(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_krb_etype_info2_s2kparams, NULL);
+       offset=dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_krb_etype_info2_s2kparams, NULL);
        return offset;
 }
 
-static ber_sequence_t PA_ENCTYPE_INFO_ENTRY_sequence[] = {
+static ber_old_sequence_t PA_ENCTYPE_INFO_ENTRY_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_etype },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
@@ -2078,25 +2231,25 @@ static ber_sequence_t PA_ENCTYPE_INFO_ENTRY_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_PA_ENCTYPE_INFO_ENTRY(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PA_ENCTYPE_INFO_ENTRY(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, PA_ENCTYPE_INFO_ENTRY_sequence, -1, -1);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, PA_ENCTYPE_INFO_ENTRY_sequence, -1, -1);
 
        return offset;
 }
 
-static ber_sequence_t PA_ENCTYPE_INFO_sequence_of[1] = {
+static ber_old_sequence_t PA_ENCTYPE_INFO_sequence_of[1] = {
   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_krb5_PA_ENCTYPE_INFO_ENTRY },
 };
 static int
-dissect_krb5_PA_ENCTYPE_INFO(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PA_ENCTYPE_INFO(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence_of(FALSE, pinfo, tree, tvb, offset, PA_ENCTYPE_INFO_sequence_of, -1, -1);
+       offset=dissect_ber_old_sequence_of(FALSE, actx, tree, tvb, offset, PA_ENCTYPE_INFO_sequence_of, -1, -1);
 
        return offset;
 }
 
-static ber_sequence_t PA_ENCTYPE_INFO2_ENTRY_sequence[] = {
+static ber_old_sequence_t PA_ENCTYPE_INFO2_ENTRY_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_etype },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
@@ -2106,38 +2259,47 @@ static ber_sequence_t PA_ENCTYPE_INFO2_ENTRY_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_PA_ENCTYPE_INFO2_ENTRY(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PA_ENCTYPE_INFO2_ENTRY(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, PA_ENCTYPE_INFO2_ENTRY_sequence, -1, -1);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, PA_ENCTYPE_INFO2_ENTRY_sequence, -1, -1);
 
        return offset;
 }
 
-static ber_sequence_t PA_ENCTYPE_INFO2_sequence_of[1] = {
+static ber_old_sequence_t PA_ENCTYPE_INFO2_sequence_of[1] = {
   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_krb5_PA_ENCTYPE_INFO2_ENTRY },
 };
 static int
-dissect_krb5_PA_ENCTYPE_INFO2(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PA_ENCTYPE_INFO2(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence_of(FALSE, pinfo, tree, tvb, offset, PA_ENCTYPE_INFO2_sequence_of, -1, -1);
+       offset=dissect_ber_old_sequence_of(FALSE, actx, tree, tvb, offset, PA_ENCTYPE_INFO2_sequence_of, -1, -1);
 
        return offset;
 }
 
 
 static int
-dissect_krb5_PW_SALT(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PW_SALT(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
+       guint32 nt_status;
+
        /* Microsoft stores a special 12 byte blob here
-        * guint32 NT_status    
+        * guint32 NT_status
         * guint32 unknown
         * guint32 unknown
         * decode everything as this blob for now until we see if anyone
-        * else ever uses it   or we learn how to tell wether this
+        * else ever uses it   or we learn how to tell whether this
         * is such an MS blob or not.
         */
        proto_tree_add_item(tree, hf_krb_smb_nt_status, tvb, offset, 4,
                        TRUE);
+       nt_status=tvb_get_letohl(tvb, offset);
+       if(nt_status && check_col(actx->pinfo->cinfo, COL_INFO)) {
+               col_append_fstr(actx->pinfo->cinfo, COL_INFO,
+                       " NT Status: %s",
+                       val_to_str(nt_status, NT_errors,
+                       "Unknown error code %#x"));
+       }
        offset += 4;
 
        proto_tree_add_item(tree, hf_krb_smb_unknown, tvb, offset, 4,
@@ -2160,10 +2322,9 @@ dissect_krb5_PW_SALT(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, in
  */
 guint32 krb_PA_DATA_type;
 static int
-dissect_krb5_PA_DATA_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PA_DATA_type(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_PA_DATA_type, &krb_PA_DATA_type);
-       krb_PA_DATA_type&=0xff; /*this is really just one single byte */
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_PA_DATA_type, &krb_PA_DATA_type);
 
        if(tree){
                proto_item_append_text(tree, " %s",
@@ -2173,59 +2334,62 @@ dissect_krb5_PA_DATA_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, i
        return offset;
 }
 static int
-dissect_krb5_PA_DATA_value(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PA_DATA_value(proto_tree *parent_tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        proto_tree *tree=parent_tree;
 
-       if(ber_last_created_item){
-               tree=proto_item_add_subtree(ber_last_created_item, ett_krb_PA_DATA_tree);
+       if(actx->created_item){
+               tree=proto_item_add_subtree(actx->created_item, ett_krb_PA_DATA_tree);
        }
 
 
        switch(krb_PA_DATA_type){
        case KRB5_PA_TGS_REQ:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_application_choice);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_application_choice);
                break;
        case KRB5_PA_PK_AS_REQ:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_pkinit_PA_PK_AS_REQ);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_pkinit_PA_PK_AS_REQ);
                break;
        case KRB5_PA_PK_AS_REP:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_pkinit_PA_PK_AS_REP);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_pkinit_PA_PK_AS_REP);
                break;
        case KRB5_PA_PAC_REQUEST:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PA_PAC_REQUEST);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PA_PAC_REQUEST);
+               break;
+       case KRB5_PA_S4U2SELF:
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PA_S4U2SELF);
                break;
        case KRB5_PA_PROV_SRV_LOCATION:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PA_PROV_SRV_LOCATION);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PA_PROV_SRV_LOCATION);
                break;
        case KRB5_PA_ENC_TIMESTAMP:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PA_ENC_TIMESTAMP);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PA_ENC_TIMESTAMP);
                break;
        case KRB5_PA_ENCTYPE_INFO:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PA_ENCTYPE_INFO);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PA_ENCTYPE_INFO);
                break;
        case KRB5_PA_ENCTYPE_INFO2:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PA_ENCTYPE_INFO2);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PA_ENCTYPE_INFO2);
                break;
        case KRB5_PA_PW_SALT:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PW_SALT);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset,hf_krb_PA_DATA_value, dissect_krb5_PW_SALT);
                break;
        default:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset,hf_krb_PA_DATA_value, NULL);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset,hf_krb_PA_DATA_value, NULL);
        }
        return offset;
 /*qqq*/
 }
 
-static ber_sequence_t PA_DATA_sequence[] = {
+static ber_old_sequence_t PA_DATA_sequence[] = {
        { BER_CLASS_CON, 1, 0, dissect_krb5_PA_DATA_type },
        { BER_CLASS_CON, 2, 0, dissect_krb5_PA_DATA_value },
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_PA_DATA(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PA_DATA(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, PA_DATA_sequence, -1, -1);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, PA_DATA_sequence, -1, -1);
 
        return offset;
 }
@@ -2237,20 +2401,19 @@ dissect_krb5_PA_DATA(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int of
  * padata[3]             SEQUENCE OF PA-DATA OPTIONAL,
  *
  */
-static ber_sequence_t PA_DATA_sequence_of[1] = {
+static ber_old_sequence_t PA_DATA_sequence_of[1] = {
   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_krb5_PA_DATA },
 };
 static int
-dissect_krb5_padata(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_padata(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence_of(FALSE, pinfo, tree, tvb, offset, PA_DATA_sequence_of, hf_krb_padata, ett_krb_padata);
+       offset=dissect_ber_old_sequence_of(FALSE, actx, tree, tvb, offset, PA_DATA_sequence_of, hf_krb_padata, ett_krb_padata);
 
        return offset;
 }
 
 
 
-
 static const true_false_string krb5_ticketflags_forwardable = {
        "FORWARDABLE tickets are allowed/requested",
        "Do NOT use forwardable tickets"
@@ -2259,7 +2422,7 @@ static const true_false_string krb5_ticketflags_forwarded = {
        "This ticket has been FORWARDED",
        "This is NOT a forwarded ticket"
 };
-static const true_false_string krb5_ticketflags_proxyable = {
+static const true_false_string krb5_ticketflags_proxiable = {
        "PROXIABLE tickets are allowed/requested",
        "Do NOT use proxiable tickets"
 };
@@ -2307,7 +2470,7 @@ static const true_false_string krb5_ticketflags_ok_as_delegate = {
 static int* TicketFlags_bits[] = {
   &hf_krb_TicketFlags_forwardable,
   &hf_krb_TicketFlags_forwarded,
-  &hf_krb_TicketFlags_proxyable,
+  &hf_krb_TicketFlags_proxiable,
   &hf_krb_TicketFlags_proxy,
   &hf_krb_TicketFlags_allow_postdate,
   &hf_krb_TicketFlags_postdated,
@@ -2322,18 +2485,18 @@ static int* TicketFlags_bits[] = {
 };
 
 static int
-dissect_krb5_TicketFlags(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_TicketFlags(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_bitstring32(FALSE, pinfo, tree, tvb, offset, TicketFlags_bits, hf_krb_TicketFlags, ett_krb_Ticket_Flags, NULL);
+       offset=dissect_ber_bitstring32(FALSE, actx, tree, tvb, offset, TicketFlags_bits, hf_krb_TicketFlags, ett_krb_Ticket_Flags, NULL);
        return offset;
 }
 
 
 static guint32 keytype;
 static int
-dissect_krb5_keytype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_keytype(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_keytype, &keytype);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_keytype, &keytype);
        if(tree){
                proto_item_append_text(tree, " %s",
                        val_to_str(keytype, krb5_encryption_types,
@@ -2344,16 +2507,16 @@ dissect_krb5_keytype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int of
 static int keylength;
 static const guint8 *keyvalue;
 static int
-store_keyvalue(packet_info *pinfo _U_, proto_tree *tree _U_, tvbuff_t *tvb, int offset)
+store_keyvalue(proto_tree *tree _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        keylength=tvb_length_remaining(tvb, offset);
        keyvalue=tvb_get_ptr(tvb, offset, keylength);
        return 0;
 }
 static int
-dissect_krb5_keyvalue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_keyvalue(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_keyvalue, store_keyvalue);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_keyvalue, store_keyvalue);
        return offset;
 }
 
@@ -2363,7 +2526,7 @@ dissect_krb5_keyvalue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int o
  *     keytype  [0] int32
  *     keyvalue [1] octet string
  */
-static ber_sequence_t EncryptionKey_sequence[] = {
+static ber_old_sequence_t EncryptionKey_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_keytype },
        { BER_CLASS_CON, 1, 0,
@@ -2371,34 +2534,97 @@ static ber_sequence_t EncryptionKey_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_key(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_key(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, EncryptionKey_sequence, hf_krb_key, ett_krb_key);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, EncryptionKey_sequence, hf_krb_key, ett_krb_key);
 
 #ifdef HAVE_KERBEROS
-       add_encryption_key(pinfo, keytype, keylength, keyvalue, "key");
+       add_encryption_key(actx->pinfo, keytype, keylength, keyvalue, "key");
 #endif
        return offset;
 }
 static int
-dissect_krb5_subkey(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_subkey(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, EncryptionKey_sequence, hf_krb_subkey, ett_krb_subkey);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, EncryptionKey_sequence, hf_krb_subkey, ett_krb_subkey);
 #ifdef HAVE_KERBEROS
-       add_encryption_key(pinfo, keytype, keylength, keyvalue, "subkey");
+       add_encryption_key(actx->pinfo, keytype, keylength, keyvalue, "subkey");
 #endif
        return offset;
 }
 
+static int
+dissect_krb5_PAC_DREP(proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 *drep)
+{
+       proto_item *item=NULL;
+       proto_tree *tree=NULL;
+       guint8 val;
+
+       if(parent_tree){
+               item=proto_tree_add_text(parent_tree, tvb, offset, 16, "DREP");
+               tree=proto_item_add_subtree(item, ett_krb_PAC_DREP);
+       }
+
+       val = tvb_get_guint8(tvb, offset);
+       proto_tree_add_uint(tree, hf_dcerpc_drep_byteorder, tvb, offset, 1, val>>4);
+
+       offset++;
 
+       if (drep) {
+               *drep = val;
+       }
 
+       return offset;
+}
+
+/* This might be some sort of header that MIDL generates when creating
+ * marshalling/unmarshalling code for blobs that are not to be transported
+ * ontop of DCERPC and where the DREP fields specifying things such as
+ * endianess and similar are not available.
+ */
 static int
-dissect_krb5_PAC_LOGON_INFO(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PAC_NDRHEADERBLOB(proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 *drep, asn1_ctx_t *actx _U_)
+{
+       proto_item *item=NULL;
+       proto_tree *tree=NULL;
+
+       if(parent_tree){
+               item=proto_tree_add_text(parent_tree, tvb, offset, 16, "MES header");
+               tree=proto_item_add_subtree(item, ett_krb_PAC_MIDL_BLOB);
+       }
+
+       /* modified DREP field that is used for stuff that is transporetd ontop
+          of non dcerpc
+       */
+       proto_tree_add_item(tree, hf_krb_midl_version, tvb, offset, 1, TRUE);
+       offset++;
+
+       offset = dissect_krb5_PAC_DREP(tree, tvb, offset, drep);
+
+
+       proto_tree_add_item(tree, hf_krb_midl_hdr_len, tvb, offset, 2, TRUE);
+       offset+=2;
+
+       proto_tree_add_item(tree, hf_krb_midl_fill_bytes, tvb, offset, 4,
+                       TRUE);
+       offset += 4;
+
+       /* length of blob that follows */
+       proto_tree_add_item(tree, hf_krb_midl_blob_len, tvb, offset, 8,
+                       TRUE);
+       offset += 8;
+
+       return offset;
+}
+
+static int
+dissect_krb5_PAC_LOGON_INFO(proto_tree *parent_tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        proto_item *item=NULL;
        proto_tree *tree=NULL;
        guint8 drep[4] = { 0x10, 0x00, 0x00, 0x00}; /* fake DREP struct */
-       dcerpc_info di; /* fake dcerpc_info struct */
+       static dcerpc_info di;  /* fake dcerpc_info struct */
+       static dcerpc_call_value call_data;
        void *old_private_data;
 
        item=proto_tree_add_item(parent_tree, hf_krb_PAC_LOGON_INFO, tvb, offset, tvb_length_remaining(tvb, offset), FALSE);
@@ -2406,35 +2632,35 @@ dissect_krb5_PAC_LOGON_INFO(packet_info *pinfo, proto_tree *parent_tree, tvbuff_
                tree=proto_item_add_subtree(item, ett_krb_PAC_LOGON_INFO);
        }
 
-       /* skip the first 16 bytes, they are some magic created by the idl 
+       /* skip the first 16 bytes, they are some magic created by the idl
         * compiler   the first 4 bytes might be flags?
         */
-       proto_tree_add_text(tree, tvb, offset, 16, "unknown: is this an undocumented policy handle?");
-       offset+=16;
-
+       offset=dissect_krb5_PAC_NDRHEADERBLOB(tree, tvb, offset, &drep[0], actx);
 
        /* the PAC_LOGON_INFO blob */
        /* fake whatever state the dcerpc runtime support needs */
        di.conformant_run=0;
-       di.call_data=NULL;
-       old_private_data=pinfo->private_data;
-       pinfo->private_data=&di;
-       init_ndr_pointer_list(pinfo);
-       offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
+       /* we need di->call_data->flags.NDR64 == 0 */
+       di.call_data=&call_data;
+       old_private_data=actx->pinfo->private_data;
+       actx->pinfo->private_data=&di;
+       init_ndr_pointer_list(actx->pinfo);
+       offset = dissect_ndr_pointer(tvb, offset, actx->pinfo, tree, drep,
                netlogon_dissect_PAC_LOGON_INFO, NDR_POINTER_UNIQUE,
                "PAC_LOGON_INFO:", -1);
-       pinfo->private_data=old_private_data;
+       actx->pinfo->private_data=old_private_data;
 
        return offset;
 }
 
 static int
-dissect_krb5_PAC_CONSTRAINED_DELEGATION(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PAC_CONSTRAINED_DELEGATION(proto_tree *parent_tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        proto_item *item=NULL;
        proto_tree *tree=NULL;
        guint8 drep[4] = { 0x10, 0x00, 0x00, 0x00}; /* fake DREP struct */
-       dcerpc_info di; /* fake dcerpc_info struct */
+       static dcerpc_info di;  /* fake dcerpc_info struct */
+       static dcerpc_call_value call_data;
        void *old_private_data;
 
        item=proto_tree_add_item(parent_tree, hf_krb_PAC_CONSTRAINED_DELEGATION, tvb, offset, tvb_length_remaining(tvb, offset), FALSE);
@@ -2442,30 +2668,84 @@ dissect_krb5_PAC_CONSTRAINED_DELEGATION(packet_info *pinfo, proto_tree *parent_t
                tree=proto_item_add_subtree(item, ett_krb_PAC_CONSTRAINED_DELEGATION);
        }
 
-       /* skip the first 16 bytes, they are some magic created by the idl 
+       /* skip the first 16 bytes, they are some magic created by the idl
         * compiler   the first 4 bytes might be flags?
         */
-       proto_tree_add_text(tree, tvb, offset, 16, "unknown: is this an undocumented policy handle?");
-       offset+=16;
+       offset=dissect_krb5_PAC_NDRHEADERBLOB(tree, tvb, offset, &drep[0], actx);
 
 
        /* the PAC_CONSTRAINED_DELEGATION blob */
        /* fake whatever state the dcerpc runtime support needs */
        di.conformant_run=0;
-       di.call_data=NULL;
-       old_private_data=pinfo->private_data;
-       pinfo->private_data=&di;
-       init_ndr_pointer_list(pinfo);
-       offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
+       /* we need di->call_data->flags.NDR64 == 0 */
+       di.call_data=&call_data;
+       old_private_data=actx->pinfo->private_data;
+       actx->pinfo->private_data=&di;
+       init_ndr_pointer_list(actx->pinfo);
+       offset = dissect_ndr_pointer(tvb, offset, actx->pinfo, tree, drep,
                netlogon_dissect_PAC_CONSTRAINED_DELEGATION, NDR_POINTER_UNIQUE,
                "PAC_CONSTRAINED_DELEGATION:", -1);
-       pinfo->private_data=old_private_data;
+       actx->pinfo->private_data=old_private_data;
 
        return offset;
 }
 
 static int
-dissect_krb5_PAC_CREDENTIAL_TYPE(packet_info *pinfo _U_, proto_tree *parent_tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PAC_UPN_DNS_INFO(proto_tree *parent_tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
+{
+       proto_item *item=NULL;
+       proto_tree *tree=NULL;
+       guint16 dns_offset, dns_len;
+       guint16 upn_offset, upn_len;
+       const char *dn;
+       int dn_len;
+       guint16 bc;
+
+       item=proto_tree_add_item(parent_tree, hf_krb_PAC_UPN_DNS_INFO, tvb, offset, tvb_length_remaining(tvb, offset), FALSE);
+       if(parent_tree){
+               tree=proto_item_add_subtree(item, ett_krb_PAC_UPN_DNS_INFO);
+       }
+
+       /* upn */
+       upn_len = tvb_get_letohs(tvb, offset);
+       proto_tree_add_item(tree, hf_krb_pac_upn_upn_len, tvb, offset, 2, TRUE);
+       offset+=2;
+       upn_offset = tvb_get_letohs(tvb, offset);
+       proto_tree_add_item(tree, hf_krb_pac_upn_upn_offset, tvb, offset, 2, TRUE);
+       offset+=2;
+
+       /* dns */
+       dns_len = tvb_get_letohs(tvb, offset);
+       proto_tree_add_item(tree, hf_krb_pac_upn_dns_len, tvb, offset, 2, TRUE);
+       offset+=2;
+       dns_offset = tvb_get_letohs(tvb, offset);
+       proto_tree_add_item(tree, hf_krb_pac_upn_dns_offset, tvb, offset, 2, TRUE);
+       offset+=2;
+
+       /* flags */
+       proto_tree_add_item(tree, hf_krb_pac_upn_flags, tvb, offset, 4, TRUE);
+
+       /* upn */
+       offset = upn_offset;
+       dn_len = upn_len;
+       bc = tvb_length_remaining(tvb, offset);
+       dn = get_unicode_or_ascii_string(tvb, &offset,
+                       TRUE, &dn_len, TRUE, TRUE, &bc);
+       proto_tree_add_string(tree, hf_krb_pac_upn_upn_name, tvb, upn_offset, upn_len, dn);
+
+       /* dns */
+       offset = dns_offset;
+       dn_len = dns_len;
+       bc = tvb_length_remaining(tvb, offset);
+       dn = get_unicode_or_ascii_string(tvb, &offset,
+                       TRUE, &dn_len, TRUE, TRUE, &bc);
+       proto_tree_add_string(tree, hf_krb_pac_upn_dns_name, tvb, dns_offset, dns_len, dn);
+
+       return offset;
+}
+
+static int
+dissect_krb5_PAC_CREDENTIAL_TYPE(proto_tree *parent_tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        proto_item *item=NULL;
        proto_tree *tree=NULL;
@@ -2480,7 +2760,7 @@ dissect_krb5_PAC_CREDENTIAL_TYPE(packet_info *pinfo _U_, proto_tree *parent_tree
 }
 
 static int
-dissect_krb5_PAC_SERVER_CHECKSUM(packet_info *pinfo _U_, proto_tree *parent_tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PAC_SERVER_CHECKSUM(proto_tree *parent_tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        proto_item *item=NULL;
        proto_tree *tree=NULL;
@@ -2501,7 +2781,7 @@ dissect_krb5_PAC_SERVER_CHECKSUM(packet_info *pinfo _U_, proto_tree *parent_tree
 }
 
 static int
-dissect_krb5_PAC_PRIVSVR_CHECKSUM(packet_info *pinfo _U_, proto_tree *parent_tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PAC_PRIVSVR_CHECKSUM(proto_tree *parent_tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        proto_item *item=NULL;
        proto_tree *tree=NULL;
@@ -2522,7 +2802,7 @@ dissect_krb5_PAC_PRIVSVR_CHECKSUM(packet_info *pinfo _U_, proto_tree *parent_tre
 }
 
 static int
-dissect_krb5_PAC_CLIENT_INFO_TYPE(packet_info *pinfo _U_, proto_tree *parent_tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PAC_CLIENT_INFO_TYPE(proto_tree *parent_tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        proto_item *item=NULL;
        proto_tree *tree=NULL;
@@ -2552,7 +2832,7 @@ dissect_krb5_PAC_CLIENT_INFO_TYPE(packet_info *pinfo _U_, proto_tree *parent_tre
 }
 
 static int
-dissect_krb5_AD_WIN2K_PAC_struct(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_AD_WIN2K_PAC_struct(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        guint32 pac_type;
        guint32 pac_size;
@@ -2584,23 +2864,27 @@ dissect_krb5_AD_WIN2K_PAC_struct(packet_info *pinfo, proto_tree *tree, tvbuff_t
        next_tvb=tvb_new_subset(tvb, pac_offset, pac_size, pac_size);
        switch(pac_type){
        case PAC_LOGON_INFO:
-               dissect_krb5_PAC_LOGON_INFO(pinfo, tr, next_tvb, 0);
+               dissect_krb5_PAC_LOGON_INFO(tr, next_tvb, 0, actx);
                break;
        case PAC_CREDENTIAL_TYPE:
-               dissect_krb5_PAC_CREDENTIAL_TYPE(pinfo, tr, next_tvb, 0);
+               dissect_krb5_PAC_CREDENTIAL_TYPE(tr, next_tvb, 0, actx);
                break;
        case PAC_SERVER_CHECKSUM:
-               dissect_krb5_PAC_SERVER_CHECKSUM(pinfo, tr, next_tvb, 0);
+               dissect_krb5_PAC_SERVER_CHECKSUM(tr, next_tvb, 0, actx);
                break;
        case PAC_PRIVSVR_CHECKSUM:
-               dissect_krb5_PAC_PRIVSVR_CHECKSUM(pinfo, tr, next_tvb, 0);
+               dissect_krb5_PAC_PRIVSVR_CHECKSUM(tr, next_tvb, 0, actx);
                break;
        case PAC_CLIENT_INFO_TYPE:
-               dissect_krb5_PAC_CLIENT_INFO_TYPE(pinfo, tr, next_tvb, 0);
+               dissect_krb5_PAC_CLIENT_INFO_TYPE(tr, next_tvb, 0, actx);
                break;
        case PAC_CONSTRAINED_DELEGATION:
-               dissect_krb5_PAC_CONSTRAINED_DELEGATION(pinfo, tr, next_tvb, 0);
+               dissect_krb5_PAC_CONSTRAINED_DELEGATION(tr, next_tvb, 0, actx);
                break;
+       case PAC_UPN_DNS_INFO:
+               dissect_krb5_PAC_UPN_DNS_INFO(tr, next_tvb, 0, actx);
+               break;
+
        default:;
 /*qqq*/
        }
@@ -2608,7 +2892,7 @@ dissect_krb5_AD_WIN2K_PAC_struct(packet_info *pinfo, proto_tree *tree, tvbuff_t
 }
 
 static int
-dissect_krb5_AD_WIN2K_PAC(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_AD_WIN2K_PAC(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        guint32 entries;
        guint32 version;
@@ -2625,17 +2909,37 @@ dissect_krb5_AD_WIN2K_PAC(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, i
        offset += 4;
 
        for(i=0;i<entries;i++){
-               offset=dissect_krb5_AD_WIN2K_PAC_struct(pinfo, tree, tvb, offset);
+               offset=dissect_krb5_AD_WIN2K_PAC_struct(tree, tvb, offset, actx);
        }
 
        return offset;
 }
 
+
+int dissect_krb5_Checksum(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx);
+
+static ber_old_sequence_t AD_SIGNTICKET_sequence[] = {
+       { BER_CLASS_CON, 0, 0,
+               dissect_krb5_etype },
+       { BER_CLASS_CON, 1, 0,
+               dissect_krb5_Checksum },
+       { 0, 0, 0, NULL }
+};
+
+/* first seen in traces from vista */
+static int
+dissect_krb5_AD_SIGNTICKET(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx)
+{
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, AD_SIGNTICKET_sequence, -1, -1);
+
+       return offset;
+}
+
 static guint32 IF_RELEVANT_type;
 static int
-dissect_krb5_IF_RELEVANT_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_IF_RELEVANT_type(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_IF_RELEVANT_type, &IF_RELEVANT_type);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_IF_RELEVANT_type, &IF_RELEVANT_type);
        if(tree){
                proto_item_append_text(tree, " %s",
                        val_to_str(IF_RELEVANT_type, krb5_ad_types,
@@ -2644,18 +2948,21 @@ dissect_krb5_IF_RELEVANT_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tv
        return offset;
 }
 static int
-dissect_krb5_IF_RELEVANT_value(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_IF_RELEVANT_value(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        switch(IF_RELEVANT_type){
        case KRB5_AD_WIN2K_PAC:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_advalue, dissect_krb5_AD_WIN2K_PAC);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_advalue, dissect_krb5_AD_WIN2K_PAC);
+               break;
+       case KRB5_AD_SIGNTICKET:
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_advalue, dissect_krb5_AD_SIGNTICKET);
                break;
        default:
-               offset=dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_krb_IF_RELEVANT_value, NULL);
+               offset=dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_krb_IF_RELEVANT_value, NULL);
        }
        return offset;
 }
-static ber_sequence_t IF_RELEVANT_item_sequence[] = {
+static ber_old_sequence_t IF_RELEVANT_item_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_IF_RELEVANT_type },
        { BER_CLASS_CON, 1, 0,
@@ -2663,30 +2970,30 @@ static ber_sequence_t IF_RELEVANT_item_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_IF_RELEVANT_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_IF_RELEVANT_item(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, IF_RELEVANT_item_sequence, hf_krb_IF_RELEVANT, ett_krb_IF_RELEVANT);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, IF_RELEVANT_item_sequence, hf_krb_IF_RELEVANT, ett_krb_IF_RELEVANT);
 
        return offset;
 }
 
-static ber_sequence_t IF_RELEVANT_sequence_of[1] = {
+static ber_old_sequence_t IF_RELEVANT_sequence_of[1] = {
   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_krb5_IF_RELEVANT_item },
 };
 
 static int
-dissect_krb5_IF_RELEVANT(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_IF_RELEVANT(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence_of(FALSE, pinfo, tree, tvb, offset, IF_RELEVANT_sequence_of, -1, -1);
+       offset=dissect_ber_old_sequence_of(FALSE, actx, tree, tvb, offset, IF_RELEVANT_sequence_of, -1, -1);
 
        return offset;
 }
 
 static guint32 adtype;
 static int
-dissect_krb5_adtype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_adtype(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_adtype, &adtype);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_adtype, &adtype);
        if(tree){
                proto_item_append_text(tree, " %s",
                        val_to_str(adtype, krb5_ad_types,
@@ -2695,14 +3002,14 @@ dissect_krb5_adtype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int off
        return offset;
 }
 static int
-dissect_krb5_advalue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_advalue(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        switch(adtype){
        case KRB5_AD_IF_RELEVANT:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_advalue, dissect_krb5_IF_RELEVANT);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_advalue, dissect_krb5_IF_RELEVANT);
                break;
        default:
-               offset=dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_krb_advalue, NULL);
+               offset=dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_krb_advalue, NULL);
        }
        return offset;
 }
@@ -2711,7 +3018,7 @@ dissect_krb5_advalue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int of
  *     ad-type  [0] int32
  *     ad-data  [1] octet string
  */
-static ber_sequence_t AuthorizationData_item_sequence[] = {
+static ber_old_sequence_t AuthorizationData_item_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_adtype },
        { BER_CLASS_CON, 1, 0,
@@ -2719,31 +3026,31 @@ static ber_sequence_t AuthorizationData_item_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_AuthorizationData_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_AuthorizationData_item(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, AuthorizationData_item_sequence, hf_krb_AuthorizationData, ett_krb_AuthorizationData);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, AuthorizationData_item_sequence, hf_krb_AuthorizationData, ett_krb_AuthorizationData);
 
        return offset;
 }
 
-static ber_sequence_t AuthorizationData_sequence_of[1] = {
+static ber_old_sequence_t AuthorizationData_sequence_of[1] = {
   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_krb5_AuthorizationData_item },
 };
 static int
-dissect_krb5_AuthorizationData(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_AuthorizationData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence_of(FALSE, pinfo, tree, tvb, offset, AuthorizationData_sequence_of, -1, -1);
+       offset=dissect_ber_old_sequence_of(FALSE, actx, tree, tvb, offset, AuthorizationData_sequence_of, -1, -1);
 
        return offset;
 }
 
 
 static int
-dissect_krb5_transited_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_transited_type(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        guint32 trtype;
 
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_transitedtype, &trtype);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_transitedtype, &trtype);
        if(tree){
                proto_item_append_text(tree, " %s",
                        val_to_str(trtype, krb5_transited_types,
@@ -2753,9 +3060,9 @@ dissect_krb5_transited_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
 }
 
 static int
-dissect_krb5_transited_contents(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_transited_contents(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_krb_transitedcontents, NULL);
+       offset=dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_krb_transitedcontents, NULL);
        return offset;
 }
 
@@ -2764,7 +3071,7 @@ dissect_krb5_transited_contents(packet_info *pinfo, proto_tree *tree, tvbuff_t *
  *     tr-type  [0] int32
  *     contents [1] octet string
  */
-static ber_sequence_t TransitedEncoding_sequence[] = {
+static ber_old_sequence_t TransitedEncoding_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_transited_type },
        { BER_CLASS_CON, 1, 0,
@@ -2772,36 +3079,36 @@ static ber_sequence_t TransitedEncoding_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_transited(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_transited(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, TransitedEncoding_sequence, hf_krb_TransitedEncoding, ett_krb_TransitedEncoding);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, TransitedEncoding_sequence, hf_krb_TransitedEncoding, ett_krb_TransitedEncoding);
 
        return offset;
 }
 
 
 static int
-dissect_krb5_authtime(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_authtime(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_authtime);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_authtime);
        return offset;
 }
 static int
-dissect_krb5_starttime(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_starttime(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_starttime);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_starttime);
        return offset;
 }
 static int
-dissect_krb5_endtime(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_endtime(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_endtime);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_endtime);
        return offset;
 }
 static int
-dissect_krb5_renew_till(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_renew_till(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_renew_till);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_renew_till);
        return offset;
 }
 
@@ -2820,7 +3127,7 @@ dissect_krb5_renew_till(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
  *      authorization-data      [10] AuthorizationData OPTIONAL
  * }
  */
-static ber_sequence_t EncTicketPart_sequence[] = {
+static ber_old_sequence_t EncTicketPart_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_TicketFlags },
        { BER_CLASS_CON, 1, 0,
@@ -2846,9 +3153,9 @@ static ber_sequence_t EncTicketPart_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_EncTicketPart(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_EncTicketPart(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, EncTicketPart_sequence, hf_krb_EncTicketPart, ett_krb_EncTicketPart);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, EncTicketPart_sequence, hf_krb_EncTicketPart, ett_krb_EncTicketPart);
 
        return offset;
 }
@@ -2866,7 +3173,7 @@ dissect_krb5_EncTicketPart(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
  *     seq-number               [3] uint32 OPTIONAL
  * }
  */
-static ber_sequence_t EncAPRepPart_sequence[] = {
+static ber_old_sequence_t EncAPRepPart_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_ctime },
        { BER_CLASS_CON, 1, 0,
@@ -2878,9 +3185,9 @@ static ber_sequence_t EncAPRepPart_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_EncAPRepPart(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_EncAPRepPart(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, EncAPRepPart_sequence, hf_krb_EncAPRepPart, ett_krb_EncAPRepPart);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, EncAPRepPart_sequence, hf_krb_EncAPRepPart, ett_krb_EncAPRepPart);
 
        return offset;
 }
@@ -2900,21 +3207,21 @@ static const value_string krb5_lr_types[] = {
     { 0, NULL }
 };
 static int
-dissect_krb5_lr_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_lr_type(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_lr_type, &lr_type);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_lr_type, &lr_type);
 
        return offset;
 }
 static int
-dissect_krb5_lr_value(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_lr_value(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_lr_time);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_lr_time);
 
        return offset;
 }
 
-static ber_sequence_t LastReq_sequence[] = {
+static ber_old_sequence_t LastReq_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_lr_type },
        { BER_CLASS_CON, 1, 0,
@@ -2922,31 +3229,31 @@ static ber_sequence_t LastReq_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_LastReq(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_LastReq(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, LastReq_sequence, hf_krb_LastReq, ett_krb_LastReq);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, LastReq_sequence, hf_krb_LastReq, ett_krb_LastReq);
 
        return offset;
 }
-static ber_sequence_t LastReq_sequence_of[1] = {
+static ber_old_sequence_t LastReq_sequence_of[1] = {
   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_krb5_LastReq },
 };
 static int
-dissect_krb5_LastReq_sequence_of(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_LastReq_sequence_of(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence_of(FALSE, pinfo, tree, tvb, offset, LastReq_sequence_of, hf_krb_LastReqs, ett_krb_LastReqs);
+       offset=dissect_ber_old_sequence_of(FALSE, actx, tree, tvb, offset, LastReq_sequence_of, hf_krb_LastReqs, ett_krb_LastReqs);
 
        return offset;
 }
 
 static int
-dissect_krb5_key_expiration(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_key_expiration(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_key_expire);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_key_expire);
        return offset;
 }
 
-static ber_sequence_t EncKDCRepPart_sequence[] = {
+static ber_old_sequence_t EncKDCRepPart_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_key },
        { BER_CLASS_CON, 1, 0,
@@ -2974,18 +3281,18 @@ static ber_sequence_t EncKDCRepPart_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_EncKDCRepPart(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_EncKDCRepPart(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, EncKDCRepPart_sequence, hf_krb_EncKDCRepPart, ett_krb_EncKDCRepPart);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, EncKDCRepPart_sequence, hf_krb_EncKDCRepPart, ett_krb_EncKDCRepPart);
 
        return offset;
 }
 
 
 static int
-dissect_krb5_authenticator_vno(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_authenticator_vno(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_authenticator_vno, NULL);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_authenticator_vno, NULL);
 
        return offset;
 }
@@ -2997,8 +3304,9 @@ dissect_krb5_authenticator_vno(packet_info *pinfo, proto_tree *tree, tvbuff_t *t
 #define KRB5_GSS_C_SEQUENCE_FLAG       0x08
 #define KRB5_GSS_C_CONF_FLAG           0x10
 #define KRB5_GSS_C_INTEG_FLAG          0x20
+#define KRB5_GSS_C_DCE_STYLE           0x1000
 static const true_false_string tfs_gss_flags_deleg = {
-       "Delegate credantials to remote peer",
+       "Delegate credentials to remote peer",
        "Do NOT delegate"
 };
 static const true_false_string tfs_gss_flags_mutual = {
@@ -3022,10 +3330,15 @@ static const true_false_string tfs_gss_flags_integ = {
        "Do NOT use integrity protection"
 };
 
+static const true_false_string tfs_gss_flags_dce_style = {
+       "DCE-STYLE",
+       "Not using DCE-STYLE"
+};
+
 /* Dissect a GSSAPI checksum as per RFC1964. This is NOT ASN.1 encoded.
  */
 static int
-dissect_krb5_rfc1964_checksum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb)
+dissect_krb5_rfc1964_checksum(asn1_ctx_t *actx _U_, proto_tree *tree, tvbuff_t *tvb)
 {
        int offset=0;
        guint32 len;
@@ -3042,6 +3355,7 @@ dissect_krb5_rfc1964_checksum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tv
 
 
        /* flags */
+       proto_tree_add_item(tree, hf_krb_gssapi_c_flag_dce_style, tvb, offset, 4, TRUE);
        proto_tree_add_item(tree, hf_krb_gssapi_c_flag_integ, tvb, offset, 4, TRUE);
        proto_tree_add_item(tree, hf_krb_gssapi_c_flag_conf, tvb, offset, 4, TRUE);
        proto_tree_add_item(tree, hf_krb_gssapi_c_flag_sequence, tvb, offset, 4, TRUE);
@@ -3049,7 +3363,7 @@ dissect_krb5_rfc1964_checksum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tv
        proto_tree_add_item(tree, hf_krb_gssapi_c_flag_mutual, tvb, offset, 4, TRUE);
        proto_tree_add_item(tree, hf_krb_gssapi_c_flag_deleg, tvb, offset, 4, TRUE);
        offset += 4;
-       
+
        /* the next fields are optional so we have to check that we have
         * more data in our buffers */
        if(tvb_length_remaining(tvb, offset)<2){
@@ -3073,34 +3387,34 @@ dissect_krb5_rfc1964_checksum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tv
        }
 
        /* this should now be a KRB_CRED message */
-       offset=dissect_ber_choice(pinfo, tree, tvb, offset, kerberos_applications_choice, -1, -1, NULL);
+       offset=dissect_ber_old_choice(actx, tree, tvb, offset, kerberos_applications_choice, -1, -1, NULL);
+
 
-               
        return offset;
 }
 
 static guint32 checksum_type;
 
 static int
-dissect_krb5_checksum_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_checksum_type(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_checksum_type, &checksum_type);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_checksum_type, &checksum_type);
 
        return offset;
 }
 
 static int
-dissect_krb5_checksum_checksum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_checksum_checksum(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        tvbuff_t *next_tvb;
 
        switch(checksum_type){
        case KRB5_CHKSUM_GSSAPI:
-               offset=dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_krb_checksum_checksum, &next_tvb);
-               dissect_krb5_rfc1964_checksum(pinfo, tree, next_tvb);
+               offset=dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_krb_checksum_checksum, &next_tvb);
+               dissect_krb5_rfc1964_checksum(actx, tree, next_tvb);
                break;
        default:
-               offset=dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_krb_checksum_checksum, NULL);
+               offset=dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_krb_checksum_checksum, NULL);
        }
        return offset;
 }
@@ -3109,7 +3423,7 @@ dissect_krb5_checksum_checksum(packet_info *pinfo, proto_tree *tree, tvbuff_t *t
  * Checksum ::=        SEQUENCE {
  * }
  */
-static ber_sequence_t Checksum_sequence[] = {
+static ber_old_sequence_t Checksum_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_checksum_type },
        { BER_CLASS_CON, 1, 0,
@@ -3117,9 +3431,9 @@ static ber_sequence_t Checksum_sequence[] = {
        { 0, 0, 0, NULL }
 };
 int
-dissect_krb5_Checksum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_Checksum(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, Checksum_sequence, hf_krb_Checksum, ett_krb_Checksum);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, Checksum_sequence, hf_krb_Checksum, ett_krb_Checksum);
 
        return offset;
 }
@@ -3137,7 +3451,7 @@ dissect_krb5_Checksum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int o
  *     authorization-data       [8] AuthorizationData OPTIONAL
  * }
  */
-static ber_sequence_t Authenticator_sequence[] = {
+static ber_old_sequence_t Authenticator_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_authenticator_vno },
        { BER_CLASS_CON, 1, 0,
@@ -3159,27 +3473,27 @@ static ber_sequence_t Authenticator_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_Authenticator(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_Authenticator(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, Authenticator_sequence, hf_krb_Authenticator, ett_krb_Authenticator);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, Authenticator_sequence, hf_krb_Authenticator, ett_krb_Authenticator);
 
        return offset;
 }
 
 
 static int
-dissect_krb5_PRIV_BODY_user_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PRIV_BODY_user_data(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        tvbuff_t *new_tvb;
-       offset=dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_krb_PRIV_BODY_user_data, &new_tvb);
+       offset=dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_krb_PRIV_BODY_user_data, &new_tvb);
 
        if (new_tvb)
-               call_kerberos_callbacks(pinfo, tree, new_tvb, KRB_CBTAG_PRIV_USER_DATA);
+               call_kerberos_callbacks(actx->pinfo, tree, new_tvb, KRB_CBTAG_PRIV_USER_DATA);
 
        return offset;
 }
 
-static ber_sequence_t EncKrbPrivPart_sequence[] = {
+static ber_old_sequence_t EncKrbPrivPart_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_PRIV_BODY_user_data },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
@@ -3195,18 +3509,18 @@ static ber_sequence_t EncKrbPrivPart_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_EncKrbPrivPart(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_EncKrbPrivPart(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, EncKrbPrivPart_sequence, hf_krb_EncKrbPrivPart, ett_krb_EncKrbPrivPart);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, EncKrbPrivPart_sequence, hf_krb_EncKrbPrivPart, ett_krb_EncKrbPrivPart);
 
        return offset;
 }
 
 static guint32 PRIV_etype;
 static int
-dissect_krb5_PRIV_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PRIV_etype(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_etype, &PRIV_etype);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_etype, &PRIV_etype);
        if(tree){
                proto_item_append_text(tree, " %s",
                        val_to_str(PRIV_etype, krb5_encryption_types,
@@ -3217,7 +3531,7 @@ dissect_krb5_PRIV_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
 
 #ifdef HAVE_KERBEROS
 static int
-dissect_krb5_decrypt_PRIV (packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_decrypt_PRIV (proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        guint8 *plaintext=NULL;
        int length;
@@ -3225,20 +3539,23 @@ dissect_krb5_decrypt_PRIV (packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
        length=tvb_length_remaining(tvb, offset);
 
        if(!plaintext){
-               plaintext=decrypt_krb5_data(tree, pinfo, 13, length, tvb_get_ptr(tvb, offset, length), PRIV_etype);
+               tvbuff_t *next_tvb;
+
+               next_tvb=tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset));
+               plaintext=decrypt_krb5_data(tree, actx->pinfo, 13, next_tvb, PRIV_etype, NULL);
        }
 
        if(plaintext){
                tvbuff_t *next_tvb;
-               next_tvb = tvb_new_real_data (plaintext,
+               next_tvb = tvb_new_child_real_data(tvb, plaintext,
                                           length,
                                           length);
-               tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+               tvb_set_free_cb(next_tvb, g_free);
 
                /* Add the decrypted data to the data source list. */
-               add_new_data_source(pinfo, next_tvb, "Decrypted Krb5");
+               add_new_data_source(actx->pinfo, next_tvb, "Decrypted Krb5");
 
-               offset=dissect_ber_choice(pinfo, tree, next_tvb, 0, kerberos_applications_choice, -1, -1, NULL);
+               offset=dissect_ber_old_choice(actx, tree, next_tvb, 0, kerberos_applications_choice, -1, -1, NULL);
 
        }
        return offset;
@@ -3254,16 +3571,16 @@ dissect_krb5_decrypt_PRIV (packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
  *  }
  */
 static int
-dissect_krb5_encrypted_PRIV(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_encrypted_PRIV(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 #ifdef HAVE_KERBEROS
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_PRIV, dissect_krb5_decrypt_PRIV);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_PRIV, dissect_krb5_decrypt_PRIV);
 #else
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_PRIV, NULL);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_PRIV, NULL);
 #endif
        return offset;
 }
-static ber_sequence_t ENC_PRIV_sequence[] = {
+static ber_old_sequence_t ENC_PRIV_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_PRIV_etype },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
@@ -3273,12 +3590,12 @@ static ber_sequence_t ENC_PRIV_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_ENC_PRIV(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_ENC_PRIV(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, ENC_PRIV_sequence, hf_krb_ENC_PRIV, ett_krb_PRIV_enc);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, ENC_PRIV_sequence, hf_krb_ENC_PRIV, ett_krb_PRIV_enc);
        return offset;
 }
-static ber_sequence_t PRIV_BODY_sequence[] = {
+static ber_old_sequence_t PRIV_BODY_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_pvno },
        { BER_CLASS_CON, 1, 0,
@@ -3288,19 +3605,19 @@ static ber_sequence_t PRIV_BODY_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_PRIV(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_PRIV(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, PRIV_BODY_sequence, hf_krb_PRIV_BODY, ett_krb_PRIV);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, PRIV_BODY_sequence, hf_krb_PRIV_BODY, ett_krb_PRIV);
 
        return offset;
 }
 
 static guint32 EncKrbCredPart_etype;
 static int
-dissect_krb5_EncKrbCredPart_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_EncKrbCredPart_etype(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_etype, &EncKrbCredPart_etype);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_etype, &EncKrbCredPart_etype);
        if(tree){
                proto_item_append_text(tree, " %s",
                        val_to_str(EncKrbCredPart_etype, krb5_encryption_types,
@@ -3313,7 +3630,7 @@ dissect_krb5_EncKrbCredPart_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t
 
 
 
-static ber_sequence_t KrbCredInfo_sequence[] = {
+static ber_old_sequence_t KrbCredInfo_sequence[] = {
        { BER_CLASS_CON, 0, 0, dissect_krb5_key },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_krb5_prealm },
        { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_krb5_pname },
@@ -3328,25 +3645,25 @@ static ber_sequence_t KrbCredInfo_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_KrbCredInfo(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_KrbCredInfo(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, KrbCredInfo_sequence, hf_krb_KrbCredInfo, ett_krb_KrbCredInfo);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, KrbCredInfo_sequence, hf_krb_KrbCredInfo, ett_krb_KrbCredInfo);
 
        return offset;
 }
 
-static ber_sequence_t KrbCredInfo_sequence_of[1] = {
+static ber_old_sequence_t KrbCredInfo_sequence_of[1] = {
   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_krb5_KrbCredInfo },
 };
 static int
-dissect_krb5_KrbCredInfo_sequence_of(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_KrbCredInfo_sequence_of(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence_of(FALSE, pinfo, tree, tvb, offset, KrbCredInfo_sequence_of, hf_krb_KrbCredInfos, ett_krb_KrbCredInfos);
+       offset=dissect_ber_old_sequence_of(FALSE, actx, tree, tvb, offset, KrbCredInfo_sequence_of, hf_krb_KrbCredInfos, ett_krb_KrbCredInfos);
 
        return offset;
 }
-static const ber_sequence_t EncKrbCredPart_sequence[] = {
+static const ber_old_sequence_t EncKrbCredPart_sequence[] = {
        { BER_CLASS_CON, 0, 0, dissect_krb5_KrbCredInfo_sequence_of },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_krb5_nonce },
        { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_krb5_ctime },
@@ -3357,19 +3674,22 @@ static const ber_sequence_t EncKrbCredPart_sequence[] = {
 };
 
 static int
-dissect_krb5_EncKrbCredPart(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_EncKrbCredPart(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, EncKrbCredPart_sequence, hf_krb_EncKrbCredPart, ett_krb_EncKrbCredPart);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, EncKrbCredPart_sequence, hf_krb_EncKrbCredPart, ett_krb_EncKrbCredPart);
 
        return offset;
 }
 
 #ifdef HAVE_KERBEROS
 static int
-dissect_krb5_decrypt_EncKrbCredPart (packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_decrypt_EncKrbCredPart (proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        guint8 *plaintext=NULL;
        int length;
+       tvbuff_t *next_tvb;
+
+       next_tvb=tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset));
 
        length=tvb_length_remaining(tvb, offset);
 
@@ -3378,37 +3698,37 @@ dissect_krb5_decrypt_EncKrbCredPart (packet_info *pinfo, proto_tree *tree, tvbuf
         * == 14
         */
        if(!plaintext){
-               plaintext=decrypt_krb5_data(tree, pinfo, 14, length, tvb_get_ptr(tvb, offset, length), EncKrbCredPart_etype);
+               plaintext=decrypt_krb5_data(tree, actx->pinfo, 14, next_tvb, EncKrbCredPart_etype, NULL);
        }
 
        if(plaintext){
-               tvbuff_t *next_tvb;
-               next_tvb = tvb_new_real_data (plaintext,
+               tvbuff_t *child_tvb;
+               child_tvb = tvb_new_child_real_data(tvb, plaintext,
                                           length,
                                           length);
-               tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+               tvb_set_free_cb(child_tvb, g_free);
 
                /* Add the decrypted data to the data source list. */
-               add_new_data_source(pinfo, next_tvb, "EncKrbCredPart");
+               add_new_data_source(actx->pinfo, child_tvb, "EncKrbCredPart");
 
-               offset=dissect_ber_choice(pinfo, tree, next_tvb, 0, kerberos_applications_choice, -1, -1, NULL);
+               offset=dissect_ber_old_choice(actx, tree, child_tvb, 0, kerberos_applications_choice, -1, -1, NULL);
        }
        return offset;
 }
 #endif
 
 static int
-dissect_krb5_encrypted_CRED_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_encrypted_CRED_data(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 #ifdef HAVE_KERBEROS
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_EncKrbCredPart, dissect_krb5_decrypt_EncKrbCredPart);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_EncKrbCredPart, dissect_krb5_decrypt_EncKrbCredPart);
 #else
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_EncKrbCredPart, NULL);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_EncKrbCredPart, NULL);
 #endif
        return offset;
 }
 
-static ber_sequence_t encrypted_CRED_sequence[] = {
+static ber_old_sequence_t encrypted_CRED_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_EncKrbCredPart_etype },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
@@ -3418,14 +3738,14 @@ static ber_sequence_t encrypted_CRED_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_encrypted_CRED(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_encrypted_CRED(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, encrypted_CRED_sequence, hf_krb_CRED_enc, ett_krb_CRED_enc);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, encrypted_CRED_sequence, hf_krb_CRED_enc, ett_krb_CRED_enc);
 
        return offset;
 }
 
-static ber_sequence_t CRED_BODY_sequence[] = {
+static ber_old_sequence_t CRED_BODY_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_pvno },
        { BER_CLASS_CON, 1, 0,
@@ -3437,39 +3757,39 @@ static ber_sequence_t CRED_BODY_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_CRED(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_CRED(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, CRED_BODY_sequence, hf_krb_CRED_BODY, ett_krb_CRED);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, CRED_BODY_sequence, hf_krb_CRED_BODY, ett_krb_CRED);
 
        return offset;
 }
 
 
 static int
-dissect_krb5_SAFE_BODY_user_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_SAFE_BODY_user_data(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        tvbuff_t *new_tvb;
-       offset=dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_krb_SAFE_BODY_user_data, &new_tvb);
+       offset=dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_krb_SAFE_BODY_user_data, &new_tvb);
        if (new_tvb)
-               call_kerberos_callbacks(pinfo, tree, new_tvb, KRB_CBTAG_SAFE_USER_DATA);
+               call_kerberos_callbacks(actx->pinfo, tree, new_tvb, KRB_CBTAG_SAFE_USER_DATA);
        return offset;
 }
 static int
-dissect_krb5_SAFE_BODY_timestamp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_SAFE_BODY_timestamp(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralizedTime(FALSE, pinfo, tree, tvb, offset, hf_krb_SAFE_BODY_timestamp);
+       offset=dissect_ber_GeneralizedTime(FALSE, actx, tree, tvb, offset, hf_krb_SAFE_BODY_timestamp);
        return offset;
 }
 
 static int
-dissect_krb5_SAFE_BODY_usec(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_SAFE_BODY_usec(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_SAFE_BODY_usec, NULL);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_SAFE_BODY_usec, NULL);
        return offset;
 }
 
-static ber_sequence_t SAFE_BODY_sequence[] = {
+static ber_old_sequence_t SAFE_BODY_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_SAFE_BODY_user_data },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
@@ -3486,17 +3806,17 @@ static ber_sequence_t SAFE_BODY_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_SAFE_BODY(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_SAFE_BODY(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, SAFE_BODY_sequence, -1, -1);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, SAFE_BODY_sequence, -1, -1);
 
        return offset;
 }
 
 
 
-static ber_sequence_t SAFE_sequence[] = {
+static ber_old_sequence_t SAFE_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_pvno },
        { BER_CLASS_CON, 1, 0,
@@ -3508,14 +3828,99 @@ static ber_sequence_t SAFE_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_SAFE(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_SAFE(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, SAFE_sequence, -1, -1);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, SAFE_sequence, -1, -1);
 
        return offset;
 }
 
+#ifdef HAVE_KERBEROS
+static guint32 enc_authorization_data_etype;
+
+static int
+dissect_krb5_decrypt_enc_authorization_data(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
+{
+       guint8 *plaintext=NULL;
+       int length;
+       tvbuff_t *next_tvb;
+
+       next_tvb=tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset));
+
+       length=tvb_length_remaining(tvb, offset);
+
+       /*
+       RFC 4120 : 5.4.1
+       The key usage value used when encrypting is 5
+       if a sub-session key is used, or 4 if the session key is used.
+       */
+       if(!plaintext){
+               plaintext=decrypt_krb5_data(tree, actx->pinfo, 4, next_tvb, enc_authorization_data_etype, NULL);
+       }
+       if(!plaintext){
+               plaintext=decrypt_krb5_data(tree, actx->pinfo, 5, next_tvb, enc_authorization_data_etype, NULL);
+       }
+
+       if(plaintext){
+               tvbuff_t *child_tvb;
+               child_tvb = tvb_new_child_real_data(tvb, plaintext,
+                                          length,
+                                          length);
+               tvb_set_free_cb(child_tvb, g_free);
+
+               /* Add the decrypted data to the data source list. */
+               add_new_data_source(actx->pinfo, child_tvb, "Decrypted Krb5");
+
+
+               proto_tree_add_text(tree, child_tvb, 0, length, "AtuhorizationData for TGS_REQ not implemented yet");
+
+       }
+       return offset;
+}
+#endif
+
+static int
+dissect_krb5_encrypted_enc_authorization_data(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
+{
+#ifdef HAVE_KERBEROS
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_enc_authorization_data, dissect_krb5_decrypt_enc_authorization_data);
+#else
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_enc_authorization_data, NULL);
+#endif
+       return offset;
+}
+
+static int
+dissect_krb5_enc_authorization_data_etype(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
+{
+#ifndef HAVE_KERBEROS
+       guint32 enc_authorization_data_etype;
+#endif
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_etype, &enc_authorization_data_etype);
+       if(tree){
+               proto_item_append_text(tree, " %s",
+                       val_to_str(enc_authorization_data_etype, krb5_encryption_types,
+                       "%#x"));
+       }
+       return offset;
+}
+static ber_old_sequence_t enc_authorization_data_sequence[] = {
+       { BER_CLASS_CON, 0, 0,
+               dissect_krb5_enc_authorization_data_etype },
+       { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
+               dissect_krb5_kvno },
+       { BER_CLASS_CON, 2, 0,
+               dissect_krb5_encrypted_enc_authorization_data },
+       { 0, 0, 0, NULL }
+};
+static int
+dissect_krb5_enc_authorization_data(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
+{
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, enc_authorization_data_sequence, -1, -1);
+
+       return offset;
+}
 
 /*
  * KDC-REQ-BODY ::=   SEQUENCE {
@@ -3538,7 +3943,7 @@ dissect_krb5_SAFE(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offse
  * }
  *
  */
-static ber_sequence_t KDC_REQ_BODY_sequence[] = {
+static ber_old_sequence_t KDC_REQ_BODY_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_KDCOptions },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
@@ -3564,13 +3969,14 @@ static ber_sequence_t KDC_REQ_BODY_sequence[] = {
                dissect_krb5_etype_sequence_of },
        { BER_CLASS_CON, 9, BER_FLAGS_OPTIONAL,
                dissect_krb5_HostAddresses },
-/* XXX [10] enc-authorization-data should be added */
+       { BER_CLASS_CON, 10, BER_FLAGS_OPTIONAL,
+               dissect_krb5_enc_authorization_data },
        { BER_CLASS_CON, 11, BER_FLAGS_OPTIONAL,
                dissect_krb5_sq_tickets },
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_KDC_REQ_BODY(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_KDC_REQ_BODY(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        conversation_t *conversation;
 
@@ -3582,17 +3988,17 @@ dissect_krb5_KDC_REQ_BODY(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, i
         * Ref: Section 7.2.1 of
         * http://www.ietf.org/internet-drafts/draft-ietf-krb-wg-kerberos-clarifications-07.txt
         */
-       if (pinfo->destport == UDP_PORT_KERBEROS && pinfo->ptype == PT_UDP) {
-               conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, PT_UDP,
-                       pinfo->srcport, 0, NO_PORT_B);
+       if (actx->pinfo->destport == UDP_PORT_KERBEROS && actx->pinfo->ptype == PT_UDP) {
+               conversation = find_conversation(actx->pinfo->fd->num, &actx->pinfo->src, &actx->pinfo->dst, PT_UDP,
+                       actx->pinfo->srcport, 0, NO_PORT_B);
                if (conversation == NULL) {
-                       conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, PT_UDP,
-                               pinfo->srcport, 0, NO_PORT2);
+                       conversation = conversation_new(actx->pinfo->fd->num, &actx->pinfo->src, &actx->pinfo->dst, PT_UDP,
+                               actx->pinfo->srcport, 0, NO_PORT2);
                        conversation_set_dissector(conversation, kerberos_handle_udp);
                }
        }
 
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, KDC_REQ_BODY_sequence, hf_krb_KDC_REQ_BODY, ett_krb_request);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, KDC_REQ_BODY_sequence, hf_krb_KDC_REQ_BODY, ett_krb_request);
 
        return offset;
 }
@@ -3607,7 +4013,7 @@ dissect_krb5_KDC_REQ_BODY(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, i
  *          req-body[4]           KDC-REQ-BODY
  * }
  */
-static ber_sequence_t KDC_REQ_sequence[] = {
+static ber_old_sequence_t KDC_REQ_sequence[] = {
        { BER_CLASS_CON, 1, 0,
                dissect_krb5_pvno },
        { BER_CLASS_CON, 2, 0,
@@ -3619,9 +4025,9 @@ static ber_sequence_t KDC_REQ_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_KDC_REQ(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_KDC_REQ(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, KDC_REQ_sequence, -1, -1);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, KDC_REQ_sequence, -1, -1);
 
        return offset;
 }
@@ -3629,10 +4035,13 @@ dissect_krb5_KDC_REQ(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int of
 
 #ifdef HAVE_KERBEROS
 static int
-dissect_krb5_decrypt_authenticator_data (packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_decrypt_authenticator_data (proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        guint8 *plaintext=NULL;
        int length;
+       tvbuff_t *next_tvb;
+
+       next_tvb=tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset));
 
        length=tvb_length_remaining(tvb, offset);
 
@@ -3643,24 +4052,24 @@ dissect_krb5_decrypt_authenticator_data (packet_info *pinfo, proto_tree *tree, t
         * == 11
         */
        if(!plaintext){
-               plaintext=decrypt_krb5_data(tree, pinfo, 7, length, tvb_get_ptr(tvb, offset, length), authenticator_etype);
+               plaintext=decrypt_krb5_data(tree, actx->pinfo, 7, next_tvb, authenticator_etype, NULL);
        }
        if(!plaintext){
-               plaintext=decrypt_krb5_data(tree, pinfo, 11, length, tvb_get_ptr(tvb, offset, length), authenticator_etype);
+               plaintext=decrypt_krb5_data(tree, actx->pinfo, 11, next_tvb, authenticator_etype, NULL);
        }
 
        if(plaintext){
-               tvbuff_t *next_tvb;
-               next_tvb = tvb_new_real_data (plaintext,
+               tvbuff_t *child_tvb;
+               child_tvb = tvb_new_child_real_data(tvb, plaintext,
                                           length,
                                           length);
-               tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+               tvb_set_free_cb(child_tvb, g_free);
 
                /* Add the decrypted data to the data source list. */
-               add_new_data_source(pinfo, next_tvb, "Decrypted Krb5");
+               add_new_data_source(actx->pinfo, child_tvb, "Decrypted Krb5");
 
 
-               offset=dissect_ber_choice(pinfo, tree, next_tvb, 0, kerberos_applications_choice, -1, -1, NULL);
+               offset=dissect_ber_old_choice(actx, tree, child_tvb, 0, kerberos_applications_choice, -1, -1, NULL);
 
        }
        return offset;
@@ -3676,16 +4085,16 @@ dissect_krb5_decrypt_authenticator_data (packet_info *pinfo, proto_tree *tree, t
  *  }
  */
 static int
-dissect_krb5_encrypted_authenticator_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_encrypted_authenticator_data(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 #ifdef HAVE_KERBEROS
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_authenticator_data, dissect_krb5_decrypt_authenticator_data);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_authenticator_data, dissect_krb5_decrypt_authenticator_data);
 #else
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_authenticator_data, NULL);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_authenticator_data, NULL);
 #endif
        return offset;
 }
-static ber_sequence_t encrypted_authenticator_sequence[] = {
+static ber_old_sequence_t encrypted_authenticator_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_authenticator_etype },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
@@ -3695,9 +4104,9 @@ static ber_sequence_t encrypted_authenticator_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_encrypted_authenticator(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_encrypted_authenticator(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, encrypted_authenticator_sequence, hf_krb_authenticator_enc, ett_krb_authenticator_enc);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, encrypted_authenticator_sequence, hf_krb_authenticator_enc, ett_krb_authenticator_enc);
 
        return offset;
 }
@@ -3706,19 +4115,22 @@ dissect_krb5_encrypted_authenticator(packet_info *pinfo, proto_tree *tree, tvbuf
 
 
 static int
-dissect_krb5_tkt_vno(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_tkt_vno(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_tkt_vno, NULL);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_tkt_vno, NULL);
        return offset;
 }
 
 
 #ifdef HAVE_KERBEROS
 static int
-dissect_krb5_decrypt_Ticket_data (packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_decrypt_Ticket_data (proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        guint8 *plaintext;
        int length;
+       tvbuff_t *next_tvb;
+
+       next_tvb=tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset));
 
        length=tvb_length_remaining(tvb, offset);
 
@@ -3726,18 +4138,18 @@ dissect_krb5_decrypt_Ticket_data (packet_info *pinfo, proto_tree *tree, tvbuff_t
         * 7.5.1
         * All Ticket encrypted parts use usage == 2
         */
-       if( (plaintext=decrypt_krb5_data(tree, pinfo, 2, length, tvb_get_ptr(tvb, offset, length), Ticket_etype)) ){
-               tvbuff_t *next_tvb;
-               next_tvb = tvb_new_real_data (plaintext,
+       if( (plaintext=decrypt_krb5_data(tree, actx->pinfo, 2, next_tvb, Ticket_etype, NULL)) ){
+               tvbuff_t *child_tvb;
+               child_tvb = tvb_new_child_real_data(tvb, plaintext,
                                           length,
                                           length);
-               tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+               tvb_set_free_cb(child_tvb, g_free);
 
                /* Add the decrypted data to the data source list. */
-               add_new_data_source(pinfo, next_tvb, "Decrypted Krb5");
+               add_new_data_source(actx->pinfo, child_tvb, "Decrypted Krb5");
 
 
-               offset=dissect_ber_choice(pinfo, tree, next_tvb, 0, kerberos_applications_choice, -1, -1, NULL);
+               offset=dissect_ber_old_choice(actx, tree, child_tvb, 0, kerberos_applications_choice, -1, -1, NULL);
 
        }
        return offset;
@@ -3745,16 +4157,16 @@ dissect_krb5_decrypt_Ticket_data (packet_info *pinfo, proto_tree *tree, tvbuff_t
 #endif
 
 static int
-dissect_krb5_encrypted_Ticket_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_encrypted_Ticket_data(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 #ifdef HAVE_KERBEROS
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_Ticket_data, dissect_krb5_decrypt_Ticket_data);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_Ticket_data, dissect_krb5_decrypt_Ticket_data);
 #else
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_Ticket_data, NULL);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_Ticket_data, NULL);
 #endif
        return offset;
 }
-static ber_sequence_t encrypted_Ticket_sequence[] = {
+static ber_old_sequence_t encrypted_Ticket_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_Ticket_etype },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
@@ -3764,14 +4176,14 @@ static ber_sequence_t encrypted_Ticket_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_Ticket_encrypted(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_Ticket_encrypted(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, encrypted_Ticket_sequence, hf_krb_ticket_enc, ett_krb_ticket_enc);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, encrypted_Ticket_sequence, hf_krb_ticket_enc, ett_krb_ticket_enc);
 
        return offset;
 }
 
-static ber_sequence_t Application_1_sequence[] = {
+static ber_old_sequence_t Application_1_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_tkt_vno },
        { BER_CLASS_CON, 1, 0,
@@ -3783,24 +4195,24 @@ static ber_sequence_t Application_1_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_Application_1(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_Application_1(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, Application_1_sequence, hf_krb_ticket, ett_krb_ticket);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, Application_1_sequence, hf_krb_ticket, ett_krb_ticket);
 
        return offset;
 }
 
 
 
-static const ber_choice_t Ticket_choice[] = {
+static const ber_old_choice_t Ticket_choice[] = {
        { 1, BER_CLASS_APP, 1,  0,
                dissect_krb5_Application_1 },
        { 0, 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_Ticket(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_Ticket(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_choice(pinfo, tree, tvb, offset, Ticket_choice, -1, -1, NULL);
+       offset=dissect_ber_old_choice(actx, tree, tvb, offset, Ticket_choice, -1, -1, NULL);
 
        return offset;
 }
@@ -3817,7 +4229,7 @@ dissect_krb5_Ticket(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int off
  *                  authenticator[4]              EncryptedData
  *  }
  */
-static ber_sequence_t AP_REQ_sequence[] = {
+static ber_old_sequence_t AP_REQ_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_pvno },
        { BER_CLASS_CON, 1, 0,
@@ -3831,9 +4243,9 @@ static ber_sequence_t AP_REQ_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_AP_REQ(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_AP_REQ(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, AP_REQ_sequence, -1, -1);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, AP_REQ_sequence, -1, -1);
 
        return offset;
 }
@@ -3843,7 +4255,7 @@ dissect_krb5_AP_REQ(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int off
 
 #ifdef HAVE_KERBEROS
 static int
-dissect_krb5_decrypt_AP_REP_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_decrypt_AP_REP_data(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        guint8 *plaintext=NULL;
        int length;
@@ -3857,21 +4269,24 @@ dissect_krb5_decrypt_AP_REP_data(packet_info *pinfo, proto_tree *tree, tvbuff_t
         * == 11
         */
        if(!plaintext){
-               plaintext=decrypt_krb5_data(tree, pinfo, 12, length, tvb_get_ptr(tvb, offset, length), AP_REP_etype);
+               tvbuff_t *next_tvb;
+
+               next_tvb=tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset));
+               plaintext=decrypt_krb5_data(tree, actx->pinfo, 12, next_tvb, AP_REP_etype, NULL);
        }
 
        if(plaintext){
                tvbuff_t *next_tvb;
-               next_tvb = tvb_new_real_data (plaintext,
+               next_tvb = tvb_new_child_real_data(tvb, plaintext,
                                           length,
                                           length);
-               tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+               tvb_set_free_cb(next_tvb, g_free);
 
                /* Add the decrypted data to the data source list. */
-               add_new_data_source(pinfo, next_tvb, "Decrypted Krb5");
+               add_new_data_source(actx->pinfo, next_tvb, "Decrypted Krb5");
 
 
-               offset=dissect_ber_choice(pinfo, tree, next_tvb, 0, kerberos_applications_choice, -1, -1, NULL);
+               offset=dissect_ber_old_choice(actx, tree, next_tvb, 0, kerberos_applications_choice, -1, -1, NULL);
 
        }
        return offset;
@@ -3880,16 +4295,16 @@ dissect_krb5_decrypt_AP_REP_data(packet_info *pinfo, proto_tree *tree, tvbuff_t
 
 
 static int
-dissect_krb5_encrypted_AP_REP_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_encrypted_AP_REP_data(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 #ifdef HAVE_KERBEROS
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_AP_REP_data, dissect_krb5_decrypt_AP_REP_data);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_AP_REP_data, dissect_krb5_decrypt_AP_REP_data);
 #else
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_AP_REP_data, NULL);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_AP_REP_data, NULL);
 #endif
        return offset;
 }
-static ber_sequence_t encrypted_AP_REP_sequence[] = {
+static ber_old_sequence_t encrypted_AP_REP_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_AP_REP_etype },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
@@ -3899,9 +4314,9 @@ static ber_sequence_t encrypted_AP_REP_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_encrypted_AP_REP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_encrypted_AP_REP(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, encrypted_AP_REP_sequence, hf_krb_AP_REP_enc, ett_krb_AP_REP_enc);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, encrypted_AP_REP_sequence, hf_krb_AP_REP_enc, ett_krb_AP_REP_enc);
 
        return offset;
 }
@@ -3913,7 +4328,7 @@ dissect_krb5_encrypted_AP_REP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tv
  *             enc-part[2]               EncryptedData
  *  }
  */
-static ber_sequence_t AP_REP_sequence[] = {
+static ber_old_sequence_t AP_REP_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_pvno },
        { BER_CLASS_CON, 1, 0,
@@ -3923,9 +4338,9 @@ static ber_sequence_t AP_REP_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_AP_REP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_AP_REP(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, AP_REP_sequence, -1, -1);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, AP_REP_sequence, -1, -1);
 
        return offset;
 }
@@ -3936,9 +4351,9 @@ dissect_krb5_AP_REP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int off
 
 static guint32 KDC_REP_etype;
 static int
-dissect_krb5_KDC_REP_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_KDC_REP_etype(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_krb_etype, &KDC_REP_etype);
+       offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_etype, &KDC_REP_etype);
        if(tree){
                proto_item_append_text(tree, " %s",
                        val_to_str(KDC_REP_etype, krb5_encryption_types,
@@ -3949,10 +4364,13 @@ dissect_krb5_KDC_REP_etype(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
 
 #ifdef HAVE_KERBEROS
 static int
-dissect_krb5_decrypt_KDC_REP_data (packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_decrypt_KDC_REP_data (proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        guint8 *plaintext=NULL;
        int length;
+       tvbuff_t *next_tvb;
+
+       next_tvb=tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset));
 
        length=tvb_length_remaining(tvb, offset);
 
@@ -3961,30 +4379,30 @@ dissect_krb5_decrypt_KDC_REP_data (packet_info *pinfo, proto_tree *tree, tvbuff_
         * ASREP/TGSREP encryptedparts are encrypted with usage
         * == 3 or
         * == 8 or
-         * == 9
+     * == 9
         */
        if(!plaintext){
-               plaintext=decrypt_krb5_data(tree, pinfo, 3, length, tvb_get_ptr(tvb, offset, length), KDC_REP_etype);
+               plaintext=decrypt_krb5_data(tree, actx->pinfo, 3, next_tvb, KDC_REP_etype, NULL);
        }
        if(!plaintext){
-               plaintext=decrypt_krb5_data(tree, pinfo, 8, length, tvb_get_ptr(tvb, offset, length), KDC_REP_etype);
+               plaintext=decrypt_krb5_data(tree, actx->pinfo, 8, next_tvb, KDC_REP_etype, NULL);
        }
        if(!plaintext){
-               plaintext=decrypt_krb5_data(tree, pinfo, 9, length, tvb_get_ptr(tvb, offset, length), KDC_REP_etype);
+               plaintext=decrypt_krb5_data(tree, actx->pinfo, 9, next_tvb, KDC_REP_etype, NULL);
        }
 
        if(plaintext){
-               tvbuff_t *next_tvb;
-               next_tvb = tvb_new_real_data (plaintext,
+               tvbuff_t *child_tvb;
+               child_tvb = tvb_new_child_real_data(tvb, plaintext,
                                           length,
                                           length);
-               tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+               tvb_set_free_cb(child_tvb, g_free);
 
                /* Add the decrypted data to the data source list. */
-               add_new_data_source(pinfo, next_tvb, "Decrypted Krb5");
+               add_new_data_source(actx->pinfo, child_tvb, "Decrypted Krb5");
 
 
-               offset=dissect_ber_choice(pinfo, tree, next_tvb, 0, kerberos_applications_choice, -1, -1, NULL);
+               offset=dissect_ber_old_choice(actx, tree, child_tvb, 0, kerberos_applications_choice, -1, -1, NULL);
 
        }
        return offset;
@@ -3993,16 +4411,16 @@ dissect_krb5_decrypt_KDC_REP_data (packet_info *pinfo, proto_tree *tree, tvbuff_
 
 
 static int
-dissect_krb5_encrypted_KDC_REP_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_encrypted_KDC_REP_data(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
 #ifdef HAVE_KERBEROS
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_KDC_REP_data, dissect_krb5_decrypt_KDC_REP_data);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_KDC_REP_data, dissect_krb5_decrypt_KDC_REP_data);
 #else
-       offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_encrypted_KDC_REP_data, NULL);
+       offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_encrypted_KDC_REP_data, NULL);
 #endif
        return offset;
 }
-static ber_sequence_t encrypted_KDC_REP_sequence[] = {
+static ber_old_sequence_t encrypted_KDC_REP_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_KDC_REP_etype },
        { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL,
@@ -4012,9 +4430,9 @@ static ber_sequence_t encrypted_KDC_REP_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_encrypted_KDC_REP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_encrypted_KDC_REP(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, encrypted_KDC_REP_sequence, hf_krb_KDC_REP_enc, ett_krb_KDC_REP_enc);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, encrypted_KDC_REP_sequence, hf_krb_KDC_REP_enc, ett_krb_KDC_REP_enc);
 
        return offset;
 }
@@ -4030,7 +4448,7 @@ dissect_krb5_encrypted_KDC_REP(packet_info *pinfo, proto_tree *tree, tvbuff_t *t
  *                enc-part[6]                EncryptedData
  *  }
  */
-static ber_sequence_t KDC_REP_sequence[] = {
+static ber_old_sequence_t KDC_REP_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_pvno },
        { BER_CLASS_CON, 1, 0,
@@ -4048,9 +4466,9 @@ static ber_sequence_t KDC_REP_sequence[] = {
        { 0, 0, 0, NULL }
 };
 static int
-dissect_krb5_KDC_REP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_KDC_REP(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, KDC_REP_sequence, -1, -1);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, KDC_REP_sequence, -1, -1);
 
        return offset;
 }
@@ -4059,14 +4477,14 @@ dissect_krb5_KDC_REP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int of
 
 
 static int
-dissect_krb5_e_text(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_e_text(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_GeneralString(pinfo, tree, tvb, offset, hf_krb_e_text, NULL, 0);
+       offset=dissect_ber_GeneralString(actx, tree, tvb, offset, hf_krb_e_text, NULL, 0);
        return offset;
 }
 
 static int
-dissect_krb5_e_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_e_data(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
        switch(krb5_errorcode){
        case KRB5_ET_KRB5KDC_ERR_BADOPTION:
@@ -4076,15 +4494,16 @@ dissect_krb5_e_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int off
                /* ms windows kdc sends e-data of this type containing a "salt"
                 * that contains the nt_status code for these error codes.
                 */
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_e_data, dissect_krb5_PA_DATA);
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_e_data, dissect_krb5_PA_DATA);
                break;
        case KRB5_ET_KRB5KDC_ERR_PREAUTH_REQUIRED:
        case KRB5_ET_KRB5KDC_ERR_PREAUTH_FAILED:
-               offset=dissect_ber_octet_string_wcb(FALSE, pinfo, tree, tvb, offset, hf_krb_e_data, dissect_krb5_padata);
+       case KRB5_ET_KRB5KDC_ERR_ETYPE_NOSUPP:
+               offset=dissect_ber_old_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_krb_e_data, dissect_krb5_padata);
 
                break;
        default:
-               offset=dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_krb_e_data, NULL);
+               offset=dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_krb_e_data, NULL);
        }
        return offset;
 }
@@ -4094,9 +4513,9 @@ dissect_krb5_e_data(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int off
  * PacketCable still use.
  */
 static int
-dissect_krb5_e_checksum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_e_checksum(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, Checksum_sequence, hf_krb_e_checksum, ett_krb_e_checksum);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, Checksum_sequence, hf_krb_e_checksum, ett_krb_e_checksum);
 
        return offset;
 }
@@ -4127,7 +4546,7 @@ dissect_krb5_e_checksum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
  *            authentication method and optionally containing data for
  *            the method:
  */
-static ber_sequence_t ERROR_sequence[] = {
+static ber_old_sequence_t ERROR_sequence[] = {
        { BER_CLASS_CON, 0, 0,
                dissect_krb5_pvno },
        { BER_CLASS_CON, 1, 0,
@@ -4159,17 +4578,15 @@ static ber_sequence_t ERROR_sequence[] = {
        { 0, 0, 0, NULL }
 };
 int
-dissect_krb5_ERROR(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_krb5_ERROR(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
 {
-       offset=dissect_ber_sequence(FALSE, pinfo, tree, tvb, offset, ERROR_sequence, -1, -1);
+       offset=dissect_ber_old_sequence(FALSE, actx, tree, tvb, offset, ERROR_sequence, -1, -1);
 
        return offset;
 }
 
 
 
-static struct { const char *set; const char *unset; } bitval = { "Set", "Not set" };
-
 static gint dissect_kerberos_udp(tvbuff_t *tvb, packet_info *pinfo,
                                 proto_tree *tree);
 static void dissect_kerberos_tcp(tvbuff_t *tvb, packet_info *pinfo,
@@ -4189,7 +4606,7 @@ dissect_kerberos_main(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int d
     return (dissect_kerberos_common(tvb, pinfo, tree, do_col_info, FALSE, FALSE, cb));
 }
 
-guint32 
+guint32
 kerberos_output_keytype(void)
 {
   return keytype;
@@ -4199,15 +4616,18 @@ static gint
 dissect_kerberos_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
     /* Some weird kerberos implementation apparently do krb4 on the krb5 port.
-       Since all (except weirdo transarc krb4 stuff) use 
+       Since all (except weirdo transarc krb4 stuff) use
        an opcode <=16 in the first byte, use this to see if it might
        be krb4.
        All krb5 commands start with an APPL tag and thus is >=0x60
        so if first byte is <=16  just blindly assume it is krb4 then
     */
-    if(tvb_bytes_exist(tvb, 0, 1) && tvb_get_guint8(tvb, 0)<=0x10){
-      if(krb4_handle){ 
-       return call_dissector(krb4_handle, tvb, pinfo, tree);
+    if(tvb_length(tvb) >= 1 && tvb_get_guint8(tvb, 0)<=0x10){
+      if(krb4_handle){
+       gboolean res;
+
+       res=call_dissector_only(krb4_handle, tvb, pinfo, tree);
+       return res;
       }else{
         return 0;
       }
@@ -4224,7 +4644,7 @@ kerberos_rm_to_reclen(guint krb_rm)
 }
 
 guint
-get_krb_pdu_len(tvbuff_t *tvb, int offset)
+get_krb_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
 {
     guint krb_rm;
     gint pdulen;
@@ -4243,19 +4663,15 @@ dissect_kerberos_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
         * The dissector failed to recognize this as a valid
         * Kerberos message.  Mark it as a continuation packet.
         */
-       if (check_col(pinfo->cinfo, COL_INFO)) {
-               col_set_str(pinfo->cinfo, COL_INFO, "Continuation");
-       }
+       col_set_str(pinfo->cinfo, COL_INFO, "Continuation");
     }
 }
 
 static void
 dissect_kerberos_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-    if (check_col(pinfo->cinfo, COL_PROTOCOL))
-        col_set_str(pinfo->cinfo, COL_PROTOCOL, "KRB5");
-    if (check_col(pinfo->cinfo, COL_INFO))
-        col_clear(pinfo->cinfo, COL_INFO);
+    col_set_str(pinfo->cinfo, COL_PROTOCOL, "KRB5");
+    col_clear(pinfo->cinfo, COL_INFO);
 
     tcp_dissect_pdus(tvb, pinfo, tree, krb_desegment, 4, get_krb_pdu_len,
        dissect_kerberos_tcp_pdu);
@@ -4288,10 +4704,11 @@ dissect_kerberos_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
     gboolean dci, gboolean do_col_protocol, gboolean have_rm,
     kerberos_callbacks *cb)
 {
-    int offset = 0;
-    proto_tree *kerberos_tree = NULL;
-    proto_item *item = NULL;
+    volatile int offset = 0;
+    proto_tree *volatile kerberos_tree = NULL;
+    proto_item *volatile item = NULL;
     void *saved_private_data;
+       asn1_ctx_t asn1_ctx;
 
     /* TCP record mark and length */
     guint32 krb_rm = 0;
@@ -4299,7 +4716,7 @@ dissect_kerberos_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
 
     saved_private_data=pinfo->private_data;
     pinfo->private_data=cb;
-    do_col_info=dci;
+    gbl_do_col_info=dci;
 
     if (have_rm) {
        krb_rm = tvb_get_ntohl(tvb, offset);
@@ -4312,8 +4729,7 @@ dissect_kerberos_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
            return (-1);
        }
        if (do_col_protocol) {
-            if (check_col(pinfo->cinfo, COL_PROTOCOL))
-                col_set_str(pinfo->cinfo, COL_PROTOCOL, "KRB5");
+            col_set_str(pinfo->cinfo, COL_PROTOCOL, "KRB5");
        }
         if (tree) {
             item = proto_tree_add_item(tree, proto_kerberos, tvb, 0, -1, FALSE);
@@ -4322,7 +4738,7 @@ dissect_kerberos_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
        show_krb_recordmark(kerberos_tree, tvb, offset, krb_rm);
        offset += 4;
     } else {
-        /* Do some sanity checking here, 
+        /* Do some sanity checking here,
          * All krb5 packets start with a TAG class that is BER_CLASS_APP
          * and a tag value that is either of the values below:
          * If it doesnt look like kerberos, return 0 and let someone else have
@@ -4334,6 +4750,7 @@ dissect_kerberos_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
 
        get_ber_identifier(tvb, offset, &tmp_class, &tmp_pc, &tmp_tag);
         if(tmp_class!=BER_CLASS_APP){
+           pinfo->private_data=saved_private_data;
             return 0;
         }
         switch(tmp_tag){
@@ -4356,24 +4773,24 @@ dissect_kerberos_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
             case KRB5_MSG_ERROR:
                 break;
             default:
+                pinfo->private_data=saved_private_data;
                 return 0;
         }
        if (do_col_protocol) {
-            if (check_col(pinfo->cinfo, COL_PROTOCOL))
-                col_set_str(pinfo->cinfo, COL_PROTOCOL, "KRB5");
+            col_set_str(pinfo->cinfo, COL_PROTOCOL, "KRB5");
        }
-       if (do_col_info) {
-            if (check_col(pinfo->cinfo, COL_INFO))
-                col_clear(pinfo->cinfo, COL_INFO);
+       if (gbl_do_col_info) {
+            col_clear(pinfo->cinfo, COL_INFO);
         }
         if (tree) {
             item = proto_tree_add_item(tree, proto_kerberos, tvb, 0, -1, FALSE);
             kerberos_tree = proto_item_add_subtree(item, ett_krb_kerberos);
         }
     }
+       asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
 
     TRY {
-       offset=dissect_ber_choice(pinfo, kerberos_tree, tvb, offset, kerberos_applications_choice, -1, -1, NULL);
+       offset=dissect_ber_old_choice(&asn1_ctx, kerberos_tree, tvb, offset, kerberos_applications_choice, -1, -1, NULL);
     } CATCH_ALL {
        pinfo->private_data=saved_private_data;
        RETHROW;
@@ -4398,7 +4815,7 @@ proto_register_kerberos(void)
     static hf_register_info hf[] = {
        { &hf_krb_rm_reserved, {
            "Reserved", "kerberos.rm.reserved", FT_BOOLEAN, 32,
-           &bitval, KRB_RM_RESERVED, "Record mark reserved bit", HFILL }},
+           TFS(&tfs_set_notset), KRB_RM_RESERVED, "Record mark reserved bit", HFILL }},
        { &hf_krb_rm_reclen, {
            "Record Length", "kerberos.rm.length", FT_UINT32, BASE_DEC,
            NULL, KRB_RM_RECLEN, "Record length", HFILL }},
@@ -4406,13 +4823,13 @@ proto_register_kerberos(void)
            "Type", "kerberos.transited.type", FT_UINT32, BASE_DEC,
            VALS(krb5_transited_types), 0, "Transited Type", HFILL }},
        { &hf_krb_transitedcontents, {
-           "Contents", "kerberos.transited.contents", FT_BYTES, BASE_HEX,
-           NULL, 0, "Transitent Contents string", HFILL }},
+           "Contents", "kerberos.transited.contents", FT_BYTES, BASE_NONE,
+           NULL, 0, "Transited Contents string", HFILL }},
        { &hf_krb_keytype, {
            "Key type", "kerberos.keytype", FT_UINT32, BASE_DEC,
            VALS(krb5_encryption_types), 0, "Key Type", HFILL }},
        { &hf_krb_keyvalue, {
-           "Key value", "kerberos.keyvalue", FT_BYTES, BASE_HEX,
+           "Key value", "kerberos.keyvalue", FT_BYTES, BASE_NONE,
            NULL, 0, "Key value (encryption key)", HFILL }},
        { &hf_krb_adtype, {
            "Type", "kerberos.adtype", FT_UINT32, BASE_DEC,
@@ -4421,10 +4838,10 @@ proto_register_kerberos(void)
            "Type", "kerberos.IF_RELEVANT.type", FT_UINT32, BASE_DEC,
            VALS(krb5_ad_types), 0, "IF-RELEVANT Data Type", HFILL }},
        { &hf_krb_advalue, {
-           "Data", "kerberos.advalue", FT_BYTES, BASE_HEX,
+           "Data", "kerberos.advalue", FT_BYTES, BASE_NONE,
            NULL, 0, "Authentication Data", HFILL }},
        { &hf_krb_IF_RELEVANT_value, {
-           "Data", "kerberos.IF_RELEVANT.value", FT_BYTES, BASE_HEX,
+           "Data", "kerberos.IF_RELEVANT.value", FT_BYTES, BASE_NONE,
            NULL, 0, "IF_RELEVANT Data", HFILL }},
        { &hf_krb_etype, {
            "Encryption type", "kerberos.etype", FT_INT32, BASE_DEC,
@@ -4443,7 +4860,10 @@ proto_register_kerberos(void)
            VALS(krb5_lr_types), 0, "Type of lastreq value", HFILL }},
        { &hf_krb_address_ip, {
            "IP Address", "kerberos.addr_ip", FT_IPv4, BASE_NONE,
-           NULL, 0, "IP Address", HFILL }},
+           NULL, 0, NULL, HFILL }},
+       { &hf_krb_address_ipv6, {
+           "IPv6 Address", "kerberos.addr_ipv6", FT_IPv6, BASE_NONE,
+           NULL, 0, NULL, HFILL }},
        { &hf_krb_address_netbios, {
            "NetBIOS Address", "kerberos.addr_nb", FT_STRING, BASE_NONE,
            NULL, 0, "NetBIOS Address and type", HFILL }},
@@ -4510,6 +4930,9 @@ proto_register_kerberos(void)
        { &hf_krb_e_text, {
            "e-text", "kerberos.e_text", FT_STRING, BASE_NONE,
            NULL, 0, "Additional (human readable) error description", HFILL }},
+       { &hf_krb_s4u2self_auth, {
+           "S4U2Self Auth", "kerberos.s4u2self.auth", FT_STRING, BASE_NONE,
+           NULL, 0, "S4U2Self authentication string", HFILL }},
        { &hf_krb_realm, {
            "Realm", "kerberos.realm", FT_STRING, BASE_NONE,
            NULL, 0, "Name of the Kerberos Realm", HFILL }},
@@ -4529,29 +4952,29 @@ proto_register_kerberos(void)
            "MSG Type", "kerberos.msg.type", FT_UINT32, BASE_DEC,
            VALS(krb5_msg_types), 0, "Kerberos Message Type", HFILL }},
        { &hf_krb_APOptions, {
-           "APOptions", "kerberos.apoptions", FT_BYTES, BASE_HEX,
+           "APOptions", "kerberos.apoptions", FT_BYTES, BASE_NONE,
            NULL, 0, "Kerberos APOptions bitstring", HFILL }},
        { &hf_krb_APOptions_use_session_key, {
            "Use Session Key", "kerberos.apoptions.use_session_key", FT_BOOLEAN, 32,
-           TFS(&krb5_apoptions_use_session_key), 0x40000000, "", HFILL }},
+           TFS(&krb5_apoptions_use_session_key), 0x40000000, NULL, HFILL }},
        { &hf_krb_APOptions_mutual_required, {
            "Mutual required", "kerberos.apoptions.mutual_required", FT_BOOLEAN, 32,
-           TFS(&krb5_apoptions_mutual_required), 0x20000000, "", HFILL }},
+           TFS(&krb5_apoptions_mutual_required), 0x20000000, NULL, HFILL }},
        { &hf_krb_KDCOptions, {
-           "KDCOptions", "kerberos.kdcoptions", FT_BYTES, BASE_HEX,
+           "KDCOptions", "kerberos.kdcoptions", FT_BYTES, BASE_NONE,
            NULL, 0, "Kerberos KDCOptions bitstring", HFILL }},
        { &hf_krb_TicketFlags, {
            "Ticket Flags", "kerberos.ticketflags", FT_NONE, BASE_NONE,
            NULL, 0, "Kerberos Ticket Flags", HFILL }},
        { &hf_krb_TicketFlags_forwardable, {
            "Forwardable", "kerberos.ticketflags.forwardable", FT_BOOLEAN, 32,
-           TFS(&krb5_ticketflags_forwardable), 0x40000000, "Flag controlling whether the tickes are forwardable or not", HFILL }},
+           TFS(&krb5_ticketflags_forwardable), 0x40000000, "Flag controlling whether the tickets are forwardable or not", HFILL }},
        { &hf_krb_TicketFlags_forwarded, {
            "Forwarded", "kerberos.ticketflags.forwarded", FT_BOOLEAN, 32,
            TFS(&krb5_ticketflags_forwarded), 0x20000000, "Has this ticket been forwarded?", HFILL }},
-       { &hf_krb_TicketFlags_proxyable, {
-           "Proxyable", "kerberos.ticketflags.proxyable", FT_BOOLEAN, 32,
-           TFS(&krb5_ticketflags_proxyable), 0x10000000, "Flag controlling whether the tickes are proxyable or not", HFILL }},
+       { &hf_krb_TicketFlags_proxiable, {
+           "Proxiable", "kerberos.ticketflags.proxiable", FT_BOOLEAN, 32,
+           TFS(&krb5_ticketflags_proxiable), 0x10000000, "Flag controlling whether the tickets are proxiable or not", HFILL }},
        { &hf_krb_TicketFlags_proxy, {
            "Proxy", "kerberos.ticketflags.proxy", FT_BOOLEAN, 32,
            TFS(&krb5_ticketflags_proxy), 0x08000000, "Has this ticket been proxied?", HFILL }},
@@ -4596,13 +5019,13 @@ proto_register_kerberos(void)
            NULL, 0, "Kerberos Encrypted PRIVate blob data", HFILL }},
        { &hf_krb_KDCOptions_forwardable, {
            "Forwardable", "kerberos.kdcoptions.forwardable", FT_BOOLEAN, 32,
-           TFS(&krb5_kdcoptions_forwardable), 0x40000000, "Flag controlling whether the tickes are forwardable or not", HFILL }},
+           TFS(&krb5_kdcoptions_forwardable), 0x40000000, "Flag controlling whether the tickets are forwardable or not", HFILL }},
        { &hf_krb_KDCOptions_forwarded, {
            "Forwarded", "kerberos.kdcoptions.forwarded", FT_BOOLEAN, 32,
            TFS(&krb5_kdcoptions_forwarded), 0x20000000, "Has this ticket been forwarded?", HFILL }},
-       { &hf_krb_KDCOptions_proxyable, {
-           "Proxyable", "kerberos.kdcoptions.proxyable", FT_BOOLEAN, 32,
-           TFS(&krb5_kdcoptions_proxyable), 0x10000000, "Flag controlling whether the tickes are proxyable or not", HFILL }},
+       { &hf_krb_KDCOptions_proxiable, {
+           "Proxiable", "kerberos.kdcoptions.proxiable", FT_BOOLEAN, 32,
+           TFS(&krb5_kdcoptions_proxiable), 0x10000000, "Flag controlling whether the tickets are proxiable or not", HFILL }},
        { &hf_krb_KDCOptions_proxy, {
            "Proxy", "kerberos.kdcoptions.proxy", FT_BOOLEAN, 32,
            TFS(&krb5_kdcoptions_proxy), 0x08000000, "Has this ticket been proxied?", HFILL }},
@@ -4652,70 +5075,76 @@ proto_register_kerberos(void)
            "Authenticator vno", "kerberos.authenticator_vno", FT_UINT32, BASE_DEC,
            NULL, 0, "Version Number for the Authenticator", HFILL }},
        { &hf_krb_encrypted_authenticator_data, {
-           "Authenticator data", "kerberos.authenticator.data", FT_BYTES, BASE_HEX,
+           "Authenticator data", "kerberos.authenticator.data", FT_BYTES, BASE_NONE,
            NULL, 0, "Data content of an encrypted authenticator", HFILL }},
        { &hf_krb_encrypted_EncKrbCredPart, {
-           "enc EncKrbCredPart", "kerberos.EncKrbCredPart.encrypted", FT_BYTES, BASE_HEX,
+           "enc EncKrbCredPart", "kerberos.EncKrbCredPart.encrypted", FT_BYTES, BASE_NONE,
            NULL, 0, "Encrypted EncKrbCredPart blob", HFILL }},
        { &hf_krb_encrypted_PA_ENC_TIMESTAMP, {
-           "enc PA_ENC_TIMESTAMP", "kerberos.PA_ENC_TIMESTAMP.encrypted", FT_BYTES, BASE_HEX,
+           "enc PA_ENC_TIMESTAMP", "kerberos.PA_ENC_TIMESTAMP.encrypted", FT_BYTES, BASE_NONE,
            NULL, 0, "Encrypted PA-ENC-TIMESTAMP blob", HFILL }},
+       { &hf_krb_encrypted_enc_authorization_data, {
+           "enc-authorization-data", "kerberos.enc_authorization_data.encrypted", FT_BYTES, BASE_NONE,
+           NULL, 0, NULL, HFILL }},
        { &hf_krb_PAC_LOGON_INFO, {
-           "PAC_LOGON_INFO", "kerberos.PAC_LOGON_INFO", FT_BYTES, BASE_HEX,
+           "PAC_LOGON_INFO", "kerberos.PAC_LOGON_INFO", FT_BYTES, BASE_NONE,
            NULL, 0, "PAC_LOGON_INFO structure", HFILL }},
        { &hf_krb_PAC_CREDENTIAL_TYPE, {
-           "PAC_CREDENTIAL_TYPE", "kerberos.PAC_CREDENTIAL_TYPE", FT_BYTES, BASE_HEX,
+           "PAC_CREDENTIAL_TYPE", "kerberos.PAC_CREDENTIAL_TYPE", FT_BYTES, BASE_NONE,
            NULL, 0, "PAC_CREDENTIAL_TYPE structure", HFILL }},
        { &hf_krb_PAC_SERVER_CHECKSUM, {
-           "PAC_SERVER_CHECKSUM", "kerberos.PAC_SERVER_CHECKSUM", FT_BYTES, BASE_HEX,
+           "PAC_SERVER_CHECKSUM", "kerberos.PAC_SERVER_CHECKSUM", FT_BYTES, BASE_NONE,
            NULL, 0, "PAC_SERVER_CHECKSUM structure", HFILL }},
        { &hf_krb_PAC_PRIVSVR_CHECKSUM, {
-           "PAC_PRIVSVR_CHECKSUM", "kerberos.PAC_PRIVSVR_CHECKSUM", FT_BYTES, BASE_HEX,
+           "PAC_PRIVSVR_CHECKSUM", "kerberos.PAC_PRIVSVR_CHECKSUM", FT_BYTES, BASE_NONE,
            NULL, 0, "PAC_PRIVSVR_CHECKSUM structure", HFILL }},
        { &hf_krb_PAC_CLIENT_INFO_TYPE, {
-           "PAC_CLIENT_INFO_TYPE", "kerberos.PAC_CLIENT_INFO_TYPE", FT_BYTES, BASE_HEX,
+           "PAC_CLIENT_INFO_TYPE", "kerberos.PAC_CLIENT_INFO_TYPE", FT_BYTES, BASE_NONE,
            NULL, 0, "PAC_CLIENT_INFO_TYPE structure", HFILL }},
        { &hf_krb_PAC_CONSTRAINED_DELEGATION, {
-           "PAC_CONSTRAINED_DELEGATION", "kerberos.PAC_CONSTRAINED_DELEGATION", FT_BYTES, BASE_HEX,
+           "PAC_CONSTRAINED_DELEGATION", "kerberos.PAC_CONSTRAINED_DELEGATION", FT_BYTES, BASE_NONE,
            NULL, 0, "PAC_CONSTRAINED_DELEGATION structure", HFILL }},
+       { &hf_krb_PAC_UPN_DNS_INFO, {
+           "UPN_DNS_INFO", "kerberos.PAC_UPN_DNS_INFO", FT_BYTES, BASE_NONE,
+           NULL, 0, "UPN_DNS_INFO structure", HFILL }},
        { &hf_krb_checksum_checksum, {
-           "checksum", "kerberos.checksum.checksum", FT_BYTES, BASE_HEX,
+           "checksum", "kerberos.checksum.checksum", FT_BYTES, BASE_NONE,
            NULL, 0, "Kerberos Checksum", HFILL }},
        { &hf_krb_ENC_PRIV, {
-           "enc PRIV", "kerberos.ENC_PRIV", FT_BYTES, BASE_HEX,
+           "enc PRIV", "kerberos.ENC_PRIV", FT_BYTES, BASE_NONE,
            NULL, 0, "Encrypted PRIV blob", HFILL }},
        { &hf_krb_encrypted_Ticket_data, {
-           "enc-part", "kerberos.ticket.data", FT_BYTES, BASE_HEX,
+           "enc-part", "kerberos.ticket.data", FT_BYTES, BASE_NONE,
            NULL, 0, "The encrypted part of a ticket", HFILL }},
        { &hf_krb_encrypted_AP_REP_data, {
-           "enc-part", "kerberos.aprep.data", FT_BYTES, BASE_HEX,
+           "enc-part", "kerberos.aprep.data", FT_BYTES, BASE_NONE,
            NULL, 0, "The encrypted part of AP-REP", HFILL }},
        { &hf_krb_encrypted_KDC_REP_data, {
-           "enc-part", "kerberos.kdcrep.data", FT_BYTES, BASE_HEX,
+           "enc-part", "kerberos.kdcrep.data", FT_BYTES, BASE_NONE,
            NULL, 0, "The encrypted part of KDC-REP", HFILL }},
        { &hf_krb_PA_DATA_value, {
-           "Value", "kerberos.padata.value", FT_BYTES, BASE_HEX,
+           "Value", "kerberos.padata.value", FT_BYTES, BASE_NONE,
            NULL, 0, "Content of the PADATA blob", HFILL }},
        { &hf_krb_etype_info_salt, {
-           "Salt", "kerberos.etype_info.salt", FT_BYTES, BASE_HEX,
-           NULL, 0, "Salt", HFILL }},
+           "Salt", "kerberos.etype_info.salt", FT_BYTES, BASE_NONE,
+           NULL, 0, NULL, HFILL }},
        { &hf_krb_etype_info2_salt, {
-           "Salt", "kerberos.etype_info2.salt", FT_BYTES, BASE_HEX,
-           NULL, 0, "Salt", HFILL }},
+           "Salt", "kerberos.etype_info2.salt", FT_BYTES, BASE_NONE,
+           NULL, 0, NULL, HFILL }},
        { &hf_krb_etype_info2_s2kparams, {
-           "Salt", "kerberos.etype_info.s2kparams", FT_BYTES, BASE_HEX,
+           "Salt", "kerberos.etype_info.s2kparams", FT_BYTES, BASE_NONE,
            NULL, 0, "S2kparams", HFILL }},
        { &hf_krb_SAFE_BODY_user_data, {
-           "User Data", "kerberos.SAFE_BODY.user_data", FT_BYTES, BASE_HEX,
+           "User Data", "kerberos.SAFE_BODY.user_data", FT_BYTES, BASE_NONE,
            NULL, 0, "SAFE BODY userdata field", HFILL }},
        { &hf_krb_PRIV_BODY_user_data, {
-           "User Data", "kerberos.PRIV_BODY.user_data", FT_BYTES, BASE_HEX,
+           "User Data", "kerberos.PRIV_BODY.user_data", FT_BYTES, BASE_NONE,
            NULL, 0, "PRIV BODY userdata field", HFILL }},
        { &hf_krb_pac_signature_signature, {
-           "Signature", "kerberos.pac.signature.signature", FT_BYTES, BASE_HEX,
+           "Signature", "kerberos.pac.signature.signature", FT_BYTES, BASE_NONE,
            NULL, 0, "A PAC signature blob", HFILL }},
        { &hf_krb_PA_DATA_type, {
-           "Type", "kerberos.padata.type", FT_UINT32, BASE_DEC,
+                "Type", "kerberos.padata.type", FT_INT32, BASE_DEC,
            VALS(krb5_preauthentication_types), 0, "Type of preauthentication data", HFILL }},
        { &hf_krb_nonce, {
            "Nonce", "kerberos.nonce", FT_UINT32, BASE_DEC,
@@ -4724,109 +5153,109 @@ proto_register_kerberos(void)
            "Tkt-vno", "kerberos.tkt_vno", FT_UINT32, BASE_DEC,
            NULL, 0, "Version number for the Ticket format", HFILL }},
        { &hf_krb_KrbCredInfo, {
-           "KrbCredInfo", "kerberos.KrbCredInfo", FT_NONE, BASE_DEC,
+           "KrbCredInfo", "kerberos.KrbCredInfo", FT_NONE, BASE_NONE,
            NULL, 0, "This is a Kerberos KrbCredInfo", HFILL }},
        { &hf_krb_HostAddress, {
-           "HostAddress", "kerberos.hostaddress", FT_NONE, BASE_DEC,
+           "HostAddress", "kerberos.hostaddress", FT_NONE, BASE_NONE,
            NULL, 0, "This is a Kerberos HostAddress sequence", HFILL }},
        { &hf_krb_s_address, {
-           "S-Address", "kerberos.s_address", FT_NONE, BASE_DEC,
+           "S-Address", "kerberos.s_address", FT_NONE, BASE_NONE,
            NULL, 0, "This is the Senders address", HFILL }},
        { &hf_krb_r_address, {
-           "R-Address", "kerberos.r_address", FT_NONE, BASE_DEC,
+           "R-Address", "kerberos.r_address", FT_NONE, BASE_NONE,
            NULL, 0, "This is the Recipient address", HFILL }},
        { &hf_krb_key, {
-           "key", "kerberos.key", FT_NONE, BASE_DEC,
+           "key", "kerberos.key", FT_NONE, BASE_NONE,
            NULL, 0, "This is a Kerberos EncryptionKey sequence", HFILL }},
        { &hf_krb_subkey, {
-           "Subkey", "kerberos.subkey", FT_NONE, BASE_DEC,
+           "Subkey", "kerberos.subkey", FT_NONE, BASE_NONE,
            NULL, 0, "This is a Kerberos subkey", HFILL }},
        { &hf_krb_seq_number, {
            "Seq Number", "kerberos.seq_number", FT_UINT32, BASE_DEC,
            NULL, 0, "This is a Kerberos sequence number", HFILL }},
        { &hf_krb_AuthorizationData, {
-           "AuthorizationData", "kerberos.AuthorizationData", FT_NONE, BASE_DEC,
+           "AuthorizationData", "kerberos.AuthorizationData", FT_NONE, BASE_NONE,
            NULL, 0, "This is a Kerberos AuthorizationData sequence", HFILL }},
        { &hf_krb_EncTicketPart, {
-           "EncTicketPart", "kerberos.EncTicketPart", FT_NONE, BASE_DEC,
+           "EncTicketPart", "kerberos.EncTicketPart", FT_NONE, BASE_NONE,
            NULL, 0, "This is a decrypted Kerberos EncTicketPart sequence", HFILL }},
        { &hf_krb_EncAPRepPart, {
-           "EncAPRepPart", "kerberos.EncAPRepPart", FT_NONE, BASE_DEC,
+           "EncAPRepPart", "kerberos.EncAPRepPart", FT_NONE, BASE_NONE,
            NULL, 0, "This is a decrypted Kerberos EncAPRepPart sequence", HFILL }},
        { &hf_krb_EncKrbPrivPart, {
-           "EncKrbPrivPart", "kerberos.EncKrbPrivPart", FT_NONE, BASE_DEC,
+           "EncKrbPrivPart", "kerberos.EncKrbPrivPart", FT_NONE, BASE_NONE,
            NULL, 0, "This is a decrypted Kerberos EncKrbPrivPart sequence", HFILL }},
        { &hf_krb_EncKrbCredPart, {
-           "EncKrbCredPart", "kerberos.EncKrbCredPart", FT_NONE, BASE_DEC,
+           "EncKrbCredPart", "kerberos.EncKrbCredPart", FT_NONE, BASE_NONE,
            NULL, 0, "This is a decrypted Kerberos EncKrbCredPart sequence", HFILL }},
        { &hf_krb_EncKDCRepPart, {
-           "EncKDCRepPart", "kerberos.EncKDCRepPart", FT_NONE, BASE_DEC,
+           "EncKDCRepPart", "kerberos.EncKDCRepPart", FT_NONE, BASE_NONE,
            NULL, 0, "This is a decrypted Kerberos EncKDCRepPart sequence", HFILL }},
        { &hf_krb_LastReq, {
-           "LastReq", "kerberos.LastReq", FT_NONE, BASE_DEC,
+           "LastReq", "kerberos.LastReq", FT_NONE, BASE_NONE,
            NULL, 0, "This is a LastReq sequence", HFILL }},
        { &hf_krb_Authenticator, {
-           "Authenticator", "kerberos.Authenticator", FT_NONE, BASE_DEC,
+           "Authenticator", "kerberos.Authenticator", FT_NONE, BASE_NONE,
            NULL, 0, "This is a decrypted Kerberos Authenticator sequence", HFILL }},
        { &hf_krb_Checksum, {
-           "Checksum", "kerberos.Checksum", FT_NONE, BASE_DEC,
+           "Checksum", "kerberos.Checksum", FT_NONE, BASE_NONE,
            NULL, 0, "This is a Kerberos Checksum sequence", HFILL }},
        { &hf_krb_HostAddresses, {
-           "HostAddresses", "kerberos.hostaddresses", FT_NONE, BASE_DEC,
+           "HostAddresses", "kerberos.hostaddresses", FT_NONE, BASE_NONE,
            NULL, 0, "This is a list of Kerberos HostAddress sequences", HFILL }},
        { &hf_krb_IF_RELEVANT, {
-           "IF_RELEVANT", "kerberos.if_relevant", FT_NONE, BASE_DEC,
+           "IF_RELEVANT", "kerberos.if_relevant", FT_NONE, BASE_NONE,
            NULL, 0, "This is a list of IF-RELEVANT sequences", HFILL }},
        { &hf_krb_etypes, {
-           "Encryption Types", "kerberos.etypes", FT_NONE, BASE_DEC,
+           "Encryption Types", "kerberos.etypes", FT_NONE, BASE_NONE,
            NULL, 0, "This is a list of Kerberos encryption types", HFILL }},
        { &hf_krb_KrbCredInfos, {
-           "Sequence of KrbCredInfo", "kerberos.KrbCredInfos", FT_NONE, BASE_DEC,
+           "Sequence of KrbCredInfo", "kerberos.KrbCredInfos", FT_NONE, BASE_NONE,
            NULL, 0, "This is a list of KrbCredInfo", HFILL }},
        { &hf_krb_sq_tickets, {
-           "Tickets", "kerberos.sq.tickets", FT_NONE, BASE_DEC,
+           "Tickets", "kerberos.sq.tickets", FT_NONE, BASE_NONE,
            NULL, 0, "This is a list of Kerberos Tickets", HFILL }},
        { &hf_krb_LastReqs, {
-           "LastReqs", "kerberos.LastReqs", FT_NONE, BASE_DEC,
+           "LastReqs", "kerberos.LastReqs", FT_NONE, BASE_NONE,
            NULL, 0, "This is a list of LastReq structures", HFILL }},
        { &hf_krb_sname, {
-           "Server Name", "kerberos.sname", FT_NONE, BASE_DEC,
+           "Server Name", "kerberos.sname", FT_NONE, BASE_NONE,
            NULL, 0, "This is the name part server's identity", HFILL }},
        { &hf_krb_pname, {
-           "Delegated Principal Name", "kerberos.pname", FT_NONE, BASE_DEC,
+           "Delegated Principal Name", "kerberos.pname", FT_NONE, BASE_NONE,
            NULL, 0, "Identity of the delegated principal", HFILL }},
        { &hf_krb_cname, {
-           "Client Name", "kerberos.cname", FT_NONE, BASE_DEC,
+           "Client Name", "kerberos.cname", FT_NONE, BASE_NONE,
            NULL, 0, "The name part of the client principal identifier", HFILL }},
        { &hf_krb_authenticator_enc, {
-           "Authenticator", "kerberos.authenticator", FT_NONE, BASE_DEC,
+           "Authenticator", "kerberos.authenticator", FT_NONE, BASE_NONE,
            NULL, 0, "Encrypted authenticator blob", HFILL }},
        { &hf_krb_CRED_enc, {
-           "EncKrbCredPart", "kerberos.encrypted_cred", FT_NONE, BASE_DEC,
+           "EncKrbCredPart", "kerberos.encrypted_cred", FT_NONE, BASE_NONE,
            NULL, 0, "Encrypted Cred blob", HFILL }},
        { &hf_krb_ticket_enc, {
-           "enc-part", "kerberos.ticket.enc_part", FT_NONE, BASE_DEC,
+           "enc-part", "kerberos.ticket.enc_part", FT_NONE, BASE_NONE,
            NULL, 0, "The structure holding the encrypted part of a ticket", HFILL }},
        { &hf_krb_AP_REP_enc, {
-           "enc-part", "kerberos.aprep.enc_part", FT_NONE, BASE_DEC,
+           "enc-part", "kerberos.aprep.enc_part", FT_NONE, BASE_NONE,
            NULL, 0, "The structure holding the encrypted part of AP-REP", HFILL }},
        { &hf_krb_KDC_REP_enc, {
-           "enc-part", "kerberos.kdcrep.enc_part", FT_NONE, BASE_DEC,
+           "enc-part", "kerberos.kdcrep.enc_part", FT_NONE, BASE_NONE,
            NULL, 0, "The structure holding the encrypted part of KDC-REP", HFILL }},
        { &hf_krb_e_data, {
-           "e-data", "kerberos.e_data", FT_NONE, BASE_DEC,
+           "e-data", "kerberos.e_data", FT_NONE, BASE_NONE,
            NULL, 0, "The e-data blob", HFILL }},
        { &hf_krb_padata, {
-           "padata", "kerberos.padata", FT_NONE, BASE_DEC,
+           "padata", "kerberos.padata", FT_NONE, BASE_NONE,
            NULL, 0, "Sequence of preauthentication data", HFILL }},
        { &hf_krb_ticket, {
-           "Ticket", "kerberos.ticket", FT_NONE, BASE_DEC,
+           "Ticket", "kerberos.ticket", FT_NONE, BASE_NONE,
            NULL, 0, "This is a Kerberos Ticket", HFILL }},
        { &hf_krb_TransitedEncoding, {
-           "TransitedEncoding", "kerberos.TransitedEncoding", FT_NONE, BASE_DEC,
+           "TransitedEncoding", "kerberos.TransitedEncoding", FT_NONE, BASE_NONE,
            NULL, 0, "This is a Kerberos TransitedEncoding sequence", HFILL }},
        { &hf_krb_PA_PAC_REQUEST_flag, {
-           "PAC Request", "kerberos.pac_request.flag", FT_UINT32, BASE_DEC,
+                "PAC Request", "kerberos.pac_request.flag", FT_BOOLEAN, 32,
            NULL, 0, "This is a MS PAC Request Flag", HFILL }},
        { &hf_krb_w2k_pac_entries, {
            "Num Entries", "kerberos.pac.entries", FT_UINT32, BASE_DEC,
@@ -4844,38 +5273,62 @@ proto_register_kerberos(void)
            "Offset", "kerberos.pac.offset", FT_UINT32, BASE_DEC,
            NULL, 0, "Offset to W2k PAC entry", HFILL }},
        { &hf_krb_pac_clientid, {
-           "ClientID", "kerberos.pac.clientid", FT_ABSOLUTE_TIME, BASE_NONE,
+           "ClientID", "kerberos.pac.clientid", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
            NULL, 0, "ClientID Timestamp", HFILL }},
        { &hf_krb_pac_namelen, {
            "Name Length", "kerberos.pac.namelen", FT_UINT16, BASE_DEC,
            NULL, 0, "Length of client name", HFILL }},
+       { &hf_krb_pac_upn_flags, {
+           "Flags", "kerberos.pac.upn.flags", FT_UINT32, BASE_HEX,
+           NULL, 0, "UPN flags", HFILL }},
+       { &hf_krb_pac_upn_dns_offset, {
+           "DNS Offset", "kerberos.pac.upn.dns_offset", FT_UINT16, BASE_DEC,
+           NULL, 0, NULL, HFILL }},
+       { &hf_krb_pac_upn_dns_len, {
+           "DNS Len", "kerberos.pac.upn.dns_len", FT_UINT16, BASE_DEC,
+           NULL, 0, NULL, HFILL }},
+       { &hf_krb_pac_upn_upn_offset, {
+           "UPN Offset", "kerberos.pac.upn.upn_offset", FT_UINT16, BASE_DEC,
+           NULL, 0, NULL, HFILL }},
+       { &hf_krb_pac_upn_upn_len, {
+           "UPN Len", "kerberos.pac.upn.upn_len", FT_UINT16, BASE_DEC,
+           NULL, 0, NULL, HFILL }},
+       { &hf_krb_pac_upn_upn_name, {
+           "UPN Name", "kerberos.pac.upn.upn_name", FT_STRING, BASE_NONE,
+           NULL, 0, NULL, HFILL }},
+       { &hf_krb_pac_upn_dns_name, {
+           "DNS Name", "kerberos.pac.upn.dns_name", FT_STRING, BASE_NONE,
+           NULL, 0, NULL, HFILL }},
        { &hf_krb_e_checksum, {
-           "e-checksum", "kerberos.e_checksum", FT_NONE, BASE_DEC,
+           "e-checksum", "kerberos.e_checksum", FT_NONE, BASE_NONE,
            NULL, 0, "This is a Kerberos e-checksum", HFILL }},
        { &hf_krb_gssapi_len, {
            "Length", "kerberos.gssapi.len", FT_UINT32, BASE_DEC,
            NULL, 0, "Length of GSSAPI Bnd field", HFILL }},
        { &hf_krb_gssapi_bnd, {
-           "Bnd", "kerberos.gssapi.bdn", FT_BYTES, BASE_HEX,
+           "Bnd", "kerberos.gssapi.bdn", FT_BYTES, BASE_NONE,
            NULL, 0, "GSSAPI Bnd field", HFILL }},
        { &hf_krb_gssapi_c_flag_deleg, {
            "Deleg", "kerberos.gssapi.checksum.flags.deleg", FT_BOOLEAN, 32,
-           VALS(&tfs_gss_flags_deleg), KRB5_GSS_C_DELEG_FLAG, "", HFILL }},
+           TFS(&tfs_gss_flags_deleg), KRB5_GSS_C_DELEG_FLAG, NULL, HFILL }},
        { &hf_krb_gssapi_c_flag_mutual, {
            "Mutual", "kerberos.gssapi.checksum.flags.mutual", FT_BOOLEAN, 32,
-           VALS(&tfs_gss_flags_mutual), KRB5_GSS_C_MUTUAL_FLAG, "", HFILL }},
+           TFS(&tfs_gss_flags_mutual), KRB5_GSS_C_MUTUAL_FLAG, NULL, HFILL }},
        { &hf_krb_gssapi_c_flag_replay, {
            "Replay", "kerberos.gssapi.checksum.flags.replay", FT_BOOLEAN, 32,
-           VALS(&tfs_gss_flags_replay), KRB5_GSS_C_REPLAY_FLAG, "", HFILL }},
+           TFS(&tfs_gss_flags_replay), KRB5_GSS_C_REPLAY_FLAG, NULL, HFILL }},
        { &hf_krb_gssapi_c_flag_sequence, {
            "Sequence", "kerberos.gssapi.checksum.flags.sequence", FT_BOOLEAN, 32,
-           VALS(&tfs_gss_flags_sequence), KRB5_GSS_C_SEQUENCE_FLAG, "", HFILL }},
+           TFS(&tfs_gss_flags_sequence), KRB5_GSS_C_SEQUENCE_FLAG, NULL, HFILL }},
        { &hf_krb_gssapi_c_flag_conf, {
            "Conf", "kerberos.gssapi.checksum.flags.conf", FT_BOOLEAN, 32,
-           VALS(&tfs_gss_flags_conf), KRB5_GSS_C_CONF_FLAG, "", HFILL }},
+           TFS(&tfs_gss_flags_conf), KRB5_GSS_C_CONF_FLAG, NULL, HFILL }},
        { &hf_krb_gssapi_c_flag_integ, {
            "Integ", "kerberos.gssapi.checksum.flags.integ", FT_BOOLEAN, 32,
-           VALS(&tfs_gss_flags_integ), KRB5_GSS_C_INTEG_FLAG, "", HFILL }},
+           TFS(&tfs_gss_flags_integ), KRB5_GSS_C_INTEG_FLAG, NULL, HFILL }},
+       { &hf_krb_gssapi_c_flag_dce_style, {
+           "DCE-style", "kerberos.gssapi.checksum.flags.dce-style", FT_BOOLEAN, 32,
+           TFS(&tfs_gss_flags_dce_style), KRB5_GSS_C_DCE_STYLE, NULL, HFILL }},
        { &hf_krb_gssapi_dlgopt, {
            "DlgOpt", "kerberos.gssapi.dlgopt", FT_UINT16, BASE_DEC,
            NULL, 0, "GSSAPI DlgOpt", HFILL }},
@@ -4888,6 +5341,21 @@ proto_register_kerberos(void)
        { &hf_krb_smb_unknown,
                { "Unknown", "kerberos.smb.unknown", FT_UINT32, BASE_HEX,
                NULL, 0, "unknown", HFILL }},
+       { &hf_krb_midl_blob_len,
+               { "Blob Length", "kerberos.midl_blob_len", FT_UINT64, BASE_DEC,
+               NULL, 0, "Length of NDR encoded data that follows", HFILL }},
+
+       { &hf_krb_midl_fill_bytes,
+               { "Fill bytes", "kerberos.midl.fill_bytes", FT_UINT32, BASE_HEX,
+               NULL, 0, "Just some fill bytes", HFILL }},
+
+       { &hf_krb_midl_version,
+               { "Version", "kerberos.midl.version", FT_UINT8, BASE_DEC,
+               NULL, 0, "Version of pickling", HFILL }},
+
+       { &hf_krb_midl_hdr_len,
+               { "HDR Length", "kerberos.midl.hdr_len", FT_UINT16, BASE_DEC,
+               NULL, 0, "Length of header", HFILL }},
 
     };
 
@@ -4942,6 +5410,9 @@ proto_register_kerberos(void)
        &ett_krb_PAC_CLIENT_INFO_TYPE,
        &ett_krb_PAC_CONSTRAINED_DELEGATION,
        &ett_krb_e_checksum,
+       &ett_krb_PAC_MIDL_BLOB,
+       &ett_krb_PAC_DREP,
+       &ett_krb_PAC_UPN_DNS_INFO
     };
     module_t *krb_module;
 
@@ -4986,10 +5457,30 @@ static int wrap_dissect_gss_kerb(tvbuff_t *tvb, int offset, packet_info *pinfo,
 }
 
 
-static dcerpc_auth_subdissector_fns gss_kerb_auth_fns = {
+static dcerpc_auth_subdissector_fns gss_kerb_auth_connect_fns = {
+       wrap_dissect_gss_kerb,                  /* Bind */
+       wrap_dissect_gss_kerb,                  /* Bind ACK */
+       wrap_dissect_gss_kerb,                  /* AUTH3 */
+       NULL,                                   /* Request verifier */
+       NULL,                                   /* Response verifier */
+       NULL,                                   /* Request data */
+       NULL                                    /* Response data */
+};
+
+static dcerpc_auth_subdissector_fns gss_kerb_auth_sign_fns = {
        wrap_dissect_gss_kerb,                  /* Bind */
        wrap_dissect_gss_kerb,                  /* Bind ACK */
-       NULL,                                   /* AUTH3 */
+       wrap_dissect_gss_kerb,                  /* AUTH3 */
+       wrap_dissect_gssapi_verf,               /* Request verifier */
+       wrap_dissect_gssapi_verf,               /* Response verifier */
+       NULL,                                   /* Request data */
+       NULL                                    /* Response data */
+};
+
+static dcerpc_auth_subdissector_fns gss_kerb_auth_seal_fns = {
+       wrap_dissect_gss_kerb,                  /* Bind */
+       wrap_dissect_gss_kerb,                  /* Bind ACK */
+       wrap_dissect_gss_kerb,                  /* AUTH3 */
        wrap_dissect_gssapi_verf,               /* Request verifier */
        wrap_dissect_gssapi_verf,               /* Response verifier */
        wrap_dissect_gssapi_payload,            /* Request data */
@@ -5011,13 +5502,17 @@ proto_reg_handoff_kerberos(void)
     dissector_add("udp.port", UDP_PORT_KERBEROS, kerberos_handle_udp);
     dissector_add("tcp.port", TCP_PORT_KERBEROS, kerberos_handle_tcp);
 
+    register_dcerpc_auth_subdissector(DCE_C_AUTHN_LEVEL_CONNECT,
+                                     DCE_C_RPC_AUTHN_PROTOCOL_GSS_KERBEROS,
+                                     &gss_kerb_auth_connect_fns);
+
     register_dcerpc_auth_subdissector(DCE_C_AUTHN_LEVEL_PKT_INTEGRITY,
                                      DCE_C_RPC_AUTHN_PROTOCOL_GSS_KERBEROS,
-                                     &gss_kerb_auth_fns);
+                                     &gss_kerb_auth_sign_fns);
 
     register_dcerpc_auth_subdissector(DCE_C_AUTHN_LEVEL_PKT_PRIVACY,
                                      DCE_C_RPC_AUTHN_PROTOCOL_GSS_KERBEROS,
-                                     &gss_kerb_auth_fns);
+                                     &gss_kerb_auth_seal_fns);
 
 }