From b3fa4f34f401a4d675c8fb936b1547b0a8fda5c2 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 5 Dec 2015 09:44:19 -0800 Subject: Undoing base-64 encoding is not decryption. For now, we don't change the name of the preference, but we *do* change the description of the preference and the name of the variable. Change-Id: I1f80b2e7187679dca787fda5f3d06e9d30536ddc Reviewed-on: https://code.wireshark.org/review/12444 Reviewed-by: Guy Harris --- epan/dissectors/packet-smtp.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/epan/dissectors/packet-smtp.c b/epan/dissectors/packet-smtp.c index 49be0fdd3e..18af0abc61 100644 --- a/epan/dissectors/packet-smtp.c +++ b/epan/dissectors/packet-smtp.c @@ -81,7 +81,7 @@ static int ett_smtp_cmdresp = -1; static gint ett_smtp_data_fragment = -1; static gint ett_smtp_data_fragments = -1; -static gboolean smtp_decryption_enabled = FALSE; +static gboolean smtp_auth_parameter_decoding_enabled = FALSE; /* desegmentation of SMTP command and response lines */ static gboolean smtp_desegment = TRUE; static gboolean smtp_data_desegment = TRUE; @@ -317,7 +317,7 @@ decode_plain_auth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 *decrypt = NULL; decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, a_offset, a_linelen, ENC_ASCII); - if (smtp_decryption_enabled) { + if (smtp_auth_parameter_decoding_enabled) { returncode = (gint)ws_base64_decode_inplace(decrypt); if (returncode) { length_user1 = (gint)strlen(decrypt); @@ -556,7 +556,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ (pinfo->fd->num >= session_state->first_auth_frame) && ((session_state->last_auth_frame == 0) || (pinfo->fd->num <= session_state->last_auth_frame))) { decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, loffset, linelen, ENC_ASCII); - if ((smtp_decryption_enabled) && + if ((smtp_auth_parameter_decoding_enabled) && ((decrypt_len = ws_base64_decode_inplace(decrypt)) > 0)) { line = decrypt; linelen = (int)decrypt_len; @@ -818,7 +818,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ /* This line wasn't already decrypted through the state machine */ decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, loffset, linelen, ENC_ASCII); decrypt_len = linelen; - if (smtp_decryption_enabled) { + if (smtp_auth_parameter_decoding_enabled) { if ((decrypt_len = ws_base64_decode_inplace(decrypt)) == 0) { /* Go back to the original string */ decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, loffset, linelen, ENC_ASCII); @@ -834,7 +834,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ /* This line wasn't already decrypted through the state machine */ decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, loffset, linelen, ENC_ASCII); decrypt_len = linelen; - if (smtp_decryption_enabled) { + if (smtp_auth_parameter_decoding_enabled) { if ((decrypt_len = ws_base64_decode_inplace(decrypt)) == 0) { /* Go back to the original string */ decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, loffset, linelen, ENC_ASCII); @@ -848,7 +848,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ } else if (session_state->ntlm_rsp_frame == pinfo->fd->num) { decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, loffset, linelen, ENC_ASCII); decrypt_len = linelen; - if (smtp_decryption_enabled) { + if (smtp_auth_parameter_decoding_enabled) { if ((decrypt_len = ws_base64_decode_inplace(decrypt)) == 0) { /* Go back to the original string */ decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, loffset, linelen, ENC_ASCII); @@ -895,7 +895,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ /* This line wasn't already decrypted through the state machine */ decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, loffset + 11, linelen - 11, ENC_ASCII); decrypt_len = linelen - 11; - if (smtp_decryption_enabled) { + if (smtp_auth_parameter_decoding_enabled) { if ((decrypt_len = ws_base64_decode_inplace(decrypt)) == 0) { /* Go back to the original string */ decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, loffset + 11, linelen - 11, ENC_ASCII); @@ -915,7 +915,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ if (linelen >= 10) { decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, loffset + 10, linelen - 10, ENC_ASCII); decrypt_len = linelen - 10; - if (smtp_decryption_enabled) { + if (smtp_auth_parameter_decoding_enabled) { if ((decrypt_len = ws_base64_decode_inplace(decrypt)) == 0) { /* Go back to the original string */ decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, loffset + 10, linelen - 10, ENC_ASCII); @@ -1097,7 +1097,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ decrypt = NULL; if (linelen >= 4) { - if ((smtp_decryption_enabled) && (code == 334)) { + if ((smtp_auth_parameter_decoding_enabled) && (code == 334)) { decrypt = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 4, linelen - 4, ENC_ASCII); if ((decrypt_len = ws_base64_decode_inplace(decrypt)) > 0) { if (g_ascii_strncasecmp(decrypt, "NTLMSSP", 7) == 0) { @@ -1289,9 +1289,9 @@ proto_register_smtp(void) &smtp_data_desegment); prefs_register_bool_preference(smtp_module, "decryption", - "Decrypt AUTH parameters", - "Whether the SMTP dissector should decrypt AUTH parameters", - &smtp_decryption_enabled); + "Decode base-64-encoded AUTH parameters", + "Whether the SMTP dissector should decode base-64-encoded AUTH parameters", + &smtp_auth_parameter_decoding_enabled); } /* The registration hand-off routine */ -- cgit v1.2.3