Ethereal-dev: [Ethereal-dev] [PATCH] Small Fix in SOCKS Code

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "David E. Weekly" <david@xxxxxxxxxx>
Date: Tue, 14 Oct 2003 18:08:04 -0700
I noticed that in the "connected to server reponse" phase of SOCKS5, the
version information was not added to the display tree. I decided to
factorize a bit of the code and fix a silly mistake while I was at it.
Feedback welcome, as this is my first Ethereal patch.

-david




diff -d -c -r1.46 packet-socks.c
*** packet-socks.c      17 Sep 2003 15:58:11 -0000      1.46
--- packet-socks.c      15 Oct 2003 01:04:15 -0000
***************
*** 535,551 ****
        guint temp;
        char *AuthMethodStr;


        if (compare_packet( hash_info->connect_row)){

                proto_tree      *AuthTree;
                proto_item      *ti;

-                                               /* Do version   */
-               proto_tree_add_item( tree, hf_socks_ver, tvb, offset, 1,
-                               hash_info->version);
-               ++offset;
-
                temp = tvb_get_guint8(tvb, offset);     /* Get Auth method
count */
                                                        /* build auth tree
*/
                ti = proto_tree_add_text( tree, tvb, offset, 1,
--- 535,548 ----
        guint temp;
        char *AuthMethodStr;

+       proto_tree_add_item( tree, hf_socks_ver, tvb, offset, 1, FALSE);
+       ++offset;

        if (compare_packet( hash_info->connect_row)){

                proto_tree      *AuthTree;
                proto_item      *ti;

                temp = tvb_get_guint8(tvb, offset);     /* Get Auth method
count */
                                                        /* build auth tree
*/
                ti = proto_tree_add_text( tree, tvb, offset, 1,
***************
*** 569,576 ****
        }                                       /* Get accepted auth method
*/
        else if (compare_packet( hash_info->auth_method_row)) {

-               ++offset;
-
                proto_tree_add_text( tree, tvb, offset, 1,
                        "Accepted Auth Method: 0x%0x (%s)",
tvb_get_guint8( tvb, offset),
                                get_auth_method_name( tvb_get_guint8( tvb,
offset)));
--- 566,571 ----
***************
*** 579,587 ****
        }                                       /* handle user/password auth
*/
        else if (compare_packet( hash_info->user_name_auth_row)) {

-               proto_tree_add_item( tree, hf_socks_ver, tvb, offset, 1,
FALSE);
-               ++offset;
-                                               /* process user name    */
                offset += display_string( tvb, offset, tree,
                                "User name");
                                                /* process password     */
--- 574,579 ----
***************
*** 593,602 ****
        else if ((compare_packet( hash_info->command_row)) ||
                 (compare_packet( hash_info->cmd_reply_row)) ||
                 (compare_packet( hash_info->bind_reply_row))){
-
-               proto_tree_add_item( tree, hf_socks_ver, tvb, offset, 1,
FALSE);
-
-               ++offset;

                command = tvb_get_guint8(tvb, offset);

--- 585,590 ----