1999-12-03 21:50:31 +00:00
|
|
|
/* packet-tacacs.c
|
2001-07-10 21:06:53 +00:00
|
|
|
* Routines for cisco tacacs/xtacacs/tacacs+ packet dissection
|
|
|
|
* Copyright 2001, Paul Ionescu <paul@acorp.ro>
|
1999-12-03 21:50:31 +00:00
|
|
|
*
|
2002-08-28 21:04:11 +00:00
|
|
|
* $Id: packet-tacacs.c,v 1.23 2002/08/28 21:00:35 jmayer Exp $
|
1999-12-03 21:50:31 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
2001-07-10 21:06:53 +00:00
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
1999-12-03 21:50:31 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2001-07-10 21:06:53 +00:00
|
|
|
* Copied from old packet-tacacs.c
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-03 21:50:31 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-03 21:50:31 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-03 21:50:31 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2001-07-10 21:06:53 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
/* rfc-1492 for tacacs and xtacacs
|
2001-07-10 21:06:53 +00:00
|
|
|
* draft-grant-tacacs-00.txt for tacacs+ (tacplus)
|
|
|
|
*/
|
|
|
|
|
1999-12-03 21:50:31 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
1999-12-03 21:50:31 +00:00
|
|
|
|
|
|
|
static int proto_tacacs = -1;
|
2001-07-11 07:03:45 +00:00
|
|
|
static int hf_tacacs_version = -1;
|
|
|
|
static int hf_tacacs_type = -1;
|
|
|
|
static int hf_tacacs_nonce = -1;
|
|
|
|
static int hf_tacacs_userlen = -1;
|
|
|
|
static int hf_tacacs_passlen = -1;
|
|
|
|
static int hf_tacacs_response = -1;
|
|
|
|
static int hf_tacacs_reason = -1;
|
|
|
|
static int hf_tacacs_result1 = -1;
|
|
|
|
static int hf_tacacs_destaddr = -1;
|
|
|
|
static int hf_tacacs_destport = -1;
|
|
|
|
static int hf_tacacs_line = -1;
|
|
|
|
static int hf_tacacs_result2 = -1;
|
|
|
|
static int hf_tacacs_result3 = -1;
|
1999-12-03 21:50:31 +00:00
|
|
|
|
|
|
|
static gint ett_tacacs = -1;
|
|
|
|
|
2001-07-11 07:03:45 +00:00
|
|
|
#define VERSION_TACACS 0x00
|
|
|
|
#define VERSION_XTACACS 0x80
|
|
|
|
|
|
|
|
static const value_string tacacs_version_vals[] = {
|
|
|
|
{ VERSION_TACACS, "TACACS" },
|
|
|
|
{ VERSION_XTACACS, "XTACACS" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
#define TACACS_LOGIN 1
|
|
|
|
#define TACACS_RESPONSE 2
|
|
|
|
#define TACACS_CHANGE 3
|
|
|
|
#define TACACS_FOLLOW 4
|
|
|
|
#define TACACS_CONNECT 5
|
|
|
|
#define TACACS_SUPERUSER 6
|
|
|
|
#define TACACS_LOGOUT 7
|
|
|
|
#define TACACS_RELOAD 8
|
|
|
|
#define TACACS_SLIP_ON 9
|
|
|
|
#define TACACS_SLIP_OFF 10
|
|
|
|
#define TACACS_SLIP_ADDR 11
|
2001-07-10 21:06:53 +00:00
|
|
|
static const value_string tacacs_type_vals[] = {
|
2001-07-11 07:03:45 +00:00
|
|
|
{ TACACS_LOGIN, "Login" },
|
|
|
|
{ TACACS_RESPONSE, "Response" },
|
|
|
|
{ TACACS_CHANGE, "Change" },
|
|
|
|
{ TACACS_FOLLOW, "Follow" },
|
|
|
|
{ TACACS_CONNECT, "Connect" },
|
|
|
|
{ TACACS_SUPERUSER, "Superuser" },
|
|
|
|
{ TACACS_LOGOUT, "Logout" },
|
|
|
|
{ TACACS_RELOAD, "Reload" },
|
|
|
|
{ TACACS_SLIP_ON, "SLIP on" },
|
|
|
|
{ TACACS_SLIP_OFF, "SLIP off" },
|
|
|
|
{ TACACS_SLIP_ADDR, "SLIP Addr" },
|
2002-08-28 21:04:11 +00:00
|
|
|
{ 0, NULL }};
|
2001-07-10 21:06:53 +00:00
|
|
|
|
|
|
|
static const value_string tacacs_reason_vals[] = {
|
|
|
|
{ 0 , "none" },
|
|
|
|
{ 1 , "expiring" },
|
|
|
|
{ 2 , "password" },
|
|
|
|
{ 3 , "denied" },
|
|
|
|
{ 4 , "quit" },
|
|
|
|
{ 5 , "idle" },
|
|
|
|
{ 6 , "drop" },
|
2001-11-27 22:37:20 +00:00
|
|
|
{ 7 , "bad" },
|
|
|
|
{ 0 , NULL }
|
|
|
|
};
|
2001-07-10 21:06:53 +00:00
|
|
|
|
|
|
|
static const value_string tacacs_resp_vals[] = {
|
|
|
|
{ 0 , "this is not a response" },
|
|
|
|
{ 1 , "accepted" },
|
2001-11-27 22:37:20 +00:00
|
|
|
{ 2 , "rejected" },
|
|
|
|
{ 0 , NULL }
|
|
|
|
};
|
2001-07-10 21:06:53 +00:00
|
|
|
|
|
|
|
#define TAC_PLUS_AUTHEN 1
|
|
|
|
#define TAC_PLUS_AUTHOR 2
|
|
|
|
#define TAC_PLUS_ACCT 3
|
|
|
|
|
2000-04-08 07:07:42 +00:00
|
|
|
#define UDP_PORT_TACACS 49
|
|
|
|
#define TCP_PORT_TACACS 49
|
|
|
|
|
|
|
|
static void
|
2001-02-28 10:28:55 +00:00
|
|
|
dissect_tacacs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
1999-12-03 21:50:31 +00:00
|
|
|
{
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree *tacacs_tree;
|
|
|
|
proto_item *ti;
|
2001-07-10 21:06:53 +00:00
|
|
|
guint8 txt_buff[256],version,type,userlen,passlen;
|
1999-12-03 21:50:31 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "TACACS");
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2001-07-11 07:03:45 +00:00
|
|
|
|
|
|
|
version = tvb_get_guint8(tvb,0);
|
|
|
|
if (version != 0) {
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "XTACACS");
|
2001-07-11 07:03:45 +00:00
|
|
|
}
|
Add the "Edit:Protocols..." feature which currently only implements
the following:
It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.
Disabling a protocol could be interesting:
- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)
Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)
I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).
Two functions are added in proto.c :
gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);
and two MACROs which can be used in dissectors:
OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)
See also the XXX in proto_dlg.c and proto.c around the new functions.
svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
|
|
|
|
2001-07-11 07:03:45 +00:00
|
|
|
type = tvb_get_guint8(tvb,1);
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_add_str(pinfo->cinfo, COL_INFO,
|
2001-07-11 07:03:45 +00:00
|
|
|
val_to_str(type, tacacs_type_vals, "Unknown (0x%02x)"));
|
1999-12-03 21:50:31 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
if (tree)
|
1999-12-03 21:50:31 +00:00
|
|
|
{
|
2001-07-10 21:06:53 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_tacacs,
|
2002-01-24 09:20:54 +00:00
|
|
|
tvb, 0, -1, version==0?"TACACS":"XTACACS");
|
1999-12-03 21:50:31 +00:00
|
|
|
tacacs_tree = proto_item_add_subtree(ti, ett_tacacs);
|
|
|
|
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_uint(tacacs_tree, hf_tacacs_version, tvb, 0, 1,
|
|
|
|
version);
|
|
|
|
proto_tree_add_uint(tacacs_tree, hf_tacacs_type, tvb, 1, 1,
|
|
|
|
type);
|
|
|
|
proto_tree_add_item(tacacs_tree, hf_tacacs_nonce, tvb, 2, 2,
|
|
|
|
FALSE);
|
2001-07-10 21:06:53 +00:00
|
|
|
|
|
|
|
if (version==0)
|
|
|
|
{
|
2001-07-11 07:03:45 +00:00
|
|
|
if (type!=TACACS_RESPONSE)
|
2001-07-10 21:06:53 +00:00
|
|
|
{
|
|
|
|
userlen=tvb_get_guint8(tvb,4);
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_uint(tacacs_tree, hf_tacacs_userlen, tvb, 4, 1,
|
|
|
|
userlen);
|
2001-07-10 21:06:53 +00:00
|
|
|
passlen=tvb_get_guint8(tvb,5);
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_uint(tacacs_tree, hf_tacacs_passlen, tvb, 5, 1,
|
|
|
|
passlen);
|
2001-07-10 21:06:53 +00:00
|
|
|
tvb_get_nstringz0(tvb,6,userlen,txt_buff);
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_text(tacacs_tree, tvb, 6, userlen, "Username: %s",txt_buff);
|
2001-07-10 21:06:53 +00:00
|
|
|
tvb_get_nstringz0(tvb,6+userlen,passlen,txt_buff);
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_text(tacacs_tree, tvb, 6+userlen, passlen, "Password: %s",txt_buff);
|
1999-12-03 21:50:31 +00:00
|
|
|
}
|
2001-07-10 21:06:53 +00:00
|
|
|
else
|
|
|
|
{
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_item(tacacs_tree, hf_tacacs_response, tvb, 4, 1,
|
|
|
|
FALSE);
|
|
|
|
proto_tree_add_item(tacacs_tree, hf_tacacs_reason, tvb, 5, 1,
|
|
|
|
FALSE);
|
1999-12-03 21:50:31 +00:00
|
|
|
}
|
2001-07-10 21:06:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
userlen=tvb_get_guint8(tvb,4);
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_uint(tacacs_tree, hf_tacacs_userlen, tvb, 4, 1,
|
|
|
|
userlen);
|
2001-07-10 21:06:53 +00:00
|
|
|
passlen=tvb_get_guint8(tvb,5);
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_uint(tacacs_tree, hf_tacacs_passlen, tvb, 5, 1,
|
|
|
|
passlen);
|
|
|
|
proto_tree_add_item(tacacs_tree, hf_tacacs_response, tvb, 6, 1,
|
|
|
|
FALSE);
|
|
|
|
proto_tree_add_item(tacacs_tree, hf_tacacs_reason, tvb, 7, 1,
|
|
|
|
FALSE);
|
|
|
|
proto_tree_add_item(tacacs_tree, hf_tacacs_result1, tvb, 8, 4,
|
|
|
|
FALSE);
|
|
|
|
proto_tree_add_item(tacacs_tree, hf_tacacs_destaddr, tvb, 12, 4,
|
|
|
|
FALSE);
|
|
|
|
proto_tree_add_item(tacacs_tree, hf_tacacs_destport, tvb, 16, 2,
|
|
|
|
FALSE);
|
|
|
|
proto_tree_add_item(tacacs_tree, hf_tacacs_line, tvb, 18, 2,
|
|
|
|
FALSE);
|
|
|
|
proto_tree_add_item(tacacs_tree, hf_tacacs_result2, tvb, 20, 4,
|
|
|
|
FALSE);
|
|
|
|
proto_tree_add_item(tacacs_tree, hf_tacacs_result3, tvb, 24, 2,
|
|
|
|
FALSE);
|
|
|
|
if (type!=TACACS_RESPONSE)
|
|
|
|
{
|
2001-07-10 21:06:53 +00:00
|
|
|
tvb_get_nstringz0(tvb,26,userlen,txt_buff);
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_text(tacacs_tree, tvb, 26, userlen, "Username: %s",txt_buff);
|
2001-07-10 21:06:53 +00:00
|
|
|
tvb_get_nstringz0(tvb,26+userlen,passlen,txt_buff);
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_text(tacacs_tree, tvb, 26+userlen, passlen, "Password; %s",txt_buff);
|
2001-07-10 21:06:53 +00:00
|
|
|
}
|
|
|
|
}
|
1999-12-03 21:50:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-11 07:03:45 +00:00
|
|
|
void
|
|
|
|
proto_register_tacacs(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_tacacs_version,
|
|
|
|
{ "Version", "tacacs.version",
|
|
|
|
FT_UINT8, BASE_HEX, VALS(tacacs_version_vals), 0x0,
|
|
|
|
"Version", HFILL }},
|
|
|
|
{ &hf_tacacs_type,
|
|
|
|
{ "Type", "tacacs.type",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(tacacs_type_vals), 0x0,
|
|
|
|
"Type", HFILL }},
|
|
|
|
{ &hf_tacacs_nonce,
|
|
|
|
{ "Nonce", "tacacs.nonce",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0,
|
|
|
|
"Nonce", HFILL }},
|
|
|
|
{ &hf_tacacs_userlen,
|
|
|
|
{ "Username length", "tacacs.userlen",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"Username length", HFILL }},
|
|
|
|
{ &hf_tacacs_passlen,
|
|
|
|
{ "Password length", "tacacs.passlen",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"Password length", HFILL }},
|
|
|
|
{ &hf_tacacs_response,
|
|
|
|
{ "Response", "tacacs.response",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(tacacs_resp_vals), 0x0,
|
|
|
|
"Response", HFILL }},
|
|
|
|
{ &hf_tacacs_reason,
|
|
|
|
{ "Reason", "tacacs.reason",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(tacacs_reason_vals), 0x0,
|
|
|
|
"Reason", HFILL }},
|
|
|
|
{ &hf_tacacs_result1,
|
|
|
|
{ "Result 1", "tacacs.result1",
|
|
|
|
FT_UINT32, BASE_HEX, NULL, 0x0,
|
|
|
|
"Result 1", HFILL }},
|
|
|
|
{ &hf_tacacs_destaddr,
|
|
|
|
{ "Destination address", "tacacs.destaddr",
|
|
|
|
FT_IPv4, BASE_NONE, NULL, 0x0,
|
|
|
|
"Destination address", HFILL }},
|
|
|
|
{ &hf_tacacs_destport,
|
|
|
|
{ "Destination port", "tacacs.destport",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
|
|
|
"Destination port", HFILL }},
|
|
|
|
{ &hf_tacacs_line,
|
|
|
|
{ "Line", "tacacs.line",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
|
|
|
"Line", HFILL }},
|
|
|
|
{ &hf_tacacs_result2,
|
|
|
|
{ "Result 2", "tacacs.result2",
|
|
|
|
FT_UINT32, BASE_HEX, NULL, 0x0,
|
|
|
|
"Result 2", HFILL }},
|
|
|
|
{ &hf_tacacs_result3,
|
|
|
|
{ "Result 3", "tacacs.result3",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0,
|
|
|
|
"Result 3", HFILL }},
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_tacacs,
|
|
|
|
};
|
|
|
|
proto_tacacs = proto_register_protocol("TACACS", "TACACS", "tacacs");
|
|
|
|
proto_register_field_array(proto_tacacs, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_tacacs(void)
|
|
|
|
{
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_handle_t tacacs_handle;
|
|
|
|
|
|
|
|
tacacs_handle = create_dissector_handle(dissect_tacacs, proto_tacacs);
|
|
|
|
dissector_add("udp.port", UDP_PORT_TACACS, tacacs_handle);
|
2001-07-11 07:03:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int proto_tacplus = -1;
|
|
|
|
static int hf_tacplus_response = -1;
|
|
|
|
static int hf_tacplus_request = -1;
|
|
|
|
static int hf_tacplus_majvers = -1;
|
|
|
|
static int hf_tacplus_minvers = -1;
|
|
|
|
static int hf_tacplus_type = -1;
|
|
|
|
static int hf_tacplus_seqno = -1;
|
|
|
|
static int hf_tacplus_flags = -1;
|
|
|
|
static int hf_tacplus_flags_payload_type = -1;
|
|
|
|
static int hf_tacplus_flags_connection_type = -1;
|
|
|
|
static int hf_tacplus_session_id = -1;
|
|
|
|
static int hf_tacplus_packet_len = -1;
|
|
|
|
|
|
|
|
static gint ett_tacplus = -1;
|
|
|
|
static gint ett_tacplus_flags = -1;
|
|
|
|
|
|
|
|
static const value_string tacplus_type_vals[] = {
|
|
|
|
{ TAC_PLUS_AUTHEN , "Authentication" },
|
|
|
|
{ TAC_PLUS_AUTHOR , "Authorization" },
|
|
|
|
{ TAC_PLUS_ACCT , "Accounting" },
|
|
|
|
{ 0 , NULL }};
|
|
|
|
|
|
|
|
#define FLAGS_UNENCRYPTED 0x01
|
|
|
|
|
|
|
|
static const true_false_string payload_type = {
|
|
|
|
"Unencrypted",
|
|
|
|
"Encrypted"
|
|
|
|
};
|
|
|
|
|
|
|
|
#define FLAGS_SINGLE 0x04
|
|
|
|
|
|
|
|
static const true_false_string connection_type = {
|
|
|
|
"Single",
|
|
|
|
"Multiple"
|
|
|
|
};
|
|
|
|
|
2000-04-08 07:07:42 +00:00
|
|
|
static void
|
2001-02-28 10:28:55 +00:00
|
|
|
dissect_tacplus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
1999-12-03 21:50:31 +00:00
|
|
|
{
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree *tacplus_tree;
|
|
|
|
proto_item *ti;
|
|
|
|
guint8 version,flags;
|
|
|
|
proto_tree *flags_tree;
|
|
|
|
proto_item *tf;
|
2001-07-10 21:06:53 +00:00
|
|
|
guint32 len;
|
|
|
|
gboolean request=(pinfo->match_port == pinfo->destport);
|
1999-12-03 21:50:31 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "TACACS+");
|
1999-12-03 21:50:31 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
1999-12-03 21:50:31 +00:00
|
|
|
{
|
2002-01-21 23:35:32 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO,
|
2002-08-28 21:04:11 +00:00
|
|
|
request ? "Request" : "Response");
|
1999-12-03 21:50:31 +00:00
|
|
|
}
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
if (tree)
|
1999-12-03 21:50:31 +00:00
|
|
|
{
|
2001-07-11 07:03:45 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_tacplus,
|
2002-01-24 09:20:54 +00:00
|
|
|
tvb, 0, -1, "TACACS+");
|
1999-12-03 21:50:31 +00:00
|
|
|
|
2001-07-11 07:03:45 +00:00
|
|
|
tacplus_tree = proto_item_add_subtree(ti, ett_tacplus);
|
|
|
|
if (pinfo->match_port == pinfo->destport)
|
|
|
|
{
|
|
|
|
proto_tree_add_boolean_hidden(tacplus_tree,
|
|
|
|
hf_tacplus_request, tvb, 0, 0, TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
proto_tree_add_boolean_hidden(tacplus_tree,
|
|
|
|
hf_tacplus_response, tvb, 0, 0, TRUE);
|
|
|
|
}
|
2001-07-10 21:06:53 +00:00
|
|
|
version = tvb_get_guint8(tvb,0);
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_uint_format(tacplus_tree, hf_tacplus_majvers, tvb, 0, 1,
|
|
|
|
version,
|
|
|
|
"Major version: %s",
|
|
|
|
(version&0xf0)==0xc0?"TACACS+":"Unknown Version");
|
|
|
|
proto_tree_add_uint(tacplus_tree, hf_tacplus_minvers, tvb, 0, 1,
|
|
|
|
version&0xf);
|
|
|
|
proto_tree_add_item(tacplus_tree, hf_tacplus_type, tvb, 1, 1,
|
|
|
|
FALSE);
|
|
|
|
proto_tree_add_item(tacplus_tree, hf_tacplus_seqno, tvb, 2, 1,
|
|
|
|
FALSE);
|
2001-07-10 21:06:53 +00:00
|
|
|
flags = tvb_get_guint8(tvb,3);
|
2001-07-11 16:03:34 +00:00
|
|
|
tf = proto_tree_add_uint_format(tacplus_tree, hf_tacplus_flags,
|
|
|
|
tvb, 3, 1, flags,
|
|
|
|
"Flags: %s, %s (0x%02x)",
|
|
|
|
(flags&FLAGS_UNENCRYPTED) ? "Unencrypted payload" :
|
|
|
|
"Encrypted payload",
|
|
|
|
(flags&FLAGS_SINGLE) ? "Single connection" :
|
|
|
|
"Multiple Connections",
|
2001-07-11 07:03:45 +00:00
|
|
|
flags);
|
|
|
|
flags_tree = proto_item_add_subtree(tf, ett_tacplus_flags);
|
|
|
|
proto_tree_add_boolean(flags_tree, hf_tacplus_flags_payload_type,
|
|
|
|
tvb, 3, 1, flags);
|
|
|
|
proto_tree_add_boolean(flags_tree, hf_tacplus_flags_connection_type,
|
|
|
|
tvb, 3, 1, flags);
|
|
|
|
proto_tree_add_item(tacplus_tree, hf_tacplus_session_id, tvb, 4, 4,
|
|
|
|
FALSE);
|
2001-07-10 21:06:53 +00:00
|
|
|
len = tvb_get_ntohl(tvb,8);
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_uint(tacplus_tree, hf_tacplus_packet_len, tvb, 8, 4,
|
|
|
|
len);
|
1999-12-03 21:50:31 +00:00
|
|
|
|
2001-07-11 07:03:45 +00:00
|
|
|
if (flags&FLAGS_UNENCRYPTED)
|
|
|
|
proto_tree_add_text(tacplus_tree, tvb, 12, len, "Payload");
|
1999-12-03 21:50:31 +00:00
|
|
|
else
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tree_add_text(tacplus_tree, tvb, 12, len, "Encrypted payload");
|
1999-12-03 21:50:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_register_tacplus(void)
|
1999-12-03 21:50:31 +00:00
|
|
|
{
|
2001-07-11 07:03:45 +00:00
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_tacplus_response,
|
|
|
|
{ "Response", "tacplus.response",
|
|
|
|
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
"TRUE if TACACS+ response", HFILL }},
|
|
|
|
{ &hf_tacplus_request,
|
|
|
|
{ "Request", "tacplus.request",
|
|
|
|
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
"TRUE if TACACS+ request", HFILL }},
|
|
|
|
{ &hf_tacplus_majvers,
|
|
|
|
{ "Major version", "tacplus.majvers",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"Major version number", HFILL }},
|
|
|
|
{ &hf_tacplus_minvers,
|
|
|
|
{ "Minor version", "tacplus.minvers",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"Minor version number", HFILL }},
|
|
|
|
{ &hf_tacplus_type,
|
|
|
|
{ "Type", "tacplus.type",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(tacplus_type_vals), 0x0,
|
|
|
|
"Type", HFILL }},
|
|
|
|
{ &hf_tacplus_seqno,
|
|
|
|
{ "Sequence number", "tacplus.seqno",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"Sequence number", HFILL }},
|
|
|
|
{ &hf_tacplus_flags,
|
|
|
|
{ "Flags", "tacplus.flags",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x0,
|
|
|
|
"Flags", HFILL }},
|
|
|
|
{ &hf_tacplus_flags_payload_type,
|
|
|
|
{ "Payload type", "tacplus.flags.payload_type",
|
|
|
|
FT_BOOLEAN, 8, TFS(&payload_type), FLAGS_UNENCRYPTED,
|
|
|
|
"Payload type (unencrypted or encrypted)", HFILL }},
|
|
|
|
{ &hf_tacplus_flags_connection_type,
|
|
|
|
{ "Connection type", "tacplus.flags.connection_type",
|
|
|
|
FT_BOOLEAN, 8, TFS(&connection_type), FLAGS_SINGLE,
|
|
|
|
"Connection type (single or multiple)", HFILL }},
|
|
|
|
{ &hf_tacplus_session_id,
|
|
|
|
{ "Session ID", "tacplus.session_id",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"Session ID", HFILL }},
|
|
|
|
{ &hf_tacplus_packet_len,
|
|
|
|
{ "Packet length", "tacplus.packet_len",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"Packet length", HFILL }}
|
|
|
|
};
|
|
|
|
|
1999-12-03 21:50:31 +00:00
|
|
|
static gint *ett[] = {
|
2001-07-11 07:03:45 +00:00
|
|
|
&ett_tacplus,
|
|
|
|
&ett_tacplus_flags,
|
1999-12-03 21:50:31 +00:00
|
|
|
};
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tacplus = proto_register_protocol("TACACS+", "TACACS+", "tacplus");
|
|
|
|
proto_register_field_array(proto_tacplus, hf, array_length(hf));
|
1999-12-03 21:50:31 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
}
|
2000-04-08 07:07:42 +00:00
|
|
|
|
|
|
|
void
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_reg_handoff_tacplus(void)
|
2000-04-08 07:07:42 +00:00
|
|
|
{
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_handle_t tacplus_handle;
|
|
|
|
|
|
|
|
tacplus_handle = create_dissector_handle(dissect_tacplus,
|
2001-07-11 07:03:45 +00:00
|
|
|
proto_tacplus);
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_add("tcp.port", TCP_PORT_TACACS, tacplus_handle);
|
2000-04-08 07:07:42 +00:00
|
|
|
}
|