diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-02-25 19:27:19 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-02-25 19:27:19 +0000 |
commit | d6097fb658131265fd80b2225cb81ccb035aa5f5 (patch) | |
tree | 4cce12a00a7cc4ac9602435d95f37d05bbe5f491 /packet-ftp.c | |
parent | 0462c4d80609913943178d83e191d34fb97bf218 (diff) |
From Brad Hards: show a description of the FTP reply code.
svn path=/trunk/; revision=7199
Diffstat (limited to 'packet-ftp.c')
-rw-r--r-- | packet-ftp.c | 54 |
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, |