@@ -36,6 +36,8 @@ static int hf_imap_tag = -1;
3636static int hf_imap_command = -1 ;
3737static int hf_imap_response_status = -1 ;
3838static int hf_imap_request_folder = -1 ;
39+ static int hf_imap_request_username = -1 ;
40+ static int hf_imap_request_password = -1 ;
3941static int hf_imap_request_uid = -1 ;
4042static int hf_imap_response_in = -1 ;
4143static int hf_imap_response_to = -1 ;
@@ -568,6 +570,20 @@ dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
568570 /* If next response is OK, then TLS should be commenced. */
569571 session_state -> ssl_requested = TRUE;
570572 }
573+ else if (strncmp (command_token , "login" , commandlen ) == 0 ) {
574+ int usernamelen = linelen - (next_token - offset );
575+ int username_offset = next_token ;
576+ int username_next_token ;
577+ int username_tokenlen = tvb_get_token_len (tvb , next_token , usernamelen , & username_next_token , FALSE);
578+ guint8 * username = tvb_get_string_enc (wmem_packet_scope (), tvb , username_offset + 1 , username_tokenlen - 2 , ENC_ASCII | ENC_NA );
579+ proto_tree_add_string (reqresp_tree , hf_imap_request_username , tvb , username_offset , username_tokenlen , username );
580+
581+ int passwordlen = linelen - (username_next_token - offset );
582+ int password_offset = username_next_token ;
583+ int password_tokenlen = tvb_get_token_len (tvb , username_next_token , passwordlen , NULL , FALSE);
584+ guint8 * password = tvb_get_string_enc (wmem_packet_scope (), tvb , password_offset + 1 , password_tokenlen - 2 , ENC_ASCII | ENC_NA );
585+ proto_tree_add_string (reqresp_tree , hf_imap_request_password , tvb , password_offset , password_tokenlen , password );
586+ }
571587 }
572588
573589 if (!is_request ) {
@@ -684,6 +700,16 @@ proto_register_imap(void)
684700 FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
685701 "Request command uid" , HFILL }
686702 },
703+ { & hf_imap_request_username ,
704+ { "Request Username" , "imap.request.username" ,
705+ FT_STRINGZ , BASE_NONE , NULL , 0x0 ,
706+ "Request command username" , HFILL }
707+ },
708+ { & hf_imap_request_password ,
709+ { "Request Password" , "imap.request.password" ,
710+ FT_STRINGZ , BASE_NONE , NULL , 0x0 ,
711+ "Request command password" , HFILL }
712+ },
687713
688714 /* Request/Response Matching */
689715 { & hf_imap_response_in ,
0 commit comments