Julien Kerihuel:

The new version of the dissector will compile without any patches to apply to
Wireshark/NDR.pm. Jelmer has improved the patch and pidl now support enums as
return type. Regarding the nspi.cnf file, it won't be useful anymore.

Regarding the dissector, I've noticed a bug in NspiGetMatches which isn't
dumped correctly. I'm currently investigating the problem and I'll notify the
list when a fixed version is available.


svn path=/trunk/; revision=19794
This commit is contained in:
Jörg Mayer 2006-11-04 17:44:37 +00:00
parent 24dbbfe608
commit ee101474de
7 changed files with 18033 additions and 94 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

13
idl/nspi/Makefile Normal file
View File

@ -0,0 +1,13 @@
all: packet-dcerpc-nspi.c packet-dcerpc-nspi.h
idl_types.h: ../../epan/dissectors/pidl/idl_types.h
cp ../../epan/dissectors/pidl/idl_types.h idl_types.h
packet-dcerpc-nspi.c packet-dcerpc-nspi.h: nspi.idl mapicodes_enum.h mapitags_enum.h idl_types.h
../../tools/pidl/pidl --ws-parser -- nspi.idl
clean:
rm -f packet-dcerpc-nspi.c packet-dcerpc-nspi.h idl_types.h
install: packet-dcerpc-nspi.c packet-dcerpc-nspi.h
cp packet-dcerpc-nspi.c packet-dcerpc-nspi.h ../../epan/dissectors/

62
idl/nspi/README Normal file
View File

@ -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
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

98
idl/nspi/mapicodes_enum.h Normal file
View File

@ -0,0 +1,98 @@
/*
MAPI 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.
*/
/* parser auto-generated by mparse */
typedef [public, v1_enum, flag(NDR_PAHEX)] enum {
MAPI_E_SUCCESS = 0x00000000,
MAPI_E_NO_SUPPORT = 0x80040102,
MAPI_E_BAD_CHARWIDTH = 0x80040103,
MAPI_E_STRING_TOO_LONG = 0x80040105,
MAPI_E_UNKNOWN_FLAGS = 0x80040106,
MAPI_E_INVALID_ENTRYID = 0x80040107,
MAPI_E_INVALID_OBJECT = 0x80040108,
MAPI_E_OBJECT_CHANGED = 0x80040109,
MAPI_E_OBJECT_DELETED = 0x8004010A,
MAPI_E_BUSY = 0x8004010B,
MAPI_E_NOT_ENOUGH_DISK = 0x8004010D,
MAPI_E_NOT_ENOUGH_RESOURCES = 0x8004010E,
MAPI_E_NOT_FOUND = 0x8004010F,
MAPI_E_VERSION = 0x80040110,
MAPI_E_LOGON_FAILED = 0x80040111,
MAPI_E_SESSION_LIMIT = 0x80040112,
MAPI_E_USER_CANCEL = 0x80040113,
MAPI_E_UNABLE_TO_ABORT = 0x80040114,
MAPI_E_NETWORK_ERROR = 0x80040115,
MAPI_E_DISK_ERROR = 0x80040116,
MAPI_E_TOO_COMPLEX = 0x80040117,
MAPI_E_BAD_COLUMN = 0x80040118,
MAPI_E_EXTENDED_ERROR = 0x80040119,
MAPI_E_COMPUTED = 0x8004011A,
MAPI_E_CORRUPT_DATA = 0x8004011B,
MAPI_E_UNCONFIGURED = 0x8004011C,
MAPI_E_FAILONEPROVIDER = 0x8004011D,
MAPI_E_UNKNOWN_CPID = 0x8004011E,
MAPI_E_UNKNOWN_LCID = 0x8004011F,
MAPI_E_PASSWORD_CHANGE_REQUIRED = 0x80040120,
MAPI_E_PASSWORD_EXPIRED = 0x80040121,
MAPI_E_INVALID_WORKSTATION_ACCOUNT = 0x80040122,
MAPI_E_INVALID_ACCESS_TIME = 0x80040123,
MAPI_E_ACCOUNT_DISABLED = 0x80040124,
MAPI_E_END_OF_SESSION = 0x80040200,
MAPI_E_UNKNOWN_ENTRYID = 0x80040201,
MAPI_E_MISSING_REQUIRED_COLUMN = 0x80040202,
MAPI_W_NO_SERVICE = 0x80040203,
MAPI_E_BAD_VALUE = 0x80040301,
MAPI_E_INVALID_TYPE = 0x80040302,
MAPI_E_TYPE_NO_SUPPORT = 0x80040303,
MAPI_E_UNEXPECTED_TYPE = 0x80040304,
MAPI_E_TOO_BIG = 0x80040305,
MAPI_E_DECLINE_COPY = 0x80040306,
MAPI_E_UNEXPECTED_ID = 0x80040307,
MAPI_W_ERRORS_RETURNED = 0x80040380,
MAPI_E_UNABLE_TO_COMPLETE = 0x80040400,
MAPI_E_TIMEOUT = 0x80040401,
MAPI_E_TABLE_EMPTY = 0x80040402,
MAPI_E_TABLE_TOO_BIG = 0x80040403,
MAPI_E_INVALID_BOOKMARK = 0x80040405,
MAPI_W_POSITION_CHANGED = 0x80040481,
MAPI_W_APPROX_COUNT = 0x80040482,
MAPI_E_WAIT = 0x80040500,
MAPI_E_CANCEL = 0x80040501,
MAPI_E_NOT_ME = 0x80040502,
MAPI_W_CANCEL_MESSAGE = 0x80040580,
MAPI_E_CORRUPT_STORE = 0x80040600,
MAPI_E_NOT_IN_QUEUE = 0x80040601,
MAPI_E_NO_SUPPRESS = 0x80040602,
MAPI_E_COLLISION = 0x80040604,
MAPI_E_NOT_INITIALIZED = 0x80040605,
MAPI_E_NON_STANDARD = 0x80040606,
MAPI_E_NO_RECIPIENTS = 0x80040607,
MAPI_E_SUBMITTED = 0x80040608,
MAPI_E_HAS_FOLDERS = 0x80040609,
MAPI_E_HAS_MESAGES = 0x8004060A,
MAPI_E_FOLDER_CYCLE = 0x8004060B,
MAPI_W_PARTIAL_COMPLETION = 0x80040680,
MAPI_E_AMBIGUOUS_RECIP = 0x80040700,
MAPI_E_RESERVED = 0xFFFFFFFF
} MAPISTATUS;

3421
idl/nspi/mapitags_enum.h Normal file

File diff suppressed because it is too large Load Diff

372
idl/nspi/nspi.idl Normal file
View File

@ -0,0 +1,372 @@
/*
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 */
#define RES_AND 0
#define RES_OR 1
#define RES_NOT 2
#define RES_CONTENT 3
#define RES_PROPERTY 4
#define RES_COMPAREPROPS 5
#define RES_BITMASK 6
#define RES_SIZE 7
#define RES_EXIST 8
#define RES_SUBRESTRICTION 9
#define RES_COMMENT 10
typedef struct {
uint32 relop;
MAPITAGS ulPropTag;
SPropValue *lpProp;
} SPropertyRestriction;
typedef struct {
uint32 cRes;
[size_is(cRes)][unique]SRestriction *lpRes;
} SAndRestriction;
typedef [switch_type(uint32)] 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{
uint32 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();
#define PT_UNSPECIFIED 0x0000
#define PT_NULL 0x0001
#define PT_I2 0x0002
#define PT_LONG 0x0003
#define PT_R4 0x0004
#define PT_DOUBLE 0x0005
#define PT_CURRENCY 0x0006
#define PT_APPTIME 0x0007
#define PT_ERROR 0x000a /* means the given attr contains no value */
#define PT_BOOLEAN 0x000b
#define PT_OBJECT 0x000d
#define PT_I8 0x0014
#define PT_STRING8 0x001e
#define PT_UNICODE 0x001f
#define PT_SYSTIME 0x0040
#define PT_CLSID 0x0048
#define PT_BINARY 0x0102
/* Multi-valued properties */
#define PT_MV_I2 0x1002
#define PT_MV_LONG 0x1003
#define PT_MV_R4 0x1004
#define PT_MV_DOUBLE 0x1005
#define PT_MV_CURRENCY 0x1006
#define PT_MV_APPTIME 0x1007
#define PT_MV_I8 0x1014
#define PT_MV_STRING8 0x101e
#define PT_MV_TSTRING 0x101e
#define PT_MV_UNICODE 0x101f
#define PT_MV_SYSTIME 0x1040
#define PT_MV_CLSID 0x1048
#define PT_MV_BINARY 0x1102
/*****************/
/* 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(uint32)] 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();
}