1999-11-10 17:23:55 +00:00
|
|
|
/* packet-ypbind.c
|
|
|
|
* Routines for ypbind dissection
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1999-11-10 17:23:55 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1999-11-10 17:23:55 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* Copied from packet-smb.c
|
|
|
|
*
|
2001-12-29 22:23:07 +00:00
|
|
|
* 2001 Ronnie Sahlberg, added dissectors for the commands
|
|
|
|
*
|
1999-11-10 17:23:55 +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.
|
|
|
|
*
|
|
|
|
* 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
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
1999-11-10 17:23:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "packet-rpc.h"
|
|
|
|
#include "packet-ypbind.h"
|
|
|
|
|
2013-12-10 06:01:16 +00:00
|
|
|
void proto_register_ypbind(void);
|
|
|
|
void proto_reg_handoff_ypbind(void);
|
|
|
|
|
1999-11-10 17:23:55 +00:00
|
|
|
static int proto_ypbind = -1;
|
2002-11-01 00:48:39 +00:00
|
|
|
static int hf_ypbind_procedure_v1 = -1;
|
|
|
|
static int hf_ypbind_procedure_v2 = -1;
|
2001-12-29 22:23:07 +00:00
|
|
|
static int hf_ypbind_domain = -1;
|
|
|
|
static int hf_ypbind_resp_type = -1;
|
2013-01-26 18:54:53 +00:00
|
|
|
/* static int hf_ypbind_error = -1; */
|
2001-12-29 22:23:07 +00:00
|
|
|
static int hf_ypbind_addr = -1;
|
|
|
|
static int hf_ypbind_port = -1;
|
|
|
|
static int hf_ypbind_setdom_version = -1;
|
1999-11-10 17:23:55 +00:00
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_ypbind = -1;
|
|
|
|
|
2001-12-29 22:23:07 +00:00
|
|
|
|
|
|
|
static int
|
2013-11-10 03:20:04 +00:00
|
|
|
dissect_ypbind_domain_v2_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
|
2001-12-29 22:23:07 +00:00
|
|
|
{
|
|
|
|
/* domain */
|
2002-08-28 21:04:11 +00:00
|
|
|
offset = dissect_rpc_string(tvb, tree,
|
2001-12-29 22:23:07 +00:00
|
|
|
hf_ypbind_domain, offset, NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define YPBIND_RESP_TYPE_SUCC_VAL 1
|
|
|
|
#define YPBIND_RESP_TYPE_FAIL_VAL 2
|
|
|
|
static const value_string resp_type_vals[] = {
|
|
|
|
{YPBIND_RESP_TYPE_SUCC_VAL, "SUCC_VAL"},
|
|
|
|
{YPBIND_RESP_TYPE_FAIL_VAL, "FAIL_VAL"},
|
|
|
|
{0, NULL}
|
|
|
|
};
|
|
|
|
|
2013-01-26 18:54:53 +00:00
|
|
|
#if 0
|
2001-12-29 22:23:07 +00:00
|
|
|
#define YPBIND_ERROR_ERR 1
|
|
|
|
#define YPBIND_ERROR_NOSERV 2
|
|
|
|
#define YPBIND_ERROR_RESC 3
|
|
|
|
static const value_string error_vals[] = {
|
|
|
|
{YPBIND_ERROR_ERR, "Internal error"},
|
|
|
|
{YPBIND_ERROR_NOSERV, "No bound server for passed domain"},
|
|
|
|
{YPBIND_ERROR_RESC, "System resource allocation failure"},
|
|
|
|
{0, NULL}
|
|
|
|
};
|
2013-01-26 18:54:53 +00:00
|
|
|
#endif
|
2001-12-29 22:23:07 +00:00
|
|
|
|
|
|
|
static int
|
2013-11-10 03:20:04 +00:00
|
|
|
dissect_ypbind_domain_v2_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
|
2001-12-29 22:23:07 +00:00
|
|
|
{
|
|
|
|
guint32 type;
|
|
|
|
|
|
|
|
/* response type */
|
|
|
|
type=tvb_get_ntohl(tvb, offset);
|
2002-04-03 13:24:13 +00:00
|
|
|
offset = dissect_rpc_uint32(tvb, tree, hf_ypbind_resp_type, offset);
|
2001-12-29 22:23:07 +00:00
|
|
|
|
|
|
|
switch(type){
|
|
|
|
case YPBIND_RESP_TYPE_SUCC_VAL:
|
|
|
|
/* ip address */
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_item(tree, hf_ypbind_addr,
|
2011-10-10 00:39:31 +00:00
|
|
|
tvb, offset, 4, ENC_BIG_ENDIAN);
|
2001-12-29 22:23:07 +00:00
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/* port */
|
2002-08-28 21:04:11 +00:00
|
|
|
offset = dissect_rpc_uint32(tvb, tree,
|
2001-12-29 22:23:07 +00:00
|
|
|
hf_ypbind_port, offset);
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2001-12-29 22:23:07 +00:00
|
|
|
break;
|
|
|
|
case YPBIND_RESP_TYPE_FAIL_VAL:
|
|
|
|
/* error */
|
2002-08-28 21:04:11 +00:00
|
|
|
offset = dissect_rpc_uint32(tvb, tree,
|
2001-12-29 22:23:07 +00:00
|
|
|
hf_ypbind_resp_type, offset);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2013-11-10 03:20:04 +00:00
|
|
|
dissect_ypbind_setdomain_v2_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
|
2001-12-29 22:23:07 +00:00
|
|
|
{
|
|
|
|
/* domain */
|
2002-08-28 21:04:11 +00:00
|
|
|
offset = dissect_rpc_string(tvb, tree,
|
2001-12-29 22:23:07 +00:00
|
|
|
hf_ypbind_domain, offset, NULL);
|
|
|
|
|
|
|
|
/* ip address */
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_item(tree, hf_ypbind_addr,
|
2011-10-10 00:39:31 +00:00
|
|
|
tvb, offset, 4, ENC_BIG_ENDIAN);
|
2001-12-29 22:23:07 +00:00
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/* port */
|
2002-08-28 21:04:11 +00:00
|
|
|
offset = dissect_rpc_uint32(tvb, tree,
|
2001-12-29 22:23:07 +00:00
|
|
|
hf_ypbind_port, offset);
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2001-12-29 22:23:07 +00:00
|
|
|
/* version */
|
2002-08-28 21:04:11 +00:00
|
|
|
offset = dissect_rpc_uint32(tvb, tree,
|
2001-12-29 22:23:07 +00:00
|
|
|
hf_ypbind_setdom_version, offset);
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2001-12-29 22:23:07 +00:00
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-11-10 17:23:55 +00:00
|
|
|
/* proc number, "proc name", dissect_request, dissect_reply */
|
2001-01-18 09:55:10 +00:00
|
|
|
/* NULL as function pointer means: type of arguments is "void". */
|
|
|
|
static const vsff ypbind1_proc[] = {
|
1999-11-10 17:23:55 +00:00
|
|
|
{ YPBINDPROC_NULL, "NULL", NULL, NULL },
|
|
|
|
{ YPBINDPROC_DOMAIN, "DOMAIN", NULL, NULL },
|
|
|
|
{ YPBINDPROC_SETDOM, "SETDOMAIN", NULL, NULL },
|
|
|
|
{ 0, NULL, NULL, NULL }
|
|
|
|
};
|
2002-11-01 00:48:39 +00:00
|
|
|
static const value_string ypbind1_proc_vals[] = {
|
|
|
|
{ YPBINDPROC_NULL, "NULL" },
|
|
|
|
{ YPBINDPROC_DOMAIN, "DOMAIN" },
|
|
|
|
{ YPBINDPROC_SETDOM, "SETDOMAIN" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
1999-11-10 17:23:55 +00:00
|
|
|
/* end of YPBind version 1 */
|
|
|
|
|
2001-01-18 09:55:10 +00:00
|
|
|
static const vsff ypbind2_proc[] = {
|
1999-11-10 17:23:55 +00:00
|
|
|
{ YPBINDPROC_NULL, "NULL", NULL, NULL },
|
2002-08-28 21:04:11 +00:00
|
|
|
{ YPBINDPROC_DOMAIN, "DOMAIN",
|
2001-12-29 22:23:07 +00:00
|
|
|
dissect_ypbind_domain_v2_request, dissect_ypbind_domain_v2_reply},
|
2002-01-05 21:49:36 +00:00
|
|
|
{ YPBINDPROC_SETDOM, "SETDOMAIN",
|
2001-12-29 22:23:07 +00:00
|
|
|
dissect_ypbind_setdomain_v2_request, NULL},
|
2001-01-18 09:55:10 +00:00
|
|
|
{ 0, NULL, NULL, NULL }
|
1999-11-10 17:23:55 +00:00
|
|
|
};
|
2002-11-01 00:48:39 +00:00
|
|
|
static const value_string ypbind2_proc_vals[] = {
|
|
|
|
{ YPBINDPROC_NULL, "NULL" },
|
|
|
|
{ YPBINDPROC_DOMAIN, "DOMAIN" },
|
|
|
|
{ YPBINDPROC_SETDOM, "SETDOMAIN" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
1999-11-10 17:23:55 +00:00
|
|
|
/* end of YPBind version 2 */
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_ypbind(void)
|
|
|
|
{
|
2001-12-29 22:23:07 +00:00
|
|
|
static hf_register_info hf[] = {
|
2002-11-01 00:48:39 +00:00
|
|
|
{ &hf_ypbind_procedure_v1, {
|
|
|
|
"V1 Procedure", "ypbind.procedure_v1", FT_UINT32, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(ypbind1_proc_vals), 0, NULL, HFILL }},
|
2002-11-01 00:48:39 +00:00
|
|
|
{ &hf_ypbind_procedure_v2, {
|
|
|
|
"V2 Procedure", "ypbind.procedure_v2", FT_UINT32, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(ypbind2_proc_vals), 0, NULL, HFILL }},
|
2001-12-29 22:23:07 +00:00
|
|
|
{ &hf_ypbind_domain, {
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"Domain", "ypbind.domain", FT_STRING, BASE_NONE,
|
2001-12-29 22:23:07 +00:00
|
|
|
NULL, 0, "Name of the NIS/YP Domain", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_ypbind_resp_type, {
|
|
|
|
"Response Type", "ypbind.resp_type", FT_UINT32, BASE_DEC,
|
2010-09-23 21:46:31 +00:00
|
|
|
VALS(resp_type_vals), 0, NULL, HFILL }},
|
2001-12-29 22:23:07 +00:00
|
|
|
|
2013-01-31 18:31:28 +00:00
|
|
|
#if 0
|
|
|
|
{ &hf_ypbind_error, {
|
2001-12-29 22:23:07 +00:00
|
|
|
"Error", "ypbind.error", FT_UINT32, BASE_DEC,
|
|
|
|
VALS(error_vals), 0, "YPBIND Error code", HFILL }},
|
2013-01-31 18:31:28 +00:00
|
|
|
#endif
|
2001-12-29 22:23:07 +00:00
|
|
|
{ &hf_ypbind_addr, {
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"IP Addr", "ypbind.addr", FT_IPv4, BASE_NONE,
|
2001-12-29 22:23:07 +00:00
|
|
|
NULL, 0, "IP Address of server", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_ypbind_port, {
|
|
|
|
"Port", "ypbind.port", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0, "Port to use", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_ypbind_setdom_version, {
|
|
|
|
"Version", "ypbind.setdom.version", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0, "Version of setdom", HFILL }},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_ypbind,
|
|
|
|
};
|
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_ypbind = proto_register_protocol("Yellow Pages Bind",
|
|
|
|
"YPBIND", "ypbind");
|
2001-12-29 22:23:07 +00:00
|
|
|
proto_register_field_array(proto_ypbind, hf, array_length(hf));
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2000-04-04 06:46:41 +00:00
|
|
|
}
|
1999-11-10 17:23:55 +00:00
|
|
|
|
2000-04-04 06:46:41 +00:00
|
|
|
void
|
|
|
|
proto_reg_handoff_ypbind(void)
|
|
|
|
{
|
1999-11-10 17:23:55 +00:00
|
|
|
/* Register the protocol as RPC */
|
1999-11-16 11:44:20 +00:00
|
|
|
rpc_init_prog(proto_ypbind, YPBIND_PROGRAM, ett_ypbind);
|
1999-11-10 17:23:55 +00:00
|
|
|
/* Register the procedure tables */
|
2002-11-01 00:48:39 +00:00
|
|
|
rpc_init_proc_table(YPBIND_PROGRAM, 1, ypbind1_proc, hf_ypbind_procedure_v1);
|
|
|
|
rpc_init_proc_table(YPBIND_PROGRAM, 2, ypbind2_proc, hf_ypbind_procedure_v2);
|
1999-11-10 17:23:55 +00:00
|
|
|
}
|