aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ftp.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2003-02-25 19:27:19 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2003-02-25 19:27:19 +0000
commit5b82e27e3fc5519f11c3aa7d05e87d778cf105be (patch)
tree4cce12a00a7cc4ac9602435d95f37d05bbe5f491 /packet-ftp.c
parentb6f626b1d0bd53340c865bc62383324f45ae354f (diff)
From Brad Hards: show a description of the FTP reply code.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@7199 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-ftp.c')
-rw-r--r--packet-ftp.c54
1 files changed, 49 insertions, 5 deletions
diff --git a/packet-ftp.c b/packet-ftp.c
index 4b449ec4ce..cac6717701 100644
--- a/packet-ftp.c
+++ b/packet-ftp.c
@@ -3,7 +3,7 @@
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
* Copyright 2001, Juan Toledo <toledo@users.sourceforge.net> (Passive FTP)
*
- * $Id: packet-ftp.c,v 1.49 2002/08/28 21:00:13 jmayer Exp $
+ * $Id: packet-ftp.c,v 1.50 2003/02/25 19:27:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -57,6 +57,49 @@ static dissector_handle_t ftpdata_handle;
#define TCP_PORT_FTPDATA 20
#define TCP_PORT_FTP 21
+static const value_string response_table[] = {
+ { 110, "Restart marker reply" },
+ { 120, "Service ready in nnn minutes" },
+ { 125, "Data connection already open; transfer starting" },
+ { 150, "File status okay; about to open data connection" },
+ { 200, "Command okay" },
+ { 202, "Command not implemented, superfluous at this site" },
+ { 211, "System status, or system help reply" },
+ { 212, "Directory status" },
+ { 213, "File status" },
+ { 214, "Help message" },
+ { 215, "NAME system type" },
+ { 220, "Service ready for new user" },
+ { 221, "Service closing control connection" },
+ { 225, "Data connection open; no transfer in progress" },
+ { 226, "Closing data connection" },
+ { 227, "Entering Passive Mode" },
+ { 230, "User logged in, proceed" },
+ { 250, "Requested file action okay, completed" },
+ { 257, "PATHNAME created" },
+ { 331, "User name okay, need password" },
+ { 332, "Need account for login" },
+ { 350, "Requested file action pending further information" },
+ { 421, "Service not available, closing control connection" },
+ { 425, "Can't open data connection" },
+ { 426, "Connection closed; transfer aborted" },
+ { 450, "Requested file action not taken" },
+ { 451, "Requested action aborted: local error in processing" },
+ { 452, "Requested action not taken. Insufficient storage space in system" },
+ { 500, "Syntax error, command unrecognized" },
+ { 501, "Syntax error in parameters or arguments" },
+ { 502, "Command not implemented" },
+ { 503, "Bad sequence of commands" },
+ { 504, "Command not implemented for that parameter" },
+ { 530, "Not logged in" },
+ { 532, "Need account for storing files" },
+ { 550, "Requested action not taken: File unavailable" },
+ { 551, "Requested action aborted: page type unknown" },
+ { 552, "Requested file action aborted: Exceeded storage allocation" },
+ { 553, "Requested action not taken: File name not allowed" },
+ { 0, NULL }
+};
+
static void
dissect_ftpdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
@@ -207,6 +250,7 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gint offset = 0;
const guchar *line;
guint32 code;
+ gchar code_str[4];
gboolean is_pasv_response = FALSE;
gint next_offset;
int linelen;
@@ -291,12 +335,12 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* One-line reply, or first or last line
* of a multi-line reply.
*/
- code = (line[0] - '0')*100 + (line[1] - '0')*10
- + (line[2] - '0');
+ tvb_get_nstringz0(tvb, offset, 3, code_str);
+ code = strtoul(code_str, NULL, 10);
+
if (tree) {
proto_tree_add_uint(ftp_tree,
hf_ftp_response_code, tvb, offset, 3, code);
-
}
/*
@@ -443,7 +487,7 @@ proto_register_ftp(void)
{ &hf_ftp_response_code,
{ "Response code", "ftp.response.code",
- FT_UINT32, BASE_DEC, NULL, 0x0,
+ FT_UINT32, BASE_DEC, VALS(response_table), 0x0,
"", HFILL }},
{ &hf_ftp_response_arg,