From 9bd868fae7d0182dbc2eff4ca1d3b5296c3bab35 Mon Sep 17 00:00:00 2001 From: Graeme Lunt Date: Sun, 13 Apr 2008 16:14:03 +0000 Subject: Support for RFC 4530 - LDAP entryUUID attribute. svn path=/trunk/; revision=24984 --- asn1/x509sat/SelectedAttributeTypes.asn | 2 +- asn1/x509sat/x509sat.cnf | 28 +++++++++++++++++++++- epan/dissectors/packet-x509sat.c | 42 +++++++++++++++++++++++++++++++-- 3 files changed, 68 insertions(+), 4 deletions(-) diff --git a/asn1/x509sat/SelectedAttributeTypes.asn b/asn1/x509sat/SelectedAttributeTypes.asn index 5bfd5449cc..140f42beae 100644 --- a/asn1/x509sat/SelectedAttributeTypes.asn +++ b/asn1/x509sat/SelectedAttributeTypes.asn @@ -1481,7 +1481,7 @@ SyntaxGraphicString ::= GraphicString SyntaxISO646String ::= ISO646String SyntaxVisibleString ::= VisibleString SyntaxGeneralString ::= GeneralString - +GUID ::= OCTET STRING END -- SelectedAttributeTypes diff --git a/asn1/x509sat/x509sat.cnf b/asn1/x509sat/x509sat.cnf index 3bbd5dfab0..526024d595 100644 --- a/asn1/x509sat/x509sat.cnf +++ b/asn1/x509sat/x509sat.cnf @@ -3,6 +3,9 @@ # $Id$ +#.TYPE_ATTR +GUID TYPE = FT_GUID DISPLAY = BASE_NONE STRING = NULL BITMASK = 0 + #.IMPORT ../x509if/x509if-exp.cnf #.EXPORTS @@ -267,7 +270,8 @@ SyntaxIA5String B "0.9.2342.19200300.100.1.25" "dc" # Microsoft-specific # GeneralName other-name -SyntaxUTF8String B "1.3.6.1.4.1.311.20.2.3" "id-ms-user-principal-name" +SyntaxBMPString B "1.3.6.1.4.1.311.20.2" "id-ms-certificate-template-name" +SyntaxUTF8String B "1.3.6.1.4.1.311.20.2.3" "id-ms-user-principal-name" # unknown X.420 PerRecipientExtensionField Integer B "1.2.826.0.1063.7.0.0.0" "unknown-UK-organisation-defined-extension" @@ -278,6 +282,9 @@ SyntaxIA5String B "1.2.826.0.1004.10.1.1" "nexor-originating-ua" # X.420 Message Store Attributes - see x420.cnf Boolean B "2.6.1.6.3" "id-sat-ipm-auto-discarded" +# RFC 4530 +GUID B "1.3.6.1.1.16.4" "entryUUID" + #.NO_EMIT #.TYPE_RENAME @@ -308,6 +315,25 @@ XDayOf/fifth fifth_dayof #.END +#.FN_BODY GUID + gint8 class; + gboolean pc; + gint32 tag; + guint32 len; + e_guid_t uuid; + + if(!implicit_tag){ + offset=dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag); + offset=dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, NULL); + } else { + gint32 remaining=tvb_length_remaining(tvb, offset); + len=remaining>0 ? remaining : 0; + } + + tvb_get_ntohguid (tvb, offset, &uuid); + actx->created_item = proto_tree_add_guid(tree, hf_index, tvb, offset, len, &uuid); +#.END + #.END diff --git a/epan/dissectors/packet-x509sat.c b/epan/dissectors/packet-x509sat.c index 3eaaa9cb4d..943228fbfe 100644 --- a/epan/dissectors/packet-x509sat.c +++ b/epan/dissectors/packet-x509sat.c @@ -97,6 +97,7 @@ static int hf_x509sat_SyntaxGraphicString_PDU = -1; /* SyntaxGraphicString */ static int hf_x509sat_SyntaxISO646String_PDU = -1; /* SyntaxISO646String */ static int hf_x509sat_SyntaxVisibleString_PDU = -1; /* SyntaxVisibleString */ static int hf_x509sat_SyntaxGeneralString_PDU = -1; /* SyntaxGeneralString */ +static int hf_x509sat_GUID_PDU = -1; /* GUID */ static int hf_x509sat_teletexString = -1; /* TeletexString */ static int hf_x509sat_printableString = -1; /* PrintableString */ static int hf_x509sat_universalString = -1; /* UniversalString */ @@ -1511,7 +1512,7 @@ dissect_x509sat_SyntaxIA5String(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in static int dissect_x509sat_SyntaxBMPString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 298 "x509sat.cnf" +#line 305 "x509sat.cnf" tvbuff_t *wide_tvb = NULL; char *string; @@ -1519,7 +1520,7 @@ dissect_x509sat_SyntaxBMPString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in actx, tree, tvb, offset, hf_index, &wide_tvb); -#line 303 "x509sat.cnf" +#line 310 "x509sat.cnf" if (! wide_tvb) { return offset; } @@ -1629,6 +1630,32 @@ dissect_x509sat_SyntaxGeneralString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_ return offset; } + + +static int +dissect_x509sat_GUID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +#line 316 "x509sat.cnf" + gint8 class; + gboolean pc; + gint32 tag; + guint32 len; + e_guid_t uuid; + + if(!implicit_tag){ + offset=dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag); + offset=dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, NULL); + } else { + gint32 remaining=tvb_length_remaining(tvb, offset); + len=remaining>0 ? remaining : 0; + } + + tvb_get_ntohguid (tvb, offset, &uuid); + actx->created_item = proto_tree_add_guid(tree, hf_index, tvb, offset, len, &uuid); + + + return offset; +} + /*--- PDUs ---*/ static void dissect_DirectoryString_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { @@ -1831,6 +1858,11 @@ static void dissect_SyntaxGeneralString_PDU(tvbuff_t *tvb _U_, packet_info *pinf asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); dissect_x509sat_SyntaxGeneralString(FALSE, tvb, 0, &asn1_ctx, tree, hf_x509sat_SyntaxGeneralString_PDU); } +static void dissect_GUID_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { + asn1_ctx_t asn1_ctx; + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); + dissect_x509sat_GUID(FALSE, tvb, 0, &asn1_ctx, tree, hf_x509sat_GUID_PDU); +} /*--- End of included file: packet-x509sat-fn.c ---*/ @@ -2005,6 +2037,10 @@ void proto_register_x509sat(void) { { "SyntaxGeneralString", "x509sat.SyntaxGeneralString", FT_STRING, BASE_NONE, NULL, 0, "x509sat.SyntaxGeneralString", HFILL }}, + { &hf_x509sat_GUID_PDU, + { "GUID", "x509sat.GUID", + FT_GUID, BASE_NONE, NULL, 0, + "x509sat.GUID", HFILL }}, { &hf_x509sat_teletexString, { "teletexString", "x509sat.teletexString", FT_STRING, BASE_NONE, NULL, 0, @@ -2718,10 +2754,12 @@ void proto_reg_handoff_x509sat(void) { register_ber_oid_dissector("1.3.6.1.5.5.7.9.4", dissect_SyntaxPrintableString_PDU, proto_x509sat, "pkcs-9-at-countryOfCitizenship"); register_ber_oid_dissector("1.3.6.1.5.5.7.9.5", dissect_SyntaxPrintableString_PDU, proto_x509sat, "pkcs-9-at-countryOfResidence"); register_ber_oid_dissector("0.9.2342.19200300.100.1.25", dissect_SyntaxIA5String_PDU, proto_x509sat, "dc"); + register_ber_oid_dissector("1.3.6.1.4.1.311.20.2", dissect_SyntaxBMPString_PDU, proto_x509sat, "id-ms-certificate-template-name"); register_ber_oid_dissector("1.3.6.1.4.1.311.20.2.3", dissect_SyntaxUTF8String_PDU, proto_x509sat, "id-ms-user-principal-name"); register_ber_oid_dissector("1.2.826.0.1063.7.0.0.0", dissect_Integer_PDU, proto_x509sat, "unknown-UK-organisation-defined-extension"); register_ber_oid_dissector("1.2.826.0.1004.10.1.1", dissect_SyntaxIA5String_PDU, proto_x509sat, "nexor-originating-ua"); register_ber_oid_dissector("2.6.1.6.3", dissect_Boolean_PDU, proto_x509sat, "id-sat-ipm-auto-discarded"); + register_ber_oid_dissector("1.3.6.1.1.16.4", dissect_GUID_PDU, proto_x509sat, "entryUUID"); /*--- End of included file: packet-x509sat-dis-tab.c ---*/ -- cgit v1.2.3