2005-11-16 22:53:33 +00:00
|
|
|
/* packet-dap.c
|
|
|
|
* Routines for X.511 (X.500 Directory Asbtract Service) and X.519 DAP packet dissection
|
|
|
|
* Graeme Lunt 2005
|
|
|
|
*
|
2005-11-26 10:05:14 +00:00
|
|
|
* $Id$
|
2005-11-16 22:53:33 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2005-11-16 22:53:33 +00:00
|
|
|
* 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 <glib.h>
|
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/prefs.h>
|
2007-08-25 01:14:24 +00:00
|
|
|
#include <epan/oids.h>
|
2007-05-13 20:58:29 +00:00
|
|
|
#include <epan/asn1.h>
|
2005-11-16 22:53:33 +00:00
|
|
|
|
|
|
|
#include "packet-ber.h"
|
|
|
|
#include "packet-acse.h"
|
|
|
|
#include "packet-ros.h"
|
2010-06-09 14:17:51 +00:00
|
|
|
#include "packet-idmp.h"
|
2005-11-16 22:53:33 +00:00
|
|
|
|
|
|
|
#include "packet-x509if.h"
|
|
|
|
#include "packet-x509af.h"
|
|
|
|
#include "packet-x509sat.h"
|
|
|
|
#include "packet-crmf.h"
|
|
|
|
|
|
|
|
#include "packet-dsp.h"
|
2005-12-16 06:47:22 +00:00
|
|
|
#include "packet-disp.h"
|
2005-11-16 22:53:33 +00:00
|
|
|
#include "packet-dap.h"
|
2005-11-16 23:17:21 +00:00
|
|
|
#include <epan/strutil.h>
|
2005-11-16 22:53:33 +00:00
|
|
|
|
2010-12-06 22:08:48 +00:00
|
|
|
/* we don't have a separate dissector for X519 -
|
2005-11-16 22:53:33 +00:00
|
|
|
most of DAP is defined in X511 */
|
|
|
|
#define PNAME "X.519 Directory Access Protocol"
|
|
|
|
#define PSNAME "DAP"
|
|
|
|
#define PFNAME "dap"
|
|
|
|
|
|
|
|
static guint global_dap_tcp_port = 102;
|
2008-11-11 15:05:00 +00:00
|
|
|
static dissector_handle_t tpkt_handle;
|
2010-12-06 22:08:48 +00:00
|
|
|
static void prefs_register_dap(void); /* forward declaration for use in preferences registration */
|
2005-11-16 22:53:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Initialize the protocol and registered fields */
|
2009-10-11 16:24:29 +00:00
|
|
|
static int proto_dap = -1;
|
2005-11-16 22:53:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include "packet-dap-hf.c"
|
|
|
|
|
|
|
|
/* Initialize the subtree pointers */
|
|
|
|
static gint ett_dap = -1;
|
|
|
|
#include "packet-dap-ett.c"
|
|
|
|
|
2007-12-15 15:21:25 +00:00
|
|
|
#include "packet-dap-val.h"
|
|
|
|
|
|
|
|
#include "packet-dap-table.c" /* operation and error codes */
|
|
|
|
|
2005-11-16 22:53:33 +00:00
|
|
|
#include "packet-dap-fn.c"
|
|
|
|
|
2007-12-15 15:21:25 +00:00
|
|
|
#include "packet-dap-table11.c" /* operation argument/result dissectors */
|
|
|
|
#include "packet-dap-table21.c" /* error dissector */
|
|
|
|
|
|
|
|
static const ros_info_t dap_ros_info = {
|
|
|
|
"DAP",
|
|
|
|
&proto_dap,
|
|
|
|
&ett_dap,
|
|
|
|
dap_opr_code_string_vals,
|
|
|
|
dap_opr_tab,
|
|
|
|
dap_err_code_string_vals,
|
|
|
|
dap_err_tab
|
|
|
|
};
|
2005-11-16 22:53:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*--- proto_register_dap -------------------------------------------*/
|
|
|
|
void proto_register_dap(void) {
|
|
|
|
|
|
|
|
/* List of fields */
|
|
|
|
static hf_register_info hf[] =
|
|
|
|
{
|
|
|
|
#include "packet-dap-hfarr.c"
|
|
|
|
};
|
|
|
|
|
|
|
|
/* List of subtrees */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_dap,
|
|
|
|
#include "packet-dap-ettarr.c"
|
|
|
|
};
|
|
|
|
module_t *dap_module;
|
|
|
|
|
|
|
|
/* Register protocol */
|
|
|
|
proto_dap = proto_register_protocol(PNAME, PSNAME, PFNAME);
|
|
|
|
|
|
|
|
/* Register fields and subtrees */
|
|
|
|
proto_register_field_array(proto_dap, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
/* Register our configuration options for DAP, particularly our port */
|
|
|
|
|
2005-12-07 23:20:11 +00:00
|
|
|
dap_module = prefs_register_protocol_subtree("OSI/X.500", proto_dap, prefs_register_dap);
|
2005-11-16 22:53:33 +00:00
|
|
|
|
|
|
|
prefs_register_uint_preference(dap_module, "tcp.port", "DAP TCP Port",
|
|
|
|
"Set the port for DAP operations (if other"
|
|
|
|
" than the default of 102)",
|
|
|
|
10, &global_dap_tcp_port);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--- proto_reg_handoff_dap --- */
|
|
|
|
void proto_reg_handoff_dap(void) {
|
|
|
|
|
|
|
|
/* #include "packet-dap-dis-tab.c" */
|
|
|
|
|
|
|
|
/* APPLICATION CONTEXT */
|
|
|
|
|
2007-10-31 21:24:16 +00:00
|
|
|
oid_add_from_string("id-ac-directory-access","2.5.3.1");
|
2005-11-16 22:53:33 +00:00
|
|
|
|
|
|
|
/* ABSTRACT SYNTAXES */
|
2010-12-06 22:08:48 +00:00
|
|
|
|
2005-11-16 22:53:33 +00:00
|
|
|
/* Register DAP with ROS (with no use of RTSE) */
|
2010-12-06 22:08:48 +00:00
|
|
|
register_ros_protocol_info("2.5.9.1", &dap_ros_info, 0, "id-as-directory-access", FALSE);
|
2005-11-16 22:53:33 +00:00
|
|
|
|
2010-06-09 14:17:51 +00:00
|
|
|
register_idmp_protocol_info("2.5.33.0", &dap_ros_info, 0, "dap-ip");
|
|
|
|
|
2005-11-16 22:53:33 +00:00
|
|
|
/* remember the tpkt handler for change in preferences */
|
|
|
|
tpkt_handle = find_dissector("tpkt");
|
|
|
|
|
2005-12-14 21:02:56 +00:00
|
|
|
/* AttributeValueAssertions */
|
|
|
|
x509if_register_fmt(hf_dap_equality, "=");
|
|
|
|
x509if_register_fmt(hf_dap_greaterOrEqual, ">=");
|
|
|
|
x509if_register_fmt(hf_dap_lessOrEqual, "<=");
|
|
|
|
x509if_register_fmt(hf_dap_approximateMatch, "=~");
|
|
|
|
/* AttributeTypes */
|
|
|
|
x509if_register_fmt(hf_dap_present, "= *");
|
|
|
|
|
2005-11-16 22:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-06 22:08:48 +00:00
|
|
|
static void
|
|
|
|
prefs_register_dap(void)
|
|
|
|
{
|
2008-11-11 15:05:00 +00:00
|
|
|
static guint tcp_port = 0;
|
2005-11-16 22:53:33 +00:00
|
|
|
|
|
|
|
/* de-register the old port */
|
|
|
|
/* port 102 is registered by TPKT - don't undo this! */
|
2008-11-11 15:05:00 +00:00
|
|
|
if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_delete_uint("tcp.port", tcp_port, tpkt_handle);
|
2005-11-16 22:53:33 +00:00
|
|
|
|
|
|
|
/* Set our port number for future use */
|
|
|
|
tcp_port = global_dap_tcp_port;
|
|
|
|
|
|
|
|
if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("tcp.port", global_dap_tcp_port, tpkt_handle);
|
2005-11-16 22:53:33 +00:00
|
|
|
|
|
|
|
}
|