diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:34:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:34:10 +0000 |
commit | e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch) | |
tree | 68cb5ef9081156392f1dd62a00c6ccc1451b93df /epan/dissectors/asn1/dsp | |
parent | Initial commit. (diff) | |
download | wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip |
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/asn1/dsp')
-rw-r--r-- | epan/dissectors/asn1/dsp/CMakeLists.txt | 46 | ||||
-rw-r--r-- | epan/dissectors/asn1/dsp/dsp.asn | 489 | ||||
-rw-r--r-- | epan/dissectors/asn1/dsp/dsp.cnf | 55 | ||||
-rw-r--r-- | epan/dissectors/asn1/dsp/packet-dsp-template.c | 313 | ||||
-rw-r--r-- | epan/dissectors/asn1/dsp/packet-dsp-template.h | 17 |
5 files changed, 920 insertions, 0 deletions
diff --git a/epan/dissectors/asn1/dsp/CMakeLists.txt b/epan/dissectors/asn1/dsp/CMakeLists.txt new file mode 100644 index 00000000..0129cd7c --- /dev/null +++ b/epan/dissectors/asn1/dsp/CMakeLists.txt @@ -0,0 +1,46 @@ +# CMakeLists.txt +# +# Wireshark - Network traffic analyzer +# By Gerald Combs <gerald@wireshark.org> +# Copyright 1998 Gerald Combs +# +# SPDX-License-Identifier: GPL-2.0-or-later +# + +set( PROTOCOL_NAME dsp ) + +set( PROTO_OPT ) + +set( EXPORT_FILES + ${PROTOCOL_NAME}-exp.cnf +) + +set( EXT_ASN_FILE_LIST +) + +set( ASN_FILE_LIST + ${PROTOCOL_NAME}.asn +) + +set( EXTRA_DIST + ${ASN_FILE_LIST} + packet-${PROTOCOL_NAME}-template.c + packet-${PROTOCOL_NAME}-template.h + ${PROTOCOL_NAME}.cnf +) + +set( SRC_FILES + ${EXTRA_DIST} + ${EXT_ASN_FILE_LIST} +) + +set( A2W_FLAGS -b ) + +set( EXTRA_CNF + "${CMAKE_CURRENT_BINARY_DIR}/../dap/dap-exp.cnf" + "${CMAKE_CURRENT_BINARY_DIR}/../x509af/x509af-exp.cnf" + "${CMAKE_CURRENT_BINARY_DIR}/../x509if/x509if-exp.cnf" + "${CMAKE_CURRENT_BINARY_DIR}/../x509sat/x509sat-exp.cnf" +) + +ASN2WRS() diff --git a/epan/dissectors/asn1/dsp/dsp.asn b/epan/dissectors/asn1/dsp/dsp.asn new file mode 100644 index 00000000..e0f2a650 --- /dev/null +++ b/epan/dissectors/asn1/dsp/dsp.asn @@ -0,0 +1,489 @@ +-- Module DistributedOperations (X.518:08/2005) +DistributedOperations {joint-iso-itu-t ds(5) module(1) distributedOperations(3) + 4} DEFINITIONS ::= +BEGIN + +-- EXPORTS All +-- The types and values defined in this module are exported for use in the other ASN.1 modules contained +-- within the Directory Specifications, and for the use of other applications which will use them to access +-- Directory services. Other applications may use them for their own purposes, but this will not constrain +-- extensions and modifications needed to maintain or improve the Directory service. +IMPORTS + -- from ITU-T Rec. X.501 | ISO/IEC 9594-2 + basicAccessControl, dap, directoryAbstractService, enhancedSecurity, + informationFramework, selectedAttributeTypes, serviceAdministration + FROM UsefulDefinitions {joint-iso-itu-t ds(5) module(1) + usefulDefinitions(0) 4} + DistinguishedName, Name, RDNSequence, Attribute + FROM InformationFramework {joint-iso-itu-t ds(5) module(1) + informationFramework(1) 4} + MRMapping, SearchRuleId + FROM ServiceAdministration {joint-iso-itu-t ds(5) module(1) + serviceAdministration(33) 4} +-- AuthenticationLevel +-- FROM BasicAccessControl {joint-iso-itu-t ds(5) module(1) +-- basicAccessControl(24) 4} + OPTIONALLY-PROTECTED{} + FROM EnhancedSecurity {joint-iso-itu-t ds(5) module(1) enhancedSecurity(28) + 4} + -- from ITU-T Rec. X.511 | ISO/IEC 9594-3 + abandon, addEntry, CommonResults, compare, directoryBind, directoryUnbind, + list, modifyDN, modifyEntry, read, referral, removeEntry, search, + SecurityParameters, + AbandonArgument, AbandonResult, AddEntryArgument, AddEntryResult, + CompareArgument, CompareResult, ListArgument, ListResult, + ModifyDNArgument, ModifyDNResult, ModifyEntryArgument, ModifyEntryResult, + ReadArgument, ReadResult, RemoveEntryArgument, RemoveEntryResult, + SearchArgument, SearchResult, + DirectoryBindArgument, DirectoryBindResult, DirectoryBindError + FROM DirectoryAbstractService {joint-iso-itu-t ds(5) module(1) + directoryAbstractService(2) 4} + -- from ITU-T Rec. X.519 | ISO/IEC 9594-5 + id-errcode-dsaReferral + FROM DirectoryAccessProtocol {joint-iso-itu-t ds(5) module(1) dap(11) 4} + -- from ITU-T Rec. X.520 | ISO/IEC 9594-6 + DirectoryString{}, PresentationAddress, ProtocolInformation, UniqueIdentifier + FROM SelectedAttributeTypes {joint-iso-itu-t ds(5) module(1) + selectedAttributeTypes(5) 4} + -- from ITU-T Rec. X.880 | ISO/IEC 13712-1 + ERROR, OPERATION + FROM Remote-Operations-Information-Objects {joint-iso-itu-t + remote-operations(4) informationObjects(5) version1(0)}--; + AlgorithmIdentifier + FROM AuthenticationFramework {joint-iso-itu-t ds(5) module(1) + authenticationFramework(7) 4}; + + + +-- parameterized type for deriving chained operations +--chained{OPERATION:operation} OPERATION ::= { +-- ARGUMENT OPTIONALLY-PROTECTED +-- {SET {chainedArgument ChainingArguments, +-- argument [0] operation.&ArgumentType}} +-- RESULT OPTIONALLY-PROTECTED +-- {SET {chainedResult ChainingResults, +-- result [0] operation.&ResultType}} +-- ERRORS +-- {operation.&Errors EXCEPT referral | dsaReferral} +-- CODE operation.&operationCode +--} + +-- bind and unbind operations +--dSABind OPERATION ::= directoryBind +DSASystemBindArgument ::= DirectoryBindArgument +DSASystemBindResult ::= DirectoryBindArgument +DSASystemBindError ::= DirectoryBindError + + +--dSAUnbind OPERATION ::= directoryUnbind + +-- chained operations +--chainedRead OPERATION ::= chained{read} + +-- expand chained{} macro +ChainedReadArgumentData ::= SET { + chainedArgument ChainingArguments, + readArgument [0] ReadArgument +} + +ChainedReadArgument ::= CHOICE { + unsignedChainedReadArgument ChainedReadArgumentData, + signedChainedReadArgument SEQUENCE { + chainedReadArgument ChainedReadArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedReadResultData ::= SET { + chainedResults ChainingResults, + readResult [0] ReadResult +} + +ChainedReadResult ::= CHOICE { + unsignedChainedReadResult ChainedReadResultData, + signedChainedReadResult SEQUENCE { + chainedReadResult ChainedReadResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedCompare OPERATION ::= chained{compare} + +-- expand chained{} macro +ChainedCompareArgumentData ::= SET { + chainedArgument ChainingArguments, + compareArgument [0] CompareArgument +} + +ChainedCompareArgument ::= CHOICE { + unsignedChainedCompareArgument ChainedCompareArgumentData, + signedChainedCompareArgument SEQUENCE { + chainedCompareArgument ChainedCompareArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedCompareResultData ::= SET { + chainedResults ChainingResults, + compareResult [0] CompareResult +} + +ChainedCompareResult ::= CHOICE { + unsignedChainedCompareResult ChainedCompareResultData, + signedChainedCompareResult SEQUENCE { + chainedCompareResult ChainedCompareResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedAbandon OPERATION ::= abandon + +ChainedAbandonArgument ::= AbandonArgument +ChainedAbandonResult ::= AbandonResult + +--chainedList OPERATION ::= chained{list} + +-- expand chained{} macro +ChainedListArgumentData ::= SET { + chainedArgument ChainingArguments, + listArgument [0] ListArgument +} + +ChainedListArgument ::= CHOICE { + unsignedChainedListArgument ChainedListArgumentData, + signedChainedListArgument SEQUENCE { + chainedListArgument ChainedListArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedListResultData ::= SET { + chainedResults ChainingResults, + listResult [0] ListResult +} + +ChainedListResult ::= CHOICE { + unsignedChainedListResult ChainedListResultData, + signedChainedListResult SEQUENCE { + chainedListResult ChainedListResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedSearch OPERATION ::= chained{search} + +-- expand chained{} macro +ChainedSearchArgumentData ::= SET { + chainedArgument ChainingArguments, + searchArgument [0] SearchArgument +} + +ChainedSearchArgument ::= CHOICE { + unsignedChainedSearchArgument ChainedSearchArgumentData, + signedChainedSearchArgument SEQUENCE { + chainedSearchArgument ChainedSearchArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedSearchResultData ::= SET { + chainedResults ChainingResults, + searchResult [0] SearchResult +} + +ChainedSearchResult ::= CHOICE { + unsignedChainedSearchResult ChainedSearchResultData, + signedChainedSearchResult SEQUENCE { + chainedSearchResult ChainedSearchResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedAddEntry OPERATION ::= chained{addEntry} + +-- expand chained{} macro +ChainedAddEntryArgumentData ::= SET { + chainedArgument ChainingArguments, + addEntryArgument [0] AddEntryArgument +} + +ChainedAddEntryArgument ::= CHOICE { + unsignedChainedAddEntryArgument ChainedAddEntryArgumentData, + signedChainedAddEntryArgument SEQUENCE { + chainedAddEntryArgument ChainedAddEntryArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedAddEntryResultData ::= SET { + chainedResults ChainingResults, + addEntryResult [0] AddEntryResult +} + +ChainedAddEntryResult ::= CHOICE { + unsignedChainedAddEntryResult ChainedAddEntryResultData, + signedChainedAddEntryResult SEQUENCE { + chainedAddEntryResult ChainedAddEntryResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedRemoveEntry OPERATION ::= chained{removeEntry} + +-- expand chained{} macro + +ChainedRemoveEntryArgumentData ::= SET { + chainedArgument ChainingArguments, + removeEntryArgument [0] RemoveEntryArgument +} + +ChainedRemoveEntryArgument ::= CHOICE { + unsignedChainedRemoveEntryArgument ChainedRemoveEntryArgumentData, + signedChainedRemoveEntryArgument SEQUENCE { + chainedRemoveEntryArgument ChainedRemoveEntryArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedRemoveEntryResultData ::= SET { + chainedResults ChainingResults, + removeEntryResult [0] RemoveEntryResult +} + +ChainedRemoveEntryResult ::= CHOICE { + unsignedChainedRemoveEntryResult ChainedRemoveEntryResultData, + signedChainedRemoveEntryResult SEQUENCE { + chainedRemoveEntryResult ChainedRemoveEntryResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedModifyEntry OPERATION ::= chained{modifyEntry} + +-- expand chained{} macro + +ChainedModifyEntryArgumentData ::= SET { + chainedArgument ChainingArguments, + modifyEntryArgument [0] ModifyEntryArgument +} + +ChainedModifyEntryArgument ::= CHOICE { + unsignedChainedModifyEntryArgument ChainedModifyEntryArgumentData, + signedChainedModifyEntryArgument SEQUENCE { + chainedModifyEntryArgument ChainedModifyEntryArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedModifyEntryResultData ::= SET { + chainedResults ChainingResults, + modifyEntryResult [0] ModifyEntryResult +} + +ChainedModifyEntryResult ::= CHOICE { + unsignedChainedModifyEntryResult ChainedModifyEntryResultData, + signedChainedModifyEntryResult SEQUENCE { + chainedModifyEntryResult ChainedModifyEntryResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedModifyDN OPERATION ::= chained{modifyDN} + +-- expand chained{} macro + +ChainedModifyDNArgumentData ::= SET { + chainedArgument ChainingArguments, + modifyDNArgument [0] ModifyDNArgument +} + +ChainedModifyDNArgument ::= CHOICE { + unsignedChainedModifyDNArgument ChainedModifyDNArgumentData, + signedChainedModifyDNArgument SEQUENCE { + chainedModifyDNArgument ChainedModifyDNArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedModifyDNResultData ::= SET { + chainedResults ChainingResults, + modifyDNResult [0] ModifyDNResult +} + +ChainedModifyDNResult ::= CHOICE { + unsignedChainedModifyDNResult ChainedModifyDNResultData, + signedChainedModifyDNResult SEQUENCE { + chainedModifyDNResult ChainedModifyDNResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +-- errors and parameters +DSAReferralData -- ERROR-- ::= -- { +-- PARAMETER OPTIONALLY-PROTECTED +-- {--SET {reference [0] ContinuationReference, + contextPrefix [1] DistinguishedName OPTIONAL, +-- COMPONENTS OF CommonResults}} + securityParameters [30] SecurityParameters OPTIONAL, + performer [29] DistinguishedName OPTIONAL, + aliasDereferenced [28] BOOLEAN DEFAULT FALSE, + notification [27] SEQUENCE --SIZE (1..MAX)-- OF Attribute OPTIONAL +-- CODE id-errcode-dsaReferral +} + +-- expand OPTIONALLY-PROTECTED macro +DSAReferral ::= CHOICE { + unsignedDSAReferral DSAReferralData, + signedDSAReferral SEQUENCE { + dsaReferral DSAReferralData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + + +-- common arguments and results +ChainingArguments ::= SET { + originator [0] DistinguishedName OPTIONAL, + targetObject [1] DistinguishedName OPTIONAL, + operationProgress [2] OperationProgress DEFAULT {nameResolutionPhase notStarted}, + traceInformation [3] TraceInformation, + aliasDereferenced [4] BOOLEAN DEFAULT FALSE, + aliasedRDNs [5] INTEGER OPTIONAL, + -- only present in 1988 systems + returnCrossRefs [6] BOOLEAN DEFAULT FALSE, + referenceType [7] ReferenceType DEFAULT superior, + info [8] DomainInfo OPTIONAL, + timeLimit [9] Time OPTIONAL, + securityParameters [10] SecurityParameters DEFAULT {}, + entryOnly [11] BOOLEAN DEFAULT FALSE, + uniqueIdentifier [12] UniqueIdentifier OPTIONAL, + authenticationLevel [13] AuthenticationLevel OPTIONAL, + exclusions [14] Exclusions OPTIONAL, + excludeShadows [15] BOOLEAN DEFAULT FALSE, + nameResolveOnMaster [16] BOOLEAN DEFAULT FALSE, + operationIdentifier [17] INTEGER OPTIONAL, + searchRuleId [18] SearchRuleId OPTIONAL, + chainedRelaxation [19] MRMapping OPTIONAL, + relatedEntry [20] INTEGER OPTIONAL, + dspPaging [21] BOOLEAN DEFAULT FALSE, + nonDapPdu [22] ENUMERATED { ldap (0) } OPTIONAL, + streamedResults [23] INTEGER OPTIONAL, + excludeWriteableCopies [24] BOOLEAN DEFAULT FALSE +} + +Time ::= CHOICE {utcTime UTCTime, + generalizedTime GeneralizedTime +} + +DomainInfo ::= --ABSTRACT-SYNTAX.&Type-- OBJECT IDENTIFIER + +ChainingResults ::= SET { + info [0] DomainInfo OPTIONAL, + crossReferences [1] SEQUENCE --SIZE (1..MAX)-- OF CrossReference OPTIONAL, + securityParameters [2] SecurityParameters DEFAULT {}, + alreadySearched [3] Exclusions OPTIONAL +} + +CrossReference ::= SET { + contextPrefix [0] DistinguishedName, + accessPoint [1] AccessPointInformation +} + +OperationProgress ::= SET { + nameResolutionPhase + [0] ENUMERATED {notStarted(1), proceeding(2), completed(3)}, + nextRDNToBeResolved [1] INTEGER OPTIONAL +} + +TraceInformation ::= SEQUENCE OF TraceItem + +TraceItem ::= SET { + dsa [0] Name, + targetObject [1] Name OPTIONAL, + operationProgress [2] OperationProgress +} + +ReferenceType ::= ENUMERATED { + superior(1), subordinate(2), cross(3), nonSpecificSubordinate(4), + supplier(5), master(6), immediateSuperior(7), self(8), ditBridge(9)} + +AccessPoint ::= SET { + ae-title [0] Name, + address [1] PresentationAddress, + protocolInformation [2] SET --SIZE (1..MAX)-- OF ProtocolInformation OPTIONAL, + labeledURI [6] LabeledURI OPTIONAL +} + +LabeledURI ::= DirectoryString{--ub-labeledURI--} + +MasterOrShadowAccessPoint ::= SET { +-- COMPONENTS OF AccessPoint, + ae-title [0] Name, + address [1] PresentationAddress, + protocolInformation [2] SET --SIZE (1..MAX)-- OF ProtocolInformation OPTIONAL, + category [3] ENUMERATED {master(0), shadow(1)} DEFAULT master, + chainingRequired [5] BOOLEAN DEFAULT FALSE +} + +MasterAndShadowAccessPoints ::= SET --SIZE (1..MAX)-- OF MasterOrShadowAccessPoint + +AccessPointInformation ::= SET { +-- COMPONENTS OF MasterOrShadowAccessPoint, + ae-title [0] Name, + address [1] PresentationAddress, + protocolInformation [2] SET --SIZE (1..MAX)-- OF ProtocolInformation OPTIONAL, + category [3] ENUMERATED {master(0), shadow(1)} DEFAULT master, + chainingRequired [5] BOOLEAN DEFAULT FALSE, + additionalPoints [4] MasterAndShadowAccessPoints OPTIONAL +} + +DitBridgeKnowledge ::= SEQUENCE { + domainLocalID DirectoryString{--ub-domainLocalID--} OPTIONAL, + accessPoints MasterAndShadowAccessPoints +} + +Exclusions ::= SET --SIZE (1..MAX)-- OF RDNSequence + +ContinuationReference ::= SET { + targetObject [0] Name, + aliasedRDNs [1] INTEGER OPTIONAL, -- only present in 1988 systems + operationProgress [2] OperationProgress, + rdnsResolved [3] INTEGER OPTIONAL, + referenceType [4] ReferenceType, + accessPoints [5] SET OF AccessPointInformation, + entryOnly [6] BOOLEAN DEFAULT FALSE, + exclusions [7] Exclusions OPTIONAL, + returnToDUA [8] BOOLEAN DEFAULT FALSE, + nameResolveOnMaster [9] BOOLEAN DEFAULT FALSE +} + +AuthenticationLevel ::= CHOICE { + basicLevels SEQUENCE { + level ENUMERATED { none(0), simple(1), strong (2) }, + localQualifier INTEGER OPTIONAL, + signed BOOLEAN DEFAULT FALSE + }, + other EXTERNAL +} + +END -- DistributedOperations + +-- Generated by Asnp, the ASN.1 pretty-printer of France Telecom R&D + diff --git a/epan/dissectors/asn1/dsp/dsp.cnf b/epan/dissectors/asn1/dsp/dsp.cnf new file mode 100644 index 00000000..c10743b3 --- /dev/null +++ b/epan/dissectors/asn1/dsp/dsp.cnf @@ -0,0 +1,55 @@ +#.MODULE_IMPORT +DirectoryAccessProtocol dap +ServiceAdministration x509if + +#.IMPORT ../dap/dap-exp.cnf +#.IMPORT ../x509if/x509if-exp.cnf +#.IMPORT ../x509af/x509af-exp.cnf +#.IMPORT ../x509sat/x509sat-exp.cnf + +#.EXPORTS +AccessPoint +AccessPointInformation EXTERN WS_DLL +ContinuationReference +Exclusions +MasterAndShadowAccessPoints +OperationProgress +ReferenceType + +#.NO_EMIT ONLY_VALS +ChainedReadArgument +ChainedReadResult +ChainedCompareArgument +ChainedCompareResult +ChainedListArgument +ChainedListResult +ChainedSearchArgument +ChainedSearchResult +ChainedAddEntryArgument +ChainedAddEntryResult +ChainedRemoveEntryArgument +ChainedRemoveEntryResult +ChainedModifyEntryArgument +ChainedModifyEntryResult +ChainedModifyDNArgument +ChainedModifyDNResult +DSAReferral + +#.TYPE_RENAME +MasterOrShadowAccessPoint/category APCategory + +#.FIELD_RENAME +MasterOrShadowAccessPoint/category access-point-category + +ChainingArguments/targetObject targetObjectDN + +#.PDU +AccessPoint +MasterAndShadowAccessPoints + +#.REGISTER +AccessPoint B "2.5.12.1" "id-doa-myAccessPoint" +AccessPoint B "2.5.12.2" "id-doa-superiorKnowledge" +MasterAndShadowAccessPoints B "2.5.12.3" "id-doa-specificKnowledge" +MasterAndShadowAccessPoints B "2.5.12.4" "id-doa-nonSpecificKnowledge" +DitBridgeKnowledge B "2.5.12.8" "id-doa-ditBridgeKnowledge" diff --git a/epan/dissectors/asn1/dsp/packet-dsp-template.c b/epan/dissectors/asn1/dsp/packet-dsp-template.c new file mode 100644 index 00000000..46fea89c --- /dev/null +++ b/epan/dissectors/asn1/dsp/packet-dsp-template.c @@ -0,0 +1,313 @@ +/* packet-dsp.c + * Routines for X.518 (X.500 Distributed Operations) packet dissection + * Graeme Lunt 2005 + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "config.h" + +#include <epan/packet.h> +#include <epan/expert.h> +#include <epan/prefs.h> +#include <epan/oids.h> +#include <epan/asn1.h> + +#include "packet-ber.h" +#include "packet-acse.h" +#include "packet-ros.h" + +#include "packet-x509if.h" +#include "packet-x509af.h" +#include "packet-x509sat.h" + +#include "packet-dap.h" +#include "packet-dsp.h" + + +#define PNAME "X.519 Directory System Protocol" +#define PSNAME "DSP" +#define PFNAME "dsp" + +void proto_register_dsp(void); +void proto_reg_handoff_dsp(void); + +/* Initialize the protocol and registered fields */ +static int proto_dsp = -1; + +#include "packet-dsp-hf.c" + +/* Initialize the subtree pointers */ +static gint ett_dsp = -1; +#include "packet-dsp-ett.c" + +static expert_field ei_dsp_unsupported_opcode = EI_INIT; +static expert_field ei_dsp_unsupported_errcode = EI_INIT; +static expert_field ei_dsp_unsupported_pdu = EI_INIT; +static expert_field ei_dsp_zero_pdu = EI_INIT; + +#include "packet-dsp-fn.c" + +static dissector_handle_t dsp_handle; + +/* +* Dissect X518 PDUs inside a ROS PDUs +*/ +static int +dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) +{ + int offset = 0; + int old_offset; + proto_item *item; + proto_tree *tree; + struct SESSION_DATA_STRUCTURE* session; + int (*dsp_dissector)(bool implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; + const char *dsp_op_name; + asn1_ctx_t asn1_ctx; + + /* do we have operation information from the ROS dissector? */ + if (data == NULL) + return 0; + session = (struct SESSION_DATA_STRUCTURE*)data; + + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); + + item = proto_tree_add_item(parent_tree, proto_dsp, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_dsp); + + col_set_str(pinfo->cinfo, COL_PROTOCOL, "DAP"); + col_clear(pinfo->cinfo, COL_INFO); + + asn1_ctx.private_data = session; + + switch(session->ros_op & ROS_OP_MASK) { + case (ROS_OP_BIND | ROS_OP_ARGUMENT): /* BindInvoke */ + dsp_dissector = dissect_dsp_DSASystemBindArgument; + dsp_op_name = "System-Bind-Argument"; + break; + case (ROS_OP_BIND | ROS_OP_RESULT): /* BindResult */ + dsp_dissector = dissect_dsp_DSASystemBindResult; + dsp_op_name = "System-Bind-Result"; + break; + case (ROS_OP_BIND | ROS_OP_ERROR): /* BindError */ + dsp_dissector = dissect_dsp_DSASystemBindError; + dsp_op_name = "System-Bind-Error"; + break; + case (ROS_OP_INVOKE | ROS_OP_ARGUMENT): /* Invoke Argument */ + switch(session->ros_op & ROS_OP_OPCODE_MASK) { + case 1: /* read */ + dsp_dissector = dissect_dsp_ChainedReadArgument; + dsp_op_name = "Chained-Read-Argument"; + break; + case 2: /* compare */ + dsp_dissector = dissect_dsp_ChainedCompareArgument; + dsp_op_name = "Chained-Compare-Argument"; + break; + case 3: /* abandon */ + dsp_dissector = dissect_dsp_ChainedAbandonArgument; + dsp_op_name = "Chained-Abandon-Argument"; + break; + case 4: /* list */ + dsp_dissector = dissect_dsp_ChainedListArgument; + dsp_op_name = "Chained-List-Argument"; + break; + case 5: /* search */ + dsp_dissector = dissect_dsp_ChainedSearchArgument; + dsp_op_name = "Chained-Search-Argument"; + break; + case 6: /* addEntry */ + dsp_dissector = dissect_dsp_ChainedAddEntryArgument; + dsp_op_name = "Chained-Add-Entry-Argument"; + break; + case 7: /* removeEntry */ + dsp_dissector = dissect_dsp_ChainedRemoveEntryArgument; + dsp_op_name = "Chained-Remove-Entry-Argument"; + break; + case 8: /* modifyEntry */ + dsp_dissector = dissect_dsp_ChainedModifyEntryArgument; + dsp_op_name = "ChainedModify-Entry-Argument"; + break; + case 9: /* modifyDN */ + dsp_dissector = dissect_dsp_ChainedModifyDNArgument; + dsp_op_name = "ChainedModify-DN-Argument"; + break; + default: + proto_tree_add_expert_format(tree, pinfo, &ei_dsp_unsupported_opcode, tvb, offset, -1, + "Unsupported DSP opcode (%d)", session->ros_op & ROS_OP_OPCODE_MASK); + break; + } + break; + case (ROS_OP_INVOKE | ROS_OP_RESULT): /* Return Result */ + switch(session->ros_op & ROS_OP_OPCODE_MASK) { + case 1: /* read */ + dsp_dissector = dissect_dsp_ChainedReadResult; + dsp_op_name = "Chained-Read-Result"; + break; + case 2: /* compare */ + dsp_dissector = dissect_dsp_ChainedCompareResult; + dsp_op_name = "Chained-Compare-Result"; + break; + case 3: /* abandon */ + dsp_dissector = dissect_dsp_ChainedAbandonResult; + dsp_op_name = "Chained-Abandon-Result"; + break; + case 4: /* list */ + dsp_dissector = dissect_dsp_ChainedListResult; + dsp_op_name = "Chained-List-Result"; + break; + case 5: /* search */ + dsp_dissector = dissect_dsp_ChainedSearchResult; + dsp_op_name = "Chained-Search-Result"; + break; + case 6: /* addEntry */ + dsp_dissector = dissect_dsp_ChainedAddEntryResult; + dsp_op_name = "Chained-Add-Entry-Result"; + break; + case 7: /* removeEntry */ + dsp_dissector = dissect_dsp_ChainedRemoveEntryResult; + dsp_op_name = "Chained-Remove-Entry-Result"; + break; + case 8: /* modifyEntry */ + dsp_dissector = dissect_dsp_ChainedModifyEntryResult; + dsp_op_name = "Chained-Modify-Entry-Result"; + break; + case 9: /* modifyDN */ + dsp_dissector = dissect_dsp_ChainedModifyDNResult; + dsp_op_name = "ChainedModify-DN-Result"; + break; + default: + proto_tree_add_expert(tree, pinfo, &ei_dsp_unsupported_opcode, tvb, offset, -1); + break; + } + break; + case (ROS_OP_INVOKE | ROS_OP_ERROR): /* Return Error */ + switch(session->ros_op & ROS_OP_OPCODE_MASK) { + case 1: /* attributeError */ + dsp_dissector = dissect_dap_AttributeError; + dsp_op_name = "Attribute-Error"; + break; + case 2: /* nameError */ + dsp_dissector = dissect_dap_NameError; + dsp_op_name = "Name-Error"; + break; + case 3: /* serviceError */ + dsp_dissector = dissect_dap_ServiceError; + dsp_op_name = "Service-Error"; + break; + case 4: /* referral */ + dsp_dissector = dissect_dap_Referral; + dsp_op_name = "Referral"; + break; + case 5: /* abandoned */ + dsp_dissector = dissect_dap_Abandoned; + dsp_op_name = "Abandoned"; + break; + case 6: /* securityError */ + dsp_dissector = dissect_dap_SecurityError; + dsp_op_name = "Security-Error"; + break; + case 7: /* abandonFailed */ + dsp_dissector = dissect_dap_AbandonFailedError; + dsp_op_name = "Abandon-Failed-Error"; + break; + case 8: /* updateError */ + dsp_dissector = dissect_dap_UpdateError; + dsp_op_name = "Update-Error"; + break; + case 9: /* DSAReferral */ + dsp_dissector = dissect_dsp_DSAReferral; + dsp_op_name = "DSA-Referral"; + break; + default: + proto_tree_add_expert(tree, pinfo, &ei_dsp_unsupported_errcode, tvb, offset, -1); + break; + } + break; + default: + proto_tree_add_expert(tree, pinfo, &ei_dsp_unsupported_pdu, tvb, offset, -1); + return tvb_captured_length(tvb); + } + + if(dsp_dissector) { + col_set_str(pinfo->cinfo, COL_INFO, dsp_op_name); + + while (tvb_reported_length_remaining(tvb, offset) > 0){ + old_offset=offset; + offset=(*dsp_dissector)(FALSE, tvb, offset, &asn1_ctx, tree, -1); + if(offset == old_offset){ + proto_tree_add_expert(tree, pinfo, &ei_dsp_zero_pdu, tvb, offset, -1); + break; + } + } + } + + return tvb_captured_length(tvb); +} + + +/*--- proto_register_dsp -------------------------------------------*/ +void proto_register_dsp(void) { + + /* List of fields */ + static hf_register_info hf[] = + { +#include "packet-dsp-hfarr.c" + }; + + /* List of subtrees */ + static gint *ett[] = { + &ett_dsp, +#include "packet-dsp-ettarr.c" + }; + static ei_register_info ei[] = { + { &ei_dsp_unsupported_opcode, { "dsp.unsupported_opcode", PI_UNDECODED, PI_WARN, "Unsupported DSP opcode", EXPFILL }}, + { &ei_dsp_unsupported_errcode, { "dsp.unsupported_errcode", PI_UNDECODED, PI_WARN, "Unsupported DSP errcode", EXPFILL }}, + { &ei_dsp_unsupported_pdu, { "dsp.unsupported_pdu", PI_UNDECODED, PI_WARN, "Unsupported DSP PDU", EXPFILL }}, + { &ei_dsp_zero_pdu, { "dsp.zero_pdu", PI_PROTOCOL, PI_ERROR, "Internal error, zero-byte DSP PDU", EXPFILL }}, + }; + + module_t *dsp_module; + expert_module_t* expert_dsp; + + /* Register protocol */ + proto_dsp = proto_register_protocol(PNAME, PSNAME, PFNAME); + + dsp_handle = register_dissector("dsp", dissect_dsp, proto_dsp); + + /* Register fields and subtrees */ + proto_register_field_array(proto_dsp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + expert_dsp = expert_register_protocol(proto_dsp); + expert_register_field_array(expert_dsp, ei, array_length(ei)); + + /* Register our configuration options for DSP, particularly our port */ + + dsp_module = prefs_register_protocol_subtree("OSI/X.500", proto_dsp, NULL); + + prefs_register_obsolete_preference(dsp_module, "tcp.port"); + + prefs_register_static_text_preference(dsp_module, "tcp_port_info", + "The TCP ports used by the DSP protocol should be added to the TPKT preference \"TPKT TCP ports\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "DSP TCP Port preference moved information"); + +} + + +/*--- proto_reg_handoff_dsp --- */ +void proto_reg_handoff_dsp(void) { +#include "packet-dsp-dis-tab.c" + + /* APPLICATION CONTEXT */ + + oid_add_from_string("id-ac-directory-system","2.5.3.2"); + + /* ABSTRACT SYNTAXES */ + + /* Register DSP with ROS (with no use of RTSE) */ + register_ros_oid_dissector_handle("2.5.9.2", dsp_handle, 0, "id-as-directory-system", FALSE); + +} diff --git a/epan/dissectors/asn1/dsp/packet-dsp-template.h b/epan/dissectors/asn1/dsp/packet-dsp-template.h new file mode 100644 index 00000000..b611f4c5 --- /dev/null +++ b/epan/dissectors/asn1/dsp/packet-dsp-template.h @@ -0,0 +1,17 @@ +/* packet-dsp.h + * Routines for X.511 (X.500 Directory Access Protocol) packet dissection + * Graeme Lunt 2005 + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef PACKET_DSP_H +#define PACKET_DSP_H + +#include "packet-dsp-exp.h" + +#endif /* PACKET_DSP_H */ |