summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/pidl/nspi
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--epan/dissectors/pidl/nspi/README62
-rw-r--r--epan/dissectors/pidl/nspi/README.ws2
-rw-r--r--epan/dissectors/pidl/nspi/nspi.cnf26
-rw-r--r--epan/dissectors/pidl/nspi/nspi.idl377
4 files changed, 467 insertions, 0 deletions
diff --git a/epan/dissectors/pidl/nspi/README b/epan/dissectors/pidl/nspi/README
new file mode 100644
index 00000000..6cf79950
--- /dev/null
+++ b/epan/dissectors/pidl/nspi/README
@@ -0,0 +1,62 @@
+OpenChange Wireshark dissector
+------------------------------
+
+Author: Julien Kerihuel <j.kerihuel@openchange.org>, November 2006
+
+0x0 Content
+-----------
+ 0x1 Installation
+ 0x2 Overview
+ 0x3 Developers installation
+ 0x4 Limitations
+ 0x5 Links
+
+0x1 Installation
+----------------
+
+Copy packet-dcerpc-nspi.c and packet-dcerpc-nspi.h in the dissector
+wireshark directory (e.g.: wireshark/epan/dissectors) and compile.
+
+That's all ;)
+
+0x2 Overview
+-------------
+
+The NSPI dissector implements the following IDL functions:
+(0x1) NspiBind
+(0x2) NspiUnbind
+(0x3) NspiQueryRows
+(0x5) NspiGetMatches
+(0x7) NspiDNToEph
+(0x9) NspiGetProps
+(0xc) NspiGetHierarchyInfo
+
+0x3 Developers installation
+---------------------------
+
+The ws-parser directory includes the file used to generate the nspi
+dissector. In order to create the dissector, you need to follow this
+procedure below:
+
+1. Install Samba PIDL (>= rev 19559 if installed from samba4 sources)
+3. Copy idl_types.h in the current directory
+4. run "pidl --ws-parser -- nspi.idl"
+
+
+0x4 Limitations
+---------------
+
+- We have only implemented the SRestriction_CTR cases we found during
+our tests:
+ * RES_AND
+ * RES_PROPERTY
+
+- The current dissector implements the NSPI functions used by
+Microsoft Exchange Server 2000/2003 but some functions used by older
+versions of Exchange such as NspiUpdateStat may miss.
+
+0x5 Links
+-----------
+
+* http://www.openchange.org
+* http://wiki.openchange.org
diff --git a/epan/dissectors/pidl/nspi/README.ws b/epan/dissectors/pidl/nspi/README.ws
new file mode 100644
index 00000000..5df05687
--- /dev/null
+++ b/epan/dissectors/pidl/nspi/README.ws
@@ -0,0 +1,2 @@
+This directory is a copy of the files from:
+svn://kb.openchange.org/openchange/tools/dissector
diff --git a/epan/dissectors/pidl/nspi/nspi.cnf b/epan/dissectors/pidl/nspi/nspi.cnf
new file mode 100644
index 00000000..2f5346c3
--- /dev/null
+++ b/epan/dissectors/pidl/nspi/nspi.cnf
@@ -0,0 +1,26 @@
+HF_FIELD hf_nspi_handle "Handle" "nspi.handle" FT_BYTES BASE_NONE NULL 0 "" "" ""
+
+HF_RENAME hf_nspi_NspiBind_handle hf_nspi_handle
+HF_RENAME hf_nspi_NspiUnbind_handle hf_nspi_handle
+HF_RENAME hf_nspi_NspiQueryRows_handle hf_nspi_handle
+HF_RENAME hf_nspi_NspiGetMatches_handle hf_nspi_handle
+HF_RENAME hf_nspi_NspiDNToEph_handle hf_nspi_handle
+HF_RENAME hf_nspi_NspiGetProps_handle hf_nspi_handle
+HF_RENAME hf_nspi_NspiGetHierarchyInfo_handle hf_nspi_handle
+
+HF_FIELD hf_nspi_property_type "Value" "nspi.SPropValue.value" FT_UINT32 BASE_HEX VALS(nspi_property_types_vals) 0 "" ""
+HF_FIELD hf_nspi_SRestriction_PTTYPE "Restriction Type" "nspi.property_type" FT_UINT32 BASE_HEX VALS(nspi_nspi_RestrictionType_vals) 0 "" ""
+HF_RENAME hf_nspi_SPropValue_value hf_nspi_property_type
+HF_RENAME hf_nspi_SRestriction_res hf_nspi_SRestriction_PTTYPE
+HF_RENAME hf_nspi_SRestriction_rt hf_nspi_SRestriction_PTTYPE
+
+#
+# policyhandle tracking
+# This block is to specify where a policyhandle is opened and where it is
+# closed so that policyhandles when dissected contain nice info such as
+# [opened in xxx] [closed in yyy]
+#
+# Policyhandles are opened in these functions (open==0x0001)
+PARAM_VALUE nspi_dissect_element_NspiBind_handle_ 0x0001
+# Policyhandles are closed in these functions (close==0x0002)
+PARAM_VALUE nspi_dissect_element_NspiUnbind_handle_ 0x0002
diff --git a/epan/dissectors/pidl/nspi/nspi.idl b/epan/dissectors/pidl/nspi/nspi.idl
new file mode 100644
index 00000000..5c893770
--- /dev/null
+++ b/epan/dissectors/pidl/nspi/nspi.idl
@@ -0,0 +1,377 @@
+/*
+ NSPI Implementation
+
+ OpenChange Project
+
+ Copyright (C) Julien Kerihuel 2006
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+
+#include "idl_types.h"
+
+[
+ uuid("f5cc5a18-4264-101a-8c59-08002b2f8426"),
+ endpoint("ncacn_np:[\\pipe\\exchange_nsp]", "ncacn_ip_tcp:"),
+ pointer_default(unique),
+ version(56.0),
+ helpstring("Exchange 5.5 Name Service Provider"),
+ helper("ndr_mapi.h")
+] interface nspi
+{
+
+#include "mapitags_enum.h"
+#include "mapicodes_enum.h"
+
+ /*****************/
+ /* Function 0x00 */
+
+ /*
+ ** MAPIUID explanation:
+ ** http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mapi/html/c42065c2-b1f5-4930-84a6-6ef90c6162d0.asp
+ */
+
+ typedef struct _MAPIUID{
+ uint8 ab[16];
+ } MAPIUID;
+
+ /*
+ ** input locale combination:
+ ** http://www.microsoft.com/globaldev/reference/win2k/setup/lcid.mspx
+ */
+
+ typedef struct {
+ uint32 language;
+ uint32 method;
+ } input_locale;
+
+ typedef [flag(NDR_NOALIGN)] struct {
+ uint32 handle;
+ uint32 flag;
+ MAPIUID service_provider;
+ uint32 codepage; /* CPID */
+ input_locale input_locale; /* LCID */
+ } MAPI_SETTINGS;
+
+ typedef struct {
+ [unique, length_is(cValues - 1), size_is(cValues - 1)] MAPITAGS *aulPropTag;
+ uint32 cValues;
+ } SPropTagArray;
+
+ typedef struct {
+ [length_is(cValues - 1), size_is(cValues - 1)] uint32 *value;
+ uint32 cValues;
+ } instance_key;
+
+
+
+ /*****************/
+ /* Function 0x00 */
+ MAPISTATUS NspiBind(
+ [in] uint32 unknown,
+ [in] MAPI_SETTINGS *settings,
+ [in,out,unique] GUID *mapiuid,
+ [out] policy_handle *handle
+ );
+
+ /*****************/
+ /* Function 0x01 */
+ MAPISTATUS NspiUnbind(
+ [in, out] policy_handle *handle,
+ [in] uint32 status
+ );
+
+
+ void NspiUpdateStat();
+
+ /*****************/
+ /* Function 0x03 */
+ MAPISTATUS NspiQueryRows(
+ [in] policy_handle *handle,
+ [in] uint32 flag,
+ [in,out] MAPI_SETTINGS *settings,
+ [in] uint32 lRows,
+ [in][size_is(lRows)][unique] uint32 *instance_key,
+ [in] uint32 unknown,
+ [in] SPropTagArray *REQ_properties,
+ [out] SRowSet **RowSet
+ );
+
+ void NspiSeekEntries();
+
+ /*****************/
+ /* Function 0x05 */
+
+
+
+ typedef struct {
+ [unique] MAPIUID *lpguid;
+ uint32 ulKind;
+ uint32 lID; /* this is actually a union in mapidefs.h */
+ } MAPINAMEID;
+
+ /* Restriction types */
+ typedef [v1_enum] enum {
+ RES_AND = 0,
+ RES_OR = 1,
+ RES_NOT = 2,
+ RES_CONTENT = 3,
+ RES_PROPERTY = 4,
+ RES_COMPAREPROPS = 5,
+ RES_BITMASK = 6,
+ RES_SIZE = 7,
+ RES_EXIST = 8,
+ RES_SUBRESTRICTION = 9,
+ RES_COMMENT = 10
+ } nspi_RestrictionType;
+
+ typedef struct {
+ uint32 relop;
+ MAPITAGS ulPropTag;
+ SPropValue *lpProp;
+ } SPropertyRestriction;
+
+ typedef struct {
+ uint32 cRes;
+ [size_is(cRes)][unique]SRestriction *lpRes;
+ } SAndRestriction;
+
+ typedef [switch_type(nspi_RestrictionType)] union {
+ [case(RES_AND) ] SAndRestriction resAnd;
+// [case(RES_OR) ] SOrRestriction resOr;
+// [case(RES_NOT) ] SNotRestriction resNot;
+// [case(RES_CONTENT) ] SContentRestriction resContent;
+ [case(RES_PROPERTY) ] SPropertyRestriction resProperty;
+// [case(RES_COMPAREPROPS) ] SComparePropsRestriction resCompareProps;
+// [case(RES_BITMASK) ] SBitMaskRestriction resBitMask;
+// [case(RES_SUBRESTRICTION)] SSubRestriction resSub;
+// [case(RES_SIZE) ] SSizeRestriction resSize;
+// [case(RES_EXIST) ] SExistRestriction resExist;
+ } SRestriction_CTR;
+
+ typedef [public] struct _SRestriction{
+ nspi_RestrictionType rt;
+ [switch_is(rt)] SRestriction_CTR res;
+ } SRestriction;
+
+/* Sort type */
+#define TABLE_SORT_ASCEND 0
+#define TABLE_SORT_DESCEND 0
+
+ typedef [public] struct _SSortOrder{
+ uint32 ulPropTag;
+ uint32 ulOrder;
+ } SSortOrder;
+
+ typedef [public] struct _SSortOrderSet{
+ uint32 cSorts;
+ uint32 cCategories;
+ uint32 cExpanded;
+ [size_is(cSorts)][unique]SSortOrder *aSort;
+ } SSortOrderSet;
+
+ MAPISTATUS NspiGetMatches(
+ [in] policy_handle *handle,
+ [in] uint32 unknown1,
+ [in,out] MAPI_SETTINGS *settings,
+ [in][unique] SPropTagArray *PropTagArray,
+ [in] uint32 unknown2,
+ [in][unique] SRestriction *restrictions,
+ [in] uint32 unknown3,
+ [out] instance_key *instance_key,
+ [in][unique] SPropTagArray *REQ_properties,
+ [out] SRowSet **RowSet
+ );
+
+
+ void NspiResortRestriction();
+
+ /*****************/
+ /* Function 0x07 */
+
+ typedef struct {
+ [string, charset(DOS)] uint8 *str;
+ } NAME_STRING;
+
+ MAPISTATUS NspiDNToEph(
+ [in] policy_handle *handle,
+ [in] uint32 flag,
+ [in] uint32 size,
+ [in,ref][size_is(size)] NAME_STRING *server_dn,
+ [out] instance_key *instance_key
+ );
+
+ void NspiGetPropList();
+
+ /*****************/
+ /* Function 0x09 */
+ MAPISTATUS NspiGetProps(
+ [in] policy_handle *handle,
+ [in] uint32 flag,
+ [in] MAPI_SETTINGS *settings,
+ [in] SPropTagArray *REQ_properties,
+ [out] SRow **REPL_values
+ );
+
+
+ void NspiCompareDNTs();
+ void NspiModProps();
+
+ typedef [v1_enum] enum {
+ PT_UNSPECIFIED = 0x0000,
+ PT_NULL = 0x0001,
+ PT_I2 = 0x0002,
+ PT_LONG = 0x0003,
+ PT_R4 = 0x0004,
+ PT_DOUBLE = 0x0005,
+ PT_CURRENCY = 0x0006,
+ PT_APPTIME = 0x0007,
+ PT_ERROR = 0x000a, /* means the given attr contains no value */
+ PT_BOOLEAN = 0x000b,
+ PT_OBJECT = 0x000d,
+ PT_I8 = 0x0014,
+ PT_STRING8 = 0x001e,
+ PT_UNICODE = 0x001f,
+ PT_SYSTIME = 0x0040,
+ PT_CLSID = 0x0048,
+ PT_BINARY = 0x0102,
+
+ /* Multi-valued properties */
+
+ PT_MV_I2 = 0x1002,
+ PT_MV_LONG = 0x1003,
+ PT_MV_R4 = 0x1004,
+ PT_MV_DOUBLE = 0x1005,
+ PT_MV_CURRENCY = 0x1006,
+ PT_MV_APPTIME = 0x1007,
+ PT_MV_I8 = 0x1014,
+ PT_MV_STRING8 = 0x101e,
+// PT_MV_TSTRING = 0x101e,
+ PT_MV_UNICODE = 0x101f,
+ PT_MV_SYSTIME = 0x1040,
+ PT_MV_CLSID = 0x1048,
+ PT_MV_BINARY = 0x1102
+ } property_types;
+
+
+ /*****************/
+ /* Function 0x0c */
+
+ typedef struct {
+ uint32 cb;
+ [size_is(cb)][unique] uint8 *lpb;
+ } SBinary;
+
+ typedef struct {
+ uint32 dwLowDateTime;
+ uint32 dwHighDateTime;
+ } FILETIME;
+
+ typedef struct {
+ uint32 cValues;
+ [size_is(cValues)] uint16 *lpi;
+ } SShortArray;
+
+ typedef struct {
+ uint32 cValues;
+ [size_is(cValues)] uint32 *lpl;
+ } MV_LONG_STRUCT;
+
+ typedef struct {
+ ascstr_noterm lppszA;
+ } LPSTR;
+
+ typedef struct {
+ uint32 cValues;
+ [size_is(cValues)] LPSTR **strings;
+ } SLPSTRArray;
+
+ typedef struct {
+ uint32 cValues;
+ [size_is(cValues)] SBinary *lpbin;
+ } SBinaryArray;
+
+ typedef [flag(NDR_NOALIGN)] struct {
+ uint32 cValues;
+ [size_is(cValues)] uint32 *lpguid;
+ } SGuidArray;
+
+ typedef struct {
+ uint32 cValues;
+ [size_is(cValues)] uint32 *lpi;
+ } MV_UNICODE_STRUCT;
+
+ typedef struct {
+ uint32 cValues;
+ [size_is(cValues)] FILETIME *lpft;
+ } SDateTimeArray;
+
+ typedef [switch_type(property_types)] union {
+ [case(PT_I2)] uint16 i;
+ [case(PT_LONG)] uint32 l;
+ [case(PT_BOOLEAN)] uint16 b;
+ [case(PT_STRING8)][unique][string,charset(DOS)] uint8 *lpszA;
+ [case(PT_BINARY)] SBinary bin;
+ [case(PT_UNICODE)] [string,charset(UTF16)] uint16 *lpszW;
+ [case(PT_CLSID)] MAPIUID *lpguid;
+ [case(PT_SYSTIME)] FILETIME ft;
+ [case(PT_ERROR)] MAPISTATUS err;
+ [case(PT_MV_I2)] SShortArray MVi;
+ [case(PT_MV_LONG)] MV_LONG_STRUCT MVl;
+ [case(PT_MV_STRING8)] SLPSTRArray MVszA;
+ [case(PT_MV_BINARY)] SBinaryArray MVbin;
+ [case(PT_MV_CLSID)] SGuidArray MVguid;
+ [case(PT_MV_UNICODE)] MV_UNICODE_STRUCT MVszW;
+ [case(PT_MV_SYSTIME)] SDateTimeArray MVft;
+ [case(PT_NULL)] uint32 null;
+ [case(PT_OBJECT)] uint32 object;
+ } SPropValue_CTR;
+
+ typedef [public]struct {
+ MAPITAGS ulPropTag;
+ uint32 dwAlignPad;
+ [switch_is(ulPropTag & 0xFFFF)] SPropValue_CTR value;
+ } SPropValue;
+
+ typedef struct {
+ uint32 ulAdrEntryPad;
+ uint32 cValues;
+ [size_is(cValues)][unique] SPropValue *lpProps;
+ } SRow;
+
+
+ typedef [public] struct {
+ uint32 cRows;
+ [size_is(cRows)] SRow aRow[*];
+ } SRowSet;
+
+ MAPISTATUS NspiGetHierarchyInfo(
+ [in] policy_handle *handle,
+ [in] uint32 unknown1,
+ [in] MAPI_SETTINGS *settings,
+ [in,out] uint32 *unknown2,
+ [out] SRowSet **RowSet
+ );
+
+ void NspiGetTemplateInfo();
+ void NspiModLInkAtt();
+ void NspiDeleteEntries();
+ void NspiQueryColumns();
+ void NspiGetNamesFromIDs();
+ void NspiGetIDsFromNames();
+ void NspiResolveNames();
+ void NspiResolveNamesW();
+}