Fix a typo.
[obnox/wireshark/wip.git] / packet-dcerpc-mapi.c
index 23d851b1c7385729abac453ae960498a93cd992c..611cf09254dd968bfc2589f92fb93db25a21b6e6 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for MS Exchange MAPI
  * Copyright 2002, Ronnie Sahlberg
  *
- * $Id: packet-dcerpc-mapi.c,v 1.20 2003/02/10 02:07:15 tpot Exp $
+ * $Id: packet-dcerpc-mapi.c,v 1.26 2004/01/19 20:10:33 jmayer Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 #include "prefs.h"
 
 static int proto_dcerpc_mapi = -1;
+static int hf_mapi_opnum = -1;
 static int hf_mapi_unknown_string = -1;
 static int hf_mapi_unknown_short = -1;
+static int hf_mapi_unknown_long = -1;
 static int hf_mapi_hnd = -1;
 static int hf_mapi_rc = -1;
 static int hf_mapi_encap_datalen = -1;
@@ -137,7 +139,7 @@ mapi_decrypt_init(void)
 
 static int
 mapi_decrypt_pdu(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
        dcerpc_info *di;
        mapi_decrypted_data_t *mmd=NULL;
@@ -234,7 +236,7 @@ mapi_decrypt_pdu(tvbuff_t *tvb, int offset,
 
 static int
 mapi_logon_rqst(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
         offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep,
                        sizeof(guint8), hf_mapi_unknown_string, TRUE, NULL);
@@ -249,17 +251,22 @@ There might be offsets/padding mismatched due to potential pointer expansions
 or padding bytes. Captures where this code breaks will tell us about that */
 static int
 mapi_logon_reply(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
-                                      hf_mapi_hnd, NULL, FALSE, FALSE);
+                                      hf_mapi_hnd, NULL, NULL, FALSE, FALSE);
 
         DISSECT_UNKNOWN(20); /* this is 20 bytes, unless there are pointers */
 
         offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep,
                        sizeof(guint8), hf_mapi_unknown_string, TRUE, NULL);
 
-        DISSECT_UNKNOWN(6); /* possibly 1 or 2 bytes padding here */
+        /* Was DISSECT_UNKNOWN(6), but the 1 or 2 bytes the comment that
+           was here referred to probably were padding, if they were seen;
+           in another capture, there are 5 bytes there - it's probably a
+           4-byte quantity, always aligned on a 4-byte boundary. */
+        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
+                       hf_mapi_unknown_long, NULL);
 
         offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep,
                        sizeof(guint8), hf_mapi_unknown_string, TRUE, NULL);
@@ -273,11 +280,11 @@ mapi_logon_reply(tvbuff_t *tvb, int offset,
 }
 
 static int
-mapi_unknown_02_request(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+mapi_ec_do_rpc_request(tvbuff_t *tvb, int offset,
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
-                                      hf_mapi_hnd, NULL, FALSE, FALSE);
+                                      hf_mapi_hnd, NULL, NULL, FALSE, FALSE);
 
        if(!mapi_decrypt){
                /* this is a unidimensional varying and conformant array of
@@ -299,11 +306,11 @@ mapi_unknown_02_request(tvbuff_t *tvb, int offset,
        return offset;
 }
 static int
-mapi_unknown_02_reply(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+mapi_ec_do_rpc_reply(tvbuff_t *tvb, int offset,
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
-                                      hf_mapi_hnd, NULL, FALSE, FALSE);
+                                      hf_mapi_hnd, NULL, NULL, FALSE, FALSE);
 
        if(!mapi_decrypt){
                /* this is a unidimensional varying and conformant array of
@@ -327,20 +334,20 @@ mapi_unknown_02_reply(tvbuff_t *tvb, int offset,
 
 static int
 mapi_logoff_rqst(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
-                                      hf_mapi_hnd, NULL, FALSE, FALSE);
+                                      hf_mapi_hnd, NULL, NULL, FALSE, FALSE);
 
        return offset;
 }
 
 static int
 mapi_logoff_reply(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, char *drep)
+       packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
-                                      hf_mapi_hnd, NULL, FALSE, FALSE);
+                                      hf_mapi_hnd, NULL, NULL, FALSE, FALSE);
 
        offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep,
                        hf_mapi_rc, NULL);
@@ -350,16 +357,24 @@ mapi_logoff_reply(tvbuff_t *tvb, int offset,
 
 
 static dcerpc_sub_dissector dcerpc_mapi_dissectors[] = {
-        { MAPI_LOGON,          "Logon",
+        { MAPI_EC_DO_CONNECT,  "EcDoConnect",
                mapi_logon_rqst,
                mapi_logon_reply },
-        { MAPI_LOGOFF,         "Logoff",
+        { MAPI_EC_DO_DISCONNECT,"EcDoDisconnect",
                mapi_logoff_rqst,
                mapi_logoff_reply },
-        { MAPI_UNKNOWN_02,     "unknown_02",
-               mapi_unknown_02_request,
-               mapi_unknown_02_reply },
-
+        { MAPI_EC_DO_RPC,      "EcDoRpc",
+               mapi_ec_do_rpc_request,
+               mapi_ec_do_rpc_reply },
+       { MAPI_EC_GET_MORE_RPC, "EcGetMoreRpc", NULL, NULL },
+       { MAPI_EC_REGISTER_PUSH_NOTIFICATION, "EcRRegisterPushNotification",
+               NULL, NULL },
+       { MAPI_EC_UNREGISTER_PUSH_NOTIFICATION, "EcRUnregisterPushNotification",
+               NULL, NULL },
+       { MAPI_EC_DUMMY_RPC, "EcDummyRpc", NULL, NULL },
+       { MAPI_EC_GET_DC_NAME, "EcRGetDCName", NULL, NULL },
+       { MAPI_EC_NET_GET_DC_NAME, "EcRNetGetDCName", NULL, NULL },
+       { MAPI_EC_DO_RPC_EXT, "EcDoRpcExt", NULL, NULL },
         {0, NULL, NULL,  NULL }
 };
 
@@ -368,6 +383,10 @@ proto_register_dcerpc_mapi(void)
 {
 
 static hf_register_info hf[] = {
+       { &hf_mapi_opnum,
+               { "Operation", "mapi.opnum", FT_UINT16, BASE_DEC,
+                 NULL, 0x0, "", HFILL }},
+
        { &hf_mapi_hnd,
                { "Context Handle", "mapi.hnd", FT_BYTES, BASE_NONE,
                NULL, 0x0, "", HFILL }},
@@ -384,6 +403,10 @@ static hf_register_info hf[] = {
                { "Unknown short", "mapi.unknown_short", FT_UINT16, BASE_HEX,
                NULL, 0, "Unknown short. If you know what this is, contact ethereal developers.", HFILL }},
 
+       { &hf_mapi_unknown_long,
+               { "Unknown long", "mapi.unknown_long", FT_UINT32, BASE_HEX,
+               NULL, 0, "Unknown long. If you know what this is, contact ethereal developers.", HFILL }},
+
        { &hf_mapi_encap_datalen,
                { "Length", "mapi.encap_len", FT_UINT16, BASE_DEC,
                NULL, 0x0, "Length of encapsulated/encrypted data", HFILL }},
@@ -449,5 +472,5 @@ proto_reg_handoff_dcerpc_mapi(void)
 
         dcerpc_init_uuid(proto_dcerpc_mapi, ett_dcerpc_mapi,
                          &uuid_dcerpc_mapi, ver_dcerpc_mapi,
-                         dcerpc_mapi_dissectors, -1);
+                         dcerpc_mapi_dissectors, hf_mapi_opnum);
 }