Use new BER functions in kpasswd.

Added RFC 3244 ChangePasswdData to the kerberos dissector.

This is the last dissector using the "old BER" functions.

Change-Id: I1d79047103c07c268d08e652745391f1ac37c82c
Reviewed-on: https://code.wireshark.org/review/1198
Reviewed-by: Tomáš Kukosa <tomas.kukosa@unify.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Stig Bjørlykke 2014-04-18 21:27:30 +02:00 committed by Anders Broman
parent d35f09761e
commit 1fb902f217
7 changed files with 55 additions and 23 deletions

View File

@ -33,6 +33,7 @@ set( EXT_ASN_FILE_LIST
set( ASN_FILE_LIST
KerberosV5Spec2.asn
k5.asn
RFC3244.asn
)
set( EXTRA_DIST

View File

@ -26,10 +26,9 @@ EXT_ASN_FILE_LIST =
ASN_FILE_LIST = \
KerberosV5Spec2.asn \
k5.asn
k5.asn \
RFC3244.asn
# The packet-$(PROTOCOL_NAME)-template.h and $(PROTOCOL_NAME).asn
# files do not exist # for all protocols: Please add/remove as required.
EXTRA_DIST = \
$(ASN_FILE_LIST) \
packet-$(PROTOCOL_NAME)-template.c \

12
asn1/kerberos/RFC3244.asn Normal file
View File

@ -0,0 +1,12 @@
-- Extracted from RFC 3244
RFC3244 DEFINITIONS ::=
BEGIN
ChangePasswdData ::= SEQUENCE {
newpasswd[0] OCTET STRING,
targname[1] PrincipalName OPTIONAL,
targrealm[2] Realm OPTIONAL
}
END

View File

@ -2,6 +2,9 @@
# kerberos conformation file
# Copyright 2008 Anders Broman
#.EXPORTS
ChangePasswdData
#.FIELD_RENAME
#EncryptedData/etype encryptedData_etype
KDC-REQ-BODY/etype kDC-REQ-BODY_etype

View File

@ -1,7 +1,7 @@
/* Do not modify this file. Changes will be overwritten. */
/* Generated automatically by the ASN.1 to Wireshark dissector compiler */
/* packet-kerberos.c */
/* ../../tools/asn2wrs.py -b -p kerberos -c ./kerberos.cnf -s ./packet-kerberos-template -D . -O ../../epan/dissectors KerberosV5Spec2.asn k5.asn */
/* ../../tools/asn2wrs.py -b -p kerberos -c ./kerberos.cnf -s ./packet-kerberos-template -D . -O ../../epan/dissectors KerberosV5Spec2.asn k5.asn RFC3244.asn */
/* Input file: packet-kerberos-template.c */
@ -276,6 +276,9 @@ static int hf_kerberos_ETYPE_INFO2_item = -1; /* ETYPE_INFO2_ENTRY */
static int hf_kerberos_name = -1; /* PrincipalName */
static int hf_kerberos_auth = -1; /* GeneralString */
static int hf_kerberos_include_pac = -1; /* BOOLEAN */
static int hf_kerberos_newpasswd = -1; /* OCTET_STRING */
static int hf_kerberos_targname = -1; /* PrincipalName */
static int hf_kerberos_targrealm = -1; /* Realm */
/* named bits */
static int hf_kerberos_APOptions_reserved = -1;
static int hf_kerberos_APOptions_use_session_key = -1;
@ -378,6 +381,7 @@ static gint ett_kerberos_TicketFlags = -1;
static gint ett_kerberos_KDCOptions = -1;
static gint ett_kerberos_PA_S4U2Self = -1;
static gint ett_kerberos_KERB_PA_PAC_REQUEST = -1;
static gint ett_kerberos_ChangePasswdData = -1;
/*--- End of included file: packet-kerberos-ett.c ---*/
#line 153 "../../asn1/kerberos/packet-kerberos-template.c"
@ -3922,6 +3926,22 @@ dissect_kerberos_KERB_PA_PAC_REQUEST(gboolean implicit_tag _U_, tvbuff_t *tvb _U
}
static const ber_sequence_t ChangePasswdData_sequence[] = {
{ &hf_kerberos_newpasswd , BER_CLASS_CON, 0, 0, dissect_kerberos_OCTET_STRING },
{ &hf_kerberos_targname , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_kerberos_PrincipalName },
{ &hf_kerberos_targrealm , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_kerberos_Realm },
{ NULL, 0, 0, 0, NULL }
};
int
dissect_kerberos_ChangePasswdData(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
ChangePasswdData_sequence, hf_index, ett_kerberos_ChangePasswdData);
return offset;
}
/*--- End of included file: packet-kerberos-fn.c ---*/
#line 1687 "../../asn1/kerberos/packet-kerberos-template.c"
@ -4713,6 +4733,18 @@ void proto_register_kerberos(void) {
{ "include-pac", "kerberos.include_pac",
FT_BOOLEAN, BASE_NONE, NULL, 0,
"BOOLEAN", HFILL }},
{ &hf_kerberos_newpasswd,
{ "newpasswd", "kerberos.newpasswd",
FT_BYTES, BASE_NONE, NULL, 0,
"OCTET_STRING", HFILL }},
{ &hf_kerberos_targname,
{ "targname", "kerberos.targname_element",
FT_NONE, BASE_NONE, NULL, 0,
"PrincipalName", HFILL }},
{ &hf_kerberos_targrealm,
{ "targrealm", "kerberos.targrealm",
FT_STRING, BASE_NONE, NULL, 0,
"Realm", HFILL }},
{ &hf_kerberos_APOptions_reserved,
{ "reserved", "kerberos.reserved",
FT_BOOLEAN, 8, NULL, 0x80,
@ -4929,6 +4961,7 @@ void proto_register_kerberos(void) {
&ett_kerberos_KDCOptions,
&ett_kerberos_PA_S4U2Self,
&ett_kerberos_KERB_PA_PAC_REQUEST,
&ett_kerberos_ChangePasswdData,
/*--- End of included file: packet-kerberos-ettarr.c ---*/
#line 1993 "../../asn1/kerberos/packet-kerberos-template.c"

View File

@ -1,7 +1,7 @@
/* Do not modify this file. Changes will be overwritten. */
/* Generated automatically by the ASN.1 to Wireshark dissector compiler */
/* packet-kerberos.h */
/* ../../tools/asn2wrs.py -b -p kerberos -c ./kerberos.cnf -s ./packet-kerberos-template -D . -O ../../epan/dissectors KerberosV5Spec2.asn k5.asn */
/* ../../tools/asn2wrs.py -b -p kerberos -c ./kerberos.cnf -s ./packet-kerberos-template -D . -O ../../epan/dissectors KerberosV5Spec2.asn k5.asn RFC3244.asn */
/* Input file: packet-kerberos-template.h */
@ -105,6 +105,7 @@ void read_keytab_file_from_preferences(void);
/*--- Included file: packet-kerberos-exp.h ---*/
#line 1 "../../asn1/kerberos/packet-kerberos-exp.h"
int dissect_kerberos_ChangePasswdData(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
/*--- End of included file: packet-kerberos-exp.h ---*/
#line 98 "../../asn1/kerberos/packet-kerberos-template.h"

View File

@ -29,7 +29,6 @@
#include <epan/asn1.h>
#include "packet-tcp.h"
#include "packet-kerberos.h"
#include "packet-ber.h"
#include <epan/prefs.h>
void proto_register_kpasswd(void);
@ -52,7 +51,6 @@ static int hf_kpasswd_ChangePasswdData = -1;
static gint ett_kpasswd = -1;
static gint ett_ap_req_data = -1;
static gint ett_krb_priv_message = -1;
static gint ett_ChangePasswdData = -1;
#define UDP_PORT_KPASSWD 464
@ -80,20 +78,6 @@ dissect_kpasswd_ap_req_data(packet_info *pinfo _U_, tvbuff_t *tvb, proto_tree *p
dissect_kerberos_main(tvb, pinfo, tree, FALSE, NULL);
}
static int dissect_kpasswd_newpassword(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_)
{
offset=dissect_ber_octet_string_wcb(FALSE, actx, tree, tvb, offset, hf_kpasswd_newpassword, NULL);
return offset;
}
static ber_old_sequence_t ChangePasswdData_sequence[] = {
{ BER_CLASS_CON, 0, 0, dissect_kpasswd_newpassword },
{ BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_krb5_cname },
{ BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_krb5_realm },
{ 0, 0, 0, NULL }
};
static int
dissect_kpasswd_user_data_request(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree)
{
@ -101,7 +85,7 @@ dissect_kpasswd_user_data_request(packet_info *pinfo, tvbuff_t *tvb, proto_tree
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
offset=dissect_ber_old_sequence(FALSE, &asn1_ctx, tree, tvb, offset, ChangePasswdData_sequence, hf_kpasswd_ChangePasswdData, ett_ChangePasswdData);
offset=dissect_kerberos_ChangePasswdData (FALSE, tvb, offset, &asn1_ctx, tree, hf_kpasswd_ChangePasswdData);
return offset;
}
@ -318,7 +302,6 @@ proto_register_kpasswd(void)
&ett_kpasswd,
&ett_ap_req_data,
&ett_krb_priv_message,
&ett_ChangePasswdData,
};
module_t *kpasswd_module;