2003-02-18 21:47:56 +00:00
|
|
|
/* packet-rsync.c
|
|
|
|
* Routines for rsync dissection
|
|
|
|
* [ very rough, but mininally functional ]
|
|
|
|
* Copyright 2003, Brad Hards <bradh@frogmouth.net>
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2003-02-18 21:47:56 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2003-02-18 21:47:56 +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.
|
2010-05-13 18:28:34 +00:00
|
|
|
*
|
2003-02-18 21:47:56 +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.
|
2010-05-13 18:28:34 +00:00
|
|
|
*
|
2003-02-18 21:47:56 +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
|
2012-06-28 23:18:38 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2003-02-18 21:47:56 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <string.h>
|
2012-05-15 19:23:35 +00:00
|
|
|
|
2003-02-18 21:47:56 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/strutil.h>
|
|
|
|
#include <epan/conversation.h>
|
|
|
|
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* what states make sense here ? */
|
|
|
|
typedef enum _rsync_state {
|
|
|
|
RSYNC_INIT = 0,
|
|
|
|
RSYNC_SERV_INIT = 1,
|
|
|
|
RSYNC_CLIENT_QUERY = 2,
|
|
|
|
RSYNC_SERV_RESPONSE = 4,
|
|
|
|
RSYNC_COMMAND = 5,
|
|
|
|
RSYNC_SERV_MOTD = 6,
|
2003-02-20 12:04:11 +00:00
|
|
|
RSYNC_DATA = 7
|
2003-02-18 21:47:56 +00:00
|
|
|
} rsync_state_t;
|
|
|
|
|
|
|
|
static gboolean rsync_desegment = TRUE;
|
|
|
|
|
|
|
|
/* this is a guide to the current conversation state */
|
|
|
|
struct rsync_conversation_data {
|
|
|
|
rsync_state_t state;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rsync_frame_data {
|
|
|
|
rsync_state_t state;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int proto_rsync = -1;
|
|
|
|
|
|
|
|
static int hf_rsync_hdr_magic = -1;
|
|
|
|
static int hf_rsync_hdr_version = -1;
|
|
|
|
static int hf_rsync_query_string = -1;
|
|
|
|
static int hf_rsync_motd_string = -1;
|
|
|
|
static int hf_rsync_response_string = -1;
|
|
|
|
static int hf_rsync_rsyncdok_string = -1;
|
|
|
|
static int hf_rsync_command_string = -1;
|
|
|
|
static int hf_rsync_data = -1;
|
|
|
|
|
|
|
|
static gint ett_rsync = -1;
|
|
|
|
|
2006-12-07 20:34:08 +00:00
|
|
|
static dissector_handle_t rsync_handle;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define TCP_PORT_RSYNC 873
|
|
|
|
|
2008-10-27 20:34:44 +00:00
|
|
|
static guint glb_rsync_tcp_port = TCP_PORT_RSYNC;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
/* Packet dissection routine called by tcp (& udp) when port 873 detected */
|
|
|
|
static void
|
|
|
|
dissect_rsync_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
2003-07-08 04:06:26 +00:00
|
|
|
gboolean desegment _U_)
|
2003-02-18 21:47:56 +00:00
|
|
|
{
|
|
|
|
conversation_t *conversation;
|
|
|
|
struct rsync_conversation_data *conversation_data;
|
2010-01-19 23:51:27 +00:00
|
|
|
struct rsync_frame_data *rsync_frame_data_p;
|
2003-02-18 21:47:56 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *rsync_tree;
|
|
|
|
int offset = 0;
|
|
|
|
gchar version[5];
|
|
|
|
gchar auth_string[10];
|
|
|
|
guint buff_length;
|
|
|
|
gchar magic_string[14];
|
2005-05-29 12:27:31 +00:00
|
|
|
gchar *version_out;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RSYNC");
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2010-05-13 18:28:34 +00:00
|
|
|
conversation = find_or_create_conversation(pinfo);
|
2003-03-01 14:12:38 +00:00
|
|
|
|
|
|
|
conversation_data = conversation_get_proto_data(conversation, proto_rsync);
|
|
|
|
|
|
|
|
if (conversation_data == NULL) {
|
2010-01-25 18:22:56 +00:00
|
|
|
conversation_data = se_alloc(sizeof(struct rsync_conversation_data));
|
2003-02-18 21:47:56 +00:00
|
|
|
conversation_data->state = RSYNC_INIT;
|
|
|
|
conversation_add_proto_data(conversation, proto_rsync, conversation_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
conversation_set_dissector(conversation, rsync_handle);
|
2010-05-13 18:28:34 +00:00
|
|
|
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_rsync, tvb, 0, -1, ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
rsync_tree = proto_item_add_subtree(ti, ett_rsync);
|
|
|
|
|
2010-01-19 23:51:27 +00:00
|
|
|
rsync_frame_data_p = p_get_proto_data(pinfo->fd, proto_rsync);
|
|
|
|
if (!rsync_frame_data_p) {
|
2003-02-18 21:47:56 +00:00
|
|
|
/* then we haven't seen this frame before */
|
2010-01-25 18:22:56 +00:00
|
|
|
rsync_frame_data_p = se_alloc(sizeof(struct rsync_frame_data));
|
2010-01-19 23:51:27 +00:00
|
|
|
rsync_frame_data_p->state = conversation_data->state;
|
|
|
|
p_add_proto_data(pinfo->fd, proto_rsync, rsync_frame_data_p);
|
2003-02-18 21:47:56 +00:00
|
|
|
}
|
|
|
|
|
2010-01-19 23:51:27 +00:00
|
|
|
switch (rsync_frame_data_p->state) {
|
2003-02-18 21:47:56 +00:00
|
|
|
case RSYNC_INIT:
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(rsync_tree, hf_rsync_hdr_magic, tvb, offset, 8, ENC_ASCII|ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
offset += 8;
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(rsync_tree, hf_rsync_hdr_version, tvb, offset, 4, ENC_ASCII|ENC_NA);
|
2003-04-30 02:35:28 +00:00
|
|
|
tvb_get_nstringz0(tvb, offset, sizeof(version), version);
|
2003-02-18 21:47:56 +00:00
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO)) {
|
2005-05-29 12:27:31 +00:00
|
|
|
/* XXX - is this really a string? */
|
|
|
|
version_out = format_text(version, 4);
|
2003-02-18 21:47:56 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO,
|
|
|
|
"Client Initialisation (Version %s)",
|
2005-05-29 12:27:31 +00:00
|
|
|
version_out);
|
2003-02-18 21:47:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
conversation_data->state = RSYNC_SERV_INIT;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case RSYNC_SERV_INIT:
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(rsync_tree, hf_rsync_hdr_magic, tvb, offset, 8, ENC_ASCII|ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
offset += 8;
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(rsync_tree, hf_rsync_hdr_version, tvb, offset, 4, ENC_ASCII|ENC_NA);
|
2003-04-30 02:35:28 +00:00
|
|
|
tvb_get_nstringz0(tvb, offset, sizeof(version), version);
|
2003-02-18 21:47:56 +00:00
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO)) {
|
2005-05-29 12:27:31 +00:00
|
|
|
/* XXX - is this really a string? */
|
|
|
|
version_out = format_text(version, 4);
|
2003-02-18 21:47:56 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO,
|
|
|
|
"Server Initialisation (Version %s)",
|
2005-05-29 12:27:31 +00:00
|
|
|
version_out);
|
2003-02-18 21:47:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
conversation_data->state = RSYNC_CLIENT_QUERY;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case RSYNC_CLIENT_QUERY:
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(rsync_tree, hf_rsync_query_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2009-09-24 20:00:21 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, "Client Query");
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
conversation_data->state = RSYNC_SERV_MOTD;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case RSYNC_SERV_MOTD:
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(rsync_tree, hf_rsync_motd_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2009-09-24 20:00:21 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, "Server MOTD");
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
conversation_data->state = RSYNC_SERV_RESPONSE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case RSYNC_SERV_RESPONSE:
|
|
|
|
/* there are two cases - file list, or authentication */
|
2003-04-30 02:35:28 +00:00
|
|
|
tvb_get_nstringz0(tvb, offset, sizeof(auth_string), auth_string);
|
2003-02-18 21:47:56 +00:00
|
|
|
if (0 == strncmp("@RSYNCD:", auth_string, 8)) {
|
|
|
|
/* matches, so we assume its an authentication message */
|
|
|
|
/* needs to handle the AUTHREQD case, but doesn't - FIXME */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(rsync_tree, hf_rsync_rsyncdok_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2009-09-24 20:00:21 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, "Authentication");
|
2003-02-18 21:47:56 +00:00
|
|
|
conversation_data->state = RSYNC_COMMAND;
|
|
|
|
|
|
|
|
} else { /* it didn't match, so it is probably a module list */
|
|
|
|
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(rsync_tree, hf_rsync_response_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2009-09-24 20:00:21 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, "Module list");
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
/* we need to check the end of the buffer for magic string */
|
|
|
|
buff_length = tvb_length_remaining(tvb, offset);
|
2003-04-30 02:35:28 +00:00
|
|
|
tvb_get_nstringz0(tvb, buff_length-14, sizeof(magic_string), magic_string);
|
2003-02-18 21:47:56 +00:00
|
|
|
if (0 == strncmp("@RSYNCD: EXIT", magic_string, 14)) {
|
|
|
|
/* that's all, folks */
|
|
|
|
conversation_data->state = RSYNC_COMMAND;
|
|
|
|
} else { /* there must be more data */
|
|
|
|
conversation_data->state = RSYNC_SERV_RESPONSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RSYNC_COMMAND:
|
|
|
|
if (pinfo->destport == glb_rsync_tcp_port) {
|
|
|
|
/* then we are still sending commands */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(rsync_tree, hf_rsync_command_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2009-09-24 20:00:21 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, "Command");
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
conversation_data->state = RSYNC_COMMAND;
|
|
|
|
|
|
|
|
break;
|
|
|
|
} /* else we fall through to the data phase */
|
|
|
|
|
|
|
|
case RSYNC_DATA:
|
|
|
|
/* then we are still sending commands */
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item(rsync_tree, hf_rsync_data, tvb, offset, -1, ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2009-09-24 20:00:21 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, "Data");
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
conversation_data->state = RSYNC_DATA;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Packet dissection routine called by tcp (& udp) when port 873 detected */
|
|
|
|
static void
|
|
|
|
dissect_rsync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
dissect_rsync_encap(tvb, pinfo, tree, rsync_desegment);
|
|
|
|
}
|
|
|
|
|
2006-05-21 04:49:01 +00:00
|
|
|
/* Register protocol with Wireshark. */
|
2008-10-27 20:34:44 +00:00
|
|
|
|
|
|
|
void proto_reg_handoff_rsync(void);
|
|
|
|
|
2003-02-18 21:47:56 +00:00
|
|
|
void
|
|
|
|
proto_register_rsync(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{&hf_rsync_hdr_magic,
|
|
|
|
{"Magic Header", "rsync.hdr_magic",
|
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
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
|
2003-02-18 21:47:56 +00:00
|
|
|
},
|
|
|
|
{&hf_rsync_hdr_version,
|
|
|
|
{"Header Version", "rsync.hdr_version",
|
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
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
|
2003-02-18 21:47:56 +00:00
|
|
|
},
|
|
|
|
{&hf_rsync_query_string,
|
|
|
|
{"Client Query String", "rsync.query",
|
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
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
|
2003-02-18 21:47:56 +00:00
|
|
|
},
|
|
|
|
{&hf_rsync_response_string,
|
|
|
|
{"Server Response String", "rsync.response",
|
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
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
|
2003-02-18 21:47:56 +00:00
|
|
|
},
|
|
|
|
{&hf_rsync_motd_string,
|
|
|
|
{"Server MOTD String", "rsync.motd",
|
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
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
|
2003-02-18 21:47:56 +00:00
|
|
|
},
|
|
|
|
{&hf_rsync_rsyncdok_string,
|
|
|
|
{"RSYNCD Response String", "rsync.response",
|
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
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
|
2003-02-18 21:47:56 +00:00
|
|
|
},
|
|
|
|
{&hf_rsync_command_string,
|
|
|
|
{"Command String", "rsync.command",
|
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
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
|
2003-02-18 21:47:56 +00:00
|
|
|
},
|
|
|
|
{&hf_rsync_data,
|
|
|
|
{"rsync data", "rsync.data",
|
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
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
|
2003-02-18 21:47:56 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_rsync,
|
|
|
|
};
|
|
|
|
|
|
|
|
module_t *rsync_module;
|
|
|
|
|
|
|
|
proto_rsync = proto_register_protocol("RSYNC File Synchroniser",
|
|
|
|
"RSYNC", "rsync");
|
|
|
|
proto_register_field_array(proto_rsync, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
2008-10-27 20:34:44 +00:00
|
|
|
rsync_module = prefs_register_protocol(proto_rsync, proto_reg_handoff_rsync);
|
2003-02-18 21:47:56 +00:00
|
|
|
prefs_register_uint_preference(rsync_module, "tcp_port",
|
|
|
|
"rsync TCP Port",
|
|
|
|
"Set the TCP port for RSYNC messages",
|
|
|
|
10,
|
|
|
|
&glb_rsync_tcp_port);
|
|
|
|
prefs_register_bool_preference(rsync_module, "desegment",
|
2004-08-21 09:02:52 +00:00
|
|
|
"Reassemble RSYNC messages spanning multiple TCP segments",
|
|
|
|
"Whether the RSYNC dissector should reassemble messages spanning multiple TCP segments."
|
|
|
|
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
|
|
|
|
&rsync_desegment);
|
2003-02-18 21:47:56 +00:00
|
|
|
}
|
|
|
|
void
|
|
|
|
proto_reg_handoff_rsync(void)
|
|
|
|
{
|
2008-10-27 20:34:44 +00:00
|
|
|
static gboolean initialized = FALSE;
|
|
|
|
static guint saved_rsync_tcp_port;
|
|
|
|
|
|
|
|
if (!initialized) {
|
|
|
|
rsync_handle = create_dissector_handle(dissect_rsync, proto_rsync);
|
|
|
|
initialized = TRUE;
|
|
|
|
} else {
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_delete_uint("tcp.port", saved_rsync_tcp_port, rsync_handle);
|
2008-10-27 20:34:44 +00:00
|
|
|
}
|
2010-05-13 18:28:34 +00:00
|
|
|
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("tcp.port", glb_rsync_tcp_port, rsync_handle);
|
2008-10-27 20:34:44 +00:00
|
|
|
saved_rsync_tcp_port = glb_rsync_tcp_port;
|
2003-02-18 21:47:56 +00:00
|
|
|
}
|