/* packet-dcerpc-mapi.c * Routines for MS Exchange MAPI * Copyright 2002, Ronnie Sahlberg * * $Id$ * * Wireshark - Network traffic analyzer * By Gerald Combs * Copyright 1998 Gerald Combs * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "packet-dcerpc.h" #include "packet-dcerpc-nt.h" #include "packet-dcerpc-mapi.h" #include "packet-windows-common.h" /* for "NT_errors[]" */ #include 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; static int hf_mapi_encrypted_data = -1; static int hf_mapi_decrypted_data_maxlen = -1; static int hf_mapi_decrypted_data_offset = -1; static int hf_mapi_decrypted_data_len = -1; static int hf_mapi_decrypted_data = -1; static int hf_mapi_pdu_len = -1; static int hf_mapi_notification_port = -1; static int hf_mapi_notification_payload = -1; static gint ett_dcerpc_mapi = -1; static gint ett_mapi_decrypted_pdu = -1; static e_uuid_t uuid_dcerpc_mapi = { 0xa4f1db00, 0xca47, 0x1067, { 0xb3, 0x1f, 0x00, 0xdd, 0x01, 0x06, 0x62, 0xda } }; static guint16 ver_dcerpc_mapi = 0; #define DISSECT_UNKNOWN(len) \ {\ proto_tree_add_text(tree, tvb, offset, len,\ "unknown data (%d byte%s)", len,\ plurality(len, "", "s"));\ offset += len;\ } /* decryption */ static gboolean mapi_decrypt = FALSE; static int mapi_decrypt_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { dcerpc_info *di; guint8 *decrypted_data; tvbuff_t *decrypted_tvb; guint32 length; gint len, reported_len; const guint8 *ptr; gint i; guint16 pdu_len; proto_item *it = NULL; proto_tree *tr = NULL; di=pinfo->private_data; if(di->conformant_run){ return offset; } offset=dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_mapi_decrypted_data_maxlen, NULL); offset=dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_mapi_decrypted_data_offset, NULL); offset=dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_mapi_decrypted_data_len, &length); len = tvb_length_remaining(tvb, offset); reported_len = tvb_reported_length_remaining(tvb, offset); if((guint32)reported_len > length) reported_len = length; if(len > reported_len) len = reported_len; ptr=tvb_get_ptr(tvb, offset, len); decrypted_data=g_malloc(len); for(i=0;i